* @param type
* molecule type, either AlignSeq.PEP or AlignSeq.DNA
*/
+ public AlignSeq(int opencost, int extcost)
+ {
+ GAP_OPEN_COST = opencost;
+ GAP_EXTEND_COST = extcost;
+ }
public AlignSeq(SequenceI s1, SequenceI s2, String type)
{
seqInit(s1, s1.getSequenceAsString(), s2, s2.getSequenceAsString(),
float minScore = 0f;
this.alignmentScore = (score <= minScore) ? Float.NaN : score;
}
+
+ public void clear()
+ {
+ 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
+ }
}
import jalview.gui.PaSiMapPanel;
import jalview.math.Matrix;
import jalview.math.MatrixI;
+import jalview.math.MiscMath;
import jalview.viewmodel.AlignmentViewport;
-
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Hashtable;
final private byte dim = 3;
+ final private int openCost = 100;
+
+ final private int extendCost = 5;
+
+ /*
+ * other
+ */
+ private long total; // total number of combinations
+
+ private long count; // current iteration number
+
/*
* outputs
*/
this.seqs = sequences;
this.scoreModel = sm;
this.similarityParams = options;
+ int nseqs = seqs.getAlignment().getHeight();
+ this.total = (long) MiscMath.permutations(nseqs, 2) / 2; // n!/(n-r)!
+ this.count = 0l;
}
/**
System.out.println(see.getName());
}
+/*
int nSeqs = seqs.getAlignment().getHeight();
float[][] scores = new float[nSeqs][nSeqs]; // rows, cols
int nSplits = 1;
- while (((float) nSeqs / nSplits) > 300f) // heap full at 341
+ while (((float) nSeqs / nSplits) > 20f) // heap full at 341
//while (((float) nSeqs / nSplits) > 5f) // heap full at 341
nSplits++;
int splitSeqs = (int) Math.ceil((float) nSeqs / nSplits);
}
pairwiseScores = new Matrix(scores);
pairwiseScores.print(System.out, "%1.4f ");
+*/
-/*
alignment = new PairwiseAlignPanel(seqs, true, 100, 5);
float[][] scores = alignment.getAlignmentScores(); //bigger index first -- eg scores[14][13]
pairwiseScores = new Matrix(scores);
pairwiseScores.print(System.out, "%1.4f ");
-*/
pairwiseScores.fillDiagonal();
eigenMatrix = pairwiseScores.copy();
// align each subsplit with subsplits from other split groups
for (int subsplitN = 0; subsplitN < newGroups.length; subsplitN++)
{
+System.gc();
int c = 1; // current subsplit block
while (newGroups[subsplitN][0] > smallS * c)
{
//PairwiseAlignPanel pap = new PairwiseAlignPanel(seqs, true, 100, 5);
//float[][] scores = pap.getAlignmentScores(); //bigger index first -- eg scores[14][13]
float[][] scores = simulateAlignment(sgArray);
+System.gc();
for (int s1 = 0; s1 < scores.length; s1++) // row
{
for (int s2 = 0; s2 < s1; s2++) // col
seqStrings[0] = seqs[i].getSequenceAsString();
seqStrings[1] = seqs[j].getSequenceAsString();
- AlignSeq as = new AlignSeq(seqs[i], seqStrings[0], seqs[j], seqStrings[1], AlignSeq.PEP);
+ AlignSeq as = new AlignSeq(seqs[i], seqStrings[0], seqs[j], seqStrings[1], AlignSeq.PEP, openCost, extendCost);
+ as.seqInit(seqs[i], seqStrings[0], seqs[j], seqStrings[1], AlignSeq.PEP);
as.calcScoreMatrix();
as.traceAlignmentWithEndGaps();
as.scoreAlignment();
- as.printAlignment(System.out);
+ //as.printAlignment(System.out);
result[i][j] = as.getAlignmentScore();
+ //as.clear();
+
+System.out.println(String.format("%d / %d (%3.2f)", count, total, (float) ((count / total) * 100)));
+ count++;
}
}
return result;
import jalview.jbgui.GPairwiseAlignPanel;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
+import jalview.math.MiscMath;
import java.awt.event.ActionEvent;
import java.util.Vector;
private int GAP_EXTEND_COST;
+ //&!
+ private long total = 0l;
+ private long ccount = 0l;
+
AlignmentViewport av;
Vector<SequenceI> sequences;
int count = seqs.length;
boolean first = true;
//AlignSeq as = new AlignSeq(seqs[1], seqStrings[1], seqs[0], seqStrings[0], type, gapOpenCost, gapExtendCost);
+//&!
+this.total = (long) MiscMath.permutations(count,2) / 2;
for (int i = 1; i < count; i++)
{
seqStrings[j], type, gapOpenCost, gapExtendCost);
// as.seqInit(seqs[i], seqStrings[i], seqs[j], seqStrings[j], type);
+System.out.println(String.format("%d / %d", ccount, total));
+this.ccount++;
if (as.s1str.length() == 0 || as.s2str.length() == 0)
{
continue;
if (!first)
{
- System.out.println(DASHES);
+ //System.out.println(DASHES);
textarea.append(DASHES);
sb.append(DASHES);
}
first = false;
- as.printAlignment(System.out);
+ //as.printAlignment(System.out);
scores[i][j] = as.getMaxScore() / as.getASeq1().length;
-System.out.println(String.format("%s x %s -> [%d][%d] (%f)", seqs[i].getName(), seqs[j].getName(), i, j, as.getAlignmentScore()));
+//System.out.println(String.format("%s x %s -> [%d][%d] (%f)", seqs[i].getName(), seqs[j].getName(), i, j, as.getAlignmentScore()));
alignmentScores[i][j] = as.getAlignmentScore();
totscore = totscore + scores[i][j];