import jalview.ext.archaeopteryx.Tree;
import jalview.ext.treeviewer.TreeI;
import jalview.ext.treeviewer.TreeParserI;
-import jalview.io.AlignmentFileReaderI;
+import jalview.io.AlignFile;
import jalview.io.DataSourceType;
import jalview.io.FileParse;
import org.forester.io.parsers.phyloxml.PhyloXmlParser;
import org.forester.phylogeny.Phylogeny;
-public class ForesterParser implements TreeParserI, AlignmentFileReaderI
+public class ForesterParser extends AlignFile
+ implements TreeParserI
{
private final PhylogenyParser parser;
+ private TreeI[] parsedTrees;
+
protected ForesterParser(PhylogenyParser foresterParser, FileParse source)
{
parser = foresterParser;
}
+ public static ForesterParser createNexusParser(FileParse source)
+ {
+ return new ForesterParser(new NexusPhylogeniesParser(), source);
+ }
+
+ public static ForesterParser createPhyloXmlParser(FileParse source)
+ {
+ // support non-xsd validating?
+ return new ForesterParser(
+ PhyloXmlParser.createPhyloXmlParserXsdValidating(), source);
+ }
+
@Override
- public TreeI[] parse() throws IOException
+ public void parse() throws IOException
{
Phylogeny[] foresterTrees = parser.parse();
- TreeI[] jalviewTrees = new TreeI[foresterTrees.length];
+ parsedTrees = new TreeI[foresterTrees.length];
for (int i = 0; i < foresterTrees.length; i++)
{
- jalviewTrees[i] = new Tree(foresterTrees[i]);
+ parsedTrees[i] = new Tree(foresterTrees[i]);
}
- return jalviewTrees;
}
return null;
}
- public static ForesterParser createNexusParser(FileParse source)
+
+
+ @Override
+ public String print(SequenceI[] seqs, boolean jvsuffix)
{
- return new ForesterParser(new NexusPhylogeniesParser(), source);
+ // TODO Auto-generated method stub
+ return null;
}
- public static ForesterParser createPhyloXmlParser(FileParse source)
+ @Override
+ public TreeI[] getParsedTrees()
{
- // support non-xsd validating?
- return new ForesterParser(
- PhyloXmlParser.createPhyloXmlParserXsdValidating(), source);
+ return parsedTrees;
}
}
\ No newline at end of file