3 import static org.testng.Assert.assertEquals;
4 import static org.testng.Assert.assertTrue;
6 import jalview.datamodel.SequenceI;
8 import java.io.IOException;
10 import org.testng.annotations.Test;
12 public class ClustalFileTest
14 @Test(groups="Functional")
15 public void testParse_withNumbering() throws IOException
18 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"
32 ClustalFile cf = new ClustalFile(data, DataSourceType.PASTE);
34 SequenceI[] seqs = cf.getSeqsAsArray();
35 assertEquals(seqs.length, 5);
36 assertEquals(seqs[0].getName(), "FER_CAPAA");
37 assertEquals(seqs[0].getStart(), 1);
38 assertEquals(seqs[0].getEnd(), 8);
39 assertTrue(seqs[0].getSequenceAsString().endsWith("ASYKVKLI"));
42 @Test(groups="Functional")
43 public void testParse_noNumbering() throws IOException
46 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";
58 ClustalFile cf = new ClustalFile(data, DataSourceType.PASTE);
60 SequenceI[] seqs = cf.getSeqsAsArray();
61 assertEquals(seqs.length, 5);
62 assertEquals(seqs[0].getName(), "FER_CAPAA");
63 assertEquals(seqs[0].getStart(), 1);
64 assertEquals(seqs[0].getEnd(), 8);
65 assertTrue(seqs[0].getSequenceAsString().endsWith("ASYKVKLI"));