X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FAlignedCodonFrame.java;h=aca523eaf7a3b51ad4885729f819fa7f8b7a33bf;hb=refs%2Fheads%2Fbug%2FJAL-3700_mapSequenceSelection;hp=7fa8b293e5a4f4ba4f0df0782491ea7bf9714a3a;hpb=cbb46d5c5784c69b3237a97e90bad5dc952b51ac;p=jalview.git diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index 7fa8b29..aca523e 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -20,13 +20,13 @@ */ package jalview.datamodel; -import jalview.util.MapList; -import jalview.util.MappingUtils; - import java.util.AbstractList; import java.util.ArrayList; import java.util.List; +import jalview.util.MapList; +import jalview.util.MappingUtils; + /** * Stores mapping between the columns of a protein alignment and a DNA alignment * and a list of individual codon to amino acid mappings between sequences. @@ -134,7 +134,7 @@ public class AlignedCodonFrame } /* - * check that each mapped range lieS with the sequence range + * check that each mapped range lies within the sequence range * (necessary for circular CDS - example EMBL:J03321:AAA91567) * and mapped length covers (at least) sequence length */ @@ -311,8 +311,8 @@ public class AlignedCodonFrame /** * Return the corresponding aligned or dataset dna sequence for given amino - * acid sequence, or null if not found. returns the sequence from - * the first mapping found that involves the protein sequence. + * acid sequence, or null if not found. returns the sequence from the first + * mapping found that involves the protein sequence. * * @param aaSeqRef * @return @@ -819,7 +819,7 @@ public class AlignedCodonFrame * Two AlignedCodonFrame objects are equal if they hold the same ordered list * of mappings * - * @see SequenceToSequenceMapping# + * @see SequenceToSequenceMapping#equals */ @Override public boolean equals(Object obj) @@ -836,12 +836,20 @@ public class AlignedCodonFrame return mappings; } - public SequenceToSequenceMapping getCoveringMapping(SequenceI cds, - SequenceI peptide) + /** + * Returns the first mapping found which is between the two given sequences, + * and covers the full extent of both. + * + * @param seq1 + * @param seq2 + * @return + */ + public SequenceToSequenceMapping getCoveringMapping(SequenceI seq1, + SequenceI seq2) { for (SequenceToSequenceMapping mapping : mappings) { - if (mapping.covers(peptide) && mapping.covers(cds)) + if (mapping.covers(seq2) && mapping.covers(seq1)) { return mapping; }