package jalview.ext.forester.io;
-import jalview.api.FeatureSettingsModelI;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SequenceI;
import jalview.ext.archaeopteryx.Tree;
import jalview.ext.treeviewer.TreeI;
import jalview.ext.treeviewer.TreeParserI;
-import jalview.io.AlignFile;
-import jalview.io.DataSourceType;
-import jalview.io.FileParse;
+import java.io.File;
import java.io.IOException;
import org.forester.io.parsers.PhylogenyParser;
import org.forester.io.parsers.nexus.NexusPhylogeniesParser;
import org.forester.io.parsers.phyloxml.PhyloXmlParser;
+import org.forester.io.parsers.util.PhylogenyParserException;
import org.forester.phylogeny.Phylogeny;
-public class ForesterParser extends AlignFile
+public class ForesterParser
implements TreeParserI
{
private final PhylogenyParser parser;
private TreeI[] parsedTrees;
- protected ForesterParser(PhylogenyParser foresterParser, FileParse source)
+ protected ForesterParser(PhylogenyParser foresterParser, File file)
+ throws PhylogenyParserException, IOException
{
parser = foresterParser;
+ parser.setSource(file);
}
- public static ForesterParser createNexusParser(FileParse source)
+ public static ForesterParser createNexusParser(File file)
+ throws PhylogenyParserException, IOException
{
- return new ForesterParser(new NexusPhylogeniesParser(), source);
+ return new ForesterParser(new NexusPhylogeniesParser(), file);
}
- public static ForesterParser createPhyloXmlParser(FileParse source)
+ public static ForesterParser createPhyloXmlParser(File file)
+ throws PhylogenyParserException, IOException
{
// support non-xsd validating?
return new ForesterParser(
- PhyloXmlParser.createPhyloXmlParserXsdValidating(), source);
+ PhyloXmlParser.createPhyloXmlParserXsdValidating(), file);
}
+ // ParserBasedPhylogenyFactory.getInstance().create(foresterParser, source)
@Override
- public void parse() throws IOException
+ public TreeI[] parse() throws IOException
{
Phylogeny[] foresterTrees = parser.parse();
parsedTrees = new TreeI[foresterTrees.length];
{
parsedTrees[i] = new Tree(foresterTrees[i]);
}
+ return parsedTrees;
}
return parser.getName();
}
- @Override
- public SequenceI[] getSeqsAsArray()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void addAnnotations(AlignmentI al)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void addGroups(AlignmentI al)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setSeqs(SequenceI[] sequencesArray)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean hasWarningMessage()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public String getWarningMessage()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getInFile()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public DataSourceType getDataSourceType()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public FeatureSettingsModelI getFeatureColourScheme()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
-
-
- @Override
- public String print(SequenceI[] seqs, boolean jvsuffix)
- {
- // TODO Auto-generated method stub
- return null;
- }
@Override
public TreeI[] getParsedTrees()