package jalview.workers;
+import java.util.ConcurrentModificationException;
import java.util.Hashtable;
import jalview.analysis.AAFrequency;
return alignViewport.getComplementConsensusHash();
}
+ /**
+ * Calculate the cDNA consensus and store it on the Viewport
+ */
@Override
protected void computeConsensus(AlignmentI alignment)
{
Hashtable[] hconsensus = new Hashtable[alignment.getWidth()];
SequenceI[] aseqs = getSequences();
- AAFrequency.calculateCdna(alignment, hconsensus);
+
+ /*
+ * Allow 3 tries at this, since this thread can start up while we are still
+ * modifying protein-codon mappings on the alignment
+ */
+ for (int i = 0; i < 3; i++)
+ {
+ try
+ {
+ AAFrequency.calculateCdna(alignment, hconsensus);
+ break;
+ } catch (ConcurrentModificationException e)
+ {
+ // try again
+ }
+ }
alignViewport.setComplementConsensusHash(hconsensus);
}