X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fio%2FClustalFileTest.java;h=0277ce682b7e7542e12eef00c9e9ce965a776dfe;hb=cd7f028b24e8fccbcab05cf68acbea55da941943;hp=a912d9675e9f49d2cf92c279aeb78b68495ebbc7;hpb=7f6b9bd1d7bde3279468d87a205a01f729787d75;p=jalview.git diff --git a/test/jalview/io/ClustalFileTest.java b/test/jalview/io/ClustalFileTest.java index a912d96..0277ce6 100644 --- a/test/jalview/io/ClustalFileTest.java +++ b/test/jalview/io/ClustalFileTest.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.io; import static org.testng.Assert.assertEquals; @@ -11,7 +31,7 @@ import org.testng.annotations.Test; public class ClustalFileTest { - @Test(groups="Functional") + @Test(groups = "Functional") public void testParse_withNumbering() throws IOException { //@formatter:off @@ -25,7 +45,35 @@ public class ClustalFileTest + "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"; + + "FER1_PEA/1-60 SYKVKLV 60\n" + + " .* .:....*******..** ..........** ********...*:::* ...\n" + + "\t\t.:.::. *\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")); + } + + @Test(groups = "Functional") + public void testParse_noNumbering() throws IOException + { + //@formatter:off + String data = "CLUSTAL\n\n" + + "FER_CAPAA/1-8 -----------------------------------------------------------A\n" + + "FER_CAPAN/1-55 MA------SVSATMISTSFMPRKPAVTSL-KPIPNVGE--ALFGLKS-A--NGGKVTCMA\n" + + "FER1_SOLLC/1-55 MA------SISGTMISTSFLPRKPAVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA\n" + + "Q93XJ9_SOLTU/1-55 MA------SISGTMISTSFLPRKPVVTSL-KAISNVGE--ALFGLKS-G--RNGRITCMA\n" + + "FER1_PEA/1-60 MATT---PALYGTAVSTSFLRTQPMPMSV-TTTKAFSN--GFLGLKT-SLKRGDLAVAMA\n\n" + + "FER_CAPAA/1-8 SYKVKLI\n" + + "FER_CAPAN/1-55 SYKVKLI\n" + + "FER1_SOLLC/1-55 SYKVKLI\n" + + "Q93XJ9_SOLTU/1-55 SYKVKLI\n" + + "FER1_PEA/1-60 SYKVKLV\n"; //@formatter:on ClustalFile cf = new ClustalFile(data, DataSourceType.PASTE); cf.parse();