private static final String DASHES = "---------------------\n";
+ private float[][] scores;
+
+ private float[][] alignmentScores; // scores used by PaSiMap
+
+ private int GAP_OPEN_COST;
+
+ private int GAP_EXTEND_COST;
+
AlignmentViewport av;
Vector<SequenceI> sequences;
+ private String alignmentOutput;
+
/**
* Creates a new PairwiseAlignPanel object.
*
* @param viewport
* DOCUMENT ME!
+ * @param endGaps ~ toggle gaps and the beginning and end of sequences
*/
public PairwiseAlignPanel(AlignmentViewport viewport)
{
+ this(viewport, false, 120, 20); // default penalties used in AlignSeq
+ }
+ public PairwiseAlignPanel(AlignmentViewport viewport, boolean endGaps, int gapOpenCost, int gapExtendCost)
+ {
super();
this.av = viewport;
+ StringBuilder sb = new StringBuilder(1024);
+
sequences = new Vector<SequenceI>();
SequenceGroup selectionGroup = viewport.getSelectionGroup();
: AlignSeq.PEP;
float[][] scores = new float[seqs.length][seqs.length];
+ float[][] alignmentScores = new float[seqs.length][seqs.length];
double totscore = 0D;
int count = seqs.length;
boolean first = true;
+ //AlignSeq as = new AlignSeq(seqs[1], seqStrings[1], seqs[0], seqStrings[0], type, gapOpenCost, gapExtendCost);
for (int i = 1; i < count; i++)
{
+ // fill diagonal alignmentScores with Float.NaN
+ alignmentScores[i-1][i-1] = Float.NaN;
for (int j = 0; j < i; j++)
{
AlignSeq as = new AlignSeq(seqs[i], seqStrings[i], seqs[j],
- seqStrings[j], type);
+ seqStrings[j], type, gapOpenCost, gapExtendCost);
+// as.seqInit(seqs[i], seqStrings[i], seqs[j], seqStrings[j], type);
if (as.s1str.length() == 0 || as.s2str.length() == 0)
{
}
as.calcScoreMatrix();
- as.traceAlignment();
+ if (endGaps)
+ {
+ as.traceAlignmentWithEndGaps();
+ } else {
+ as.traceAlignment();
+ }
+ as.scoreAlignment();
if (!first)
{
System.out.println(DASHES);
textarea.append(DASHES);
+ sb.append(DASHES);
}
first = false;
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()));
+ alignmentScores[i][j] = as.getAlignmentScore();
totscore = totscore + scores[i][j];
textarea.append(as.getOutput());
+ sb.append(as.getOutput());
sequences.add(as.getAlignedSeq1());
sequences.add(as.getAlignedSeq2());
}
}
+ alignmentScores[count-1][count-1] = Float.NaN;
+
+ this.scores = scores;
+ this.alignmentScores = alignmentScores;
if (count > 2)
{
printScoreMatrix(seqs, scores, totscore);
}
+
+ alignmentOutput = sb.toString();
+ }
+
+ public float[][] getScores()
+ {
+ return this.scores;
+ }
+
+ public float[][] getAlignmentScores()
+ {
+ return this.alignmentScores;
+ }
+
+ public String getAlignmentOutput()
+ {
+ return this.alignmentOutput;
}
/**