*/
package jalview.analysis;
+import jalview.analysis.scoremodels.ScoreModels;
+import jalview.analysis.scoremodels.SimilarityParams;
import jalview.api.analysis.ScoreModelI;
import jalview.api.analysis.SimilarityParamsI;
+ import jalview.analysis.scoremodels.ScoreMatrix;
-import jalview.analysis.scoremodels.ScoreModels;
import jalview.bin.Console;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
import jalview.datamodel.Point;
import jalview.datamodel.SequenceI;
import jalview.datamodel.SequenceGroup;
try
{
// alignment = new PairwiseAlignPanel(seqs, true, 100, 5);
- alignment.calculate(scoreMatrix);
- float[][] scores = alignment.getAlignmentScores(); // bigger index first
- // -- eg scores[14][13]
- SequenceI[] iseqs = alignment.getInputSequences();
+ float[][] scores;
+ SequenceI[] iseqs;
- if (!dontRealign)
++ if (!dontRealign && scoreModel instanceof ScoreMatrix)
+ {
- alignment.calculate();
++ alignment.calculate((ScoreMatrix)scoreModel);
+ iseqs = alignment.getInputSequences();
+ scores = alignment.getAlignmentScores(); // bigger index first -- eg
+ // scores[14][13]
+ }
+ else
+ {
+ 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];
+ }
+ }
+ }
+
Connectivity.getConnectivity(iseqs, scores, dim);
pairwiseScores = new Matrix(scores);
paramsPanel.add(matchGaps);
paramsPanel.add(includeGappedColumns);
paramsPanel.add(shorterSequence);
-
+
/*
+ * pasimap parameters
+ */
+ reuseAlignment = new JCheckBox("Use aligned similarity");
+ reuseAlignment.setSelected(false);
+ reuseAlignment.setVisible(false);
+ scoreModelPanel.add(reuseAlignment);
+
+
+ /*
* OK / Cancel buttons
*/
calculate = new JButton(MessageManager.getString("action.calculate"));
MIN_TREE_SELECTION);
boolean checkAverageDistance = checkEnabled(averageDistance, size,
MIN_TREE_SELECTION);
+ boolean checkPairwise = checkEnabled(pairwise, size,
+ MIN_PAIRWISE_SELECTION);
+ reuseAlignment.setVisible(checkPasimap);
- if (checkPca || checkPasimap || checkNeighbourJoining || checkAverageDistance)
+ if (checkPca || checkPasimap || checkPca || checkNeighbourJoining
+ || checkAverageDistance || checkPairwise)
{
calculate.setToolTipText(null);
calculate.setEnabled(true);
{
selGroup = new SequenceGroup(av.getAlignment().getSequences());
selGroup.setStartRes(0);
- selGroup.setEndRes(av.getAlignment().getWidth()-1);
+ selGroup.setEndRes(av.getAlignment().getWidth() - 1);
}
-
- if (selGroup.getSize()>MAX_PASIMAP_SEQ)
+
+ if (selGroup.getSize() > MAX_PASIMAP_SEQ)
{
- int start = selGroup.getStartRes(),end=selGroup.getEndRes();
- selGroup = new SequenceGroup(selGroup.getSequences().subList(0, MAX_PASIMAP_SEQ));
- selGroup.setStartRes(start);
- selGroup.setEndRes(end);
- Console.warn("Truncated input sequences for PASIMAP analysis to "+MAX_PASIMAP_SEQ);
+ int start = selGroup.getStartRes(), end = selGroup.getEndRes();
+ selGroup = new SequenceGroup(
+ selGroup.getSequences().subList(0, MAX_PASIMAP_SEQ));
+ selGroup.setStartRes(start);
+ selGroup.setEndRes(end);
+ Console.warn("Truncated input sequences for PASIMAP analysis to "
+ + MAX_PASIMAP_SEQ);
}
-
+
PairwiseAlignPanel pap = new PairwiseAlignPanel(av, selGroup, true,
- GAP_OPEN_COST, GAP_EXTEND_COST, false);
+ GAP_OPEN_COST, GAP_EXTEND_COST, false, null);
+ pap.setDiscardAlignments(true);
+ pap.setQuiet(true);
+
System.out.println(pap != null);
setPairwiseAlignPanel(pap);
+ getPasimapModel().setUseObservedAlignment(useObservedAlignment);
getPasimapModel().calculate(pap);
xCombobox.setSelectedIndex(0);