2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import static org.testng.Assert.assertEquals;
24 import static org.testng.Assert.assertTrue;
26 import jalview.datamodel.AlignmentAnnotation;
27 import jalview.datamodel.SequenceI;
29 import java.io.IOException;
31 import org.testng.annotations.Test;
33 public class FastaFileTest
35 @Test(groups = "Functional")
36 public void testParse_rnaFasta() throws IOException
38 String rnaseq = "gGGGGCCACAGCAGAAGCGUUCACGUCGCAGCCCCUGUCAGCCAUUGCACUCCGGCUGCGAAUUCUGCU",
39 rnastruct = "[[[[[[...((((((((((.......))).]]]]]]..(((((..........)))))....)))))))";
41 String rna_fasta = ">strand_B\n"
45 FastaFile cf = new FastaFile(rna_fasta, DataSourceType.PASTE);
46 SequenceI[] seqs = cf.getSeqsAsArray();
47 AlignmentAnnotation[] aa = cf.annotations.toArray(new AlignmentAnnotation[1]);
48 assertEquals(seqs.length, 1);
49 assertEquals(seqs[0].getName(), "strand_B");
50 assertEquals(seqs[0].getStart(), 1);
51 assertEquals(seqs[0].getEnd(), 69);
52 assertTrue(seqs[0].getSequenceAsString().endsWith("UUCUGCU"));
53 assertTrue(seqs[0].getAnnotation()!=null);
54 assertEquals(seqs[0].getAnnotation().length,1);
55 assertEquals(seqs[0].getAnnotation()[0].getRNAStruc(),rnastruct);