[Biojava-l] Reading a newick format tree file generates an ArrayIndexOutOfBoundsException (TreeBlock, getTreeAsWeightedJGraphT)

JP jp at javaclass.co.uk
Mon Jun 22 15:05:31 UTC 2009


I have tried to use the getTreeAsWeightedJGraphT functionality in TreesBlock
as highlighted in the wikipedia page:

My code for completeness sake (a direct and lazy copy and paste)

String newickFileContents = FileUtils.readTextFile(treeFile, false);  //
> reads the text file without newlines
> WeightedGraph<String, DefaultWeightedEdge> jg = new
> SimpleWeightedGraph<String, DefaultWeightedEdge>(DefaultWeightedEdge.class);
> TreesBlock sample_tree = new TreesBlock();
> TreesBlock.NewickTreeString s = new TreesBlock.NewickTreeString();
> s.setTreeString(newickFileContents);
> sample_tree.addTree("test", s);
> jg = sample_tree.getTreeAsWeightedJGraphT("test");
> System.out.println(newickFileContents);
> System.out.println(jg.toString());
>

The data file is attached (newwick format), and this is the returned error
message...

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 79169
>     at
> org.biojavax.bio.phylo.io.nexus.TreesBlock.getTreeAsWeightedJGraphT(TreesBlock.java:562)
>     at
> edu.imperial.msc.multiglass.tree.TreeBuilder.<init>(TreeBuilder.java:50)
>     at
> edu.imperial.msc.multiglass.launcher.MultiGlassLauncher.main(MultiGlassLauncher.java:59)


Any idea why this is so ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gene_association.ecocyc-EColi.goa.P.nj.known.cmp
Type: application/octet-stream
Size: 79170 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biojava-l/attachments/20090622/25707e63/attachment-0002.obj>


More information about the Biojava-l mailing list