try
{
// alignment = new PairwiseAlignPanel(seqs, true, 100, 5);
- alignment.calculate(scoreMatrix);
- if (alignment.isCancelled())
+ float[][] scores;
+ SequenceI[] iseqs;
+ if (!dontRealign && scoreModel instanceof ScoreMatrix)
+ {
+ alignment.calculate((ScoreMatrix)scoreModel);
++ if (alignment.isCancelled())
++ {
++ cancel();
++ return;
++ }
+ iseqs = alignment.getInputSequences();
+ scores = alignment.getAlignmentScores(); // bigger index first -- eg
+ // scores[14][13]
+ }
+ else
{
- cancel();
- return;
+ AlignmentView alignview = seqs.getAlignmentView(true);
+ iseqs = alignview.getEditedSequences(seqs.getGapCharacter(), false);
+ ScoreModelI sm = scoreModel;
+ if (sm== null)
+ {
+ sm = ScoreModels.getInstance().getDefaultModel(!seqs.isNucleotide());
+ }
+ MatrixI similarities = sm.findSimilarities(alignview,
+ SimilarityParams.Jalview);
+ scores = new float[similarities.height()][similarities.width()];
+ for (int i = 0; i < scores.length; i++)
+ {
+ double[] row = similarities.getRow(i);
+ for (int j = 0; j < scores[i].length; j++)
+ {
+ scores[i][j] = (float) row[j];
+ }
++ if (alignment.isCancelled())
++ {
++ cancel();
++ return;
++ }
+ }
}
- float[][] scores = alignment.getAlignmentScores(); // bigger index first
- // -- eg scores[14][13]
- SequenceI[] iseqs = alignment.getInputSequences();
+
Connectivity.getConnectivity(iseqs, scores, dim);
pairwiseScores = new Matrix(scores);
private boolean working;
+ private boolean useObservedAlignment;
+
+ private String newPasimapTitle;
+
/**
* Constructor given sequence data, a similarity (or distance) score model
* name, and score calculation parameters
ScoreModelI scoreModel = ScoreModels.getInstance()
.getScoreModel(modelName, ap);
- setPasimapModel(new PaSiMapModel(av, seqs, nucleotide, scoreModel));
+ setPasimapModel(
+ new PaSiMapModel(av, seqs, nucleotide, useObservedAlignment, scoreModel));
+
+ newPasimapTitle = alignPanel.alignFrame.formCalculationTitle(
+ MessageManager.formatMessage("label.calc_title", "PaSiMap",
- scoreModel.getName()),
++ scoreModel.getName()+(useObservedAlignment ? " (from alignment)":"")),
+ selected, ap.alignFrame.getTitle());
+
PaintRefresher.Register(this, av.getSequenceSetId());
setRotatableCanvas(new RotatableCanvas(alignPanel));
System.out.println(pap != null);
setPairwiseAlignPanel(pap);
- getPasimapModel().setUseObservedAlignment(useObservedAlignment);
- getPasimapModel().calculate(pap);
+
- xCombobox.setSelectedIndex(0);
- yCombobox.setSelectedIndex(1);
- zCombobox.setSelectedIndex(2);
++ getPasimapModel().setUseObservedAlignment(useObservedAlignment);
+
- getPasimapModel().updateRc(getRotatableCanvas());
- // rc.invalidate();
- setTop(getPasimapModel().getTop());
+ progressBar.registerHandler(progId, new IProgressIndicatorHandler()
+ {
+
+ @Override
+ public boolean cancelActivity(long id)
+ {
+ getPasimapModel().cancel();
+ return true;
+ }
+
+ @Override
+ public boolean canCancel()
+ {
+ return true;
+ }
+ });
+ getPasimapModel().calculate(pap);
+ if (!getPasimapModel().isCancelled())
+ {
+ // TODO: fix outputAlignment so it uses the compact form if no text report is available
+ outputAlignment.setVisible(!pap.isDiscardAlignments() && !pap.isQuiet());
+ xCombobox.setSelectedIndex(0);
+ yCombobox.setSelectedIndex(1);
+ zCombobox.setSelectedIndex(2);
+
+ getPasimapModel().updateRc(getRotatableCanvas());
+ // rc.invalidate();
+ setTop(getPasimapModel().getTop());
+ }
} catch (OutOfMemoryError er)
{
new OOMWarning("calculating PaSiMap", er);
public void calculate(PairwiseAlignPanel pap)
{
pasimap = new PaSiMap(inputData, scoreModel, pap);
+ pasimap.setDontRealign(dontRealign);
pasimap.run(); // executes in same thread, wait for completion
+ if (pasimap.isCancelled())
+ {
+ // no more work to do
+ return;
+ }
// Now find the component coordinates
int ii = 0;
pasimap = data;
}
+ public void setUseObservedAlignment(boolean useObservedAlignment)
+ {
+ dontRealign = useObservedAlignment;
+ }
++
+ public boolean isCancelled()
+ {
+ if (pasimap==null || pasimap.isCancelled())
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public void cancel()
+ {
+ pasimap.cancel();
+ }
}