X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignedCodonFrame.java;h=a9875b47dc7855527fc8bd4998ba54128d30a3ab;hb=bf7c5d6a690420087d2925c018bb01595c9ccb89;hp=d59078bb5cf50ea90338e69ae21a52fc23464d46;hpb=96a5726c430b26ed83fc8ee3be0c7ea871519fa1;p=jalview.git diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index d59078b..a9875b4 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -170,6 +170,10 @@ public class AlignedCodonFrame int[] codon = null; SequenceI mappedSeq = null; SequenceI ds = seq.getDatasetSequence(); + if (ds == null) + { + ds = seq; + } if (this.fromSeq == seq || this.fromSeq == ds) { @@ -379,7 +383,8 @@ public class AlignedCodonFrame /** * Add search results for regions in other sequences that translate or are - * translated from a particular position in seq + * translated from a particular position in seq (which may be an aligned or + * dataset sequence) * * @param seq * @param index @@ -391,44 +396,14 @@ public class AlignedCodonFrame SearchResultsI results) { SequenceI ds = seq.getDatasetSequence(); - for (SequenceToSequenceMapping ssm : mappings) + if (ds == null) { - ssm.markMappedRegion(ds, index, results); + ds = seq; } - } - - /** - * Returns the DNA codon positions (base 1) for the given position (base 1) in - * a mapped protein sequence, or null if no mapping is found. - * - * Intended for use in aligning cDNA to match aligned protein. Only the first - * mapping found is returned, so not suitable for use if multiple protein - * sequences are mapped to the same cDNA (but aligning cDNA as protein is - * ill-defined for this case anyway). - * - * @param seq - * the DNA dataset sequence - * @param aaPos - * residue position (base 1) in a protein sequence - * @return - */ - public int[] getDnaPosition(SequenceI seq, int aaPos) - { - /* - * Adapted from markMappedRegion(). - */ - MapList ml = null; - int i = 0; for (SequenceToSequenceMapping ssm : mappings) { - if (ssm.fromSeq == seq) - { - ml = getdnaToProt()[i]; - break; - } - i++; + ssm.markMappedRegion(ds, index, results); } - return ml == null ? null : ml.locateInFrom(aaPos, aaPos); } /**