From: kjvdheide Date: Wed, 20 Dec 2017 13:24:41 +0000 (+0000) Subject: JAL-281 split up TreeParser into separate format parsers X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5cf8629f8b4516dab71c3f563b299aae468b3fe0;p=jalview.git JAL-281 split up TreeParser into separate format parsers --- diff --git a/src/jalview/ext/archaeopteryx/JalviewBinding.java b/src/jalview/ext/archaeopteryx/JalviewBinding.java index 54b9225..2ba5a88 100644 --- a/src/jalview/ext/archaeopteryx/JalviewBinding.java +++ b/src/jalview/ext/archaeopteryx/JalviewBinding.java @@ -9,13 +9,13 @@ import jalview.datamodel.ColumnSelection; import jalview.datamodel.HiddenColumns; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; +import jalview.ext.treeviewer.LoadedTreeSequenceAssociation; import jalview.ext.treeviewer.TreeFrameI; import jalview.ext.treeviewer.TreeI; import jalview.ext.treeviewer.TreeNodeI; import jalview.ext.treeviewer.TreePanelI; import jalview.ext.treeviewer.TreeViewerBindingI; import jalview.ext.treeviewer.TreeViewerUtils; -import jalview.ext.treeviewer.LoadedTreeSequenceAssociation; import jalview.gui.AlignViewport; import jalview.gui.AlignmentPanel; import jalview.gui.Desktop; @@ -347,6 +347,10 @@ public final class JalviewBinding tree.getRoot()); } + else + { + // clear previous colours? + } } diff --git a/src/jalview/ext/archaeopteryx/TreeParser.java b/src/jalview/ext/forester/io/ForesterParser.java similarity index 76% rename from src/jalview/ext/archaeopteryx/TreeParser.java rename to src/jalview/ext/forester/io/ForesterParser.java index c16ea12..1167e13 100644 --- a/src/jalview/ext/archaeopteryx/TreeParser.java +++ b/src/jalview/ext/forester/io/ForesterParser.java @@ -1,5 +1,7 @@ -package jalview.ext.archaeopteryx; +package jalview.ext.forester.io; +import jalview.datamodel.SequenceI; +import jalview.ext.archaeopteryx.Tree; import jalview.ext.treeviewer.TreeI; import jalview.ext.treeviewer.TreeParserI; @@ -8,11 +10,13 @@ import java.io.IOException; import org.forester.io.parsers.PhylogenyParser; import org.forester.phylogeny.Phylogeny; -public class TreeParser implements TreeParserI +public class ForesterParser implements TreeParserI { private final PhylogenyParser parser; - public TreeParser(PhylogenyParser foresterParser) + private SequenceI[] seqs; + + public ForesterParser(PhylogenyParser foresterParser) { parser = foresterParser; } @@ -43,5 +47,4 @@ public class TreeParser implements TreeParserI { return parser.getName(); } - -} +} \ No newline at end of file diff --git a/src/jalview/ext/forester/io/ForesterReader.java b/src/jalview/ext/forester/io/ForesterReader.java new file mode 100644 index 0000000..625a151 --- /dev/null +++ b/src/jalview/ext/forester/io/ForesterReader.java @@ -0,0 +1,91 @@ +package jalview.ext.forester.io; + +import jalview.api.FeatureSettingsModelI; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SequenceI; +import jalview.io.AlignmentFileReaderI; +import jalview.io.DataSourceType; +import jalview.io.FileParse; + +public class ForesterReader implements AlignmentFileReaderI +{ + + public ForesterReader(FileParse source) + { + // if (source.getDataSourceType() == DataSourceType.URL) + // { + // ParserUtils.createParserDependingOnUrlContents(url, + // AptxInit.APTX_CONFIG.isValidatePhyloXmlAgainstSchema()); + // + // } + // else + // { + // ParserUtils.createParserDependingOnFileType(file, + // AptxInit.APTX_CONFIG.isValidatePhyloXmlAgainstSchema()); + // } + } + + @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; + } + +} diff --git a/src/jalview/ext/forester/io/NexusParser.java b/src/jalview/ext/forester/io/NexusParser.java index d48b033..f15c6f2 100644 --- a/src/jalview/ext/forester/io/NexusParser.java +++ b/src/jalview/ext/forester/io/NexusParser.java @@ -1,105 +1,87 @@ -package jalview.ext.forester.io; - -import jalview.api.FeatureSettingsModelI; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.SequenceI; -import jalview.ext.treeviewer.TreeI; -import jalview.ext.treeviewer.TreeParserI; -import jalview.io.AlignmentFileReaderI; -import jalview.io.DataSourceType; - -import java.io.IOException; - -public class NexusParser implements TreeParserI, AlignmentFileReaderI -{ - - - public NexusParser() - { - - } - - @Override - public TreeI[] parse() throws IOException - { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setSource(Object source) throws IOException - { - // TODO Auto-generated method stub - - } - - @Override - public String getName() - { - // TODO Auto-generated method stub - return null; - } - - @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; - } -} +// package jalview.ext.forester.io; +// +// import jalview.api.FeatureSettingsModelI; +// import jalview.datamodel.AlignmentI; +// import jalview.datamodel.SequenceI; +// import jalview.io.AlignmentFileReaderI; +// import jalview.io.DataSourceType; +// +// import org.forester.io.parsers.nexus.NexusPhylogeniesParser; +// +// public class NexusParser extends ForesterParser +// implements AlignmentFileReaderI +// { +// NexusPhylogeniesParser nxParser; +// +// public NexusParser() +// { +// nxParser = new NexusPhylogeniesParser(); +// +// } +// +// @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; +// } +// +// +// +// } \ No newline at end of file diff --git a/src/jalview/ext/forester/io/PhyloXMLParser.java b/src/jalview/ext/forester/io/PhyloXMLParser.java index 8194d21..e877d41 100644 --- a/src/jalview/ext/forester/io/PhyloXMLParser.java +++ b/src/jalview/ext/forester/io/PhyloXMLParser.java @@ -1,100 +1,86 @@ -package jalview.ext.forester.io; - -import jalview.api.FeatureSettingsModelI; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.SequenceI; -import jalview.ext.treeviewer.TreeI; -import jalview.ext.treeviewer.TreeParserI; -import jalview.io.AlignmentFileReaderI; -import jalview.io.DataSourceType; - -import java.io.IOException; - -public class PhyloXMLParser implements TreeParserI, AlignmentFileReaderI -{ - - @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 TreeI[] parse() throws IOException - { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setSource(Object source) throws IOException - { - // TODO Auto-generated method stub - - } - - @Override - public String getName() - { - // TODO Auto-generated method stub - return null; - } - -} +// package jalview.ext.forester.io; +// +// import jalview.api.FeatureSettingsModelI; +// import jalview.datamodel.AlignmentI; +// import jalview.datamodel.SequenceI; +// import jalview.io.AlignmentFileReaderI; +// import jalview.io.DataSourceType; +// +// import org.forester.io.parsers.PhylogenyParser; +// import org.forester.io.parsers.phyloxml.PhyloXmlParser; +// +// public class PhyloXMLParser extends ForesterParser +// implements AlignmentFileReaderI +// { +// PhyloXmlParser phxmlParser = PhyloXmlParser +// .createPhyloXmlParserXsdValidating(); +// +// public PhyloXMLParser(PhylogenyParser foresterParser) +// { +// super(foresterParser); +// } +// +// @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; +// } +// +// } \ No newline at end of file diff --git a/src/jalview/io/FileFormat.java b/src/jalview/io/FileFormat.java index 718370a..ef4a2be 100644 --- a/src/jalview/io/FileFormat.java +++ b/src/jalview/io/FileFormat.java @@ -22,6 +22,7 @@ package jalview.io; import jalview.datamodel.AlignmentI; import jalview.datamodel.PDBEntry; +import jalview.ext.forester.io.ForesterReader; import jalview.ext.jmol.JmolParser; import jalview.structure.StructureImportSettings; @@ -381,8 +382,7 @@ public enum FileFormat implements FileFormatI public AlignmentFileReaderI getReader(FileParse source) throws IOException { - // TODO Auto-generated method stub - return null; + return new ForesterReader(source); } @Override @@ -406,8 +406,7 @@ public enum FileFormat implements FileFormatI public AlignmentFileReaderI getReader(FileParse source) throws IOException { - // TODO Auto-generated method stub - return null; + return new ForesterReader(source); } @Override