import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import jalview.analysis.AlignmentUtils;
+import jalview.analysis.SeqsetUtils;
import jalview.gui.JvOptionPane;
import jalview.util.MapList;
import jalview.ws.datamodel.MappableContactMatrixI;
// last column
assertNotNull(newseq.getContactListFor(newaa, -1+newseq.findIndex(10)));
+ // verify MappedPositions includes discontinuity
+ int[] mappedCl = newseq.getContactListFor(newaa, 5).getMappedPositionsFor(0, 4);
+ assertEquals(4,mappedCl.length,"getMappedPositionsFor doesn't support discontinuous mappings to contactList");
+
+ // make it harder.
+
+ SequenceI alseq = newseq.getSubSequence(6, 10);
+ alseq.insertCharAt(2, 2, '-');
+ AlignmentI alForSeq=new Alignment(new SequenceI[] { alseq });
+ newaa = AlignmentUtils.addReferenceAnnotationTo(alForSeq, alseq, newaa, null);
+ ContactListI alcl = alForSeq.getContactListFor(newaa, 1);
+ assertNotNull(alcl);
+ mappedCl = alcl.getMappedPositionsFor(0, 4);
+ assertNotNull(mappedCl);
+ assertEquals(4,mappedCl.length,"getMappedPositionsFor doesn't support discontinuous mappings to contactList");
+
// remap2 - test with original matrix map from 1-5 remapped to 5-9
seq = new Sequence("Seq/1-5","ASDQE");
newaa = newseq.addContactList(remapped);
verify_mapping(newseq, newaa);
-
}
/**
* checks that the PAE matrix is located at positions 1-9 in newseq, and columns are not truncated.
assertNull(newseq.getContactListFor(newaa, -1+newseq.findIndex(10)));
verifyPAEmatrix(newseq, newaa, 4, 4, 8);
-
-
}
private void verifyPAEmatrix(SequenceI seq, AlignmentAnnotation aa, int topl, int rowl, int rowr)
{
+ int[] mappedCl;
for (int f=rowl;f<=rowr;f++) {
ContactListI clist = seq.getContactListFor(aa, f);
assertNotNull(clist,"No ContactListI for position "+(f));
assertEquals(clist.getContactAt(0), (double) f-topl+1,"for column "+f+" relative to "+topl);
+ mappedCl = clist.getMappedPositionsFor(0, 0);
+ assertNotNull(mappedCl);
+ assertEquals(mappedCl[0],mappedCl[1]);
+ assertEquals(mappedCl[0],seq.findIndex(seq.getStart()+topl));
assertEquals(clist.getContactAt(f-topl),1d, "for column and row "+f+" relative to "+topl);
}
}