From 447be81be882f890f069b6ad644c2b0809629109 Mon Sep 17 00:00:00 2001 From: Anton Nekrutenko Date: Tue, 18 Mar 2008 19:29:51 +0000 Subject: [PATCH] Cleanup of taxonomy processing scripts. Now only one is left --- scripts/taxonomy/gi2tax_test.txt | 100 +++++ scripts/taxonomy/names_test.txt | 100 +++++ scripts/taxonomy/processTaxonomy.sh | 9 +- scripts/taxonomy/process_NCBI_taxonomy.py | 50 +++ scripts/taxonomy/readme.txt | 49 --- scripts/taxonomy/runTest.sh | 8 - scripts/taxonomy/tax.py | 71 --- scripts/taxonomy/tax1_NodeParser.py | 118 ----- scripts/taxonomy/tax1_test_argv1.txt | 32 -- scripts/taxonomy/tax2_Node2Name.py | 144 ------- scripts/taxonomy/tax2_testData_Nodes.txt | 498 ---------------------- scripts/taxonomy/tax2_test_argv1.txt | 498 ---------------------- scripts/taxonomy/tax2_test_argv2.txt | 72 ---- scripts/taxonomy/tax3_gi2tax.py | 103 ----- scripts/taxonomy/tax3_test_argv2.txt | 5 - scripts/taxonomy/tax_result.txt | 5 - 16 files changed, 251 insertions(+), 1611 deletions(-) create mode 100644 scripts/taxonomy/gi2tax_test.txt create mode 100644 scripts/taxonomy/names_test.txt mode change 100644 => 100755 scripts/taxonomy/processTaxonomy.sh create mode 100755 scripts/taxonomy/process_NCBI_taxonomy.py delete mode 100644 scripts/taxonomy/readme.txt delete mode 100644 scripts/taxonomy/runTest.sh delete mode 100644 scripts/taxonomy/tax.py delete mode 100644 scripts/taxonomy/tax1_NodeParser.py delete mode 100644 scripts/taxonomy/tax1_test_argv1.txt delete mode 100644 scripts/taxonomy/tax2_Node2Name.py delete mode 100644 scripts/taxonomy/tax2_testData_Nodes.txt delete mode 100644 scripts/taxonomy/tax2_test_argv1.txt delete mode 100644 scripts/taxonomy/tax2_test_argv2.txt delete mode 100644 scripts/taxonomy/tax3_gi2tax.py delete mode 100644 scripts/taxonomy/tax3_test_argv2.txt delete mode 100644 scripts/taxonomy/tax_result.txt diff --git a/scripts/taxonomy/gi2tax_test.txt b/scripts/taxonomy/gi2tax_test.txt new file mode 100644 index 00000000000..27aee906eff --- /dev/null +++ b/scripts/taxonomy/gi2tax_test.txt @@ -0,0 +1,100 @@ +2 9913 +3 9913 +4 9646 +5 9913 +7 9913 +9 9913 +11 9913 +13 9913 +15 9915 +16 9771 +17 9771 +18 9771 +19 9771 +20 9771 +21 9771 +22 9771 +23 9771 +24 9771 +25 9771 +26 9771 +27 9770 +28 9770 +29 9913 +31 9913 +33 9913 +34 9913 +36 9913 +37 9913 +38 9913 +39 9913 +40 9913 +41 9913 +43 9913 +45 9913 +49 9913 +53 9913 +56 9913 +60 9913 +62 9913 +63 9913 +65 9913 +67 9913 +69 9913 +70 9913 +71 9913 +72 9913 +73 9913 +75 9913 +77 9913 +79 9913 +80 9913 +82 9913 +84 9913 +86 9913 +88 9913 +89 9913 +93 9913 +95 9913 +98 9913 +101 9913 +103 9913 +105 9913 +109 9913 +113 9913 +115 9913 +117 9913 +119 9913 +120 9913 +121 9913 +123 9913 +124 9913 +125 9913 +127 9913 +128 9913 +133 9913 +136 9913 +137 9913 +138 9913 +142 9913 +147 9913 +150 9913 +152 9913 +154 9913 +157 9913 +158 9913 +159 9913 +160 9913 +161 9913 +162 9913 +164 9913 +166 9913 +167 9913 +169 9913 +170 9913 +171 9913 +175 9913 +176 9913 +177 9913 +180 9913 +183 9913 diff --git a/scripts/taxonomy/names_test.txt b/scripts/taxonomy/names_test.txt new file mode 100644 index 00000000000..bcbfbf1274f --- /dev/null +++ b/scripts/taxonomy/names_test.txt @@ -0,0 +1,100 @@ +1 all synonym +1 root scientific name +2 Bacteria scientific name +2 Monera in-part +2 Procaryotae in-part +2 Prokaryota in-part +2 Prokaryotae in-part +2 bacteria blast name +2 eubacteria genbank common name +2 not Bacteria Haeckel 1894 synonym +2 prokaryotes in-part +6 Azorhizobium scientific name +6 Azorhizobium Dreyfus et al. 1988 synonym +6 Azotirhizobium equivalent name +7 Azorhizobium caulinodans scientific name +7 Azorhizobium caulinodans Dreyfus et al. 1988 synonym +7 Azotirhizobium caulinodans equivalent name +9 Acyrthosiphon pisum symbiont P includes +9 Buchnera aphidicola scientific name +9 Buchnera aphidicola Munson et al. 1991 synonym +10 Cellvibrio Winogradsky 1929 synonym +10 Cellvibrio scientific name +10 Cellvibrio (ex Winogradsky 1929) Blackall et al. 1986 emend. Humphry et al. 2003 synonym +11 'Cellvibrio gilvus' synonym +11 Cellvibrio gilvus scientific name +13 Dictyoglomus scientific name +13 Dictyoglomus Saiki et al. 1985 synonym +14 Dictyoglomus thermophilum scientific name +14 Dictyoglomus thermophilum Saiki et al. 1985 synonym +16 Methyliphilus equivalent name +16 Methylophilus scientific name +16 Methylophilus Jenkins et al. 1987 synonym +16 Methylotrophus misspelling +17 Methyliphilus methylitrophus equivalent name +17 Methyliphilus methylotrophus equivalent name +17 Methylophilus methylitrophus equivalent name +17 Methylophilus methylotrophus scientific name +17 Methylophilus methylotrophus Jenkins et al. 1987 synonym +17 Methylotrophus methylophilus synonym +18 Pelobacter scientific name +18 Pelobacter Schink and Pfennig 1983 synonym +19 Pelobacter carbinolicus scientific name +19 Pelobacter carbinolicus Schink 1984 synonym +20 Phenylobacterium scientific name +20 Phenylobacterium Lingens et al. 1985 emend. Kanso and Patel 2004 synonym +20 Phenylobacterium Lingens et al. 1985 emend. Tiago et al. 2005 synonym +21 Phenylobacterium immobile scientific name +21 Phenylobacterium immobile Lingens et al. 1985 synonym +22 Shewanella scientific name +22 Shewanella MacDonell and Colwell 1986 synonym +23 Alteromonas colwelliana synonym +23 Shewanella colwelliana scientific name +23 Shewanella colwelliana (Weiner et al. 1988) Coyne et al. 1990 synonym +24 Pseudomonas putrefaciens (Derby and Hammer) Long and Hammer 1941 synonym +24 Alteromonas putrefaciens synonym +24 Alteromonas putrefaciens (ex Derby and Hammer) Lee et al. 1981 synonym +24 Alteromonas putrifaciens misspelling +24 Pseudomonas putrefaciens synonym +24 Shewanella putrefaciens scientific name +24 Shewanella putrefaciens (Lee et al. 1981) MacDonell and Colwell 1986 synonym +24 Shewanella putrifaciens misspelling +25 Alteromonas hanedai synonym +25 Alteromonas hanedai Jensen et al. 1981 synonym +25 Shewanella hanedai scientific name +25 Shewanella hanedai (Jensen et al. 1981) MacDonell and Colwell 1986 synonym +27 halophilic eubacterium (NRCC 41227) synonym +27 halophilic eubacterium NRCC 41227 scientific name +27 halophilic eubacterium NRCC41227 synonym +29 Myxobacteria synonym +29 Myxococcales scientific name +29 Myxococcales Tchan et al. 1948 synonym +29 The Myxobacteria synonym +29 fruiting gliding bacteria genbank common name +31 Myxococcaceae scientific name +31 Myxococcaceae Jahn 1924 synonym +32 Myxococcus scientific name +32 Myxococcus Thaxter 1892 synonym +33 Micrococcus fulvus Cohn 1875 synonym +33 Micrococcus fulvus synonym +33 Myxococcus fulvus scientific name +33 Myxococcus fulvus (Cohn 1875) Jahn 1911 synonym +34 Myxococcus xanthus scientific name +34 Myxococcus xanthus Beebe 1941 synonym +34 Myxococcus xanthus retron Mx162 includes +34 Myxococcus xanthus retron Mx65 includes +35 Chondrococcus macrosporus Krzemieniewska and Krzemieniewski 1926 synonym +35 'Corallococcus macrosporus' synonym +35 Chondrococcus macrosporus synonym +35 Corallococcus macrosporus synonym +35 Myxococcus macrosporus scientific name +35 Myxococcus macrosporus (Krzemieniewska and Krzemieniewski 1926) Zahler and McCurdy 1974 synonym +35 not Myxococcus macrosporus Zukal 1897 synonym +36 Chondrococcus coralloides (Thaxter 1892) Jahn 1924 synonym +36 Chondrococcus polycystus (Kofler 1913) Krzemieniewska and Krzemieniewski 1926 synonym +36 Myxococcus clavatus Quehl 1906 synonym +36 Myxococcus digitatus Quehl 1906 synonym +36 Myxococcus exiguus Kofler 1913 synonym +36 Myxococcus polycystus Kofler 1913 synonym +36 Chondrococcus coralloides synonym +36 Chondrococcus polycystus synonym diff --git a/scripts/taxonomy/processTaxonomy.sh b/scripts/taxonomy/processTaxonomy.sh old mode 100644 new mode 100755 index 9a3dae57864..c6cf7a76b04 --- a/scripts/taxonomy/processTaxonomy.sh +++ b/scripts/taxonomy/processTaxonomy.sh @@ -10,15 +10,8 @@ gunzip gi_taxid_nucl.dmp.gz gunzip gi_taxid_prot.dmp.gz cat gi_taxid_nucl.dmp gi_taxid_prot.dmp > gi_taxid_all.dmp rm gi_taxid_nucl.dmp gi_taxid_prot.dmp -echo "Parsing nodes.dmp..." -cat nodes.dmp | tr -s "\t" "|" | tr "|" "\t" | cut -f 1,2,3,5 > nodes.txt -echo "Collapsing taxonomy. This will take several hours..." -python tax1_NodeParser.py nodes.txt > node2child.txt echo "Parsing names.dmg" cat names.dmp | cut -f 1,2,4 -d "|" | tr -s "\t" "|" | tr "|" "\t" | sed s/\"//g > names.txt -echo "Running tax2_Node2Name.py" -python tax2_Node2Name.py node2child.txt names.txt taxonomy.db -echo "Running tax3_gi2tax.py" -python tax3_gi2tax.py taxonomy.db gi_taxid_all.dmp +python process_NCBI_taxonomy.py gi_taxid_all.dmp names.txt taxonomy.db echo "Done!.." diff --git a/scripts/taxonomy/process_NCBI_taxonomy.py b/scripts/taxonomy/process_NCBI_taxonomy.py new file mode 100755 index 00000000000..1f73449b2e0 --- /dev/null +++ b/scripts/taxonomy/process_NCBI_taxonomy.py @@ -0,0 +1,50 @@ +""" +process_NCBI_taxonomy.py +""" + +import pkg_resources +pkg_resources.require( 'pysqlite' ) +from pysqlite2 import dbapi2 as sqlite +import string, sys, tempfile + +def stop_err(msg): + sys.stderr.write(msg) + sys.exit() + + +try: + gi2tax = open(sys.argv[1], 'r') + names = open(sys.argv[2], 'r') + db_name = sys.argv[3] +except: + stop_err('Check arguments: process_NCBI_taxonomy.py \n') + + +try: + con = sqlite.connect(db_name) + cur = con.cursor() + cur.execute('create table gi2tax(gi int unsigned not null, taxId int unsigned not null)') + cur.execute('create table t_names(taxId int unsigned not null, name text not null)') + cur.execute('create table names(taxId int unsigned not null, name text not null)') + + for line in gi2tax: + fields = string.split(line.rstrip(), '\t') + cur.execute('insert into gi2tax values(%s, %s)' % ( fields[0], fields[1] ) ) + + gi2tax.close() + + for line in names: + fields = string.split(line.rstrip(), '\t') + cur.execute('insert into t_names values(%s, "%s")' % ( fields[0], fields[1] ) ) + + names.close() + + cur.execute('create index gi_i on gi2tax(gi)') + cur.execute('insert into names select * from t_names group by name') + cur.execute('drop table t_names') + cur.execute('create index name_i on names(name)') + cur.execute('vacuum') + con.commit() + con.close() +except Exception, e: + stop_err("%s\n" % e) diff --git a/scripts/taxonomy/readme.txt b/scripts/taxonomy/readme.txt deleted file mode 100644 index 4e643c8e41c..00000000000 --- a/scripts/taxonomy/readme.txt +++ /dev/null @@ -1,49 +0,0 @@ -How to prepare NCBI taxonomy for Galaxy Metagenomic Toolkit ------------------------------------------------------------ - -1. run runTest.sh - If this script produces NO messages -> everything is OK - -2. run processTaxonomy.sh - This script does several things: - - downloads taxonomy dump tarball from NCBI ftp site - - downloads very large gi2taxId files for nucleotide and protein entries of GenBank - - runs a series of 3 python scripts on these files - - creates a sqlite database called taxonomy.db (you can use sqlite to explore this database) - - this database is used by /tools/taxonomy/tax.py tool to convert gi's into full taxonomic representation - -3. move taxonomy.db into /static/taxonomy/ - -Taxonomy ranks --------------- - -These scripts consider the following taxonomic ranks: - - 1 root - 2 superkingdom - 3 kingdom - 4 subkingdom - 5 superphylum - 6 phylum - 7 subphylum - 8 superclass - 9 class -10 subclass -11 superorder -12 order -13 suborder -14 superfamily -15 family -16 subfamily -17 tribe -18 subtribe -19 genus -20 subgenus -21 species -22 subspecies - -Problems? ---------- - E-mail to anton@bx.psu.edu - - diff --git a/scripts/taxonomy/runTest.sh b/scripts/taxonomy/runTest.sh deleted file mode 100644 index 32db42b66f9..00000000000 --- a/scripts/taxonomy/runTest.sh +++ /dev/null @@ -1,8 +0,0 @@ -PYTHONPATH="../../lib:../../eggs:../../eggs/`../check_python_ucs.py`" -export PYTHONPATH -rm -f /tmp/taxTest.db -python tax1_NodeParser.py tax1_test_argv1.txt > tax2_test_argv1.txt -python tax2_Node2Name.py tax2_test_argv1.txt tax2_test_argv2.txt /tmp/taxTest.db -python tax3_gi2tax.py /tmp/taxTest.db tax3_test_argv2.txt -python tax.py tax3_test_argv2.txt tax_out.txt 1 -diff tax_out.txt tax_result.txt diff --git a/scripts/taxonomy/tax.py b/scripts/taxonomy/tax.py deleted file mode 100644 index a7e7db7199c..00000000000 --- a/scripts/taxonomy/tax.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python - -""" -Identify full taxonomic standing for sequences identified by gi number - -usage: tax.py gi_list_file out_file columnNumber - - gi_list_file - input file containing GI identifiers - out_file - output file - columnNumber - integer corresponding to column in gi_list_file containing GIs (column numbers start with 1) - -""" - -import pkg_resources -pkg_resources.require( 'bx-python' ) -pkg_resources.require( 'pysqlite' ) -import traceback -import fileinput -from pysqlite2 import dbapi2 as sqlite -from warnings import warn -import string, sys - - - -TAXONOMY = '/tmp/taxTest.db' - -# database containing collapsed NCBI taxonomy generated by prepareTaxonomy.sh script -# distributed with Galaxy. See prepareTaxonomy.readme (in scripts/taxonomy ditrectory) for information on how to generate -# necessary files - -def main(): - - try: - gi_fname = sys.argv[1] - out_fname = sys.argv[2] - giCol = int( sys.argv[3] ) - 1 - except: - sys.stderr.write('Not enough arguments\n') - sys.exit(0) - - try: - con = sqlite.connect(TAXONOMY) - except: - sys.stderr.write('Cannot connect to database\n') - sys.exit(0) - - cur = con.cursor() - fg = open(gi_fname, 'r') - of = open( out_fname, "w" ) - - try: - for line in fg: - try: - field = string.split(line.rstrip(), '\t') - sqlTemplate = string.Template('select gi2tax.gi, tax.* from gi2tax left join tax on gi2tax.taxId = tax.taxId where gi2tax.gi = $gi') - sql = sqlTemplate.substitute(gi = int(field[giCol])) - cur.execute(sql) - - for item in cur.fetchall(): - ranks = string.split(item[2], ",") - print >> of, str(item[0]) + "\t" + str(item[1]) + "\t" + "\t".join(ranks) - - except: - pass - - finally: - fg.close() - of.close() - -if __name__ == "__main__": - main() diff --git a/scripts/taxonomy/tax1_NodeParser.py b/scripts/taxonomy/tax1_NodeParser.py deleted file mode 100644 index b000cc9455e..00000000000 --- a/scripts/taxonomy/tax1_NodeParser.py +++ /dev/null @@ -1,118 +0,0 @@ -""" - tax1_NodeParser.py - - flattens NCBI taxonomy by printing list of children for every node - nodes_file is created from nodes.dmp file using the following command: - - cat nodes.dmp | tr -s "\t" "|" | tr "|" "\t" | cut -f 1,2,3,5 > nodes.txt - (nodes.dmp is downloaded from NCBI taxonomy FTP site) - - anton nekrutenko | anton@bx.psu.edu - -""" - -import sys -import string - -def findAll(L, value): - hits = [] - i = 0 - for item in L: - if item == value: - hits.append(i) - else: - pass - i += 1 - return hits - -def makeLookup(L): - D = {} - i = 0 - for item in L: - if item in D: - D[item].append(i) - else: - D[item] = [i] - i += 1 - - return D - -def addUnique(baseList, otherList): - auxDict = dict.fromkeys(baseList) - for item in otherList: - if item not in auxDict: - baseList.append(item) - auxDict[item] = None - return baseList - - -def main(): - - taxId = [] - taxParentId = [] - name = [] - - try: - inFile = sys.argv[1] - nodeFile = open(inFile, 'r') - except: - sys.stderr.write('tax1_NodeParser.py : No arguments or file does not exist\n') - sys.exit(0) - - - try: - for line in nodeFile: - field = string.split(line.rstrip(), '\t') - taxId.append(int(field[0])) - taxParentId.append(int(field[1])) - name.append(field[2]) - finally: - nodeFile.close() - - # Check data consistency - - if (len(taxId)+len(taxParentId)+len(name))/3 != len(taxId): - sys.stderr.write('Arrays are of different length: Corrupted input file') - sys.exit(0) - else: - pass - - parentLookUp = makeLookup(taxParentId) - - i = 0 - children = [] - - for taxon in taxId: - try: - children = parentLookUp[taxon] #findAll(taxParentId, taxon) - - except: - pass - - for child in children: - if len(children) > 0: - if taxId[child] != taxParentId[child]: - try: - children = addUnique(children, parentLookUp[taxId[child]]) - except: - pass - - else: - pass - - if len(children) > 0: - for child in children: - outTmp = string.Template('$pId\t$pRank\t$cId\t$cRank') - out = outTmp.substitute(pId = taxon, pRank = name[i], cId = taxId[child], cRank = name[child]) - print out - else: - outTmp = string.Template('$pId\t$pRank\t0\tNone') - out = outTmp.substitute(pId = taxon, pRank = name[i]) - print out - - children = [] - i += 1 - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/scripts/taxonomy/tax1_test_argv1.txt b/scripts/taxonomy/tax1_test_argv1.txt deleted file mode 100644 index 6ef7aac3b2b..00000000000 --- a/scripts/taxonomy/tax1_test_argv1.txt +++ /dev/null @@ -1,32 +0,0 @@ -63221 9606 subspecies -1 1 no rank -2759 131567 superkingdom -6072 33208 no rank -7711 33511 phylum -7742 89593 no rank -7776 7742 superclass -8287 117571 no rank -9347 32525 no rank -9443 314146 order -9526 314293 parvorder -9604 314295 family -9605 207598 genus -32523 8287 no rank -32524 32523 no rank -32525 40674 no rank -33154 2759 no rank -33208 33154 kingdom -33213 6072 no rank -33316 33213 no rank -33511 33316 no rank -40674 32524 class -89593 7711 subphylum -117570 7776 no rank -117571 117570 no rank -131567 1 no rank -207598 9604 no rank -314146 9347 superorder -314293 376913 infraorder -314295 9526 superfamily -376913 9443 suborder -9606 9605 species diff --git a/scripts/taxonomy/tax2_Node2Name.py b/scripts/taxonomy/tax2_Node2Name.py deleted file mode 100644 index becfd8d643d..00000000000 --- a/scripts/taxonomy/tax2_Node2Name.py +++ /dev/null @@ -1,144 +0,0 @@ -""" - tax2_Node2Name.py - - adds taxonomic names to collapsed NCBI taxonomy produced by tax1_NodeParser.py script - - node2child_file = created by tax1_NodeParser.py script - names_file = created from names.dmp file with the following command: - - cat names.dmp | cut -f 1,2,4 -d "|" | tr -s "\t" "|" | tr "|" "\t" | sed s/\"//g > names.txt - (names.dmp is downloaded from NCBI taxonomy FTP site) - - db_name = a name of sqlite file this program will create. Output of this script is stored in table names of this database - - anton nekrutenko | anton@bx.psu.edu -""" - - -import pkg_resources -pkg_resources.require('pysqlite') -from pysqlite2 import dbapi2 as sqlite -import sys -import string - -def main(): - - try: - inFileNodes = sys.argv[1] - inFileNames = sys.argv[2] - dbName = sys.argv[3] - except: - sys.stderr.write('tax2_Node2Name.py : Not enough arguments\n') - sys.exit(0) - - taxRank = { - 'root' :1, - 'superkingdom':2, - 'kingdom' :3, - 'subkingdom' :4, - 'superphylum' :5, - 'phylum' :6, - 'subphylum' :7, - 'superclass' :8, - 'class' :9, - 'subclass' :10, - 'superorder' :11, - 'order' :12, - 'suborder' :13, - 'superfamily' :14, - 'family' :15, - 'subfamily' :16, - 'tribe' :17, - 'subtribe' :18, - 'genus' :19, - 'subgenus' :20, - 'species' :21, - 'subspecies' :22 - } - - con = sqlite.connect(dbName) - cur = con.cursor() - - cur.execute('drop table if exists nodes') - cur.execute('create table nodes (pid int unsigned not null, pidRank varchar(20) not null, pnumRank smallint unsigned not null, id int unsigned not null, idRank varchar(20), numRank smallint unsigned not null)') - cur.execute('create index if not exists ipid on nodes(pid)') - - cur.execute('drop table if exists names') - cur.execute('create table names (taxId int unsigned not null, name text, type text)') - cur.execute('create index itaxId on names(taxId)') - con.commit() - - f = open(inFileNodes, 'r') - - try: - for line in f: - field = string.split(line.rstrip(), '\t') - field = [ int(field[0]), field[1], 0, int(field[2]), field[3], 0 ] - - - # Changing taxId == 1 from 'no rank' to 'root' - - if field[0] == 1: - field[1] = 'root' - - # Setting numeric IDs for major taxonomic groups from taxRank dictionary - - if taxRank.has_key(field[1]): - field[2] = taxRank[field[1]] - - if taxRank.has_key(field[4]): - field[5] = taxRank[field[4]] - - sqlTemplate = string.Template('insert into nodes values($pId, "$pRank", $pNumRank, $cId, "$cRank", $cNumRank)') - sql = sqlTemplate.substitute(pId = field[0], pRank = field[1], pNumRank = field[2], cId = field[3], cRank = field[4], cNumRank = field[5]) - cur.execute(sql) - - finally: - f.close() - con.commit() - - f = open(inFileNames, 'r') - try: - for line in f: - field = string.split(line.rstrip(), '\t') - -# The following is based on assimption that every tax id in NCBI taxonomy -# contains a single 'scientific name' type - try: - if field[2] == 'scientific name': - field[1] = field[1].replace('\t','_') - sqlTemplate = string.Template('insert into names values($taxId, "$name", "$syn")') - sql = sqlTemplate.substitute(taxId = int(field[0]), name = field[1], syn = field[2]) - cur.execute(sql) - except: - pass - - finally: - f.close() - con.commit() - - cur.execute('drop table if exists t') - - cur.execute('create table t (pid int unsigned not null, pidRank varchar(20) not null, pnumRank smallint unsigned not null, id int unsigned not null, idRank varchar(20), numRank smallint unsigned not null, pName text)') - - cur.execute('insert into t select nodes.*, name from nodes left join names on pid = taxId') - - cur.execute('create index iid on t(id)') - - cur.execute('drop table nodes') - - cur.execute('drop table if exists node2name') - - cur.execute('create table node2name (pId int unsigned not null, pIdRank varchar(20) not null, pNumRank smallint unsigned not null, cId int unsigned not null, cIdRank varchar(20), cNumRank smallint unsigned not null, pName text, cName text)') - - cur.execute('insert into node2name select t.*, name from t left join names on id = taxId') - - cur.execute('drop table t') - cur.execute('vacuum') - con.commit() - con.close() - - -if __name__ == "__main__": - main() - diff --git a/scripts/taxonomy/tax2_testData_Nodes.txt b/scripts/taxonomy/tax2_testData_Nodes.txt deleted file mode 100644 index 2fae8527f08..00000000000 --- a/scripts/taxonomy/tax2_testData_Nodes.txt +++ /dev/null @@ -1,498 +0,0 @@ -63221 subspecies 0 None -1 no rank 1 no rank -1 no rank 131567 no rank -1 no rank 2759 superkingdom -1 no rank 33154 no rank -1 no rank 33208 kingdom -1 no rank 6072 no rank -1 no rank 33213 no rank -1 no rank 33316 no rank -1 no rank 33511 no rank -1 no rank 7711 phylum -1 no rank 89593 subphylum -1 no rank 7742 no rank -1 no rank 7776 superclass -1 no rank 117570 no rank -1 no rank 117571 no rank -1 no rank 8287 no rank -1 no rank 32523 no rank -1 no rank 32524 no rank -1 no rank 40674 class -1 no rank 32525 no rank -1 no rank 9347 no rank -1 no rank 314146 superorder -1 no rank 9443 order -1 no rank 376913 suborder -1 no rank 314293 infraorder -1 no rank 9526 parvorder -1 no rank 314295 superfamily -1 no rank 9604 family -1 no rank 207598 no rank -1 no rank 9605 genus -1 no rank 9606 species -1 no rank 63221 subspecies -2759 superkingdom 33154 no rank -2759 superkingdom 33208 kingdom -2759 superkingdom 6072 no rank -2759 superkingdom 33213 no rank -2759 superkingdom 33316 no rank -2759 superkingdom 33511 no rank -2759 superkingdom 7711 phylum -2759 superkingdom 89593 subphylum -2759 superkingdom 7742 no rank -2759 superkingdom 7776 superclass -2759 superkingdom 117570 no rank -2759 superkingdom 117571 no rank -2759 superkingdom 8287 no rank -2759 superkingdom 32523 no rank -2759 superkingdom 32524 no rank -2759 superkingdom 40674 class -2759 superkingdom 32525 no rank -2759 superkingdom 9347 no rank -2759 superkingdom 314146 superorder -2759 superkingdom 9443 order -2759 superkingdom 376913 suborder -2759 superkingdom 314293 infraorder -2759 superkingdom 9526 parvorder -2759 superkingdom 314295 superfamily -2759 superkingdom 9604 family -2759 superkingdom 207598 no rank -2759 superkingdom 9605 genus -2759 superkingdom 9606 species -2759 superkingdom 63221 subspecies -6072 no rank 33213 no rank -6072 no rank 33316 no rank -6072 no rank 33511 no rank -6072 no rank 7711 phylum -6072 no rank 89593 subphylum -6072 no rank 7742 no rank -6072 no rank 7776 superclass -6072 no rank 117570 no rank -6072 no rank 117571 no rank -6072 no rank 8287 no rank -6072 no rank 32523 no rank -6072 no rank 32524 no rank -6072 no rank 40674 class -6072 no rank 32525 no rank -6072 no rank 9347 no rank -6072 no rank 314146 superorder -6072 no rank 9443 order -6072 no rank 376913 suborder -6072 no rank 314293 infraorder -6072 no rank 9526 parvorder -6072 no rank 314295 superfamily -6072 no rank 9604 family -6072 no rank 207598 no rank -6072 no rank 9605 genus -6072 no rank 9606 species -6072 no rank 63221 subspecies -7711 phylum 89593 subphylum -7711 phylum 7742 no rank -7711 phylum 7776 superclass -7711 phylum 117570 no rank -7711 phylum 117571 no rank -7711 phylum 8287 no rank -7711 phylum 32523 no rank -7711 phylum 32524 no rank -7711 phylum 40674 class -7711 phylum 32525 no rank -7711 phylum 9347 no rank -7711 phylum 314146 superorder -7711 phylum 9443 order -7711 phylum 376913 suborder -7711 phylum 314293 infraorder -7711 phylum 9526 parvorder -7711 phylum 314295 superfamily -7711 phylum 9604 family -7711 phylum 207598 no rank -7711 phylum 9605 genus -7711 phylum 9606 species -7711 phylum 63221 subspecies -7742 no rank 7776 superclass -7742 no rank 117570 no rank -7742 no rank 117571 no rank -7742 no rank 8287 no rank -7742 no rank 32523 no rank -7742 no rank 32524 no rank -7742 no rank 40674 class -7742 no rank 32525 no rank -7742 no rank 9347 no rank -7742 no rank 314146 superorder -7742 no rank 9443 order -7742 no rank 376913 suborder -7742 no rank 314293 infraorder -7742 no rank 9526 parvorder -7742 no rank 314295 superfamily -7742 no rank 9604 family -7742 no rank 207598 no rank -7742 no rank 9605 genus -7742 no rank 9606 species -7742 no rank 63221 subspecies -7776 superclass 117570 no rank -7776 superclass 117571 no rank -7776 superclass 8287 no rank -7776 superclass 32523 no rank -7776 superclass 32524 no rank -7776 superclass 40674 class -7776 superclass 32525 no rank -7776 superclass 9347 no rank -7776 superclass 314146 superorder -7776 superclass 9443 order -7776 superclass 376913 suborder -7776 superclass 314293 infraorder -7776 superclass 9526 parvorder -7776 superclass 314295 superfamily -7776 superclass 9604 family -7776 superclass 207598 no rank -7776 superclass 9605 genus -7776 superclass 9606 species -7776 superclass 63221 subspecies -8287 no rank 32523 no rank -8287 no rank 32524 no rank -8287 no rank 40674 class -8287 no rank 32525 no rank -8287 no rank 9347 no rank -8287 no rank 314146 superorder -8287 no rank 9443 order -8287 no rank 376913 suborder -8287 no rank 314293 infraorder -8287 no rank 9526 parvorder -8287 no rank 314295 superfamily -8287 no rank 9604 family -8287 no rank 207598 no rank -8287 no rank 9605 genus -8287 no rank 9606 species -8287 no rank 63221 subspecies -9347 no rank 314146 superorder -9347 no rank 9443 order -9347 no rank 376913 suborder -9347 no rank 314293 infraorder -9347 no rank 9526 parvorder -9347 no rank 314295 superfamily -9347 no rank 9604 family -9347 no rank 207598 no rank -9347 no rank 9605 genus -9347 no rank 9606 species -9347 no rank 63221 subspecies -9443 order 376913 suborder -9443 order 314293 infraorder -9443 order 9526 parvorder -9443 order 314295 superfamily -9443 order 9604 family -9443 order 207598 no rank -9443 order 9605 genus -9443 order 9606 species -9443 order 63221 subspecies -9526 parvorder 314295 superfamily -9526 parvorder 9604 family -9526 parvorder 207598 no rank -9526 parvorder 9605 genus -9526 parvorder 9606 species -9526 parvorder 63221 subspecies -9604 family 207598 no rank -9604 family 9605 genus -9604 family 9606 species -9604 family 63221 subspecies -9605 genus 9606 species -9605 genus 63221 subspecies -32523 no rank 32524 no rank -32523 no rank 40674 class -32523 no rank 32525 no rank -32523 no rank 9347 no rank -32523 no rank 314146 superorder -32523 no rank 9443 order -32523 no rank 376913 suborder -32523 no rank 314293 infraorder -32523 no rank 9526 parvorder -32523 no rank 314295 superfamily -32523 no rank 9604 family -32523 no rank 207598 no rank -32523 no rank 9605 genus -32523 no rank 9606 species -32523 no rank 63221 subspecies -32524 no rank 40674 class -32524 no rank 32525 no rank -32524 no rank 9347 no rank -32524 no rank 314146 superorder -32524 no rank 9443 order -32524 no rank 376913 suborder -32524 no rank 314293 infraorder -32524 no rank 9526 parvorder -32524 no rank 314295 superfamily -32524 no rank 9604 family -32524 no rank 207598 no rank -32524 no rank 9605 genus -32524 no rank 9606 species -32524 no rank 63221 subspecies -32525 no rank 9347 no rank -32525 no rank 314146 superorder -32525 no rank 9443 order -32525 no rank 376913 suborder -32525 no rank 314293 infraorder -32525 no rank 9526 parvorder -32525 no rank 314295 superfamily -32525 no rank 9604 family -32525 no rank 207598 no rank -32525 no rank 9605 genus -32525 no rank 9606 species -32525 no rank 63221 subspecies -33154 no rank 33208 kingdom -33154 no rank 6072 no rank -33154 no rank 33213 no rank -33154 no rank 33316 no rank -33154 no rank 33511 no rank -33154 no rank 7711 phylum -33154 no rank 89593 subphylum -33154 no rank 7742 no rank -33154 no rank 7776 superclass -33154 no rank 117570 no rank -33154 no rank 117571 no rank -33154 no rank 8287 no rank -33154 no rank 32523 no rank -33154 no rank 32524 no rank -33154 no rank 40674 class -33154 no rank 32525 no rank -33154 no rank 9347 no rank -33154 no rank 314146 superorder -33154 no rank 9443 order -33154 no rank 376913 suborder -33154 no rank 314293 infraorder -33154 no rank 9526 parvorder -33154 no rank 314295 superfamily -33154 no rank 9604 family -33154 no rank 207598 no rank -33154 no rank 9605 genus -33154 no rank 9606 species -33154 no rank 63221 subspecies -33208 kingdom 6072 no rank -33208 kingdom 33213 no rank -33208 kingdom 33316 no rank -33208 kingdom 33511 no rank -33208 kingdom 7711 phylum -33208 kingdom 89593 subphylum -33208 kingdom 7742 no rank -33208 kingdom 7776 superclass -33208 kingdom 117570 no rank -33208 kingdom 117571 no rank -33208 kingdom 8287 no rank -33208 kingdom 32523 no rank -33208 kingdom 32524 no rank -33208 kingdom 40674 class -33208 kingdom 32525 no rank -33208 kingdom 9347 no rank -33208 kingdom 314146 superorder -33208 kingdom 9443 order -33208 kingdom 376913 suborder -33208 kingdom 314293 infraorder -33208 kingdom 9526 parvorder -33208 kingdom 314295 superfamily -33208 kingdom 9604 family -33208 kingdom 207598 no rank -33208 kingdom 9605 genus -33208 kingdom 9606 species -33208 kingdom 63221 subspecies -33213 no rank 33316 no rank -33213 no rank 33511 no rank -33213 no rank 7711 phylum -33213 no rank 89593 subphylum -33213 no rank 7742 no rank -33213 no rank 7776 superclass -33213 no rank 117570 no rank -33213 no rank 117571 no rank -33213 no rank 8287 no rank -33213 no rank 32523 no rank -33213 no rank 32524 no rank -33213 no rank 40674 class -33213 no rank 32525 no rank -33213 no rank 9347 no rank -33213 no rank 314146 superorder -33213 no rank 9443 order -33213 no rank 376913 suborder -33213 no rank 314293 infraorder -33213 no rank 9526 parvorder -33213 no rank 314295 superfamily -33213 no rank 9604 family -33213 no rank 207598 no rank -33213 no rank 9605 genus -33213 no rank 9606 species -33213 no rank 63221 subspecies -33316 no rank 33511 no rank -33316 no rank 7711 phylum -33316 no rank 89593 subphylum -33316 no rank 7742 no rank -33316 no rank 7776 superclass -33316 no rank 117570 no rank -33316 no rank 117571 no rank -33316 no rank 8287 no rank -33316 no rank 32523 no rank -33316 no rank 32524 no rank -33316 no rank 40674 class -33316 no rank 32525 no rank -33316 no rank 9347 no rank -33316 no rank 314146 superorder -33316 no rank 9443 order -33316 no rank 376913 suborder -33316 no rank 314293 infraorder -33316 no rank 9526 parvorder -33316 no rank 314295 superfamily -33316 no rank 9604 family -33316 no rank 207598 no rank -33316 no rank 9605 genus -33316 no rank 9606 species -33316 no rank 63221 subspecies -33511 no rank 7711 phylum -33511 no rank 89593 subphylum -33511 no rank 7742 no rank -33511 no rank 7776 superclass -33511 no rank 117570 no rank -33511 no rank 117571 no rank -33511 no rank 8287 no rank -33511 no rank 32523 no rank -33511 no rank 32524 no rank -33511 no rank 40674 class -33511 no rank 32525 no rank -33511 no rank 9347 no rank -33511 no rank 314146 superorder -33511 no rank 9443 order -33511 no rank 376913 suborder -33511 no rank 314293 infraorder -33511 no rank 9526 parvorder -33511 no rank 314295 superfamily -33511 no rank 9604 family -33511 no rank 207598 no rank -33511 no rank 9605 genus -33511 no rank 9606 species -33511 no rank 63221 subspecies -40674 class 32525 no rank -40674 class 9347 no rank -40674 class 314146 superorder -40674 class 9443 order -40674 class 376913 suborder -40674 class 314293 infraorder -40674 class 9526 parvorder -40674 class 314295 superfamily -40674 class 9604 family -40674 class 207598 no rank -40674 class 9605 genus -40674 class 9606 species -40674 class 63221 subspecies -89593 subphylum 7742 no rank -89593 subphylum 7776 superclass -89593 subphylum 117570 no rank -89593 subphylum 117571 no rank -89593 subphylum 8287 no rank -89593 subphylum 32523 no rank -89593 subphylum 32524 no rank -89593 subphylum 40674 class -89593 subphylum 32525 no rank -89593 subphylum 9347 no rank -89593 subphylum 314146 superorder -89593 subphylum 9443 order -89593 subphylum 376913 suborder -89593 subphylum 314293 infraorder -89593 subphylum 9526 parvorder -89593 subphylum 314295 superfamily -89593 subphylum 9604 family -89593 subphylum 207598 no rank -89593 subphylum 9605 genus -89593 subphylum 9606 species -89593 subphylum 63221 subspecies -117570 no rank 117571 no rank -117570 no rank 8287 no rank -117570 no rank 32523 no rank -117570 no rank 32524 no rank -117570 no rank 40674 class -117570 no rank 32525 no rank -117570 no rank 9347 no rank -117570 no rank 314146 superorder -117570 no rank 9443 order -117570 no rank 376913 suborder -117570 no rank 314293 infraorder -117570 no rank 9526 parvorder -117570 no rank 314295 superfamily -117570 no rank 9604 family -117570 no rank 207598 no rank -117570 no rank 9605 genus -117570 no rank 9606 species -117570 no rank 63221 subspecies -117571 no rank 8287 no rank -117571 no rank 32523 no rank -117571 no rank 32524 no rank -117571 no rank 40674 class -117571 no rank 32525 no rank -117571 no rank 9347 no rank -117571 no rank 314146 superorder -117571 no rank 9443 order -117571 no rank 376913 suborder -117571 no rank 314293 infraorder -117571 no rank 9526 parvorder -117571 no rank 314295 superfamily -117571 no rank 9604 family -117571 no rank 207598 no rank -117571 no rank 9605 genus -117571 no rank 9606 species -117571 no rank 63221 subspecies -131567 no rank 2759 superkingdom -131567 no rank 33154 no rank -131567 no rank 33208 kingdom -131567 no rank 6072 no rank -131567 no rank 33213 no rank -131567 no rank 33316 no rank -131567 no rank 33511 no rank -131567 no rank 7711 phylum -131567 no rank 89593 subphylum -131567 no rank 7742 no rank -131567 no rank 7776 superclass -131567 no rank 117570 no rank -131567 no rank 117571 no rank -131567 no rank 8287 no rank -131567 no rank 32523 no rank -131567 no rank 32524 no rank -131567 no rank 40674 class -131567 no rank 32525 no rank -131567 no rank 9347 no rank -131567 no rank 314146 superorder -131567 no rank 9443 order -131567 no rank 376913 suborder -131567 no rank 314293 infraorder -131567 no rank 9526 parvorder -131567 no rank 314295 superfamily -131567 no rank 9604 family -131567 no rank 207598 no rank -131567 no rank 9605 genus -131567 no rank 9606 species -131567 no rank 63221 subspecies -207598 no rank 9605 genus -207598 no rank 9606 species -207598 no rank 63221 subspecies -314146 superorder 9443 order -314146 superorder 376913 suborder -314146 superorder 314293 infraorder -314146 superorder 9526 parvorder -314146 superorder 314295 superfamily -314146 superorder 9604 family -314146 superorder 207598 no rank -314146 superorder 9605 genus -314146 superorder 9606 species -314146 superorder 63221 subspecies -314293 infraorder 9526 parvorder -314293 infraorder 314295 superfamily -314293 infraorder 9604 family -314293 infraorder 207598 no rank -314293 infraorder 9605 genus -314293 infraorder 9606 species -314293 infraorder 63221 subspecies -314295 superfamily 9604 family -314295 superfamily 207598 no rank -314295 superfamily 9605 genus -314295 superfamily 9606 species -314295 superfamily 63221 subspecies -376913 suborder 314293 infraorder -376913 suborder 9526 parvorder -376913 suborder 314295 superfamily -376913 suborder 9604 family -376913 suborder 207598 no rank -376913 suborder 9605 genus -376913 suborder 9606 species -376913 suborder 63221 subspecies -9606 species 63221 subspecies diff --git a/scripts/taxonomy/tax2_test_argv1.txt b/scripts/taxonomy/tax2_test_argv1.txt deleted file mode 100644 index 2fae8527f08..00000000000 --- a/scripts/taxonomy/tax2_test_argv1.txt +++ /dev/null @@ -1,498 +0,0 @@ -63221 subspecies 0 None -1 no rank 1 no rank -1 no rank 131567 no rank -1 no rank 2759 superkingdom -1 no rank 33154 no rank -1 no rank 33208 kingdom -1 no rank 6072 no rank -1 no rank 33213 no rank -1 no rank 33316 no rank -1 no rank 33511 no rank -1 no rank 7711 phylum -1 no rank 89593 subphylum -1 no rank 7742 no rank -1 no rank 7776 superclass -1 no rank 117570 no rank -1 no rank 117571 no rank -1 no rank 8287 no rank -1 no rank 32523 no rank -1 no rank 32524 no rank -1 no rank 40674 class -1 no rank 32525 no rank -1 no rank 9347 no rank -1 no rank 314146 superorder -1 no rank 9443 order -1 no rank 376913 suborder -1 no rank 314293 infraorder -1 no rank 9526 parvorder -1 no rank 314295 superfamily -1 no rank 9604 family -1 no rank 207598 no rank -1 no rank 9605 genus -1 no rank 9606 species -1 no rank 63221 subspecies -2759 superkingdom 33154 no rank -2759 superkingdom 33208 kingdom -2759 superkingdom 6072 no rank -2759 superkingdom 33213 no rank -2759 superkingdom 33316 no rank -2759 superkingdom 33511 no rank -2759 superkingdom 7711 phylum -2759 superkingdom 89593 subphylum -2759 superkingdom 7742 no rank -2759 superkingdom 7776 superclass -2759 superkingdom 117570 no rank -2759 superkingdom 117571 no rank -2759 superkingdom 8287 no rank -2759 superkingdom 32523 no rank -2759 superkingdom 32524 no rank -2759 superkingdom 40674 class -2759 superkingdom 32525 no rank -2759 superkingdom 9347 no rank -2759 superkingdom 314146 superorder -2759 superkingdom 9443 order -2759 superkingdom 376913 suborder -2759 superkingdom 314293 infraorder -2759 superkingdom 9526 parvorder -2759 superkingdom 314295 superfamily -2759 superkingdom 9604 family -2759 superkingdom 207598 no rank -2759 superkingdom 9605 genus -2759 superkingdom 9606 species -2759 superkingdom 63221 subspecies -6072 no rank 33213 no rank -6072 no rank 33316 no rank -6072 no rank 33511 no rank -6072 no rank 7711 phylum -6072 no rank 89593 subphylum -6072 no rank 7742 no rank -6072 no rank 7776 superclass -6072 no rank 117570 no rank -6072 no rank 117571 no rank -6072 no rank 8287 no rank -6072 no rank 32523 no rank -6072 no rank 32524 no rank -6072 no rank 40674 class -6072 no rank 32525 no rank -6072 no rank 9347 no rank -6072 no rank 314146 superorder -6072 no rank 9443 order -6072 no rank 376913 suborder -6072 no rank 314293 infraorder -6072 no rank 9526 parvorder -6072 no rank 314295 superfamily -6072 no rank 9604 family -6072 no rank 207598 no rank -6072 no rank 9605 genus -6072 no rank 9606 species -6072 no rank 63221 subspecies -7711 phylum 89593 subphylum -7711 phylum 7742 no rank -7711 phylum 7776 superclass -7711 phylum 117570 no rank -7711 phylum 117571 no rank -7711 phylum 8287 no rank -7711 phylum 32523 no rank -7711 phylum 32524 no rank -7711 phylum 40674 class -7711 phylum 32525 no rank -7711 phylum 9347 no rank -7711 phylum 314146 superorder -7711 phylum 9443 order -7711 phylum 376913 suborder -7711 phylum 314293 infraorder -7711 phylum 9526 parvorder -7711 phylum 314295 superfamily -7711 phylum 9604 family -7711 phylum 207598 no rank -7711 phylum 9605 genus -7711 phylum 9606 species -7711 phylum 63221 subspecies -7742 no rank 7776 superclass -7742 no rank 117570 no rank -7742 no rank 117571 no rank -7742 no rank 8287 no rank -7742 no rank 32523 no rank -7742 no rank 32524 no rank -7742 no rank 40674 class -7742 no rank 32525 no rank -7742 no rank 9347 no rank -7742 no rank 314146 superorder -7742 no rank 9443 order -7742 no rank 376913 suborder -7742 no rank 314293 infraorder -7742 no rank 9526 parvorder -7742 no rank 314295 superfamily -7742 no rank 9604 family -7742 no rank 207598 no rank -7742 no rank 9605 genus -7742 no rank 9606 species -7742 no rank 63221 subspecies -7776 superclass 117570 no rank -7776 superclass 117571 no rank -7776 superclass 8287 no rank -7776 superclass 32523 no rank -7776 superclass 32524 no rank -7776 superclass 40674 class -7776 superclass 32525 no rank -7776 superclass 9347 no rank -7776 superclass 314146 superorder -7776 superclass 9443 order -7776 superclass 376913 suborder -7776 superclass 314293 infraorder -7776 superclass 9526 parvorder -7776 superclass 314295 superfamily -7776 superclass 9604 family -7776 superclass 207598 no rank -7776 superclass 9605 genus -7776 superclass 9606 species -7776 superclass 63221 subspecies -8287 no rank 32523 no rank -8287 no rank 32524 no rank -8287 no rank 40674 class -8287 no rank 32525 no rank -8287 no rank 9347 no rank -8287 no rank 314146 superorder -8287 no rank 9443 order -8287 no rank 376913 suborder -8287 no rank 314293 infraorder -8287 no rank 9526 parvorder -8287 no rank 314295 superfamily -8287 no rank 9604 family -8287 no rank 207598 no rank -8287 no rank 9605 genus -8287 no rank 9606 species -8287 no rank 63221 subspecies -9347 no rank 314146 superorder -9347 no rank 9443 order -9347 no rank 376913 suborder -9347 no rank 314293 infraorder -9347 no rank 9526 parvorder -9347 no rank 314295 superfamily -9347 no rank 9604 family -9347 no rank 207598 no rank -9347 no rank 9605 genus -9347 no rank 9606 species -9347 no rank 63221 subspecies -9443 order 376913 suborder -9443 order 314293 infraorder -9443 order 9526 parvorder -9443 order 314295 superfamily -9443 order 9604 family -9443 order 207598 no rank -9443 order 9605 genus -9443 order 9606 species -9443 order 63221 subspecies -9526 parvorder 314295 superfamily -9526 parvorder 9604 family -9526 parvorder 207598 no rank -9526 parvorder 9605 genus -9526 parvorder 9606 species -9526 parvorder 63221 subspecies -9604 family 207598 no rank -9604 family 9605 genus -9604 family 9606 species -9604 family 63221 subspecies -9605 genus 9606 species -9605 genus 63221 subspecies -32523 no rank 32524 no rank -32523 no rank 40674 class -32523 no rank 32525 no rank -32523 no rank 9347 no rank -32523 no rank 314146 superorder -32523 no rank 9443 order -32523 no rank 376913 suborder -32523 no rank 314293 infraorder -32523 no rank 9526 parvorder -32523 no rank 314295 superfamily -32523 no rank 9604 family -32523 no rank 207598 no rank -32523 no rank 9605 genus -32523 no rank 9606 species -32523 no rank 63221 subspecies -32524 no rank 40674 class -32524 no rank 32525 no rank -32524 no rank 9347 no rank -32524 no rank 314146 superorder -32524 no rank 9443 order -32524 no rank 376913 suborder -32524 no rank 314293 infraorder -32524 no rank 9526 parvorder -32524 no rank 314295 superfamily -32524 no rank 9604 family -32524 no rank 207598 no rank -32524 no rank 9605 genus -32524 no rank 9606 species -32524 no rank 63221 subspecies -32525 no rank 9347 no rank -32525 no rank 314146 superorder -32525 no rank 9443 order -32525 no rank 376913 suborder -32525 no rank 314293 infraorder -32525 no rank 9526 parvorder -32525 no rank 314295 superfamily -32525 no rank 9604 family -32525 no rank 207598 no rank -32525 no rank 9605 genus -32525 no rank 9606 species -32525 no rank 63221 subspecies -33154 no rank 33208 kingdom -33154 no rank 6072 no rank -33154 no rank 33213 no rank -33154 no rank 33316 no rank -33154 no rank 33511 no rank -33154 no rank 7711 phylum -33154 no rank 89593 subphylum -33154 no rank 7742 no rank -33154 no rank 7776 superclass -33154 no rank 117570 no rank -33154 no rank 117571 no rank -33154 no rank 8287 no rank -33154 no rank 32523 no rank -33154 no rank 32524 no rank -33154 no rank 40674 class -33154 no rank 32525 no rank -33154 no rank 9347 no rank -33154 no rank 314146 superorder -33154 no rank 9443 order -33154 no rank 376913 suborder -33154 no rank 314293 infraorder -33154 no rank 9526 parvorder -33154 no rank 314295 superfamily -33154 no rank 9604 family -33154 no rank 207598 no rank -33154 no rank 9605 genus -33154 no rank 9606 species -33154 no rank 63221 subspecies -33208 kingdom 6072 no rank -33208 kingdom 33213 no rank -33208 kingdom 33316 no rank -33208 kingdom 33511 no rank -33208 kingdom 7711 phylum -33208 kingdom 89593 subphylum -33208 kingdom 7742 no rank -33208 kingdom 7776 superclass -33208 kingdom 117570 no rank -33208 kingdom 117571 no rank -33208 kingdom 8287 no rank -33208 kingdom 32523 no rank -33208 kingdom 32524 no rank -33208 kingdom 40674 class -33208 kingdom 32525 no rank -33208 kingdom 9347 no rank -33208 kingdom 314146 superorder -33208 kingdom 9443 order -33208 kingdom 376913 suborder -33208 kingdom 314293 infraorder -33208 kingdom 9526 parvorder -33208 kingdom 314295 superfamily -33208 kingdom 9604 family -33208 kingdom 207598 no rank -33208 kingdom 9605 genus -33208 kingdom 9606 species -33208 kingdom 63221 subspecies -33213 no rank 33316 no rank -33213 no rank 33511 no rank -33213 no rank 7711 phylum -33213 no rank 89593 subphylum -33213 no rank 7742 no rank -33213 no rank 7776 superclass -33213 no rank 117570 no rank -33213 no rank 117571 no rank -33213 no rank 8287 no rank -33213 no rank 32523 no rank -33213 no rank 32524 no rank -33213 no rank 40674 class -33213 no rank 32525 no rank -33213 no rank 9347 no rank -33213 no rank 314146 superorder -33213 no rank 9443 order -33213 no rank 376913 suborder -33213 no rank 314293 infraorder -33213 no rank 9526 parvorder -33213 no rank 314295 superfamily -33213 no rank 9604 family -33213 no rank 207598 no rank -33213 no rank 9605 genus -33213 no rank 9606 species -33213 no rank 63221 subspecies -33316 no rank 33511 no rank -33316 no rank 7711 phylum -33316 no rank 89593 subphylum -33316 no rank 7742 no rank -33316 no rank 7776 superclass -33316 no rank 117570 no rank -33316 no rank 117571 no rank -33316 no rank 8287 no rank -33316 no rank 32523 no rank -33316 no rank 32524 no rank -33316 no rank 40674 class -33316 no rank 32525 no rank -33316 no rank 9347 no rank -33316 no rank 314146 superorder -33316 no rank 9443 order -33316 no rank 376913 suborder -33316 no rank 314293 infraorder -33316 no rank 9526 parvorder -33316 no rank 314295 superfamily -33316 no rank 9604 family -33316 no rank 207598 no rank -33316 no rank 9605 genus -33316 no rank 9606 species -33316 no rank 63221 subspecies -33511 no rank 7711 phylum -33511 no rank 89593 subphylum -33511 no rank 7742 no rank -33511 no rank 7776 superclass -33511 no rank 117570 no rank -33511 no rank 117571 no rank -33511 no rank 8287 no rank -33511 no rank 32523 no rank -33511 no rank 32524 no rank -33511 no rank 40674 class -33511 no rank 32525 no rank -33511 no rank 9347 no rank -33511 no rank 314146 superorder -33511 no rank 9443 order -33511 no rank 376913 suborder -33511 no rank 314293 infraorder -33511 no rank 9526 parvorder -33511 no rank 314295 superfamily -33511 no rank 9604 family -33511 no rank 207598 no rank -33511 no rank 9605 genus -33511 no rank 9606 species -33511 no rank 63221 subspecies -40674 class 32525 no rank -40674 class 9347 no rank -40674 class 314146 superorder -40674 class 9443 order -40674 class 376913 suborder -40674 class 314293 infraorder -40674 class 9526 parvorder -40674 class 314295 superfamily -40674 class 9604 family -40674 class 207598 no rank -40674 class 9605 genus -40674 class 9606 species -40674 class 63221 subspecies -89593 subphylum 7742 no rank -89593 subphylum 7776 superclass -89593 subphylum 117570 no rank -89593 subphylum 117571 no rank -89593 subphylum 8287 no rank -89593 subphylum 32523 no rank -89593 subphylum 32524 no rank -89593 subphylum 40674 class -89593 subphylum 32525 no rank -89593 subphylum 9347 no rank -89593 subphylum 314146 superorder -89593 subphylum 9443 order -89593 subphylum 376913 suborder -89593 subphylum 314293 infraorder -89593 subphylum 9526 parvorder -89593 subphylum 314295 superfamily -89593 subphylum 9604 family -89593 subphylum 207598 no rank -89593 subphylum 9605 genus -89593 subphylum 9606 species -89593 subphylum 63221 subspecies -117570 no rank 117571 no rank -117570 no rank 8287 no rank -117570 no rank 32523 no rank -117570 no rank 32524 no rank -117570 no rank 40674 class -117570 no rank 32525 no rank -117570 no rank 9347 no rank -117570 no rank 314146 superorder -117570 no rank 9443 order -117570 no rank 376913 suborder -117570 no rank 314293 infraorder -117570 no rank 9526 parvorder -117570 no rank 314295 superfamily -117570 no rank 9604 family -117570 no rank 207598 no rank -117570 no rank 9605 genus -117570 no rank 9606 species -117570 no rank 63221 subspecies -117571 no rank 8287 no rank -117571 no rank 32523 no rank -117571 no rank 32524 no rank -117571 no rank 40674 class -117571 no rank 32525 no rank -117571 no rank 9347 no rank -117571 no rank 314146 superorder -117571 no rank 9443 order -117571 no rank 376913 suborder -117571 no rank 314293 infraorder -117571 no rank 9526 parvorder -117571 no rank 314295 superfamily -117571 no rank 9604 family -117571 no rank 207598 no rank -117571 no rank 9605 genus -117571 no rank 9606 species -117571 no rank 63221 subspecies -131567 no rank 2759 superkingdom -131567 no rank 33154 no rank -131567 no rank 33208 kingdom -131567 no rank 6072 no rank -131567 no rank 33213 no rank -131567 no rank 33316 no rank -131567 no rank 33511 no rank -131567 no rank 7711 phylum -131567 no rank 89593 subphylum -131567 no rank 7742 no rank -131567 no rank 7776 superclass -131567 no rank 117570 no rank -131567 no rank 117571 no rank -131567 no rank 8287 no rank -131567 no rank 32523 no rank -131567 no rank 32524 no rank -131567 no rank 40674 class -131567 no rank 32525 no rank -131567 no rank 9347 no rank -131567 no rank 314146 superorder -131567 no rank 9443 order -131567 no rank 376913 suborder -131567 no rank 314293 infraorder -131567 no rank 9526 parvorder -131567 no rank 314295 superfamily -131567 no rank 9604 family -131567 no rank 207598 no rank -131567 no rank 9605 genus -131567 no rank 9606 species -131567 no rank 63221 subspecies -207598 no rank 9605 genus -207598 no rank 9606 species -207598 no rank 63221 subspecies -314146 superorder 9443 order -314146 superorder 376913 suborder -314146 superorder 314293 infraorder -314146 superorder 9526 parvorder -314146 superorder 314295 superfamily -314146 superorder 9604 family -314146 superorder 207598 no rank -314146 superorder 9605 genus -314146 superorder 9606 species -314146 superorder 63221 subspecies -314293 infraorder 9526 parvorder -314293 infraorder 314295 superfamily -314293 infraorder 9604 family -314293 infraorder 207598 no rank -314293 infraorder 9605 genus -314293 infraorder 9606 species -314293 infraorder 63221 subspecies -314295 superfamily 9604 family -314295 superfamily 207598 no rank -314295 superfamily 9605 genus -314295 superfamily 9606 species -314295 superfamily 63221 subspecies -376913 suborder 314293 infraorder -376913 suborder 9526 parvorder -376913 suborder 314295 superfamily -376913 suborder 9604 family -376913 suborder 207598 no rank -376913 suborder 9605 genus -376913 suborder 9606 species -376913 suborder 63221 subspecies -9606 species 63221 subspecies diff --git a/scripts/taxonomy/tax2_test_argv2.txt b/scripts/taxonomy/tax2_test_argv2.txt deleted file mode 100644 index 0389c63c422..00000000000 --- a/scripts/taxonomy/tax2_test_argv2.txt +++ /dev/null @@ -1,72 +0,0 @@ -taxid name class -63221 Homo neanderthalensis synonym -63221 Homo sapiens neanderthalensis scientific name -1 all synonym -1 root scientific name -2759 Eucarya synonym -2759 Eucaryotae synonym -2759 Eukarya synonym -2759 Eukaryota scientific name -2759 Eukaryotae synonym -2759 eucaryotes genbank common name -2759 eukaryotes common name -2759 eukaryotes blast name -6072 Eumetazoa scientific name -7711 Chordata scientific name -7711 chordates genbank common name -7711 chordates blast name -7742 Vertebrata scientific name -7742 vertebrates genbank common name -7742 vertebrates blast name -7776 Gnathostomata scientific name -7776 jawed vertebrates genbank common name -8287 Sarcopterygii scientific name -9347 Eutheria scientific name -9347 Placentalia synonym -9347 eutherian mammals common name -9347 placental mammals common name -9347 placentals genbank common name -9347 placentals blast name -9443 Primata synonym -9443 Primates scientific name -9443 primate equivalent name -9443 primates blast name -9526 Catarrhini scientific name -9604 Hominidae scientific name -9604 Pongidae synonym -9604 great apes common name -9605 Homo scientific name -32523 Tetrapoda scientific name -32523 tetrapods genbank common name -32524 Amniota scientific name -32524 amniotes genbank common name -32525 Theria scientific name -33154 Fungi/Metazoa group scientific name -33208 Animalia synonym -33208 Metazoa scientific name -33208 animals blast name -33208 metazoans genbank common name -33208 multicellular animals common name -33213 Bilateria scientific name -33316 Coelomata scientific name -33511 Deuterostomia scientific name -40674 Mammalia scientific name -40674 mammals genbank common name -40674 mammals blast name -89593 Craniata scientific name -117570 Teleostomi scientific name -117571 Euteleostomi scientific name -117571 bony vertebrates genbank common name -131567 biota synonym -131567 cellular organisms scientific name -207598 Homo/Pan/Gorilla group scientific name -314146 Euarchontoglires scientific name -314293 Anthropoidea synonym -314293 Simiiformes scientific name -314295 Hominoidea scientific name -314295 ape common name -314295 apes common name -376913 Haplorrhini scientific name -9606 Homo sapiens scientific name -9606 human genbank common name -9606 man common name diff --git a/scripts/taxonomy/tax3_gi2tax.py b/scripts/taxonomy/tax3_gi2tax.py deleted file mode 100644 index d5675ba3bf4..00000000000 --- a/scripts/taxonomy/tax3_gi2tax.py +++ /dev/null @@ -1,103 +0,0 @@ -""" - tax3_gi2tax.py - - db_name = name of the database produced by tax2_Node2Name.py scriopt - gi2tax_file = conactenation of gi_taxid_nucl.dmp and gi_taxid_prot.dmp downloaded from NCBI Taxonomy FTP site - -""" - - -import pkg_resources -pkg_resources.require('pysqlite') -from pysqlite2 import dbapi2 as sqlite -import sys -import string - -def main(): - - try: - dbName = sys.argv[1] - inFileGIs = sys.argv[2] - con = sqlite.connect(dbName) - except: - sys.stderr.write('tax3_gi2tax.py : Not enough arguments of database does not exist\n') - sys.exit(0) - - - cur = con.cursor() - - try: - cur.execute('select * from node2name limit 1') - except: - sys.stderr.write('Table node2name does not exist') - sys.exit(0) - cur.execute('drop table if exists gi2tax') - cur.execute('create table gi2tax (gi int unsigned primary key, taxId int unsigned not null)') - - cur.execute('drop table if exists tax') - cur.execute('create table tax (taxId int unsigned not null, tax text)') - cur.execute('insert into tax values(0,"superkingdom,kingdom,subkingdom,superphylum,phylum,subphylum,superclass,class,subclass,superorder,order,suborder,superfamily,family,subfamily,tribe,subtribe,genus,subgenus,species,subspecies")') - - cur.execute('create index if not exists cId_index on node2name(cId)') - con.commit() - - fg = open(inFileGIs, 'r') - - - try: - for line in fg: - field = string.split(line.rstrip(), '\t') - sqlTemplate = string.Template('insert into gi2tax values($gi, $taxId)') - sql = sqlTemplate.substitute(gi = int(field[0]), taxId = int(field[1])) - cur.execute(sql) - - finally: - con.commit() - fg.close() - - cur.execute('select distinct taxId from gi2tax') - - for line in cur.fetchall(): - i = 0 - taxRank = ['n' for i in range(22)] # This number depends on the length of taxRank dictionary in tax2_Node2Name.py - - # select all parents of a given taxId - sqlTemplate = string.Template('select * from node2name where cId = $taxId and pNumRank > 0 order by pNumRank asc') - sql = sqlTemplate.substitute(taxId = int(line[0])) - cur.execute(sql) - - for item in cur.fetchall(): - taxRank[item[2]-1] = str(item[6]) - - - # select lowest ranking parent (with max pNumRank) - sqlTemplate = string.Template('select max(pNumRank) from node2name where cId = $taxId') - sql = sqlTemplate.substitute(taxId = int(line[0])) - cur.execute(sql) - row = cur.fetchone() - - # Set the child of the lowest ranking parent as the lowest taxon for that taxId (e.g., species, subspecies etc.) - - try: - sqlTemplate = string.Template('select * from node2name where cId = $taxId and pNumRank = $max_pNumRank') - sql = sqlTemplate.substitute(taxId = int(line[0]), max_pNumRank = int(row[0])) - cur.execute(sql) - lowestRank = cur.fetchone() - taxRank[int(lowestRank[5])-1] = str(lowestRank[7]) - taxonomyInfo = ",".join(taxRank) - except: - print "The following taxId was not found in taxonomy database: ", line[0] - pass - - taxTemplate = string.Template('insert into tax values($taxId, "$taxInfo")') - tax = taxTemplate.substitute(taxId = int(line[0]), taxInfo = taxonomyInfo) - cur.execute(tax) - - cur.execute('create index taxId_index on tax(taxId)') - cur.execute('drop table if exists node2name') - cur.execute('vacuum') - con.commit() - con.close() - -if __name__ == "__main__": - main() diff --git a/scripts/taxonomy/tax3_test_argv2.txt b/scripts/taxonomy/tax3_test_argv2.txt deleted file mode 100644 index 4c4af7c9e08..00000000000 --- a/scripts/taxonomy/tax3_test_argv2.txt +++ /dev/null @@ -1,5 +0,0 @@ -33001686 9443 -23236241 9604 -12583 9606 -410771 40674 -2286205 63221 diff --git a/scripts/taxonomy/tax_result.txt b/scripts/taxonomy/tax_result.txt deleted file mode 100644 index d246b34882b..00000000000 --- a/scripts/taxonomy/tax_result.txt +++ /dev/null @@ -1,5 +0,0 @@ -33001686 9443 root Eukaryota Metazoa n n Chordata Craniata Gnathostomata Mammalia n Euarchontoglires Primates n n n n n n n n n n -23236241 9604 root Eukaryota Metazoa n n Chordata Craniata Gnathostomata Mammalia n Euarchontoglires Primates Haplorrhini Hominoidea Hominidae n n n n n n n -12583 9606 root Eukaryota Metazoa n n Chordata Craniata Gnathostomata Mammalia n Euarchontoglires Primates Haplorrhini Hominoidea Hominidae n n n Homo n Homo sapiens n -410771 40674 root Eukaryota Metazoa n n Chordata Craniata Gnathostomata Mammalia n n n n n n n n n n n n n -2286205 63221 root Eukaryota Metazoa n n Chordata Craniata Gnathostomata Mammalia n Euarchontoglires Primates Haplorrhini Hominoidea Hominidae n n n Homo n Homo sapiens Homo sapiens neanderthalensis