JAL-3143 unit tests updated for code changes!
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 25 Oct 2018 19:27:16 +0000 (20:27 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 25 Oct 2018 19:27:16 +0000 (20:27 +0100)
test/jalview/ext/ensembl/EnsemblCdnaTest.java
test/jalview/ext/ensembl/EnsemblCdsTest.java
test/jalview/ext/ensembl/EnsemblGeneTest.java
test/jalview/ext/ensembl/EnsemblGenomeTest.java

index c9d8deb..9e9d9a4 100644 (file)
@@ -79,19 +79,19 @@ public class EnsemblCdnaTest
     // exon at (start+10000) length 501
     SequenceFeature sf = new SequenceFeature("exon", "", 20000, 20500, 0f,
             null);
-    sf.setValue("Parent", "transcript:" + transcriptId);
+    sf.setValue("Parent", transcriptId);
     sf.setStrand("-");
     genomic.addSequenceFeature(sf);
 
     // exon (sub-type) at (start + exon_variant) length 101
     sf = new SequenceFeature("coding_exon", "", 10500, 10600, 0f, null);
-    sf.setValue("Parent", "transcript:" + transcriptId);
+    sf.setValue("Parent", transcriptId);
     sf.setStrand("-");
     genomic.addSequenceFeature(sf);
 
     // exon belonging to a different transcript doesn't count
     sf = new SequenceFeature("exon", "", 11500, 12600, 0f, null);
-    sf.setValue("Parent", "transcript:anotherOne");
+    sf.setValue("Parent", "anotherOne");
     genomic.addSequenceFeature(sf);
 
     // transcript feature doesn't count
@@ -134,19 +134,19 @@ public class EnsemblCdnaTest
     // exon at (start+10000) length 501
     SequenceFeature sf = new SequenceFeature("exon", "", 20000, 20500, 0f,
             null);
-    sf.setValue("Parent", "transcript:" + transcriptId);
+    sf.setValue("Parent", transcriptId);
     sf.setStrand("+");
     genomic.addSequenceFeature(sf);
 
     // exon (sub-type) at (start + exon_variant) length 101
     sf = new SequenceFeature("coding_exon", "", 10500, 10600, 0f, null);
-    sf.setValue("Parent", "transcript:" + transcriptId);
+    sf.setValue("Parent", transcriptId);
     sf.setStrand("+");
     genomic.addSequenceFeature(sf);
 
     // exon belonging to a different transcript doesn't count
     sf = new SequenceFeature("exon", "", 11500, 12600, 0f, null);
-    sf.setValue("Parent", "transcript:anotherOne");
+    sf.setValue("Parent", "anotherOne");
     genomic.addSequenceFeature(sf);
 
     // transcript feature doesn't count
@@ -226,14 +226,14 @@ public class EnsemblCdnaTest
     assertTrue(testee.retainFeature(sf, accId));
 
     // other feature with desired parent is retained
-    sf.setValue("Parent", "transcript:" + accId);
+    sf.setValue("Parent", accId);
     assertTrue(testee.retainFeature(sf, accId));
 
     // test is not case-sensitive
     assertTrue(testee.retainFeature(sf, accId.toLowerCase()));
 
     // feature with wrong parent is not retained
-    sf.setValue("Parent", "transcript:XYZ");
+    sf.setValue("Parent", "XYZ");
     assertFalse(testee.retainFeature(sf, accId));
   }
 
@@ -253,30 +253,30 @@ public class EnsemblCdnaTest
 
     // exon with wrong parent: not valid
     SequenceFeature sf2 = new SequenceFeature("exon", "", 1, 2, 0f, null);
-    sf2.setValue("Parent", "transcript:XYZ");
+    sf2.setValue("Parent", "XYZ");
     seq.addSequenceFeature(sf2);
 
     // exon with right parent is valid
     SequenceFeature sf3 = new SequenceFeature("exon", "", 1, 2, 0f, null);
-    sf3.setValue("Parent", "transcript:" + accId);
+    sf3.setValue("Parent", accId);
     seq.addSequenceFeature(sf3);
 
     // exon sub-type with right parent is valid
     SequenceFeature sf4 = new SequenceFeature("coding_exon", "", 1, 2, 0f,
             null);
-    sf4.setValue("Parent", "transcript:" + accId);
+    sf4.setValue("Parent", accId);
     seq.addSequenceFeature(sf4);
 
     // transcript not valid:
     SequenceFeature sf5 = new SequenceFeature("transcript", "", 1, 2, 0f,
             null);
-    sf5.setValue("Parent", "transcript:" + accId);
+    sf5.setValue("Parent", accId);
     seq.addSequenceFeature(sf5);
 
     // CDS not valid:
     SequenceFeature sf6 = new SequenceFeature("transcript", "", 1, 2, 0f,
             null);
