Example program for retrieving general search information.
using System;
using matrix_science.msparser;
namespace MsParserExamples
{
public class resfile_info
{
public static void Main(string[] argv)
{
if (argv.Length < 1)
{
Console.WriteLine("Must specify results filename as parameter");
return;
}
ms_mascotresfilebase file = ms_mascotresfilebase.createResfile(argv[0], 0, "");
if (file.isValid())
{
searchInformation(file);
}
else
{
Console.WriteLine("Error number: {0}", file.getLastError());
Console.WriteLine("Error string: {0}", file.getLastErrorString());
return;
}
}
private static void searchInformation(ms_mascotresfilebase file)
{
DateTime searchDate;
int seconds = file.getDate();
long milliseconds = (long) seconds * 1000;
searchDate = (new DateTime(1970, 1, 1)).AddMilliseconds(milliseconds);
Console.WriteLine("Search information from ms_mascotresfilebase");
Console.WriteLine("========================================");
Console.WriteLine("Number of queries : {0}", file.getNumQueries());
Console.WriteLine("Number of sequences : {0}", file.getNumSeqs());
Console.WriteLine("Sequences after tax : {0}", file.getNumSeqsAfterTax());
Console.WriteLine("Number of residues : {0}", (int) file.getNumResidues());
Console.WriteLine("Execution time : {0}", file.getExecTime());
Console.WriteLine("Date (seconds) : {0}", file.getDate());
Console.WriteLine("Date : {0}", searchDate.ToString("ddd MMM dd hh:mm:ss yyyy"));
Console.WriteLine("Mascot version : {0}", file.getMascotVer());
Console.WriteLine("Fasta version : {0}", file.getFastaVer());
Console.WriteLine("Is PMF? : {0}", toBinary(file.isPMF()));
Console.WriteLine("Is MSMS? : {0}", toBinary(file.isMSMS()));
Console.WriteLine("Is SQ? : {0}", toBinary(file.isSQ()));
Console.WriteLine("Is Error tolerant : {0}", toBinary(file.isErrorTolerant()));
Console.WriteLine("Any PMF? : {0}", toBinary(file.anyPMF()));
Console.WriteLine("Any MSMS? : {0}", toBinary(file.anyMSMS()));
Console.WriteLine("Any SQ? : {0}", toBinary(file.anySQ()));
Console.WriteLine("Any peptide matches : {0}", toBinary(file.anyFastaMatches()));
Console.WriteLine();
}
public static int toBinary(bool b)
{
return (b) ? 1 : 0;
}
}
}