Read in the mascot.dat file.
    1
    2 
   16 
   17import msparser
   18import sys
   19 
   20if len(sys.argv) < 2 :
   21    print("""
   22Location of mascot.dat has to be specified as a parameter.
   23The location should either be the full path to the mascot.dat 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_datfile(sys.argv[1], 0, cs)
   34else :
   35    file = msparser.ms_datfile(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 
   42
   43dbs = file.getDatabases()
   44 
   45
   46
   47if dbs.isSectionAvailable() :
   48    n = dbs.getNumberOfDatabases()
   49    print("There are %d databases configured:" % n)
   50 
   51    for i in range(n) :
   52        database = dbs.getDatabase(i).getName()
   53 
   54        if dbs.getDatabase(i).isActive() :
   55            inuse = "active"
   56        else :
   57            inuse = "inactive"
   58        print('{:<20}'.format(database) + '{:<}'.format(inuse))
   59else :
   60    print("Section 'Databases' is missing")
   61 
   62print("") 
   63 
   64
   65parseOptions = file.getParseOptions()
   66 
   67
   68if parseOptions.isSectionAvailable() :
   69    n = parseOptions.getNumberOfParseRules()
   70    print("There are %d parse rules in the file; the following are specified:" % n)
   71 
   72    for i in range(n) :
   73        
   74        if parseOptions.getParseRule(i).isAvailable() :
   75            print("Rule_%d : %s" % (i, parseOptions.getParseRule(i).getRuleStr()))
   76else :
   77    print("Section 'Parse' is missing")
   78 
   79print("") 
   80 
   81
   82wwwOptions = file.getWWWOptions()
   83 
   84
   85if wwwOptions.isSectionAvailable() :
   86    n = wwwOptions.getNumberOfEntries()
   87    print("There are %d sequence report sources configured:" % n)
   88 
   89    for i in range(n) :
   90        if wwwOptions.getEntry(i).getType() == msparser.WWW_SEQ :
   91            type = "SEQ"
   92        else :
   93            type = "REP"
   94 
   95        print("%s_%s" % (wwwOptions.getEntry(i).getName(), type))
   96else :
   97    print("Section 'WWW' is missing")
   98 
   99print("") 
  100 
  101
  102print("Available taxonomy sources:")
  103 
  104maxtax = file.getMaxTaxonomyRules()
  105activetax = 0
  106 
  107for taxind in range(1, 1 + maxtax) :
  108    
  109    if file.getTaxonomyRules(taxind) :
  110        activetax += 1
  111        print("TAXONOMY_%d" % taxind)
  112        print(file.getTaxonomyRules(taxind).getIdentifier())
  113 
  114if activetax == 0 :
  115    print("(none)")
  116 
  117print("") 
  118 
  119
  120clusterParams = file.getClusterParams()
  121 
  122
  123if clusterParams.isSectionAvailable() :
  124    
  125    if clusterParams.isEnabled() :
  126        print("Cluster mode: enabled")
  127    else :
  128        print("Cluster mode: disabled")
  129else :
  130    print("Section 'Cluster' is missing")
  131 
  132print("") 
  133 
  134
  135procOptions = file.getProcessors()
  136 
  137
  138if procOptions.isSectionAvailable() :
  139    print("%d CPU(s) configured" % procOptions.getNumberOfProcessors())
  140else :
  141    print("Section 'Processor' is missing")
  142 
  143print("") 
  144 
  145
  146mascotOptions = file.getMascotOptions()
  147 
  148
  149if mascotOptions.isSectionAvailable() :
  150    print("MascotCmdLine: %s" % mascotOptions.getMascotCmdLine())
  151else :
  152    print("Section 'Options' is missing")
  153 
  154print("") 
  155 
  156
  157cronOptions = file.getCronOptions()
  158 
  159
  160if cronOptions.isSectionAvailable() :
  161    if cronOptions.isCronEnabled() :
  162        n = cronOptions.getNumberOfCronJobs()
  163 
  164        if n == 0 :
  165            print("There are %d cron jobs configured" % n)
  166        else :
  167            print("There are %d cron jobs configured:" % n)
  168 
  169        for i in range(n) :
  170            print(cronOptions.getCronJob(i).getCommandStr())
  171    else :
  172        print("Cron functionality is disabled")
  173else :
  174    print("Section 'Cron' is missing")
  175 
  176print("") 
  177 
  178 
  179"""
  180 
  181Running the program as 
  182 
  183python config_mascotdat.py /usr/local/mascot/config/mascot.dat
  184 
  185will give the following output under Mascot Server 2.3 (exact details depend 
  186on how the server has been configured):
  187 
  188 
  189There are 29 databases configured:
  190contaminants : active
  191cRAP : active
  192EST_human : inactive
  193EST_mouse : inactive
  194EST_others : inactive
  195IPI_arabidopsis : inactive
  196IPI_bovine : inactive
  197IPI_chicken : inactive
  198IPI_human : inactive
  199IPI_mouse : inactive
  200IPI_rat : inactive
  201IPI_zebrafish : inactive
  202MSIPI_human : inactive
  203MSIPI_mouse : inactive
  204NCBInr : active
  205SwissProt : active
  206Trembl : inactive
  207UniRef100 : inactive
  208Environmental_EST : inactive
  209Fungi_EST : inactive
  210Human_EST : inactive
  211Invertebrates_EST : inactive
  212Mammals_EST : inactive
  213Mus_EST : inactive
  214Plants_EST : inactive
  215Prokaryotes_EST : inactive
  216Rodents_EST : inactive
  217Unclassified_EST : inactive
  218Vertebrates_EST : inactive
  219 
  220There are 256 parse rules in the file; the following are specified:
  221Rule_1 : >owl[^ ]*|\([^ ]*\)
  222Rule_2 : >owl[^ ]*|[^ ]*[ ]\(.*\)
  223Rule_3 : >[A-Z][0-9];\([^ ]*\)
  224Rule_4 : >\([^ ]*\)
  225Rule_5 : >[^ ]* \(.*\)
  226Rule_6 : >\(gi|[0-9]*\)
  227Rule_7 : >[^ ]* \(.*\)
  228Rule_8 : \*\(.*\)>
  229Rule_9 : \*.*\(>[A-Z][0-9];.*\)
  230Rule_10 : \(LOCUS .*\)ORIGIN 
  231Rule_11 : \(LOCUS .*\)
  232Rule_12 : >\([^ ]*\)
  233Rule_13 : >[^ ]* \(.*\)
  234Rule_14 : <pre>\(.*\)</pre>
  235Rule_15 : ^ID   \([^ ]*\)
  236Rule_16 : \*.*\(ID   [A-Z0-9]*_[A-Z0-9]* .*\)
  237Rule_17 : >\([^ ]*\)
  238Rule_18 : >[^ ]* \(.*\)
  239Rule_19 : >[A-Z][0-9];\([^ ]*\)[ ]*
  240Rule_20 : >\(.*\)
  241Rule_21 : >IPI:\([^| .]*\)
  242Rule_22 : \*.*\(ID   IPI[0-9]* .*\)
  243Rule_23 : \(.*\)
  244Rule_24 : \*.*\(ID   [-A-Z0-9_].*\)
  245Rule_25 : >[^(]*.\([^)]*\)
  246Rule_26 : ^AC   \([^ ;]*\)
  247Rule_27 : \*.*\(AC   \S.*\)
  248Rule_28 : ^ID   \([^ .]*\)
  249Rule_29 : \*.*\(ID   IPI[0-9.]* .*\)
  250Rule_30 : >UniRef100_\([^ ]*\)
  251Rule_31 : >[^|]*|\([^ ]*\)
  252Rule_32 : >\([^|]*\)
  253Rule_33 : >..|[^|]*|\([^ ]*\)
  254Rule_34 : >..|\([^|]*\)
  255Rule_35 : >sp|\([^|]*\)
  256Rule_36 : >IPI:CON_\([^|]*\)
  257Rule_37 : >MSIPI:s*p*|*\([^| .]*\)
  258Rule_38 : >EM_EST:\([A-Z0-9]*\);
  259Rule_39 : >EM_ENV:\([A-Z0-9]*\);
  260 
  261There are 56 sequence report sources configured:
  262contaminants_SEQ
  263cRAP_SEQ
  264EST_human_REP
  265EST_human_SEQ
  266EST_mouse_REP
  267EST_mouse_SEQ
  268EST_others_REP
  269EST_others_SEQ
  270IPI_arabidopsis_REP
  271IPI_arabidopsis_SEQ
  272IPI_bovine_REP
  273IPI_bovine_SEQ
  274IPI_chicken_REP
  275IPI_chicken_SEQ
  276IPI_human_REP
  277IPI_human_SEQ
  278IPI_mouse_REP
  279IPI_mouse_SEQ
  280IPI_rat_REP
  281IPI_rat_SEQ
  282IPI_zebrafish_REP
  283IPI_zebrafish_SEQ
  284MSIPI_human_REP
  285MSIPI_human_SEQ
  286MSIPI_mouse_REP
  287MSIPI_mouse_SEQ
  288NCBInr_REP
  289NCBInr_SEQ
  290SwissProt_REP
  291SwissProt_SEQ
  292Trembl_REP
  293Trembl_SEQ
  294UniRef100_REP
  295UniRef100_SEQ
  296Environmental_EST_SEQ
  297Environmental_EST_REP
  298Fungi_EST_SEQ
  299Fungi_EST_REP
  300Human_EST_SEQ
  301Human_EST_REP
  302Invertebrates_EST_SEQ
  303Invertebrates_EST_REP
  304Mammals_EST_SEQ
  305Mammals_EST_REP
  306Mus_EST_SEQ
  307Mus_EST_REP
  308Plants_EST_SEQ
  309Plants_EST_REP
  310Prokaryotes_EST_SEQ
  311Prokaryotes_EST_REP
  312Rodents_EST_SEQ
  313Rodents_EST_REP
  314Unclassified_EST_SEQ
  315Unclassified_EST_REP
  316Vertebrates_EST_SEQ
  317Vertebrates_EST_REP
  318 
  319Available taxonomy sources:
  320TAXONOMY_1 Obsolete
  321TAXONOMY_2 OWL REF
  322TAXONOMY_3 SwissProt FASTA
  323TAXONOMY_4 Obsolete
  324TAXONOMY_5 Swiss-prot DAT
  325TAXONOMY_6 MSDB REF (pre 20000621)
  326TAXONOMY_7 MSDB REF
  327TAXONOMY_8 NCBI nr FASTA using GI2TAXID
  328TAXONOMY_9 dbEST FASTA using GI2TAXID
  329TAXONOMY_10 EST_human FASTA with TaxID
  330TAXONOMY_11 EST_mouse FASTA with TaxID
  331TAXONOMY_12 UniRef Fasta
  332TAXONOMY_13 EMBL EST Fasta
  333 
  334Cluster mode : disabled
  335 
  336Section 'Processor' is missing
  337 
  338MascotCmdLine : ../cgi/nph-mascot.exe
  339 
  340Cron functionality is disabled
  341 
  342"""
  343