[Biojava-l] About ABITrace class

Andy Yates ayates at ebi.ac.uk
Mon Jan 7 14:36:26 UTC 2008

Hi David,

Not to worry it's quite confusing at first. ChromatogramGraphic.Option 
is a pre Java 1.5 enum (where a restricted vocab is specified by class 
type rather than accepting plain Strings or ints which can be abused). 
Your code should look something like:

Chromatogram c = getChromatogram();
Alignment baseCalls = c.getBaseCalls();
//Of course you've got to check if you've got an alignment, base pairs
//and that these values are going to make sense when rendering (nothing
//beats attempting to render a chromatogram from & to the same position)
int start = getIndex(0, baseCalls);
int end = getIndex(baseCalls.length);

ChromatogramGraphic cg = new ChromatogramGraphic(c);
cg.setOption(ChromatogramGraphic.Option.FROM_TRACE_SAMPLE, start);
cg.setOption(ChromatogramGraphic.Option.TO_TRACE_SAMPLE, end);

private int getIndex(int pos, Alignment baseCalls) {
	Symbol sym = baseCalls.symbolAt(Chromatogram.OFFSETS, pos);
	return ((IntegerAlphabet.IntegerSymbol)sym).intValue();

It's been a long time since I've used this library in anger (and to be 
honest I wrote a wrapper around it for my particular usage) but 
hopefully it should give you a point in the right direction (also the 
above code is in Java 5 so that will probably have an impact on it 
working for you).

Hope that helps


David Bourgais wrote:
> Hello Andy
> Thank you very much for your answer.
> But, even if I have a ABIFChromatogram object and a ChromatogramGraphic 
> object, I do not understand what you said about setting options. I see a 
> class Chromatogramgraphic.Option, but I do not know what can I do with this.
> Thank you very much for your help.
> Best regards.
>> Yup Russ is on the ball with that one 100% :)
>> A chromatogram is really a graph of 4 tracks where each scan index  
>> refers to an intensity of the 4 dyes used in Sanger Sequencing. There  
>> is no direct relation to the size of a chromatogram and the number of  
>> base pairs it will represent. If you require any changes to the  
>> rendering the options are controlled by ChromatogramGraphic.Option  
>> instances in conjunction with the setOption() method in  
>> ChromatogramGraphic.
>> If you are rendering a processed ABI file and just want to see the  
>> base called sequences then the best option is to use the  
>> Chromatogram's getBaseCalls() method & look up the start & finish of  
>> the base calls. Use this to set where you want rendering to start &  
>> stop (again another ChromatogramGraphic.Option).
>> Hope this helps,
>> Andy
> -- 
> David Bourgais
> Bioinformatician
> BioXpr SA/NV
> http://www.bioxpr.com
> Rue du Seminaire, 22
> 5000, Namur, Belgium
> Phone: +32(0)81 72 51 58

More information about the Biojava-l mailing list