Read in the enzymes file.
#!/usr/local/bin/perl ############################################################################## # file: config_enzymes.pl # # 'msparser' toolkit example code # ############################################################################## # COPYRIGHT NOTICE # # Copyright 1998-2010 Matrix Science Limited All Rights Reserved. # # # ############################################################################## # $Source: parser/examples/test_perl/config_enzymes.pl $ # # $Author: villek@matrixscience.com $ # # $Date: 2018-07-30 16:23:53 +0100 $ # # $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ # # $NoKeywords:: $ # ############################################################################## use strict; ############################################################################## use msparser; if (!defined($ARGV[0])) { print <<EOF; The location of 'enzymes' file has to be specified as a parameter. The location should either be the full path to the 'enzymes' file or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi EOF exit 1; } # Note: $cs must not be lexically scoped; you need to keep it in scope # for as long as you use $file. See "Using the toolkit from Perl, Java and # Python" in Mascot Parser manual. my ($file, $cs); # A sessionID can optionally be passed as the second parameter. # This will only be required if the 'file' is a URL. if (defined($ARGV[1])) { $cs = new msparser::ms_connection_settings; $cs->setSessionID($ARGV[1]); $file = new msparser::ms_enzymefile($ARGV[0], $cs); } else { $file = new msparser::ms_enzymefile($ARGV[0]); } if (!$file->isValid) { print "There are errors. Cannot continue. The last error description:\n"; print $file->getLastErrorString(), "\n"; exit 1; } my $n = $file->getNumberOfEnzymes(); print "There are ", $n, " enzyme definitions available\n"; for my $i (0 .. $n-1) { my $enzyme = $file->getEnzymeByNumber($i); print $enzyme->getTitle(), ": "; for my $c (0 .. $enzyme->getNumberOfCutters - 1) { if ($enzyme->getCutterType($c) == $msparser::ms_enzyme::NTERM_CUTTER) { print "nTerm - "; } else { print "cTerm - "; } print $enzyme->getCleave($c), "!", $enzyme->getRestrict($c); print "; "; } print "\n"; } # Now try updating the first one in the list to semi-specific. my $enzyme = $file->getEnzymeByNumber(0); $enzyme->setSemiSpecific(1); $file->updateEnzymeByNumber(0, $enzyme); # And delete V8-DE. $file->deleteEnzymeByName("V8-DE"); # Finally, save the file under a new name. $file->setFileName($ARGV[0] . ".new"); $file->save_file; if (!$file->isValid) { print "Failed to save: ", $file->getLastErrorString, "\n"; } else { print $ARGV[0], ".new now has ", $file->getNumberOfEnzymes, " enzyme definitions available\n"; } =pod Running the program as perl -I../bin config_enzymes.pl ../config/enzymes will give the following output under Mascot Server 2.3: There are 21 enzyme definitions available Trypsin: cTerm - KR!P; Trypsin/P: cTerm - KR!; Arg-C: cTerm - R!P; Asp-N: nTerm - BD!; Asp-N_ambic: nTerm - DE!; Chymotrypsin: cTerm - FLWY!P; CNBr: cTerm - M!; CNBr+Trypsin: cTerm - M!; cTerm - KR!P; Formic_acid: nTerm - D!; cTerm - D!; Lys-C: cTerm - K!P; Lys-C/P: cTerm - K!; LysC+AspN: nTerm - BD!; cTerm - K!P; Lys-N: nTerm - K!; PepsinA: cTerm - FL!; semiTrypsin: cTerm - KR!P; TrypChymo: cTerm - FKLRWY!P; TrypsinMSIPI: nTerm - J!; cTerm - KR!P; cTerm - J!; TrypsinMSIPI/P: nTerm - J!; cTerm - JKR!; V8-DE: cTerm - BDEZ!P; V8-E: cTerm - EZ!P; None: cTerm - KR!P; ../config/enzymes.new now has 20 enzyme definitions available =cut
Copyright © 2022 Matrix Science Ltd. All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29 |