boolean gatherViewsHere = false;
-
- public AlignViewport(AlignmentI al, boolean dataset)
- {
- isDataset = dataset;
- setAlignment(al);
- init();
- }
/**
* Creates a new AlignViewport object.
*
autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
- padGaps = Cache.getDefault("PAD_GAPS", false);
+ padGaps = Cache.getDefault("PAD_GAPS", true);
String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "") ;
setFont(new Font(fontName, style, Integer.parseInt(fontSize)));
-
alignment.setGapCharacter( Cache.getDefault("GAP_SYMBOL", "-").charAt(0) );
{
alignment.addAnnotation(consensus);
}
-
}
if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null)
cons.findQuality();
}
-
String sequence = cons.getConsSequence().getSequence();
float minR;
float minG;
}
- ConservationThread conservationThread;
+ static ConservationThread conservationThread;
- ConsensusThread consensusThread;
+ static ConsensusThread consensusThread;
boolean consUpdateNeeded = false;
/**
* DOCUMENT ME!
*/
- public void updateConservation(AlignmentPanel ap)
+ public void updateConservation(final AlignmentPanel ap)
{
- if (alignment.isNucleotide())
+ if (alignment.isNucleotide() || conservation==null)
return;
updatingConservation = true;
-
- if (conservationThread == null || !conservationThread.isAlive())
- {
- conservationThread = new ConservationThread(ap);
- conservationThread.start();
- }
- else
- {
- consUpdateNeeded = true;
- System.out.println("come back later");
- }
+ // javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() {
+ while (conservationThread != null && conservationThread.isAlive())
+ {
+ try
+ {
+ // Thread.sleep(100);
+ ap.repaint();
+ }
+ catch (Exception ex)
+ {}
+ }
+ conservationThread = new ConservationThread(ap);
+ conservationThread.start();
+ // } });
}
/**
* DOCUMENT ME!
*/
- public void updateConsensus(AlignmentPanel ap)
+ public void updateConsensus(final AlignmentPanel ap)
{
updatingConsensus = true;
- if (consensusThread == null || !consensusThread.isAlive())
- {
- consensusThread = new ConsensusThread(ap);
- consensusThread.start();
- }
- else
- {
- consUpdateNeeded = true;
- System.out.println("come back later");
- }
+ // javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() {
+ while (consensusThread != null && consensusThread.isAlive())
+ {
+ try
+ {
+ // Thread.sleep(100);
+ ap.repaint();
+ }
+ catch (Exception ex)
+ {}
+ }
+ consensusThread = new ConsensusThread(ap);
+ consensusThread.start();
+ // } });
}
return sequenceSetID;
}
+ public void alignmentChanged(AlignmentPanel ap)
+ {
+ if (padGaps)
+ alignment.padGaps();
+
+ if (hconsensus != null && autoCalculateConsensus)
+ {
+ updateConsensus(ap);
+ updateConservation(ap);
+ }
+
+ resetAllColourSchemes();
+
+ alignment.adjustSequenceAnnotations();
+ }
+
+
+ void resetAllColourSchemes()
+ {
+ ColourSchemeI cs = globalColourScheme;
+ if(cs!=null)
+ {
+ if (cs instanceof ClustalxColourScheme)
+ {
+ ( (ClustalxColourScheme) cs).
+ resetClustalX(alignment.getSequences(),
+ alignment.getWidth());
+ }
+
+ cs.setConsensus(hconsensus);
+ if (cs.conservationApplied())
+ {
+ Alignment al = (Alignment) alignment;
+ Conservation c = new Conservation("All",
+ ResidueProperties.propHash, 3,
+ al.getSequences(), 0,
+ al.getWidth() - 1);
+ c.calculate();
+ c.verdict(false, ConsPercGaps);
+
+ cs.setConservation(c);
+ }
+ }
+
+ int s, sSize = alignment.getGroups().size();
+ for(s=0; s<sSize; s++)
+ {
+ SequenceGroup sg = (SequenceGroup)alignment.getGroups().elementAt(s);
+ if(sg.cs!=null && sg.cs instanceof ClustalxColourScheme)
+ {
+ ((ClustalxColourScheme)sg.cs).resetClustalX(
+ sg.getSequences(true), sg.getWidth());
+ }
+ sg.recalcConservation();
+ }
+ }
+
+
+
}