Matrix Science header

resfile_info.pl

Example program for retrieving general search information.

#!/usr/local/bin/perl
##############################################################################
# file: resfile_info.pl                                                      #
# 'msparser' toolkit                                                         #
# Test harness / example code                                                #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1998-2010 Matrix Science Limited  All Rights Reserved.           #
#                                                                            #
##############################################################################
#     $Source: /vol/cvsroot/parser/examples/test_perl/resfile_info.pl,v $ #
#     $Author: villek $ #
#       $Date: 2010/08/31 08:48:07 $ #
#   $Revision: 1.4 $ #
# $NoKeywords::                                                            $ #
##############################################################################
use strict;
##############################################################################

use msparser;

if (!defined($ARGV[0])) { die "Must specify results filename as parameter"; }

my $file = new msparser::ms_mascotresfile($ARGV[0]);

if ($file->isValid) {
    searchInformation($file);
}


##############################################################################
#  searchInformation                                                         #
#  - parameter 0  ms_mascotresfile                                           #
#  Display parameters from the ms_mascotresfile object. The functions        #
#  anyPMF, anyMSMS, anySQ should normally be used in preference to isPMF etc #
#  because some people submit MSMS though the sequence query window etc.     #
##############################################################################
sub searchInformation {
    my ($resfile) = @_;

    my $fmt = "%-20s: %s\n";

    print "Search information from ms_mascotresfile", "\n";
    print "========================================", "\n";
    printf $fmt, "Number of queries"   , $resfile->getNumQueries();
    printf $fmt, "Number of hits"      , $resfile->getNumHits();
    printf $fmt, "Number of sequences" , $resfile->getNumSeqs();
    printf $fmt, "Sequences after tax" , $resfile->getNumSeqsAfterTax();
    printf $fmt, "Number of residues"  , $resfile->getNumResidues();
    printf $fmt, "Execution time"      , $resfile->getExecTime();
    printf $fmt, "Date (seconds)"      , $resfile->getDate();

    # Let's jump through a few hoops to get the equivalent of a 'C' asctime call
    my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) 
        = localtime($resfile->getDate);

    printf $fmt, "Date", sprintf("%s %s %d %02d:%02d:%02d %d", 
        (qw(Sun Mon Tue Wed Thu Fri Sat))[$wday],
        (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec))[$mon],  
        $mday, 
        $hour, 
        $min, 
        $sec, 
        $year+1900
    );

    printf $fmt, "Mascot version"       , $resfile->getMascotVer();
    printf $fmt, "Fasta version"        , $resfile->getFastaVer();
    printf $fmt, "Is PMF?"              , $resfile->isPMF();
    printf $fmt, "Is MSMS?"             , $resfile->isMSMS();
    printf $fmt, "Is SQ?"               , $resfile->isSQ();
    printf $fmt, "Is Error tolerant"    , $resfile->isErrorTolerant();
    printf $fmt, "Any PMF?"             , $resfile->anyPMF();
    printf $fmt, "Any MSMS?"            , $resfile->anyMSMS();
    printf $fmt, "Any SQ?"              , $resfile->anySQ();
    printf $fmt, "Any peptides section" , $resfile->doesSectionExist($msparser::ms_mascotresfile::SEC_PEPTIDES);
    printf $fmt, "Any peptide matches"  , $resfile->anyPeptideSummaryMatches();

    print "\n";
}


=pod

Running the program as 

perl -I../bin resfile_info.pl ../data/F981123.dat

will give the following output under Mascot Server 2.3


Search information from ms_mascotresfile
========================================
Number of queries   : 67
Number of hits      : 50
Number of sequences : 257964
Sequences after tax : 257964
Number of residues  : 93947433
Execution time      : 6
Date (seconds)      : 1171894187
Date                : Mon Feb 19 14:09:47 2007
Mascot version      : 2.1.119
Fasta version       : SwissProt_51.6.fasta
Is PMF?             : 
Is MSMS?            : 1
Is SQ?              : 
Is Error tolerant   : 
Any PMF?            : 
Any MSMS?           : 1
Any SQ?             : 
Any peptides section: 1
Any peptide matches : 1


=cut

Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50