1 package jalview.ext.forester;
3 import jalview.datamodel.SequenceI;
4 import jalview.math.MatrixI;
6 import org.forester.evoinference.matrix.distance.DistanceMatrix;
7 import org.forester.io.parsers.phyloxml.PhyloXmlDataFormatException;
9 public final class ForesterConversions
11 public static org.forester.phylogeny.data.Sequence createForesterSequence(
12 final SequenceI jalviewSequence, final boolean sequenceIsAligned)
14 org.forester.phylogeny.data.Sequence foresterSeq = new org.forester.phylogeny.data.Sequence();
16 if (jalviewSequence.getDescription() != null)
18 foresterSeq.setName(jalviewSequence.getDescription());
20 foresterSeq.setMolecularSequenceAligned(sequenceIsAligned); // all tree
24 foresterSeq.setMolecularSequence(jalviewSequence.getSequenceAsString());
25 if (jalviewSequence.isProtein()) // add checks for DNA or RNA (infer from
30 foresterSeq.setType("protein");
31 } catch (final PhyloXmlDataFormatException ignore)
43 // public static org.forester.phylogeny.data.Accession
44 // createForesterAccession(
45 // SequenceI jalviewSequence)
49 // org.forester.phylogeny.data.Accession foresterAcs = new
50 // org.forester.phylogeny.data.Accession();
52 // return foresterAcs;
55 public static DistanceMatrix createForesterDistanceMatrix(
56 final MatrixI jalviewInputMatrix,
57 final String[] matrixIdentifiers)
59 if (jalviewInputMatrix.width() != jalviewInputMatrix.height())
61 // some kind of warning?
64 DistanceMatrix foresterMatrix = new ForesterMatrix(jalviewInputMatrix,
66 return foresterMatrix;
70 public static DistanceMatrix createForesterDistanceMatrix(
71 final MatrixI jalviewInputMatrix,
72 final SequenceI[] matrixSequences)
74 if (jalviewInputMatrix.width() != jalviewInputMatrix.height())
76 // some kind of warning?
78 DistanceMatrix foresterMatrix = new ForesterMatrix(jalviewInputMatrix,
80 return foresterMatrix;