cm = new ColorModelGray ();
continue;
}
if (args[i].equals ("--log"))
{
scaler = new ScalerLog ();
continue;
}
if (args[i].equals ("--sqrt"))
{
scaler = new ScalerSQRT ();
continue;
}
if (args[i].equals ("--noscale"))
{
scaler = new ScalerNone ();
continue;
}
if (args[i].equals ("--legend"))
{
legend = true;
continue;
}
err.add ("Don't understand " + args[i]);
}
// checks
if (infile == null)
{
err.add ("please specify an file to read from");
}
else if (!new File (infile).canRead ())
{
err.add ("can't read " + infile);
}
else
{
String ext = infile.substring (infile.lastIndexOf(".") + 1);
if (ext.equals ("mzxml"))
mapper = new Map2DMZXML (new MSXMLParser (infile, true));
else if (ext.equals ("pl"))
mapper = new Map2DPL (new MountainList (new File (infile)));
else
err.add ("Don't know file format");
}
if (outfile == null)
{
err.add ("please specify an file to write to");
}
else if (new File (outfile).exists ())
{
err.add (outfile + " exists, we stop here to prevent loss of data...");
}
if (width < 200 || height < 200)
{
err.add ("Map has to be at least 200 x 200 pixels");
}
if (startMz < 0 || endMz <= startMz)
{
err.add ("endMz has to be bigger than startMz, both positive");
}
if (startTime < 0 || endTime <= startTime)
{
err.add ("endTime has to be bigger than startTime, both positive");
}
if (err.size () > 0 || help)
{
if (err.size () > 0)
{
System.err.println ("Following errors occoured:");
for (int i = 0; i < err.size (); i++)
System.err.println ("\t-> " + err.elementAt (i));
System.err.println ();
}
System.out.println ("Arguments:");
System.out.println ("I/O:");
System.out.println ("\t--in\t\tfile to read");
System.out.println ("\t--out\t\there we'll store the pic, only png supported yet");
System.out.println ("Threshs:");
System.out.println ("\t--stime\t\tstart retention time in secs - defaults to 0");
System.out.println ("\t--etime\t\tend retention time in secs - defaults to 3600");
System.out.println ("\t--smz\t\tmin mz - defaults to 0");
System.out.println ("\t--emz\t\tmax mz - defaults to 1000");
System.out.println ("Map settings:");
System.out.println ("\t--motley\tcolorize the map - default");
System.out.println ("\t--gray\t\tgray image map");
System.out.println ("\t--legend\tadd a legend");
System.out.println ("Scale settings:");
System.out.println ("\t--log\t\tscale intensities with nat. log - default");
System.out.println ("\t--sqrt\t\tscale intensities by sqare root");
System.out.println ("\t--noscale\tdon't scale intensities");
System.out.println ("help:");
System.out.println ("\t--help\t\tprint this help message");
System.exit (1);
}
if (cm == null)
cm = new ColorModelMotley ();
if (scaler == null)
scaler = new ScalerLog ();
if (legend)
mapper.addLegend (null, null, null);
bi = mapper.createMap (width, height, startTime, endTime, startMz, endMz, scaler, cm, null);