X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignedCodonFrame.java;h=1d34d41592f0aff9f3ba5f5ce22760f571b41224;hb=c19d2a91ca05e052e3408bf5852d88eb5d0608f1;hp=d0b2731fcc1eabcf752da6e2d55de24075196f0c;hpb=e29e164306d88242fe615973eeebc8c4a49d1bb0;p=jalview.git diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index d0b2731..1d34d41 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2) + * Copyright (C) 2015 The Jalview Authors * * This file is part of Jalview. * @@ -20,12 +20,12 @@ */ package jalview.datamodel; -import java.util.ArrayList; -import java.util.List; - import jalview.util.MapList; import jalview.util.MappingUtils; +import java.util.ArrayList; +import java.util.List; + /** * 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. @@ -33,12 +33,12 @@ import jalview.util.MappingUtils; public class AlignedCodonFrame { - /* + /** * tied array of na Sequence objects. */ private SequenceI[] dnaSeqs = null; - /* + /** * tied array of Mappings to protein sequence Objects and SequenceI[] * aaSeqs=null; MapLists where each maps from the corresponding dnaSeqs * element to corresponding aaSeqs element @@ -373,7 +373,8 @@ public class AlignedCodonFrame if (dnaSeqs[mi] == targetDs && dnaToProt[mi].to == sourceDs) { int[] codon = dnaToProt[mi].map.locateInFrom(pos, pos); - if (codon != null) { + if (codon != null) + { return codon; } } @@ -398,13 +399,13 @@ public class AlignedCodonFrame return null; } MapList ml = null; - char[] dnaSeq = null; + SequenceI dnaSeq = null; for (int i = 0; i < dnaToProt.length; i++) { if (dnaToProt[i].to == protein) { ml = getdnaToProt()[i]; - dnaSeq = dnaSeqs[i].getSequence(); + dnaSeq = dnaSeqs[i]; break; } } @@ -422,9 +423,10 @@ public class AlignedCodonFrame * Read off the mapped nucleotides (converting to position base 0) */ codonPos = MappingUtils.flattenRanges(codonPos); - return new char[] - { dnaSeq[codonPos[0] - 1], dnaSeq[codonPos[1] - 1], - dnaSeq[codonPos[2] - 1] }; + char[] dna = dnaSeq.getSequence(); + int start = dnaSeq.getStart(); + return new char[] { dna[codonPos[0] - start], dna[codonPos[1] - start], + dna[codonPos[2] - start] }; } /** @@ -444,7 +446,7 @@ public class AlignedCodonFrame List related = new ArrayList(); SequenceI seqDs = seq.getDatasetSequence(); seqDs = seqDs != null ? seqDs : seq; - + for (int ds = 0; ds < dnaSeqs.length; ds++) { final Mapping mapping = dnaToProt[ds];