X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FMappingUtils.java;h=f2213adcdcffa65363e887cf4b6cad441f17a4ec;hb=2fc1013d3c126983a8d7d932671168e11cfab63d;hp=4aed258bf50b20b178be47d12c0c13e1e784109e;hpb=ed2283c5f54da377a2a2fdbdb7aec75ed7041714;p=jalview.git diff --git a/src/jalview/util/MappingUtils.java b/src/jalview/util/MappingUtils.java index 4aed258..f2213ad 100644 --- a/src/jalview/util/MappingUtils.java +++ b/src/jalview/util/MappingUtils.java @@ -413,18 +413,18 @@ public final class MappingUtils SequenceI[] sortOrder = command.getSequenceOrder(undo); List mappedOrder = new ArrayList(); int j = 0; + + /* + * Assumption: we are only interested in a cDNA/protein mapping; refactor in + * future if we want to support sorting (c)dna as (c)dna or protein as + * protein + */ + boolean mappingToNucleotide = mapTo.isNucleotide(); for (SequenceI seq : sortOrder) { for (AlignedCodonFrame acf : mappings) { - /* - * Try protein-to-Dna, failing that try dna-to-protein - */ - SequenceI mappedSeq = acf.getDnaForAaSeq(seq); - if (mappedSeq == null) - { - mappedSeq = acf.getAaForDnaSeq(seq); - } + SequenceI mappedSeq = mappingToNucleotide ? acf.getDnaForAaSeq(seq) : acf.getAaForDnaSeq(seq); if (mappedSeq != null) { for (SequenceI seq2 : mapTo.getSequences()) @@ -494,6 +494,12 @@ public final class MappingUtils Set codonFrames = protein.getAlignment() .getCodonFrames(); ColumnSelection mappedColumns = new ColumnSelection(); + + if (colsel == null) + { + return mappedColumns; + } + char fromGapChar = mapFrom.getAlignment().getGapCharacter(); // FIXME allow for hidden columns