JAL-2114 save 'raw' ENA location as a sequence feature attribute
[jalview.git] / test / jalview / datamodel / xdb / embl / EmblEntryTest.java
1 package jalview.datamodel.xdb.embl;
2
3 import static org.testng.AssertJUnit.assertEquals;
4
5 import jalview.datamodel.Sequence;
6 import jalview.datamodel.SequenceI;
7
8 import java.util.ArrayList;
9 import java.util.Arrays;
10 import java.util.List;
11
12 import org.testng.annotations.Test;
13
14 public class EmblEntryTest
15 {
16   @Test(groups = "Functional")
17   public void testGetCdsRanges()
18   {
19     EmblEntry testee = new EmblEntry();
20
21     /*
22      * Make a (CDS) Feature with 4 locations
23      */
24     EmblFeature cds = new EmblFeature();
25     cds.setLocation("join(10..20,complement(30..40),50..60,70..80,complement(110..120))");
26
27     int[] exons = testee.getCdsRanges(cds);
28     assertEquals("[10, 20, 40, 30, 50, 60, 70, 80, 120, 110]",
29             Arrays.toString(exons));
30   }
31
32   @Test(groups = "Functional")
33   public void testParseCodingFeature()
34   {
35     // not the whole sequence but enough for this test...
36     SequenceI dna = new Sequence("J03321", "GGATCCGTAAGTTAGACGAAATT");
37     List<SequenceI> peptides = new ArrayList<SequenceI>();
38     EmblFile ef = EmblTestHelper.getEmblFile();
39     EmblFeature feature = null;
40     for (EmblFeature feat : ef.getEntries().get(0).getFeatures())
41     {
42       if ("CDS".equals(feat.getName()))
43       {
44         feature = feat;
45         break;
46       }
47     }
48
49     EmblEntry testee = new EmblEntry();
50     testee.parseCodingFeature(feature, "EMBL", dna, peptides);
51   }
52 }