1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.io; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
import static org.testng.Assert.assertTrue; |
25 |
|
|
26 |
|
import jalview.datamodel.SequenceI; |
27 |
|
|
28 |
|
import java.io.IOException; |
29 |
|
|
30 |
|
import org.testng.annotations.Test; |
31 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 2 |
Complexity Density: 0.11 |
|
32 |
|
public class ClustalFileTest |
33 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
34 |
1 |
@Test(groups = "Functional")... |
35 |
|
public void testParse_withNumbering() throws IOException |
36 |
|
{ |
37 |
|
|
38 |
1 |
String data = "CLUSTAL\n\n" |
39 |
|
+ "FER_CAPAA/1-8 -----------------------------------------------------------A\t1\n" |
40 |
|
+ "FER_CAPAN/1-55 MA------SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALFGLKS-A--NGGKVTCMA 48\n" |
41 |
|
+ "FER1_SOLLC/1-55 MA------SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA 48\n" |
42 |
|
+ "Q93XJ9_SOLTU/1-55 MA------SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA 48\n" |
43 |
|
+ "FER1_PEA/1-60 MATT---PALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFLGLKT-SLKRGDLAVAMA 53\n\n" |
44 |
|
+ "FER_CAPAA/1-8 SYKVKLI 8\n" |
45 |
|
+ "FER_CAPAN/1-55 SYKVKLI 55\n" |
46 |
|
+ "FER1_SOLLC/1-55 SYKVKLI 55\n" |
47 |
|
+ "Q93XJ9_SOLTU/1-55 SYKVKLI 55\n" |
48 |
|
+ "FER1_PEA/1-60 SYKVKLV 60\n" |
49 |
|
+ " .* .:....*******..** ..........** ********...*:::* ...\n" |
50 |
|
+ "\t\t.:.::. *\n"; |
51 |
|
|
52 |
1 |
ClustalFile cf = new ClustalFile(data, DataSourceType.PASTE); |
53 |
1 |
cf.parse(); |
54 |
1 |
SequenceI[] seqs = cf.getSeqsAsArray(); |
55 |
1 |
assertEquals(seqs.length, 5); |
56 |
1 |
assertEquals(seqs[0].getName(), "FER_CAPAA"); |
57 |
1 |
assertEquals(seqs[0].getStart(), 1); |
58 |
1 |
assertEquals(seqs[0].getEnd(), 8); |
59 |
1 |
assertTrue(seqs[0].getSequenceAsString().endsWith("ASYKVKLI")); |
60 |
|
} |
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
62 |
1 |
@Test(groups = "Functional")... |
63 |
|
public void testParse_noNumbering() throws IOException |
64 |
|
{ |
65 |
|
|
66 |
1 |
String data = "CLUSTAL\n\n" |
67 |
|
+ "FER_CAPAA/1-8 -----------------------------------------------------------A\n" |
68 |
|
+ "FER_CAPAN/1-55 MA------SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALFGLKS-A--NGGKVTCMA\n" |
69 |
|
+ "FER1_SOLLC/1-55 MA------SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA\n" |
70 |
|
+ "Q93XJ9_SOLTU/1-55 MA------SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA\n" |
71 |
|
+ "FER1_PEA/1-60 MATT---PALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFLGLKT-SLKRGDLAVAMA\n\n" |
72 |
|
+ "FER_CAPAA/1-8 SYKVKLI\n" |
73 |
|
+ "FER_CAPAN/1-55 SYKVKLI\n" |
74 |
|
+ "FER1_SOLLC/1-55 SYKVKLI\n" |
75 |
|
+ "Q93XJ9_SOLTU/1-55 SYKVKLI\n" |
76 |
|
+ "FER1_PEA/1-60 SYKVKLV\n"; |
77 |
|
|
78 |
1 |
ClustalFile cf = new ClustalFile(data, DataSourceType.PASTE); |
79 |
1 |
cf.parse(); |
80 |
1 |
SequenceI[] seqs = cf.getSeqsAsArray(); |
81 |
1 |
assertEquals(seqs.length, 5); |
82 |
1 |
assertEquals(seqs[0].getName(), "FER_CAPAA"); |
83 |
1 |
assertEquals(seqs[0].getStart(), 1); |
84 |
1 |
assertEquals(seqs[0].getEnd(), 8); |
85 |
1 |
assertTrue(seqs[0].getSequenceAsString().endsWith("ASYKVKLI")); |
86 |
|
} |
87 |
|
} |