-    sf6.setValue("Parent", "transcript:" + accId);
+    sf6.setValue("Parent", accId);
     seq.addSequenceFeature(sf6);
 
     List<SequenceFeature> sfs = new EnsemblCdna()
index a44ab7f..e7574eb 100644 (file)
@@ -78,19 +78,19 @@ public class EnsemblCdsTest
     // CDS at (start+10000) length 501
     SequenceFeature sf = new SequenceFeature("CDS", "", 20000, 20500, 0f,
             null);
-    sf.setValue("Parent", "transcript:" + transcriptId);
+    sf.setValue("Parent", transcriptId);
     sf.setStrand("+");
     genomic.addSequenceFeature(sf);
 
     // CDS (sub-type) at (start + 10500) length 101
     sf = new SequenceFeature("CDS_predicted", "", 10500, 10600, 0f, null);
-    sf.setValue("Parent", "transcript:" + transcriptId);
+    sf.setValue("Parent", transcriptId);
     sf.setStrand("+");
     genomic.addSequenceFeature(sf);
 
     // CDS belonging to a different transcript doesn't count
     sf = new SequenceFeature("CDS", "", 11500, 12600, 0f, null);
-    sf.setValue("Parent", "transcript:anotherOne");
+    sf.setValue("Parent", "anotherOne");
     genomic.addSequenceFeature(sf);
 
     // exon feature doesn't count
@@ -135,16 +135,16 @@ public class EnsemblCdsTest
     assertFalse(testee.retainFeature(sf, accId));
 
     // other feature with no parent is retained
-    sf = new SequenceFeature("CDS_psequence_variantredicted", "", 20000,
+    sf = new SequenceFeature("anotherType", "", 20000,
             20500, 0f, null);
     assertTrue(testee.retainFeature(sf, accId));
 
     // other feature with desired parent is retained
-    sf.setValue("Parent", "transcript:" + accId);
+    sf.setValue("Parent", accId);
     assertTrue(testee.retainFeature(sf, accId));
 
     // feature with wrong parent is not retained
-    sf.setValue("Parent", "transcript:XYZ");
+    sf.setValue("Parent", "XYZ");
     assertFalse(testee.retainFeature(sf, accId));
   }
 
@@ -164,29 +164,29 @@ public class EnsemblCdsTest
 
     // cds with wrong parent not valid
     SequenceFeature sf2 = new SequenceFeature("CDS", "", 1, 2, 0f, null);
-    sf2.setValue("Parent", "transcript:XYZ");
+    sf2.setValue("Parent", "XYZ");
     seq.addSequenceFeature(sf2);
 
     // cds with right parent is valid
     SequenceFeature sf3 = new SequenceFeature("CDS", "", 1, 2, 0f, null);
-    sf3.setValue("Parent", "transcript:" + accId);
+    sf3.setValue("Parent", accId);
     seq.addSequenceFeature(sf3);
 
     // cds sub-type with right parent is valid
     SequenceFeature sf4 = new SequenceFeature("CDS_predicted", "", 1, 2, 0f,
             null);
-    sf4.setValue("Parent", "transcript:" + accId);
+    sf4.setValue("Parent", accId);
     seq.addSequenceFeature(sf4);
 
     // transcript not valid:
     SequenceFeature sf5 = new SequenceFeature("transcript", "", 1, 2, 0f,
             null);
-    sf5.setValue("Parent", "transcript:" + accId);
+    sf5.setValue("Parent", accId);
     seq.addSequenceFeature(sf5);
 
     // exon not valid:
     SequenceFeature sf6 = new SequenceFeature("exon", "", 1, 2, 0f, null);
