[Biojava-l] advice on ABIFParser

Russ Kepler russ at kepler-eng.com
Thu Oct 12 13:38:41 UTC 2006


On Thursday 12 October 2006 03:44 am, Ed Dicks wrote:

> now I've done "strings temp.ab1" to verify the tag "PDMF" is present.
> What's going on here is that ABIFParser reads the data item into a long
> variable (field dataRecord) but the PSTRING is length 21 which is too big
> for a long. I have succesfully pulled out strings that are length <= 8 but
> this one just seems too big, can anyone give me some advice on this.

The TaggedDataRecord is really a pointer when the data size is > 4 bytes, what 
you'll have to do is to loop like this:

  ABIFParser abiParse=new ABIFParser("temp.ab1");
  ABIFParser.DataAccess a1=abiParse.getDataAccess();
  ABIFParser.TaggedDataRecord r1=abiParse.getDataRecord("PDMF",1);
  System.err.println("r1 ok "+r1.toString());

  a1.seek(r1.dataRecord);
  int count = (int) r1.numberOfElements;
  StringBuffer sb = new StringBuffer(count);
  for (int i = 0; i < count; ) {
    sb.append(a1.readChar());
  }
  System.out.println("Dye mobility: "+sb.toString());

Really your basic seek & read loop.  Look in ABIFChromatogram.parseBaseCalls() 
for a fuller example, but this will get you started.  



More information about the Biojava-l mailing list