Read in the taxonomy file.
import msparser
import sys
if len(sys.argv) < 2 :
print("""
The location of taxonomy file has to be specified as a parameter.
The location should either be the full path to the taxonomy file
or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi
""")
sys.exit(1)
if len(sys.argv) > 2 :
cs = msparser.ms_connection_settings()
cs.setSessionID(sys.argv[2])
file = msparser.ms_taxonomyfile(sys.argv[1], cs)
else :
file = msparser.ms_taxonomyfile(sys.argv[1])
if not file.isValid() :
print("There are errors. Cannot continue. The last error description:")
print(file.getLastErrorString())
sys.exit(1)
n = file.getNumberOfEntries()
print("There are %d taxonomy choice entries configured:" % n)
for i in range(n) :
entry = file.getEntryByNumber(i)
print(entry.getTitle())
tax = []
for i in range(entry.getNumberOfIncludeTaxonomies()) :
tax.append("%d" % entry.getIncludeTaxonomy(i))
print("Include: " + ', '.join(tax))
tax = []
for i in range(entry.getNumberOfExcludeTaxonomies()) :
tax.append("%d" % entry.getExcludeTaxonomy(i))
print("Exclude: " + ', '.join(tax))
"""
Running the program as
python config_taxonomy.pl /usr/local/mascot/config/taxonomy
will give the following output under Mascot Server 2.3:
There are 65 taxonomy choice entries configured:
All entries
Include: 1
Exclude: 0
. . Archaea (Archaeobacteria)
Include: 2157
Exclude:
. . Eukaryota (eucaryotes)
Include: 2759
Exclude:
. . . . Alveolata (alveolates)
Include: 33630
Exclude:
. . . . . . Plasmodium falciparum (malaria parasite)
Include: 5833
Exclude:
. . . . . . Other Alveolata
[ ... ]
"""