1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.datamodel; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
|
25 |
|
import jalview.util.MapList; |
26 |
|
|
27 |
|
import java.util.ArrayList; |
28 |
|
import java.util.HashMap; |
29 |
|
import java.util.List; |
30 |
|
import java.util.Map; |
31 |
|
|
32 |
|
import org.testng.annotations.Test; |
33 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (46) |
Complexity: 1 |
Complexity Density: 0.02 |
|
34 |
|
public class MappedFeaturesTest |
35 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (45) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
36 |
1 |
@Test(groups = "Functional")... |
37 |
|
public void testFindProteinVariants() |
38 |
|
{ |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
1 |
SequenceI from = new Sequence("dna/10-20", "acgTAGCTGAA"); |
45 |
1 |
SequenceI to = new Sequence("peptide", "RG"); |
46 |
1 |
MapList map = new MapList(new int[] { 11, 13, 15, 15, 18, 19 }, |
47 |
|
new int[] |
48 |
|
{ 1, 2 }, 3, 1); |
49 |
1 |
Mapping mapping = new Mapping(to, map); |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
1 |
List<SequenceFeature> features = new ArrayList<>(); |
57 |
1 |
SequenceFeature sf1 = new SequenceFeature("sequence_variant", "C,T", 11, |
58 |
|
11, null); |
59 |
1 |
sf1.setValue("alleles", "C,T"); |
60 |
1 |
features.add(sf1); |
61 |
1 |
SequenceFeature sf2 = new SequenceFeature("sequence_variant", "T,C", 13, |
62 |
|
13, null); |
63 |
1 |
sf2.setValue("alleles", "T,C"); |
64 |
1 |
features.add(sf2); |
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
1 |
MappedFeatures mf = new MappedFeatures(mapping, from, 1, 'R', features); |
70 |
1 |
String variant = mf.findProteinVariants(sf1); |
71 |
1 |
assertEquals(variant, "p.Arg1Cys"); |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
1 |
sf1.setValue("alleles", "C,T,G"); |
79 |
1 |
variant = mf.findProteinVariants(sf1); |
80 |
1 |
assertEquals(variant, "p.Arg1Cys,p.Arg1Gly"); |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
1 |
variant = mf.findProteinVariants(sf2); |
87 |
1 |
assertEquals(variant, "c.13T>C(p.=)"); |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
1 |
Map<String, String> csq = new HashMap<>(); |
94 |
1 |
csq.put("HGVSp", "hello:world"); |
95 |
1 |
sf2.setValue("CSQ", csq); |
96 |
1 |
variant = mf.findProteinVariants(sf2); |
97 |
1 |
assertEquals(variant, "c.13T>C(p.=)"); |
98 |
1 |
csq.put("HGVSp", "p.HelloWorld"); |
99 |
1 |
variant = mf.findProteinVariants(sf2); |
100 |
1 |
assertEquals(variant, "c.13T>C(p.=)"); |
101 |
1 |
csq.put("HGVSp", "try this:hellop.world"); |
102 |
1 |
variant = mf.findProteinVariants(sf2); |
103 |
1 |
assertEquals(variant, "hellop.world"); |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
1 |
mf = new MappedFeatures(mapping, from, 2, 'G', features); |
112 |
1 |
features.clear(); |
113 |
1 |
SequenceFeature sf3 = new SequenceFeature("sequence_variant", |
114 |
|
"G,-,CG,T", 18, 18, null); |
115 |
1 |
sf3.setValue("alleles", "G,-,CG,T"); |
116 |
1 |
features.add(sf3); |
117 |
1 |
variant = mf.findProteinVariants(sf3); |
118 |
1 |
assertEquals(variant, "p.Gly2Val"); |
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
1 |
SequenceFeature sf4 = new SequenceFeature("sequence_variant", "G,T", 15, |
125 |
|
15, null); |
126 |
1 |
sf4.setValue("alleles", "G,-,CG,T"); |
127 |
1 |
features.add(sf4); |
128 |
1 |
variant = mf.findProteinVariants(sf4); |
129 |
1 |
assertEquals(variant, "p.Gly2Ter"); |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
1 |
SequenceFeature sf9 = new SequenceFeature("sequence_variant", "G,C", 15, |
135 |
|
15, null); |
136 |
1 |
variant = mf.findProteinVariants(sf9); |
137 |
1 |
assertEquals(variant, ""); |
138 |
|
} |
139 |
|
} |