Read in the modifications file - modfile.
#!/usr/local/bin/perl ############################################################################## # file: config_modfile.pl # # 'msparser' toolkit example code # ############################################################################## # COPYRIGHT NOTICE # # Copyright 1998-2010 Matrix Science Limited All Rights Reserved. # # # ############################################################################## # $Source: parser/examples/test_perl/config_modfile.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 mod_file has to be specified as a parameter. The location should either be the full path to the mod_file or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi EOF exit 1; } # We need an ms_masses object. In practice, it has to be read from a file but # for simplicity, we will use default masses. my $massesFile = new msparser::ms_masses; # Note: $cs and $massesFile must not be lexically scoped; you need to keep them # 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_modfile($ARGV[0], $massesFile, 0, $cs); } else { $file = new msparser::ms_modfile($ARGV[0], $massesFile, 0); } if (!$file->isValid) { print "There are errors. Cannot continue. The last error description:\n"; print $file->getLastErrorString(), "\n"; exit 1; } my $n = $file->getNumberOfModifications(); print "There are ", $n, " modifications configured:\n"; for my $i (0 .. $n-1) { print $file->getModificationByNumber($i)->getTitle(), "\n"; } # Now change Acetyl (K). my $mod = $file->getModificationByName("Acetyl (K)"); $mod->setHidden(1); $file->updateModificationByName("Acetyl (K)", $mod); # And delete Methyl (R). $file->deleteModificationByName("Methyl (R)"); # 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->getNumberOfModifications(), " modifications configured\n"; } =pod Running the program as perl -I../bin config_modfile.pl ../config/mod_file will give the following output under Mascot Server 2.3: There are 886 modifications configured: 15dB-biotin (C) 2-succinyl (C) 2HPG (R) 3-deoxyglucosone (R) 3sulfo (N-term) 4-ONE (C) 4-ONE (H) 4-ONE (K) 4-ONE+Delta:H(-2)O(-1) (C) 4-ONE+Delta:H(-2)O(-1) (H) 4-ONE+Delta:H(-2)O(-1) (K) 4AcAllylGal (C) a-type-ion (C-term) AccQTag (K) AccQTag (N-term) Acetyl (C) [ ... ] Xlink:B10621 (C) Xlink:DMP (K) Xlink:DMP (Protein N-term) Xlink:DMP-s (K) Xlink:DMP-s (Protein N-term) Xlink:novobiocin (N-term) Xlink:SSD (K) ZGB (K) ZGB (N-term) ../config/mod_file.new now has 885 modifications configured =cut
Copyright © 2022 Matrix Science Ltd. All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29 |