Proteome Informatics Group > Java Proteomic Library
 

Recipe 3.5. Exporting peak list charts

Problem

You need to export a graph image from MS peak list.

Solution

First, you have to create a renderer with possible settings

		
MSRenderer renderer = MSRenderer.newInstance();
renderer.setBarWidth(0.1);
renderer.setXAxisLegend("mass-to-charge");

then you add your MS peak lists

PeakList plTheo =
	new PeakListImpl.Builder(masses).annotations(annotations).build();
	
PeakList plExp =
	new PeakListImpl.Builder(masses).intensities(intensities).build();


renderer.addDataSet(plExp, "MS Data 1");
renderer.addDataSet(plTheo, "MS Data 2");

and render the graph

	renderer.exportChart("/tmp", "graph");

graph

Discussion

See Also