From: gmungoc Date: Thu, 22 Aug 2019 15:06:05 +0000 (+0100) Subject: JAL-3187 case-insensitive codon variant calculation X-Git-Tag: Release_2_11_1_0~22^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=be38fa8acaa8061b501a4e94fb7dea4b7ed8ed41;p=jalview.git JAL-3187 case-insensitive codon variant calculation --- diff --git a/src/jalview/datamodel/MappedFeatures.java b/src/jalview/datamodel/MappedFeatures.java index 4b558a5..0fa03cf 100644 --- a/src/jalview/datamodel/MappedFeatures.java +++ b/src/jalview/datamodel/MappedFeatures.java @@ -91,9 +91,12 @@ public class MappedFeatures codonPos = codonPositions; baseCodon = new char[3]; int cdsStart = fromSeq.getStart(); - baseCodon[0] = fromSeq.getCharAt(codonPos[0] - cdsStart); - baseCodon[1] = fromSeq.getCharAt(codonPos[1] - cdsStart); - baseCodon[2] = fromSeq.getCharAt(codonPos[2] - cdsStart); + baseCodon[0] = Character + .toUpperCase(fromSeq.getCharAt(codonPos[0] - cdsStart)); + baseCodon[1] = Character + .toUpperCase(fromSeq.getCharAt(codonPos[1] - cdsStart)); + baseCodon[2] = Character + .toUpperCase(fromSeq.getCharAt(codonPos[2] - cdsStart)); } else { diff --git a/test/jalview/datamodel/MappedFeaturesTest.java b/test/jalview/datamodel/MappedFeaturesTest.java index e4caac3..de4ce6c 100644 --- a/test/jalview/datamodel/MappedFeaturesTest.java +++ b/test/jalview/datamodel/MappedFeaturesTest.java @@ -13,7 +13,7 @@ import org.testng.annotations.Test; public class MappedFeaturesTest { - @Test + @Test(groups = "Functional") public void testFindProteinVariants() { /* @@ -21,7 +21,7 @@ public class MappedFeaturesTest * dna/10-20 aCGTaGctGAa (codons CGT=R, GGA = G) * mapping: 3:1 from [11-13,15,18-19] to peptide/1-2 RG */ - SequenceI from = new Sequence("dna/10-20", "ACGTAGCTGAA"); + SequenceI from = new Sequence("dna/10-20", "acgTAGCTGAA"); SequenceI to = new Sequence("peptide", "RG"); MapList map = new MapList(new int[] { 11, 13, 15, 15, 18, 19 }, new int[] @@ -68,13 +68,20 @@ public class MappedFeaturesTest assertEquals(variant, "c.13T>C(p.=)"); /* - * CSQ:HGVSp value is used if present + * CSQ:HGVSp value is used if present + * _and_ it contains "p." following a colon */ Map csq = new HashMap<>(); csq.put("HGVSp", "hello:world"); sf2.setValue("CSQ", csq); variant = mf.findProteinVariants(sf2); - assertEquals(variant, "world"); + assertEquals(variant, "c.13T>C(p.=)"); + csq.put("HGVSp", "p.HelloWorld"); + variant = mf.findProteinVariants(sf2); + assertEquals(variant, "c.13T>C(p.=)"); + csq.put("HGVSp", "try this:hellop.world"); + variant = mf.findProteinVariants(sf2); + assertEquals(variant, "hellop.world"); /* * missense and indel variants in second codon