X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2FAlignmentViewport.java;h=ab9740c69eb94a2eba3f32937c4a1c4e7f9c5edb;hb=a6b324e3f5edac3df0b968f0037b1cc8b651598e;hp=c4ae76d1060f9c88418600834fbefb0eeeff86b7;hpb=5b079109d33a4596a8c3017dbf93b7de5b0300c5;p=jalview.git diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index c4ae76d..ab9740c 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -65,7 +65,6 @@ import java.util.HashMap; import java.util.Hashtable; import java.util.List; import java.util.Map; -import java.util.Set; /** * base class holding visualization and analysis attributes and common logic for @@ -837,15 +836,26 @@ public abstract class AlignmentViewport implements AlignViewportI, /* * A separate thread to compute cDNA consensus for a protein alignment + * which has mapping to cDNA */ final AlignmentI al = this.getAlignment(); if (!al.isNucleotide() && al.getCodonFrames() != null && !al.getCodonFrames().isEmpty()) { - if (calculator - .getRegisteredWorkersOfClass(ComplementConsensusThread.class) == null) + /* + * fudge - check first mapping is protein-to-nucleotide + * (we don't want to do this for protein-to-protein) + */ + AlignedCodonFrame mapping = al.getCodonFrames().iterator().next(); + // TODO hold mapping type e.g. dna-to-protein in AlignedCodonFrame? + if (mapping.getdnaToProt()[0].getFromRatio() == 3) { - calculator.registerWorker(new ComplementConsensusThread(this, ap)); + if (calculator + .getRegisteredWorkersOfClass(ComplementConsensusThread.class) == null) + { + calculator + .registerWorker(new ComplementConsensusThread(this, ap)); + } } } } @@ -1424,7 +1434,7 @@ public abstract class AlignmentViewport implements AlignViewportI, if (hiddenRepSequences == null) { - hiddenRepSequences = new Hashtable(); + hiddenRepSequences = new Hashtable(); } hiddenRepSequences.put(repSequence, sg); @@ -1769,14 +1779,20 @@ public abstract class AlignmentViewport implements AlignViewportI, { if (!alignment.isNucleotide()) { - final Set codonMappings = alignment + final List codonMappings = alignment .getCodonFrames(); if (codonMappings != null && !codonMappings.isEmpty()) { - complementConsensus = new AlignmentAnnotation("cDNA Consensus", - "PID for cDNA", new Annotation[1], 0f, 100f, - AlignmentAnnotation.BAR_GRAPH); - initConsensus(complementConsensus); + // fudge: check mappings are not protein-to-protein + // TODO: nicer + AlignedCodonFrame mapping = codonMappings.iterator().next(); + if (mapping.getdnaToProt()[0].getFromRatio() == 3) + { + complementConsensus = new AlignmentAnnotation("cDNA Consensus", + "PID for cDNA", new Annotation[1], 0f, 100f, + AlignmentAnnotation.BAR_GRAPH); + initConsensus(complementConsensus); + } } } } @@ -2569,7 +2585,7 @@ public abstract class AlignmentViewport implements AlignViewportI, { return 0; } - final Set mappings = proteinAlignment + final List mappings = proteinAlignment .getCodonFrames(); /*