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