import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
-import jalview.analysis.AlignmentUtils.DnaVariant;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
+import jalview.datamodel.ContactListI;
+import jalview.datamodel.ContactMatrixI;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.GeneLociI;
import jalview.datamodel.Mapping;
import jalview.datamodel.SearchResultMatchI;
import jalview.datamodel.SearchResultsI;
+import jalview.datamodel.SeqDistanceContactMatrix;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
-import jalview.datamodel.features.SequenceFeatures;
import jalview.gui.JvOptionPane;
import jalview.io.AppletFormatAdapter;
import jalview.io.DataSourceType;
import jalview.io.gff.SequenceOntologyI;
import jalview.util.MapList;
import jalview.util.MappingUtils;
-import jalview.ws.params.InvalidArgumentException;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
public class AlignmentUtilsTests
{
* the given protein. That is, given a transcript-to-peptide mapping, find the
* cds-to-peptide mapping that relates to both, and return the CDS sequence.
*/
- @Test
+ @Test(groups = "Functional")
public void testFindCdsForProtein()
{
List<AlignedCodonFrame> mappings = new ArrayList<>();
* cds-to-peptide mapping that relates to both, and return the CDS sequence.
* This test is for the case where transcript and CDS are the same length.
*/
- @Test
+ @Test(groups = "Functional")
public void testFindCdsForProtein_noUTR()
{
List<AlignedCodonFrame> mappings = new ArrayList<>();
SequenceI sq = new Sequence("a", "SSSQ");
ContactMatrixI cm = new SeqDistanceContactMatrix(4);
AlignmentAnnotation cm_aan = sq.addContactList(cm);
+ cm_aan.description = cm_aan.description + " cm1";
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<>();
+ Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<>();
AlignmentUtils.findAddableReferenceAnnotations(al.getSequences(),
tipEntries, candidates, al);
assertNotNull(
"No contact matrix recovered after reference annotation transfer",
cl);
+ // semantics of sequence associated contact list is slightly tricky - column 3 in alignment should have data
+ cl = al.getContactListFor(alan, 3);
+ assertNotNull(
+ "Contact matrix should have data for last position in sequence",
+ cl);
+
+ ContactMatrixI cm2 = new SeqDistanceContactMatrix(4);
+ dssq.addContactList(cm2);
+ tipEntries = new TreeMap<>();
+ candidates = new LinkedHashMap<>();
+
+ AlignmentUtils.findAddableReferenceAnnotations(al.getSequences(),
+ tipEntries, candidates, al);
+ AlignmentUtils.addReferenceAnnotations(candidates, al, null);
+ assertTrue("Expected two contact map annotation transferred",
+ al.getAlignmentAnnotation() != null
+ && al.getAlignmentAnnotation().length == 2);
}
}