Read in the taxonomy file.
#!/usr/bin/python ############################################################################## # file: config_taxonomy.py # # 'msparser' toolkit example code # ############################################################################## # COPYRIGHT NOTICE # # Copyright 1998-2010 Matrix Science Limited All Rights Reserved. # # # ############################################################################## # $Source: parser/examples/test_python/config_taxonomy.py $ # # $Author: villek@matrixscience.com $ # # $Date: 2018-07-30 16:23:53 +0100 $ # # $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ # # $NoKeywords:: $ # ############################################################################## 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) # A sessionID can optionally be passed as the second parameter. # This will only be required if the 'file' is a URL. 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 [ ... ] """
Copyright © 2022 Matrix Science Ltd. All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29 |