X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fio%2Fvcf%2FVCFLoaderTest.java;h=7379ecde8e8d8ce7525bd6aa0b5db1036e9655b8;hb=4b24105fbfd942b6ec58a407b9dc68a331ba13d7;hp=cdfe2988d31c03a7b58a3e21e7407b292974c524;hpb=ec335385cbf75abd45251dd673f99fb023c5fd43;p=jalview.git diff --git a/test/jalview/io/vcf/VCFLoaderTest.java b/test/jalview/io/vcf/VCFLoaderTest.java index cdfe298..7379ecd 100644 --- a/test/jalview/io/vcf/VCFLoaderTest.java +++ b/test/jalview/io/vcf/VCFLoaderTest.java @@ -4,7 +4,6 @@ import static org.testng.Assert.assertEquals; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; -import jalview.datamodel.GeneLoci; import jalview.datamodel.Mapping; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; @@ -100,8 +99,15 @@ public class VCFLoaderTest * verify variant feature(s) computed and added to protein * first codon AGC varies to ACC giving S/T */ - SequenceI peptide = al.getSequenceAt(1) - .getDBRefs()[0].getMap().getTo(); + DBRefEntry[] dbRefs = al.getSequenceAt(1).getDBRefs(); + SequenceI peptide = null; + for (DBRefEntry dbref : dbRefs) + { + if (dbref.getMap().getMap().getFromRatio() == 3) + { + peptide = dbref.getMap().getTo(); + } + } List proteinFeatures = peptide.getSequenceFeatures(); assertEquals(proteinFeatures.size(), 1); sf = proteinFeatures.get(0); @@ -143,8 +149,7 @@ public class VCFLoaderTest SequenceI gene1 = alignment.getSequenceAt(0); int[] to = new int[] { 45051610, 45051634 }; int[] from = new int[] { gene1.getStart(), gene1.getEnd() }; - gene1.setGeneLoci(new GeneLoci("human", "GRCh38", "17", new MapList( - from, to, 1, 1))); + gene1.setGeneLoci("human", "GRCh38", "17", new MapList(from, to, 1, 1)); /* * map 'transcript1' to chromosome via 'gene1' @@ -154,8 +159,8 @@ public class VCFLoaderTest to = new int[] { 45051612, 45051619, 45051624, 45051633 }; SequenceI transcript1 = alignment.getSequenceAt(1); from = new int[] { transcript1.getStart(), transcript1.getEnd() }; - transcript1.setGeneLoci(new GeneLoci("human", "GRCh38", "17", - new MapList(from, to, 1, 1))); + transcript1.setGeneLoci("human", "GRCh38", "17", new MapList(from, to, + 1, 1)); /* * map gene2 to chromosome reverse strand @@ -163,8 +168,7 @@ public class VCFLoaderTest SequenceI gene2 = alignment.getSequenceAt(2); to = new int[] { 45051634, 45051610 }; from = new int[] { gene2.getStart(), gene2.getEnd() }; - gene2.setGeneLoci(new GeneLoci("human", "GRCh38", "17", new MapList( - from, to, 1, 1))); + gene2.setGeneLoci("human", "GRCh38", "17", new MapList(from, to, 1, 1)); /* * map 'transcript2' to chromosome via 'gene2' @@ -174,8 +178,8 @@ public class VCFLoaderTest to = new int[] { 45051633, 45051624, 45051619, 45051612 }; SequenceI transcript2 = alignment.getSequenceAt(3); from = new int[] { transcript2.getStart(), transcript2.getEnd() }; - transcript2.setGeneLoci(new GeneLoci("human", "GRCh38", "17", - new MapList(from, to, 1, 1))); + transcript2.setGeneLoci("human", "GRCh38", "17", new MapList(from, to, + 1, 1)); /* * add a protein product as a DBRef on transcript1 @@ -262,7 +266,15 @@ public class VCFLoaderTest * verify variant feature(s) computed and added to protein * last codon GCT varies to GGT giving A/G in the last peptide position */ - SequenceI peptide = al.getSequenceAt(3).getDBRefs()[0].getMap().getTo(); + DBRefEntry[] dbRefs = al.getSequenceAt(3).getDBRefs(); + SequenceI peptide = null; + for (DBRefEntry dbref : dbRefs) + { + if (dbref.getMap().getMap().getFromRatio() == 3) + { + peptide = dbref.getMap().getTo(); + } + } List proteinFeatures = peptide.getSequenceFeatures(); assertEquals(proteinFeatures.size(), 1); sf = proteinFeatures.get(0);