this.alignmentScore = (score <= minScore) ? Float.NaN : score;
}
- public void clear()
+ public void setScoreMatrix(ScoreMatrix sm)
{
- score = null;
- alignmentScore = 0f;
- E = null;
- F = null;
- traceback = null; // todo is this actually used?
- seq1 = null;
- seq2 = null;
- s1 = null;
- s2 = null;
- s1str = null;
- s2str = null;
- maxi = 0;
- maxj = 0;
- aseq1 = null;
- aseq2 = null;
- astr1 = "";
- astr2 = "";
- indelfreeAstr1 = "";
- indelfreeAstr2 = "";
- seq1start = 0;
- seq1end = 0;
- seq2start = 0;
- seq2end = 0;
- count = 0;
- maxscore = 0f;
- meanScore = 0f; //needed for PaSiMap
- hypotheticMaxScore = 0; // needed for PaSiMap
- prev = 0;
- StringBuffer output = new StringBuffer();
- String type = null; // AlignSeq.PEP or AlignSeq.DNA
+ this.scoreMatrix = sm;
}
}
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.Point;
import jalview.datamodel.SequenceI;
*/
final private AlignmentViewport seqs;
- final private ScoreModelI scoreModel;
+ final private ScoreMatrix scoreMatrix;
final private byte dim = 8;
public PaSiMap(AlignmentViewport sequences, ScoreModelI sm, PairwiseAlignPanel pap)
{
this.seqs = sequences;
- this.scoreModel = sm;
+
+ //convert ScoreModel name into score matrix, use default if not Blosum or Pam
+ if (sm.getName().equals("BLOSUM62"))
+ {
+ this.scoreMatrix = ScoreModels.getInstance().getBlosum62();
+ } else if (sm.getName().equals("PAM250")) {
+ this.scoreMatrix = ScoreModels.getInstance().getPam250();
+ } else {
+ this.scoreMatrix = null;
+ }
+
this.alignment = pap;
}
public String getDetails()
{
StringBuilder sb = new StringBuilder(1024);
- sb.append("PaSiMap calculation using ").append(scoreModel.getName())
+ sb.append("PaSiMap calculation using ").append(scoreMatrix.getName())
.append(" sequence similarity matrix\n========\n\n");
PrintStream ps = wrapOutputBuffer(sb);
try
{
//alignment = new PairwiseAlignPanel(seqs, true, 100, 5);
- alignment.calculate();
+ alignment.calculate(scoreMatrix);
float[][] scores = alignment.getAlignmentScores(); //bigger index first -- eg scores[14][13]
SequenceI[] iseqs = alignment.getInputSequences();
Connectivity.getConnectivity(iseqs, scores, dim);
ScoreModels scoreModels = ScoreModels.getInstance();
for (ScoreModelI sm : scoreModels.getModels())
{
- if ((!nucleotide && sm.isProtein() || nucleotide && sm.isDNA()
+ if (!forPasimap && (!nucleotide && sm.isProtein() || nucleotide && sm.isDNA()
|| sm.isSecondaryStructure() && ssPresent))
{
filtered.add(sm);
}
}
+
+ /*
+ * make PaSiMap only use Blosum62 and Pam250
+ */
+ if (forPasimap && !nucleotide && !forPca)
+ {
+ filtered.add(scoreModels.getBlosum62());
+ filtered.add(scoreModels.getPam250());
+ }
/*
* special case: add BLOSUM62 as last option for nucleotide PCA,
package jalview.gui;
import jalview.analysis.AlignSeq;
+import jalview.analysis.scoremodels.ScoreMatrix;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.SequenceGroup;
public void calculate()
{
+ calculate(null);
+ }
+ public void calculate (ScoreMatrix sm)
+ {
StringBuilder sb = new StringBuilder(1024);
{
AlignSeq as = new AlignSeq(seqs[i], seqStrings[i], seqs[j],
seqStrings[j], type, GAP_OPEN_COST, GAP_EXTEND_COST);
+ if (sm != null)
+ as.setScoreMatrix(sm);
if (as.s1str.length() == 0 || as.s2str.length() == 0)
{