-    sf6.setValue("Parent", "transcript:" + accId);
+    sf6.setValue("Parent", accId);
     seq.addSequenceFeature(sf6);
 
     List<SequenceFeature> sfs = new EnsemblCds().getIdentifyingFeatures(seq,
index 446b4f7..8b1e840 100644 (file)
@@ -81,7 +81,7 @@ public class EnsemblGeneTest
     // gene at (start + 10500) length 101
     SequenceFeature sf = new SequenceFeature("gene", "", 10500, 10600, 0f,
             null);
-    sf.setValue("ID", "gene:" + geneId);
+    sf.setValue("id", geneId);
     sf.setStrand("+");
     genomic.addSequenceFeature(sf);
 
@@ -113,7 +113,7 @@ public class EnsemblGeneTest
     // gene at (start + 10500) length 101
     SequenceFeature sf = new SequenceFeature("gene", "", 10500, 10600, 0f,
             null);
-    sf.setValue("ID", "gene:" + geneId);
+    sf.setValue("id", geneId);
     sf.setStrand("+");
     genomic.addSequenceFeature(sf);
 
@@ -146,30 +146,30 @@ public class EnsemblGeneTest
     // transcript feature
     SequenceFeature sf1 = new SequenceFeature("transcript", "", 20000,
             20500, 0f, null);
-    sf1.setValue("Parent", "gene:" + geneId);
-    sf1.setValue("transcript_id", "transcript1");
+    sf1.setValue("Parent", geneId);
+    sf1.setValue("id", "transcript1");
     genomic.addSequenceFeature(sf1);
 
     // transcript sub-type feature
     SequenceFeature sf2 = new SequenceFeature("snRNA", "", 21000, 21500,
             0f, null);
-    sf2.setValue("Parent", "gene:" + geneId);
-    sf2.setValue("transcript_id", "transcript2");
+    sf2.setValue("Parent", geneId);
+    sf2.setValue("id", "transcript2");
     genomic.addSequenceFeature(sf2);
 
     // NMD_transcript_variant treated like transcript in Ensembl
     SequenceFeature sf3 = new SequenceFeature("NMD_transcript_variant", "",
             22000, 22500, 0f, null);
     // id matching should not be case-sensitive
-    sf3.setValue("Parent", "gene:" + geneId.toLowerCase());
-    sf3.setValue("transcript_id", "transcript3");
+    sf3.setValue("Parent", geneId.toLowerCase());
+    sf3.setValue("id", "transcript3");
     genomic.addSequenceFeature(sf3);
 
     // transcript for a different gene - ignored
     SequenceFeature sf4 = new SequenceFeature("snRNA", "", 23000, 23500,
             0f, null);
-    sf4.setValue("Parent", "gene:XYZ");
-    sf4.setValue("transcript_id", "transcript4");
+    sf4.setValue("Parent", "XYZ");
+    sf4.setValue("id", "transcript4");
     genomic.addSequenceFeature(sf4);
 
     EnsemblGene testee = new EnsemblGene();
@@ -196,24 +196,24 @@ public class EnsemblGeneTest
     EnsemblGene testee = new EnsemblGene();
     SequenceFeature sf = new SequenceFeature("gene", "", 20000, 20500, 0f,
             null);
-    sf.setValue("ID", "gene:" + geneId);
+    sf.setValue("id", geneId);
     assertFalse(testee.retainFeature(sf, geneId));
 
     sf = new SequenceFeature("transcript", "", 20000, 20500, 0f, null);
-    sf.setValue("Parent", "gene:" + geneId);
+    sf.setValue("Parent", geneId);
     assertTrue(testee.retainFeature(sf, geneId));
 
     sf = new SequenceFeature("mature_transcript", "", 20000, 20500, 0f,
             null);
-    sf.setValue("Parent", "gene:" + geneId);
+    sf.setValue("Parent", geneId);
     assertTrue(testee.retainFeature(sf, geneId));
 
     sf = new SequenceFeature("NMD_transcript_variant", "", 20000, 20500,
             0f, null);
-    sf.setValue("Parent", "gene:" + geneId);
+    sf.setValue("Parent", geneId);
     assertTrue(testee.retainFeature(sf, geneId));
 
-    sf.setValue("Parent", "gene:XYZ");
+    sf.setValue("Parent", "ßXYZ");
     assertFalse(testee.retainFeature(sf, geneId));
 
     sf = new SequenceFeature("anything", "", 20000, 20500, 0f, null);
@@ -235,28 +235,28 @@ public class EnsemblGeneTest
     seq.addSequenceFeature(sf1);
 
     // gene with wrong ID not valid
-    SequenceFeature sf2 = new SequenceFeature("gene", "", 1, 2, 0f, null);
-    sf2.setValue("ID", "gene:XYZ");
+    SequenceFeature sf2 = new SequenceFeature("gene", "a", 1, 2, 0f, null);
+    sf2.setValue("id", "XYZ");
     seq.addSequenceFeature(sf2);
 
     // gene with right ID is valid
-    SequenceFeature sf3 = new SequenceFeature("gene", "", 1, 2, 0f, null);
-    sf3.setValue("ID", "gene:" + accId);
+    SequenceFeature sf3 = new SequenceFeature("gene", "b", 1, 2, 0f, null);
+    sf3.setValue("id", accId);
     seq.addSequenceFeature(sf3);
 
     // gene sub-type with right ID is valid
     SequenceFeature sf4 = new SequenceFeature("snRNA_gene", "", 1, 2, 0f, null);
-    sf4.setValue("ID", "gene:" + accId);
+    sf4.setValue("id", accId);
     seq.addSequenceFeature(sf4);
 
     // transcript not valid:
     SequenceFeature sf5 = new SequenceFeature("transcript", "", 1, 2, 0f, null);
-    sf5.setValue("ID", "gene:" + accId);
+    sf5.setValue("id", accId);
     seq.addSequenceFeature(sf5);
 
     // exon not valid:
     SequenceFeature sf6 = new SequenceFeature("exon", "", 1, 2, 0f, null);
-    sf6.setValue("ID", "gene:" + accId);
+    sf6.setValue("id", accId);
     seq.addSequenceFeature(sf6);
     
     List<SequenceFeature> sfs = new EnsemblGene()
index 72ee492..11140f9 100644 (file)
@@ -77,13 +77,13 @@ public class EnsemblGenomeTest
     // transcript at (start+10000) length 501
     SequenceFeature sf = new SequenceFeature("transcript", "", 20000,
             20500, 0f, null);
-    sf.setValue("ID", "transcript:" + transcriptId);
+    sf.setValue("id", transcriptId);
     sf.setStrand("+");
     genomic.addSequenceFeature(sf);
 
     // transcript (sub-type) at (start + 10500) length 101
     sf = new SequenceFeature("ncRNA", "", 10500, 10600, 0f, null);
-    sf.setValue("ID", "transcript:" + transcriptId);
+    sf.setValue("id", transcriptId);
     sf.setStrand("+");
     genomic.addSequenceFeature(sf);
 
@@ -91,13 +91,13 @@ public class EnsemblGenomeTest
     // although strictly it is a sequence_variant in SO
     sf = new SequenceFeature("NMD_transcript_variant", "", 11000, 12000,
             0f, null);
-    sf.setValue("ID", "transcript:" + transcriptId);
+    sf.setValue("id", transcriptId);
     sf.setStrand("+");
     genomic.addSequenceFeature(sf);
 
     // transcript with a different ID doesn't count
     sf = new SequenceFeature("transcript", "", 11500, 12600, 0f, null);
-    sf.setValue("ID", "transcript:anotherOne");
+    sf.setValue("id", "anotherOne");
     genomic.addSequenceFeature(sf);
 
     // parent of transcript feature doesn't count
@@ -150,11 +150,11 @@ public class EnsemblGenomeTest
     assertTrue(testee.retainFeature(sf, accId));
 
     // other feature with correct parent is kept
-    sf.setValue("Parent", "transcript:" + accId);
+    sf.setValue("Parent", accId);
     assertTrue(testee.retainFeature(sf, accId));
 
     // other feature with wrong parent is not kept
-    sf.setValue("Parent", "transcript:XYZ");
+    sf.setValue("Parent", "XYZ");
     assertFalse(testee.retainFeature(sf, accId));
   }
 
