Read in the taxonomy file.
1
2
16
17import msparser
18import sys
19
20if len(sys.argv) < 2 :
21 print("""
22The location of taxonomy file has to be specified as a parameter.
23The location should either be the full path to the taxonomy file
24or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi
25""")
26 sys.exit(1)
27
28
29
30if len(sys.argv) > 2 :
31 cs = msparser.ms_connection_settings()
32 cs.setSessionID(sys.argv[2])
33 file = msparser.ms_taxonomyfile(sys.argv[1], cs)
34else :
35 file = msparser.ms_taxonomyfile(sys.argv[1])
36
37if not file.isValid() :
38 print("There are errors. Cannot continue. The last error description:")
39 print(file.getLastErrorString())
40 sys.exit(1)
41
42n = file.getNumberOfEntries()
43print("There are %d taxonomy choice entries configured:" % n)
44
45for i in range(n) :
46 entry = file.getEntryByNumber(i)
47 print(entry.getTitle())
48
49 tax = []
50 for i in range(entry.getNumberOfIncludeTaxonomies()) :
51 tax.append("%d" % entry.getIncludeTaxonomy(i))
52
53 print("Include: " + ', '.join(tax))
54
55 tax = []
56 for i in range(entry.getNumberOfExcludeTaxonomies()) :
57 tax.append("%d" % entry.getExcludeTaxonomy(i))
58
59 print("Exclude: " + ', '.join(tax))
60
61
62
63"""
64
65Running the program as
66
67python config_taxonomy.pl /usr/local/mascot/config/taxonomy
68
69will give the following output under Mascot Server 2.3:
70
71
72There are 65 taxonomy choice entries configured:
73All entries
74Include: 1
75Exclude: 0
76. . Archaea (Archaeobacteria)
77Include: 2157
78Exclude:
79. . Eukaryota (eucaryotes)
80Include: 2759
81Exclude:
82. . . . Alveolata (alveolates)
83Include: 33630
84Exclude:
85. . . . . . Plasmodium falciparum (malaria parasite)
86Include: 5833
87Exclude:
88. . . . . . Other Alveolata
89 [ ... ]
90
91"""
92