protected void setTemplateForThreePrimeArm() {
//There are three different modes to consider, target is position (no poly), SNP or InDel
TargettedSequence template;
String tempID = "TEMPLATE|3|"+getID(); //$NON-NLS-1$
if (targetPoly == 0) { //No poly
template = new SimpleSubSequenceTemplate(this, "Template for 3' arm", getType(), //$NON-NLS-1$
getTargetPosition(), length(), getID());
}
else { //Target is Poly
Polymorphism poly = getPolys()[targetPoly - 1];
if (poly instanceof SNP) {
Nucleotide n = (Nucleotide) poly.getVariants()[variantIndex];
if (n == null) {
throw new UnsupportedOperationException("No target nucleotide found"); //$NON-NLS-1$
}
String seq = subsequence(getTargetPosition()+1, length());
String nt = String.valueOf(n.getChar());
String full = nt + seq;
template = new SimpleSubSequenceTemplate(tempID, full, getType(),
getTargetPosition(), length(), getID());
}
else if (poly instanceof InDel) {
switch (variantIndex) {
case InDel.INS:
template = new SimpleSubSequenceTemplate(this, tempID, getType(),
getTargetPosition(), length(), getID());
break;
case InDel.DEL:
template = new SimpleSubSequenceTemplate(this,tempID, getType(),
getTargetPosition() + poly.length(), length(), getID());
break;
default:
throw new UnsupportedOperationException(
"Invalid InDel mode specified"); //$NON-NLS-1$