1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ext.ensembl; |
22 |
|
|
23 |
|
import static org.testng.AssertJUnit.assertEquals; |
24 |
|
|
25 |
|
import jalview.datamodel.AlignmentI; |
26 |
|
import jalview.datamodel.SequenceFeature; |
27 |
|
import jalview.datamodel.SequenceI; |
28 |
|
import jalview.gui.JvOptionPane; |
29 |
|
import jalview.io.DataSourceType; |
30 |
|
import jalview.io.FastaFile; |
31 |
|
import jalview.io.gff.SequenceOntologyFactory; |
32 |
|
import jalview.io.gff.SequenceOntologyLite; |
33 |
|
|
34 |
|
import java.lang.reflect.Method; |
35 |
|
|
36 |
|
import org.testng.Assert; |
37 |
|
import org.testng.annotations.AfterClass; |
38 |
|
import org.testng.annotations.BeforeClass; |
39 |
|
import org.testng.annotations.DataProvider; |
40 |
|
import org.testng.annotations.Test; |
41 |
|
|
|
|
| 69% |
Uncovered Elements: 13 (42) |
Complexity: 8 |
Complexity Density: 0.24 |
|
42 |
|
public class EnsemblSeqProxyTest |
43 |
|
{ |
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
45 |
1 |
@BeforeClass(alwaysRun = true)... |
46 |
|
public void setUpJvOptionPane() |
47 |
|
{ |
48 |
1 |
JvOptionPane.setInteractiveMode(false); |
49 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
50 |
|
} |
51 |
|
|
52 |
|
private static final Object[][] allSeqs = new Object[][] { { |
53 |
|
new EnsemblProtein(), "CCDS5863.1", |
54 |
|
">CCDS5863.1\n" |
55 |
|
+ "MAALSGGGGGGAEPGQALFNGDMEPEAGAGAGAAASSAADPAIPEEVWNIKQMIKLTQEH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GAC\n" |
71 |
|
+ "CCTGCCATTCCGGAGGAGGTGTGGAATATCAAACAAATGATTAAGTTGACACAGGAACAT\n" |
72 |
|
+ "ATAGAGGCCCTATTGGACAAATTTGGTGGGGAGCATAATCCACCATCAATATATCTGGAG\n" |
73 |
|
+ "GCCTATGAAGAATACACCAGCAAGCTAGATGCACTCCAACAAAGAGAACAACAGTTATTG\n" |
74 |
|
+ "GAATCTCTGGGGAACGGAACTGATTTTTCTGTTTCTAGCTCTGCATCAATGGATACCGTT\n" |
75 |
|
+ "ACATCTTCTTCCTCTTCTAGCCTTTCAGTGCTACCTTCATCTCTTTCAGTTTTTCAAAAT\n" |
76 |
|
+ "CCCACAGATGTGGCACGGAGCAACCCCAAGTCACCACAAAAACCTATCGTTAGAGTCTTC\n" |
77 |
|
+ "CTGCCCAACAAACAGAGGACAGTGGTACCTGCAAGGTGTGGAGTTACAGTCCGAGACAGT\n" |
78 |
|
+ "CTAAAGAAAGCACTGATGATGAGAGGTCTAATCCCAGAGTGCTGTGCTGTTTACAGAATT\n" |
79 |
|
+ "CAGGATGGAGAGAAGAAACCAATTGGTTGGGACACTGATATTTCCTGGCTTACTGGAGAA\n" |
80 |
|
+ "GAATTGCATGTGGAAGTGTTGGAGAATGTTCCACTTACAACACACAACTTTGTACGAAAA\n" |
81 |
|
+ "ACGTTTTTCACCTTAGCATTTTGTGACTTTTGTCGAAAGCTGCTTTTCCAGGGTTTCCGC\n" |
82 |
|
+ "TGTCAAACATGTGGTTATAAATTTCACCAGCGTTGTAGTACAGAAGTTCCACTGATGTGT\n" |
83 |
|
+ "GTTAATTATGACCAACTTGATTTGCTGTTTGTCTCCAAGTTCTTTGAACACCACCCAATA\n" |
84 |
|
+ "CCACAGGAAGAGGCGTCCTTAGCAGAGACTGCCCTAACATCTGGATCATCCCCTTCCGCA\n" |
85 |
|
+ "CCCGCCTCGGACTCTATTGGGCCCCAAATTCTCACCAGTCCGTCTCCTTCAAAATCCATT\n" |
86 |
|
+ "CCAATTCCACAGCCCTTCCGACCAGCAGATGAAGATCATCGAAATCAATTTGGGCAACGA\n" |
87 |
|
+ "GACCGATCCTCATCAGCTCCCAATGTGCATATAAACACAATAGAACCTGTCAATATTGAT\n" |
88 |
|
+ "GACTTGATTAGAGACCAAGGATTTCGTGGTGATGGAGGATCAACCACAGGTTTGTCTGCT\n" |
89 |
|
+ "ACCCCCCCTGCCTCATTACCTGGCTCACTAACTAACGTGAAAGCCTTACAGAAATCTCCA\n" |
90 |
|
+ "GGACCTCAGCGAGAAAGGAAGTCATCTTCATCCTCAGAAGACAGGAATCGAATGAAAACA\n" |
91 |
|
+ "CTTGGTAGACGGGACTCGAGTGATGATTGGGAGATTCCTGATGGGCAGATTACAGTGGGA\n" |
92 |
|
+ "CAAAGAATTGGATCTGGATCATTTGGAACAGTCTACAAGGGAAAGTGGCATGGTGATGTG\n" |
93 |
|
+ "GCAGTGAAAATGTTGAATGTGACAGCACCTACACCTCAGCAGTTACAAGCCTTCAAAAAT\n" |
94 |
|
+ "GAAGTAGGAGTACTCAGGAAAACACGACATGTGAATATCCTACTCTTCATGGGCTATTCC\n" |
95 |
|
+ "ACAAAGCCACAACTGGCTATTGTTACCCAGTGGTGTGAGGGCTCCAGCTTGTATCACCAT\n" |
96 |
|
+ "CTCCATATCATTGAGACCAAATTTGAGATGATCAAACTTATAGATATTGCACGACAGACT\n" |
97 |
|
+ "GCACAGGGCATGGATTACTTACACGCCAAGTCAATCATCCACAGAGACCTCAAGAGTAAT\n" |
98 |
|
+ "AATATATTTCTTCATGAAGACCTCACAGTAAAAATAGGTGATTTTGGTCTAGCTACAGTG\n" |
99 |
|
+ "AAATCTCGATGGAGTGGGTCCCATCAGTTTGAACAGTTGTCTGGATCCATTTTGTGGATG\n" |
100 |
|
+ "GCACCAGAAGTCATCAGAATGCAAGATAAAAATCCATACAGCTTTCAGTCAGATGTATAT\n" |
101 |
|
+ "GCATTTGGAATTGTTCTGTATGAATTGATGACTGGACAGTTACCTTATTCAAACATCAAC\n" |
102 |
|
+ "AACAGGGACCAGATAATTTTTATGGTGGGACGAGGATACCTGTCTCCAGATCTCAGTAAG\n" |
103 |
|
+ "GTACGGAGTAACTGTCCAAAAGCCATGAAGAGATTAATGGCAGAGTGCCTCAAAAAGAAA\n" |
104 |
|
+ "AGAGATGAGAGACCACTCTTTCCCCAAATTCTCGCCTCTATTGAGCTGCTGGCCCGCTCA\n" |
105 |
|
+ "TTGCCAAAAATTCACCGCAGTGCATCAGAACCCTCCTTGAATCGGGCTGGTTTCCAAACA\n" |
106 |
|
+ "GAGGATTTTAGTCTATATGCTTGTGCTTCTCCAAAAACACCCATCCAGGCAGGGGGATAT\n" |
107 |
|
+ "GGTGCGTTTCCTGTCCACTGA\n" }, |
108 |
|
{ new EnsemblProtein(), "ENSP00000288602", ">ENSP00000288602\n" |
109 |
|
+ "MAALSGGGGGGAEPGQALFNGDMEPEAGAGAGAAASSAADPAIPEEVWNIKQMIKLTQEH\n" |
110 |
|
+ "IEALLDKFGGEHNPPSIYLEAYEEYTSKLDALQQREQQLLESLGNGTDFSVSSSASMDTV\n" |
111 |
|
+ "TSSSSSSLSVLPSSLSVFQNPTDVARSNPKSPQKPIVRVFLPNKQRTVVPARCGVTVRDS\n" |
112 |
|
+ "LKKALMMRGLIPECCAVYRIQDGEKKPIGWDTDISWLTGEELHVEVLENVPLTTHNFVRK\n" |
113 |
|
+ "TFFTLAFCDFCRKLLFQGFRCQTCGYKFHQRCSTEVPLMCVNYDQLDLLFVSKFFEHHPI\n" |
114 |
|
+ "PQEEASLAETALTSGSSPSAPASDSIGPQILTSPSPSKSIPIPQPFRPADEDHRNQFGQR\n" |
115 |
|
+ "DRSSSAPNVHINTIEPVNIDDLIRDQGFRGDG\n" |
116 |
|
|
117 |
|
+ "APLNQLMRCLRKYQSRTPSPLLHSVPSEIVFDFEPGPVFR\n" |
118 |
|
|
119 |
|
+ "GSTTGLSATPPASLPGSLTNVKALQKSP\n" |
120 |
|
+ "GPQRERKSSSSSEDRNRMKTLGRRDSSDDWEIPDGQITVGQRIGSGSFGTVYKGKWHGDV\n" |
121 |
|
+ "AVKMLNVTAPTPQQLQAFKNEVGVLRKTRHVNILLFMGYSTKPQLAIVTQWCEGSSLYHH\n" |
122 |
|
+ "LHIIETKFEMIKLIDIARQTAQGMDYLHAKSIIHRDLKSNNIFLHEDLTVKIGDFGLATV\n" |
123 |
|
+ "KSRWSGSHQFEQLSGSILWMAPEVIRMQDKNPYSFQSDVYAFGIVLYELMTGQLPYSNIN\n" |
124 |
|
+ "NRDQIIFMVGRGYLSPDLSKVRSNCPKAMKRLMAECLKKKRDERPLFPQILASIELLARS\n" |
125 |
|
+ "LPKIHRSASEPSLNRAGFQTEDFSLYACASPKTPIQAGGYGAFPVH" } }; |
126 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
127 |
1 |
@BeforeClass(alwaysRun = true)... |
128 |
|
public void setUp() |
129 |
|
{ |
130 |
1 |
SequenceOntologyFactory.setInstance(new SequenceOntologyLite()); |
131 |
|
} |
132 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
133 |
1 |
@AfterClass(alwaysRun = true)... |
134 |
|
public void tearDown() |
135 |
|
{ |
136 |
1 |
SequenceOntologyFactory.setInstance(null); |
137 |
|
} |
138 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
139 |
0 |
@DataProvider(name = "ens_seqs")... |
140 |
|
public Object[][] createData(Method m) |
141 |
|
{ |
142 |
0 |
System.out.println(m.getName()); |
143 |
0 |
return allSeqs; |
144 |
|
} |
145 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
4-
|
|
146 |
0 |
@Test(dataProvider = "ens_seqs", suiteName = "live")... |
147 |
|
public void testGetSequenceRecords(EnsemblSeqProxy proxy, String sq, |
148 |
|
String fastasq) throws Exception |
149 |
|
{ |
150 |
0 |
FastaFile trueRes = new FastaFile(fastasq, DataSourceType.PASTE); |
151 |
0 |
SequenceI[] expected = trueRes.getSeqsAsArray(); |
152 |
0 |
AlignmentI retrieved = proxy.getSequenceRecords(sq); |
153 |
|
|
154 |
0 |
Assert.assertEquals(retrieved.getHeight(), expected.length, |
155 |
|
"Different number of sequences retrieved for query " + sq); |
156 |
|
|
157 |
0 |
for (SequenceI tr : expected) |
158 |
|
{ |
159 |
0 |
SequenceI[] rseq; |
160 |
0 |
Assert.assertNotNull(rseq = retrieved.findSequenceMatch(tr.getName()), |
161 |
|
"Couldn't find sequences matching expected sequence " |
162 |
|
+ tr.getName()); |
163 |
0 |
Assert.assertEquals(rseq.length, 1, |
164 |
|
"Expected only one sequence for sequence ID " + tr.getName()); |
165 |
0 |
Assert.assertEquals(rseq[0].getSequenceAsString(), |
166 |
|
tr.getSequenceAsString(), |
167 |
|
"Sequences differ for " + tr.getName() + "\n" + "Exp:" |
168 |
|
+ tr.getSequenceAsString() + "\n" + "Got:" |
169 |
|
+ rseq[0].getSequenceAsString()); |
170 |
|
} |
171 |
|
} |
172 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
1PASS
|
|
173 |
1 |
@Test(groups = "Functional")... |
174 |
|
public void getGenomicRangesFromFeatures() |
175 |
|
{ |
176 |
|
|
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
183 |
1 |
@Test(groups = "Functional")... |
184 |
|
public void testReverseComplementAllele() |
185 |
|
{ |
186 |
1 |
StringBuilder sb = new StringBuilder(); |
187 |
1 |
EnsemblSeqProxy.reverseComplementAllele(sb, "G"); |
188 |
1 |
EnsemblSeqProxy.reverseComplementAllele(sb, "g"); |
189 |
1 |
EnsemblSeqProxy.reverseComplementAllele(sb, "C"); |
190 |
1 |
EnsemblSeqProxy.reverseComplementAllele(sb, "T"); |
191 |
1 |
EnsemblSeqProxy.reverseComplementAllele(sb, "A"); |
192 |
1 |
assertEquals("C,c,G,A,T", sb.toString()); |
193 |
|
|
194 |
1 |
sb = new StringBuilder(); |
195 |
1 |
EnsemblSeqProxy.reverseComplementAllele(sb, "-GATt"); |
196 |
1 |
EnsemblSeqProxy.reverseComplementAllele(sb, "hgmd_mutation"); |
197 |
1 |
EnsemblSeqProxy.reverseComplementAllele(sb, "PhenCode_variation"); |
198 |
1 |
assertEquals("aATC-,hgmd_mutation,PhenCode_variation", sb.toString()); |
199 |
|
} |
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
205 |
1 |
@Test(groups = "Functional")... |
206 |
|
public void testReverseComplementAlleles() |
207 |
|
{ |
208 |
1 |
String alleles = "C,G,-TAC,HGMD_MUTATION,gac"; |
209 |
1 |
SequenceFeature sf = new SequenceFeature("sequence_variant", alleles, 1, |
210 |
|
2, 0f, null); |
211 |
1 |
sf.setValue("alleles", alleles); |
212 |
|
|
213 |
1 |
EnsemblSeqProxy.reverseComplementAlleles(sf); |
214 |
1 |
String revcomp = "G,C,GTA-,HGMD_MUTATION,gtc"; |
215 |
|
|
216 |
1 |
assertEquals(revcomp, sf.getDescription()); |
217 |
|
|
218 |
1 |
assertEquals(revcomp, sf.getValue("alleles")); |
219 |
|
} |
220 |
|
} |