1 package jalview.workers;
3 import jalview.analysis.AAFrequency;
4 import jalview.api.AlignViewportI;
5 import jalview.api.AlignmentViewPanel;
6 import jalview.datamodel.AlignmentAnnotation;
7 import jalview.datamodel.AlignmentI;
8 import jalview.datamodel.SequenceI;
10 import java.util.Hashtable;
13 * A thread to recompute the consensus of the cDNA complement for a linked
19 public class ComplementConsensusThread extends ConsensusThread
22 public ComplementConsensusThread(AlignViewportI alignViewport,
23 AlignmentViewPanel alignPanel)
25 super(alignViewport, alignPanel);
29 protected AlignmentAnnotation getConsensusAnnotation()
31 return alignViewport.getComplementConsensusAnnotation();
35 protected Hashtable[] getViewportConsensus()
37 return alignViewport.getComplementConsensusHash();
41 protected void computeConsensus(AlignmentI alignment)
43 Hashtable[] hconsensus = new Hashtable[alignment.getWidth()];
45 SequenceI[] aseqs = getSequences();
46 AAFrequency.calculateCdna(alignment, hconsensus);
48 alignViewport.setComplementConsensusHash(hconsensus);
52 * Convert the computed consensus data into the desired annotation for
55 * @param consensusAnnotation
56 * the annotation to be populated
57 * @param consensusData
58 * the computed consensus data
61 protected void deriveConsensus(AlignmentAnnotation consensusAnnotation,
62 Hashtable[] consensusData)
64 AAFrequency.completeCdnaConsensus(consensusAnnotation, consensusData,
65 alignViewport.isShowSequenceLogo(), getSequences().length);