[Biojava-l] nexus file parser

Richard Holland dicknetherlands at gmail.com
Thu Jul 17 11:21:45 UTC 2008


Hello. If you pass an instance of NexusFileBuilder to the
NexusFileFormat parse methods, it will construct a NexusFile instance
in memory which you can get by calling getNexusFile() after parsing
has finished.

You can then iterate over the blocks of the NexusFile by using the
blockIterator() method. Each block returned is a class that implements
the NexusObject interface. You can find out which type of block it is
using instanceof, and thus find the DataBlock instance. You can then
cast to DataBlock (which extends CharactersBlock) and use the methods
from that to explore the alignment.

cheers,
Richard

2008/7/17 Anisah Ghoorah <anisahghoorah at hotmail.com>:
>
>
>
> Hi,
>
> I would like to parse a nexus file and get the alignment
> from the DATA block.  I'm not sure how the NexusFileListener works.  Is
> there any code available that illustrates how to parse a nexus file.
>
> Many thanks,
> Anisah
> _________________________________________________________________
> The John Lewis Clearance - save up to 50% with FREE delivery
> http://clk.atdmt.com/UKM/go/101719806/direct/01/
> _______________________________________________
> 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