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 |
|
|
|
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 8 |
Complexity Density: 0.24 |
|
42 |
|
public class EnsemblSeqProxyTest |
43 |
|
{ |
44 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
45 |
0 |
@BeforeClass(alwaysRun = true)... |
46 |
|
public void setUpJvOptionPane() |
47 |
|
{ |
48 |
0 |
JvOptionPane.setInteractiveMode(false); |
49 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
127 |
0 |
@BeforeClass(alwaysRun = true)... |
128 |
|
public void setUp() |
129 |
|
{ |
130 |
0 |
SequenceOntologyFactory.setInstance(new SequenceOntologyLite()); |
131 |
|
} |
132 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
133 |
0 |
@AfterClass(alwaysRun = true)... |
134 |
|
public void tearDown() |
135 |
|
{ |
136 |
0 |
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: - |
4-
|
|
173 |
0 |
@Test(groups = "Functional")... |
174 |
|
public void getGenomicRangesFromFeatures() |
175 |
|
{ |
176 |
|
|
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
4-
|
|
183 |
0 |
@Test(groups = "Functional")... |
184 |
|
public void testReverseComplementAllele() |
185 |
|
{ |
186 |
0 |
StringBuilder sb = new StringBuilder(); |
187 |
0 |
EnsemblSeqProxy.reverseComplementAllele(sb, "G"); |
188 |
0 |
EnsemblSeqProxy.reverseComplementAllele(sb, "g"); |
189 |
0 |
EnsemblSeqProxy.reverseComplementAllele(sb, "C"); |
190 |
0 |
EnsemblSeqProxy.reverseComplementAllele(sb, "T"); |
191 |
0 |
EnsemblSeqProxy.reverseComplementAllele(sb, "A"); |
192 |
0 |
assertEquals("C,c,G,A,T", sb.toString()); |
193 |
|
|
194 |
0 |
sb = new StringBuilder(); |
195 |
0 |
EnsemblSeqProxy.reverseComplementAllele(sb, "-GATt"); |
196 |
0 |
EnsemblSeqProxy.reverseComplementAllele(sb, "hgmd_mutation"); |
197 |
0 |
EnsemblSeqProxy.reverseComplementAllele(sb, "PhenCode_variation"); |
198 |
0 |
assertEquals("aATC-,hgmd_mutation,PhenCode_variation", sb.toString()); |
199 |
|
} |
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
4-
|
|
205 |
0 |
@Test(groups = "Functional")... |
206 |
|
public void testReverseComplementAlleles() |
207 |
|
{ |
208 |
0 |
String alleles = "C,G,-TAC,HGMD_MUTATION,gac"; |
209 |
0 |
SequenceFeature sf = new SequenceFeature("sequence_variant", alleles, 1, |
210 |
|
2, 0f, null); |
211 |
0 |
sf.setValue("alleles", alleles); |
212 |
|
|
213 |
0 |
EnsemblSeqProxy.reverseComplementAlleles(sf); |
214 |
0 |
String revcomp = "G,C,GTA-,HGMD_MUTATION,gtc"; |
215 |
|
|
216 |
0 |
assertEquals(revcomp, sf.getDescription()); |
217 |
|
|
218 |
0 |
assertEquals(revcomp, sf.getValue("alleles")); |
219 |
|
} |
220 |
|
} |