[Biojava-l] Reading AB1 files and drawing chromatogram ?
Andy Yates
ayates at ebi.ac.uk
Fri Jan 30 12:57:40 UTC 2009
Hi Umanga,
Fortunately BioJava has an API for drawing chromatograms located under
org.biojava.bio.chromatogram & org.biojava.bio.chromatogram.graphic. To
parse in a AB1 file you can run the following code:
import java.io.*;
import org.biojava.bio.program.abi.ABIFChromatogram;
import org.biojava.bio.chromatogram.*;
import org.biojava.bio.chromatogram.graphic.*;
File file = new File("chr.ab1");
Chromatogram c = ABIFChromatogram.parse(file);
ChromatogramGraphic cg = new ChromatogramGraphic(c);
//Can't remember how to get this so you'll have to find out
Graphics2D context = getContextFromSomewhere();
cg.drawTo(cg);
You can configure the size of the image through the ChromatogramGraphic
object & alter a number of ChromatogramGraphic.Option attributes through
ChromatogramGraphic.setOption(ChromatogramGraphic.Option opt, Object value).
This should be enough to get you going. I will warn you that this class
is quite memory intensive & an application I wrote ages ago had very big
memory problems because of it (the drawing component not the file
parsing). An alternative library is available from
http://code.google.com/p/bioview2/ (which was developed by an old
colleague).
Try the biojava code first and if that serves your purpose then great;
if not then try bioview2.
Regards,
Andy Yates
P.S. The AB1 parser only supports the processed data channels in the AB1
file. If you want the raw data from it then you will have to modify the
source or use another library (probably the C library StadenIO) to
convert the raw data into an SCF file.
Ashika Umanga Umangiliya wrote:
> Greetings all,
>
> In the application I develop ,I want to draw chromatogram from AB1. I come
> from computer science background have little knowledge this subject.Where
> can I find information on this?
> Can I draw the graph using data in AB1 file? Or is there any function ?
>
>
> thanks in advance,
>
> Umanga
> _______________________________________________
> Biojava-l mailing list - Biojava-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-l
More information about the Biojava-l
mailing list