예제 #1
0
파일: addHgts.py 프로젝트: LanLab/MGT
def addTheHstMatrix(projectPath, projectName, appName, mgtlist):

		# setting up the appClass
		readAppSettAndConnToDb.setupEnvPath(projectPath, projectName)
		appClass = readAppSettAndConnToDb.importAppClassModels(appName)

		readFileAndAdd(projectPath, appName, appClass, mgtlist)
예제 #2
0
def addInfo(projectPath, projectName, appName, fn_isolateInfo):

    readAppSettAndConnToDb.setupEnvPath(projectPath, projectName)

    appClass = readAppSettAndConnToDb.importAppClassModels(appName)

    from django.contrib.auth.models import User
    handleTheFile(User, appClass, fn_isolateInfo)
예제 #3
0
def doAddClonalComplexes(projectPath, projectName, appName, tableNum_orderNum,
                         schemeName, cc, st, dst, merges):

    # setting up the appClass
    readAppSettAndConnToDb.setupEnvPath(projectPath, projectName)
    organismAppClass = readAppSettAndConnToDb.importAppClassModels(appName)

    # print(organismAppClass)

    loadAndAddCcs(projectPath, appName, organismAppClass, tableNum_orderNum,
                  schemeName, cc, st, dst, merges)
예제 #4
0
def addSnpMutsToDb(projectPath, projectName, orgAppName, allele_dict):

    # setting up the appClass
    readAppSettAndConnToDb.setupEnvPath(projectPath, projectName)
    organismAppClass = readAppSettAndConnToDb.importAppClassModels(orgAppName)

    # running add snps

    for locus in allele_dict:
        allele = allele_dict[locus][1]
        snplist = allele_dict[locus][3]
        getAlleleAndAddSnpsTo_(organismAppClass, {}, locus, allele, snplist)
예제 #5
0
파일: addAlleles.py 프로젝트: LanLab/MGT
def addAlleles(projectPath, projectName, appName,dir_alleleSeqs, alleles_out_dict):
    ## change dir_alleleSeqs to use alleles_dict_out

    # setting up the appClass
    readAppSettAndConnToDb.setupEnvPath(projectPath, projectName)
    organismAppClass = readAppSettAndConnToDb.importAppClassModels(appName)

    dir_seqsToSaveTo = readAppSettAndConnToDb.importAlleleDirFromSettings(projectName)
    # print(organismAppClass,dir_seqsToSaveTo)

    # for each file in the folder

    extractAndAddAlleles(organismAppClass, dir_alleleSeqs, projectPath, appName, alleles_out_dict)
예제 #6
0
def addApForScheme(projectPath, projectName, appName, schemeName, profile_dict,
                   st, dst, nodash_to_dash):
    readAppSettAndConnToDb.setupEnvPath(projectPath, projectName)
    orgAppClass = readAppSettAndConnToDb.importAppClassModels(appName)

    list_tableNameClass = getTableClasses(orgAppClass, schemeName, appName,
                                          projectPath)
    schObj = getFromTableInOrgDb.getScheme(orgAppClass, schemeName)
    lociNames_sorted = getLociNamesSorted(schObj)

    # print("HELLO",len(lociNames_sorted))
    # print(list_tableNameClass)

    locus_ids_list_o_lists = list(chunks(lociNames_sorted, 1000))

    alleles_ls = []
    for locuslis in locus_ids_list_o_lists:
        nlis = []
        for locus in locuslis:
            locus = nodash_to_dash[locus]
            nlis.append(profile_dict[locus])
        alleles_ls.append(nlis)

    # print("1")
    # for i in locus_ids_list_o_lists:
    #     print(len(i),i)
    # print("2")
    # for i in alleles_ls:
    #     print(len(i), i)

    #for addToDb() need lociNames_sorted = list of lists of loci ids = [[l1,l2,l3...][l1001,l1002....]]
    # also need equivalent list of allele assignments = alleles_ls = [[1,2,1,...][-1_1,4,....]]

    #TODO check when adding that allele + locus ids are used NOT unique allele id...

    # print("pre addToDb")
    # print(st, dst, locus_ids_list_o_lists)

    addToDb(list_tableNameClass, st, dst, locus_ids_list_o_lists, alleles_ls)
예제 #7
0
def genDefs(projectPath, projectName, appName):

    readAppSettAndConnToDb.setupEnvPath(projectPath, projectName)
    organismAppClass = readAppSettAndConnToDb.importAppClassModels(appName)

    genApCode(organismAppClass)