Skip to content
Snippets Groups Projects
Commit 014d2473 authored by Thomas  BIGOT's avatar Thomas BIGOT
Browse files

Reorganization

parent ef2be131
No related branches found
No related tags found
No related merge requests found
......@@ -2,9 +2,9 @@
# -*- coding: utf-8 -*-
import glob,re,argparse
#from taxadb.schema import *
#from taxadb import accession
#from taxadb import taxid
from taxadb.schema import *
from taxadb import accession
from taxadb import taxid
parser = argparse.ArgumentParser()
parser.add_argument("hmmDB", help="hmm file")
......@@ -55,15 +55,19 @@ print("\nReading acc number from gathered data")
for currCluster in allHMM.keys():
accs = []
for ca in allHMM[currCluster]["annotations"]:
print(ca)
accs.append(ca.split("|")[3].split(".")[0])
#allHMM[currCluster]["taxid"] = accession.taxid(accs, args.taxadb, Prot)
allHMM[currCluster]["taxid"] = "1234"
accs.append(re.findall("[A-Z0-9\._]{5,10}",ca)[0].split(".")[0])
allHMM[currCluster]["taxid"] = []
currAcc = 0
# proceeding by lots, to avoid `too many SQL variables` issue
while currAcc < len(accs):
allHMM[currCluster]["taxid"].append(accession.taxid(accs[currAcc:(min(currAcc+50,len(accs)-1))], args.taxadb, Prot))
currAcc += 50
# from taxid family
allHMM[currCluster]["families"] = {}
for ct in allHMM[currCluster]["taxid"]:
#lineage = taxid.lineage_name(ct[1], args.taxadb)
lineage = (1234,"ABCD")
# deloting
for ctgen in allHMM[currCluster]["taxid"]:
for ct in ctgen:
lineage = taxid.lineage_name(ct[1], args.taxadb)
family = lineage[2]
if family not in allHMM[currCluster]["families"].keys():
allHMM[currCluster]["families"][family] = 1
......@@ -81,4 +85,4 @@ for currCluster in allHMM.keys():
currAnnot.write("FAMILIES\t" + str(allHMM[currCluster]["families"]) + "\n")
currAnnot.write("FASTA SEQUENCE TITLES:\n")
for currST in allHMM[currCluster]["annotations"]:
currAnnot.write(currST+"\n")
currAnnot.write(currST)
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment