//Set up the structure for the MPC
int secstart = fixedEnd == TemplateHandler.THREEPRIME ? 1 :
temp.length() - pa.length() + 1;
int secend = fixedEnd == TemplateHandler.THREEPRIME ? pa.length() :
temp.length();
NAHybridStructure st = new DefaultNAHybridStructure(pa, 1, pa.length(),
temp, secstart,
secend);
//calculate the Tm of the probe Arm to the template
oldTm = Tm;
Tm = Analyzer.calculateTm(pa,temp,st,defaultMpc,backupMpc);
//Tm = defaultMpc.getMeltingPoint(pa);
//If minimum length reached, stop and check if further away than last length
if (pa.length() <= minlength) {
done = true;
//if further from temp than last, restore the old seq.
if (oldTm > 0 && Math.abs(Tm - preftemp) > Math.abs(oldTm - preftemp)) {
try {
cns.setSequence(oldseq);
}
catch (SequenceFormatException e) {
throw new UnsupportedOperationException("Invalid sequence"); //$NON-NLS-1$
}
}
break;
}
//If below temp limit, back up one step
if (Tm <= preftemp) {
done = true;
if (oldTm > 0 && Math.abs(Tm - preftemp) > Math.abs(oldTm - preftemp)) {
try {
cns.setSequence(oldseq);
}
catch (SequenceFormatException e) {
throw new UnsupportedOperationException("Invalid sequence"); //$NON-NLS-1$
}
}
break;
}
//Here we cut of the sequence at the appropriate end and do all again
oldseq = pa.seqString(); //but first store the old sequence
//remove nucleotides form the non-fixed end of the arm
switch (fixedEnd) {
case TemplateHandler.THREEPRIME:
try {
cns.edit(new SimpleSequenceEdit(1, 1, "")); //$NON-NLS-1$
}
catch (SequenceFormatException e) {
throw new UnsupportedOperationException("Invalid sequence"); //$NON-NLS-1$
}
break;
case TemplateHandler.FIVEPRIME:
try {
cns.edit(new SimpleSequenceEdit(pa.length(), 1, "")); //$NON-NLS-1$
}
catch (SequenceFormatException e) {
throw new UnsupportedOperationException("Invalid sequence"); //$NON-NLS-1$
}
break;
}
}
}
//Recalculate tm, in case we backed the sequence up.
//Set up the structure for the MPC
int secstart = fixedEnd == TemplateHandler.FIVEPRIME ?
temp.length() - pa.length() + 1 : 1;
int secend = fixedEnd == TemplateHandler.FIVEPRIME ?
temp.length() : pa.length();
NAHybridStructure st = new DefaultNAHybridStructure(pa, 1, pa.length(),
temp, secstart, secend);
ProbeMakerPropertyUtils.clearMessages(pa);
float Tm = Analyzer.calculateTm(pa,temp,st,defaultMpc,backupMpc);
//Set the temperature