X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignedCodonFrame.java;h=d1b12d3d96e2e9f4f5507d48ecc29e9c37c4a9cd;hb=ce93212014c116c4c516c6dc85c5032449d311eb;hp=9fa11ccd98c9cd4212a04970920ac23a574347a5;hpb=c9296c060f69f3eeab1f6da2a07dbdb87c946e52;p=jalview.git diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index 9fa11cc..d1b12d3 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -455,6 +455,20 @@ public class AlignedCodonFrame */ public SequenceI findAlignedSequence(SequenceI seq, AlignmentI al) { + return findAlignedSequence(seq, al, null); + } + /** + * Convenience method to return the first aligned sequence in the given + * alignment whose dataset has a mapping with the given (aligned or dataset) + * sequence, and optionally the mapping that relates them + * + * @param seq + * @param al + * @param map - list to add the mapping to + * @return sequence from al that maps to seq + */ + public SequenceI findAlignedSequence(SequenceI seq, AlignmentI al,List map) + { /* * Search mapped protein ('to') sequences first. */ @@ -464,9 +478,12 @@ public class AlignedCodonFrame { for (SequenceI sourceAligned : al.getSequences()) { - if (ssm.mapping.to == sourceAligned.getDatasetSequence() - || ssm.mapping.to == sourceAligned) + if (ssm.covers(sourceAligned,true)) { + if (map != null) + { + map.add(ssm); + } return sourceAligned; } } @@ -483,8 +500,12 @@ public class AlignedCodonFrame { for (SequenceI sourceAligned : al.getSequences()) { - if (ssm.fromSeq == sourceAligned.getDatasetSequence()) + if (ssm.covers(sourceAligned,true)) { + if (map != null) + { + map.add(ssm); + } return sourceAligned; } }