From: gmungoc Date: Wed, 23 May 2018 15:49:53 +0000 (+0100) Subject: JAL-2997 unit test X-Git-Tag: Release_2_10_5~72 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7f6b9bd1d7bde3279468d87a205a01f729787d75;p=jalview.git JAL-2997 unit test --- diff --git a/test/jalview/io/ClustalFileTest.java b/test/jalview/io/ClustalFileTest.java new file mode 100644 index 0000000..a912d96 --- /dev/null +++ b/test/jalview/io/ClustalFileTest.java @@ -0,0 +1,39 @@ +package jalview.io; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import jalview.datamodel.SequenceI; + +import java.io.IOException; + +import org.testng.annotations.Test; + +public class ClustalFileTest +{ + @Test(groups="Functional") + public void testParse_withNumbering() throws IOException + { + //@formatter:off + String data = "CLUSTAL\n\n" + + "FER_CAPAA/1-8 -----------------------------------------------------------A\t1\n" + + "FER_CAPAN/1-55 MA------SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALFGLKS-A--NGGKVTCMA 48\n" + + "FER1_SOLLC/1-55 MA------SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA 48\n" + + "Q93XJ9_SOLTU/1-55 MA------SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA 48\n" + + "FER1_PEA/1-60 MATT---PALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFLGLKT-SLKRGDLAVAMA 53\n\n" + + "FER_CAPAA/1-8 SYKVKLI 8\n" + + "FER_CAPAN/1-55 SYKVKLI 55\n" + + "FER1_SOLLC/1-55 SYKVKLI 55\n" + + "Q93XJ9_SOLTU/1-55 SYKVKLI 55\n" + + "FER1_PEA/1-60 SYKVKLV 60\n"; + //@formatter:on + ClustalFile cf = new ClustalFile(data, DataSourceType.PASTE); + cf.parse(); + SequenceI[] seqs = cf.getSeqsAsArray(); + assertEquals(seqs.length, 5); + assertEquals(seqs[0].getName(), "FER_CAPAA"); + assertEquals(seqs[0].getStart(), 1); + assertEquals(seqs[0].getEnd(), 8); + assertTrue(seqs[0].getSequenceAsString().endsWith("ASYKVKLI")); + } +}