예제 #1
0
def main():
    #read list
    li = read_list(sys.argv[1])
    #read fasta
    algene = utils.read_fasta_usda(sys.argv[2])
    
    #find overlap
    for it in li:
        find_overlap(it,algene)
예제 #2
0
def main():
    #read list
    list_gene = {}
    for line in open(sys.argv[1],'r'):
        spl = line.strip().split('\t')
        if(list_gene.has_key(spl[2])):
            temp = list_gene[spl[2]]
            temp.append(spl[1])
            list_gene[spl[2]] = temp
        else:
            temp = [spl[1]]
            list_gene[spl[2]] = temp

    #read fasta
    fafile = sys.argv[2]
    faseq = utils.read_fasta_usda(fafile)

    #read primers -> primer
    mypath = sys.argv[3]
    onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
    primer = {}
    for file in onlyfiles:
        if (file[:1] == "."):
            continue
        fullpath = mypath+file
        fpri,rpri = utils.read_trad_primer(fullpath)
        locus = file.split('.')[0]
        if(primer.has_key(locus)):
            temp = primer[locus]
            temp.append([fpri,rpri])
            primer[locus] = temp
        else:
            primer[locus] = [fpri,rpri]
    
#    print list_gene
    for item in list_gene.items():                                                                      
        if(len(item[1]) >1):
            genename = item[0]
            g1 = item[1][0]
            g2 = item[1][1]
            if( primer.has_key(g1) and primer.has_key(g2)):
                find_least_primer_two_gene(g1,g2,faseq,primer,genename)
            #else:
            #    print g1,g2
        else:
            genename = item[0]
            g1 = item[1][0]
            if(primer.has_key(g1)):
                find_lease_primer_one_gene(g1,faseq,primer,genename)