Example program for retrieving search parameter data.
import java.util.Date;
import matrix_science.msparser.*;
public class resfile_params {
static {
try {
System.loadLibrary("msparserj");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. "
+ "Is msparserj.dll on the path?\n" + e);
System.exit(0);
}
}
public static void main(String argv[])
{
if(argv.length < 1) {
System.out.println("Must specify results filename as parameter");
System.exit(0);
}
ms_mascotresfilebase file = ms_mascotresfilebase.createResfile(argv[0], 0, "");
if (file.isValid()) {
searchParameters(file);
} else {
System.out.println("Error number: "+file.getLastError());
System.out.println("Error string: "+file.getLastErrorString());
System.exit(0);
}
}
private static void searchParameters(ms_mascotresfilebase file) {
int i;
char ch;
ms_searchparams p = file.params();
System.out.println("Search parameters from ms_searchparams");
System.out.println("=========================================");
System.out.println("License : "+p.getLICENSE());
System.out.println("Search title : "+p.getCOM());
System.out.println("SEG mass : "+p.getSEG());
System.out.println("Peptide tol : "+p.getTOL());
System.out.println("Peptide tol units : "+p.getTOLU());
System.out.println("Fragment tol : "+p.getITOL());
System.out.println("Fragment tol units : "+p.getITOLU());
System.out.println("Missed cleavages : "+p.getPFA());
System.out.println("Database : "+p.getDB());
System.out.println("Static mods : "+p.getMODS());
System.out.println("Average/monoisotopic: "+p.getMASS());
System.out.println("Enzyme : "+p.getCLE());
System.out.println("Raw data file name : "+p.getFILENAME());
System.out.println("Input data : "+p.getQUE());
System.out.println("Type of search : "+p.getSEARCH());
System.out.println("User name : "+p.getUSERNAME());
System.out.println("User email : "+p.getUSEREMAIL());
System.out.println("Charge state : "+p.getCHARGE());
System.out.println("Repeat search file : "+p.getINTERMEDIATE());
System.out.println("Num hits to display : "+p.getREPORT());
System.out.println("Show overview : "+toBinary(p.getOVERVIEW()));
System.out.println("Data file format : "+p.getFORMAT());
System.out.println("Form version : "+p.getFORMVER());
System.out.println("Variable mods : "+p.getIT_MODS());
for(i=0; i <=12; i++) {
String output = "User";
if(i < 10) output += "0";
output += i+" : "+p.getUSERField(i);
System.out.println(output);
}
System.out.println("Precursor mass : "+roundWholeNumber(p.getPRECURSOR()));
System.out.println("Taxonomy filter : "+p.getTAXONOMY());
System.out.println("Type of report : "+p.getREPTYPE());
System.out.println("Accessions to search: "+p.getACCESSION());
System.out.println("Subcluster used : "+p.getSUBCLUSTER());
System.out.println("ICAT search? : "+toBinary(p.getICAT()));
System.out.println("Instrument type : "+p.getINSTRUMENT());
System.out.println("Error tolerant? : "+toBinary(p.getERRORTOLERANT()));
System.out.println("Rules (ions series) : "+p.getRULES());
System.out.println("Quantitation method : "+p.getQUANTITATION());
System.out.println("Peptide isotope err : "+p.getPEP_ISOTOPE_ERROR());
System.out.println("Decoy database : "+p.getDECOY());
for(ch='A'; ch <= 'Z'; ch++) {
System.out.println("Residue "+ch+" : "+roundWholeNumber(p.getResidueMass(ch)));
}
System.out.println("C terminus mass : "+roundWholeNumber(p.getCTermMass()));
System.out.println("N terminus mass : "+roundWholeNumber(p.getNTermMass()));
System.out.println("Mass of hydrogen : "+roundWholeNumber(p.getHydrogenMass()));
System.out.println("Mass of oxygen : "+roundWholeNumber(p.getOxygenMass()));
System.out.println("Mass of carbon : "+roundWholeNumber(p.getCarbonMass()));
System.out.println("Mass of nitrogen : "+roundWholeNumber(p.getNitrogenMass()));
System.out.println("Mass of electron : "+roundWholeNumber(p.getElectronMass()));
i=1;
while(!(p.getVarModsName(i).equals(""))) {
System.out.println("Variable mod name : "+p.getVarModsName(i));
System.out.println("Variable mod delta : "+roundWholeNumber(p.getVarModsDelta(i)));
System.out.println("Variable mod neutral: "+roundWholeNumber(p.getVarModsNeutralLoss(i)));
i++;
}
System.out.println("\n");
}
private static int toBinary(boolean bool) {
if(bool) return 1;
return 0;
}
private static String roundWholeNumber (double toRound) {
String myInt = ""+toRound;
myInt += "\n";
if(myInt.indexOf(".0\n")>-1) {
return myInt.substring(0,myInt.indexOf(".0\n"));
}
return ""+toRound;
}
}