@@ -174,36 +174,37 @@ public class EnsemblGenomeTest
     seq.addSequenceFeature(sf1);
 
     // transcript with wrong ID not valid
-    SequenceFeature sf2 = new SequenceFeature("transcript", "", 1, 2, 0f,
+    // NB change desc to avoid rejection of duplicate feature!
+    SequenceFeature sf2 = new SequenceFeature("transcript", "a", 1, 2, 0f,
             null);
-    sf2.setValue("ID", "transcript");
+    sf2.setValue("id", "transcript");
     seq.addSequenceFeature(sf2);
 
     // transcript with right ID is valid
-    SequenceFeature sf3 = new SequenceFeature("transcript", "", 1, 2, 0f,
+    SequenceFeature sf3 = new SequenceFeature("transcript", "b", 1, 2, 0f,
             null);
-    sf3.setValue("ID", "transcript:" + accId);
+    sf3.setValue("id", accId);
     seq.addSequenceFeature(sf3);
 
     // transcript sub-type with right ID is valid
     SequenceFeature sf4 = new SequenceFeature("ncRNA", "", 1, 2, 0f, null);
-    sf4.setValue("ID", "transcript:" + accId);
+    sf4.setValue("id", accId);
     seq.addSequenceFeature(sf4);
 
     // Ensembl treats NMD_transcript_variant as if a transcript
     SequenceFeature sf5 = new SequenceFeature("NMD_transcript_variant", "",
             1, 2, 0f, null);
-    sf5.setValue("ID", "transcript:" + accId);
+    sf5.setValue("id", accId);
     seq.addSequenceFeature(sf5);
 
     // gene not valid:
     SequenceFeature sf6 = new SequenceFeature("gene", "", 1, 2, 0f, null);
-    sf6.setValue("ID", "transcript:" + accId);
+    sf6.setValue("id", accId);
     seq.addSequenceFeature(sf6);
 
     // exon not valid:
     SequenceFeature sf7 = new SequenceFeature("exon", "", 1, 2, 0f, null);
-    sf7.setValue("ID", "transcript:" + accId);
+    sf7.setValue("id", accId);
     seq.addSequenceFeature(sf7);
 
     List<SequenceFeature> sfs = new EnsemblGenome()