Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
config_fragrules.pl

Read in the fragmentation_rules file.

#!/usr/local/bin/perl
##############################################################################
# file: config_fragrules.pl #
# 'msparser' toolkit example code #
##############################################################################
# COPYRIGHT NOTICE #
# Copyright 1998-2010 Matrix Science Limited All Rights Reserved. #
# #
##############################################################################
# $Source: parser/examples/test_perl/config_fragrules.pl $ #
# $Author: villek@matrixscience.com $ #
# $Date: 2018-07-30 16:23:53 +0100 $ #
# $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
# $NoKeywords:: $ #
##############################################################################
use strict;
##############################################################################
use msparser;
if (!defined($ARGV[0])) {
print <<EOF;
The location of 'fragmentation_rules' file has to be specified as a parameter.
The location should either be the full path to the 'fragmentation_rules' 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_fragrulesfile($ARGV[0], $cs);
} else {
$file = new msparser::ms_fragrulesfile($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->getNumberOfInstruments;
print $n, " instruments are configured:\n";
for my $i (0 .. $n-1) {
print $file->getInstrumentName($i), "\n";
}
# Now change ESI-QUAD-TOF.
my $instrument = $file->getInstrumentByName("ESI-QUAD-TOF");
$instrument->setSeriesUsed(23, 1); # Add v series
$file->updateInstrumentByName("ESI-QUAD-TOF", $instrument);
# And delete MALDI-QIT-TOF
$file->deleteInstrumentByName("MALDI-QIT-TOF");
# 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->getNumberOfInstruments(), " instruments configured.\n";
}
my $firstSeries = msparser::ms_fragmentationrules::getFirstSeries();
my $lastSeries = msparser::ms_fragmentationrules::getLastSeries();
print "First series: ", $firstSeries, "\n";
print "Last series : ", $lastSeries , "\n";
for my $i ($firstSeries .. $lastSeries) {
print "--------- $i ---------\n";
print msparser::ms_fragmentationrules::getSeriesName($i), "\n";
print msparser::ms_fragmentationrules::getSeriesDescription ($i), "\n";
}
=pod
Running the program as
perl -I../bin config_fragfules.pl ../config/fragmentation_rules
will give the following output under Mascot Server 2.3:
14 instruments are configured:
Default
ESI-QUAD-TOF
MALDI-TOF-PSD
ESI-TRAP
ESI-QUAD
ESI-FTICR
MALDI-TOF-TOF
ESI-4SECTOR
FTMS-ECD
ETD-TRAP
MALDI-QUAD-TOF
MALDI-QIT-TOF
MALDI-ISD
CID+ETD
../config/fragmentation_rules.new now has 13 instruments configured
First series: 4
Last series : 25
--------- 4 ---------
immonium
immonium
--------- 5 ---------
a
a series
--------- 6 ---------
a*
a - NH3 if a significant and fragment includes RKNQ
--------- 7 ---------
a0
a - H2O if a significant and fragment includes STED
--------- 8 ---------
b
b series
--------- 9 ---------
b*
b - NH3 if b significant and fragment includes RKNQ
--------- 10 ---------
b0
b - H2O if b significant and fragment includes STED
--------- 11 ---------
c
c series
--------- 12 ---------
x
x series
--------- 13 ---------
y
y series
--------- 14 ---------
y*
y - NH3 if y significant and fragment includes RKNQ
--------- 15 ---------
y0
y - H2O if y significant and fragment includes STED
--------- 16 ---------
z
z series
--------- 17 ---------
yb
internal yb < 700 Da
--------- 18 ---------
ya
internal ya < 700 Da
--------- 19 ---------
y must be significant
y or y++ must be significant
--------- 20 ---------
y must be highest score
y or y++ must be highest scoring series
--------- 21 ---------
z+1
z+1 series
--------- 22 ---------
d
d and d' series
--------- 23 ---------
v
v series
--------- 24 ---------
w
w and w' series
--------- 25 ---------
z+2
z+2 series
=cut