+
+ @Test(groups = "Functional")
+ public void testAddReferenceContactMap()
+ {
+ SequenceI sq = new Sequence("a", "SSSQ");
+ ContactMatrixI cm = new SeqDistanceContactMatrix(4);
+ AlignmentAnnotation cm_aan = sq.addContactList(cm);
+ SequenceI dssq = sq.createDatasetSequence();
+ Alignment ds = new Alignment(new SequenceI[] { dssq });
+
+ // remove annotation on our non-dataset sequence
+ sq.removeAlignmentAnnotation(sq.getAnnotation()[0]);
+ // test transfer
+ Alignment al = new Alignment(new SequenceI[] { sq });
+ SortedMap<String, String> tipEntries = new TreeMap<>();
+ final Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<>();
+
+ AlignmentUtils.findAddableReferenceAnnotations(al.getSequences(),
+ tipEntries, candidates, al);
+ AlignmentUtils.addReferenceAnnotations(candidates, al, null);
+ assertTrue("No contact map annotation transferred",
+ al.getAlignmentAnnotation() != null
+ && al.getAlignmentAnnotation().length == 1);
+ AlignmentAnnotation alan = al.findAnnotations(sq, null, cm_aan.label)
+ .iterator().next();
+ ContactListI cl = al.getContactListFor(alan, 1);
+ assertNotNull(
+ "No contact matrix recovered after reference annotation transfer",
+ cl);
+
+ }