X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FAlignedCodonFrame.java;h=6d6cdb55194f818ce6c16d2e2b3079eb21c179af;hb=refs%2Fheads%2Ffeatures%2FJAL-2068groovyAnnotationWorker;hp=a56f1d4a5573ca446d65306f76dff38feed19ce7;hpb=6ed535f7ef953468f8827255ec6ebcd5a6e54d8d;p=jalview.git diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index a56f1d4..6d6cdb5 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -649,4 +649,29 @@ public class AlignedCodonFrame { return mappings == null ? "null" : mappings.toString(); } + + /** + * Returns the first mapping found that is from 'fromSeq' to 'toSeq', or null + * if none found + * + * @param fromSeq + * aligned or dataset sequence + * @param toSeq + * aligned or dataset sequence + * @return + */ + public Mapping getMappingBetween(SequenceI fromSeq, SequenceI toSeq) + { + for (SequenceToSequenceMapping mapping : mappings) + { + SequenceI from = mapping.fromSeq; + SequenceI to = mapping.mapping.to; + if ((from == fromSeq || from == fromSeq.getDatasetSequence()) + && (to == toSeq || to == toSeq.getDatasetSequence())) + { + return mapping.mapping; + } + } + return null; + } }