Read in the enzymes file.
import java.util.Date;
import matrix_science.msparser.*;
public class config_enzymes {
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("The location of enzymes file has to be specified as a parameter");
System.out.println("The location should either be the full path to the enzymes file");
System.out.println("or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi");
System.exit(0);
}
ms_enzymefile file;
if (argv.length > 1)
{
ms_connection_settings cs = new ms_connection_settings();
cs.setSessionID(argv[1]);
file = new ms_enzymefile(argv[0], cs);
}
else
{
file = new ms_enzymefile(argv[0]);
}
if (!file.isValid())
{
System.out.println("Error number: "+file.getLastError());
System.out.println("Error string: "+file.getLastErrorString());
System.exit(0);
}
int n = file.getNumberOfEnzymes();
System.out.println("There are " + n + " enzymes definitions available");
for (int i=0; i < n ; i++)
{
ms_enzyme enzyme = file.getEnzymeByNumber(i);
System.out.print(enzyme.getTitle() + ": ");
for (int c=0; c < enzyme.getNumberOfCutters(); c++)
{
if (enzyme.getCutterType(c) == ms_enzyme.NTERM_CUTTER)
{
System.out.print("nTerm - ");
}
else
{
System.out.print("cTerm - ");
}
System.out.print(enzyme.getCleave(c) + "!");
System.out.print(enzyme.getRestrict(c));
System.out.print("; ");
}
System.out.println("");
}
ms_enzyme enzyme = file.getEnzymeByNumber(0);
enzyme.setSemiSpecific(true);
file.updateEnzymeByNumber(0, enzyme);
file.deleteEnzymeByName("V8-DE");
file.setFileName(argv[0] + ".new");
file.save_file();
System.out.println("There are now " + file.getNumberOfEnzymes() + " enzymes definitions available");
}
}