1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.analysis; |
22 |
|
|
23 |
|
import jalview.datamodel.Alignment; |
24 |
|
import jalview.datamodel.AlignmentI; |
25 |
|
import jalview.datamodel.Sequence; |
26 |
|
import jalview.datamodel.SequenceFeature; |
27 |
|
import jalview.datamodel.SequenceI; |
28 |
|
import jalview.gui.JvOptionPane; |
29 |
|
|
30 |
|
import java.util.Hashtable; |
31 |
|
|
32 |
|
import org.testng.Assert; |
33 |
|
import org.testng.annotations.BeforeClass; |
34 |
|
import org.testng.annotations.Test; |
35 |
|
|
36 |
|
|
37 |
|
@author |
38 |
|
|
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (22) |
Complexity: 2 |
Complexity Density: 0.1 |
|
40 |
|
public class SeqsetUtilsTest |
41 |
|
{ |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
43 |
1 |
@BeforeClass(alwaysRun = true)... |
44 |
|
public void setUpJvOptionPane() |
45 |
|
{ |
46 |
1 |
JvOptionPane.setInteractiveMode(false); |
47 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
48 |
|
} |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
54 |
1 |
@Test(groups = { "Functional" })... |
55 |
|
public void testSeqFeatureAddition() |
56 |
|
{ |
57 |
1 |
SequenceI[] sqset = new SequenceI[] { new Sequence("Aseq1", "AREALSEQ"), |
58 |
|
new Sequence("Aseq2", "AREALSEQ") }; |
59 |
|
|
60 |
1 |
AlignmentI al = new Alignment(sqset); |
61 |
1 |
al.setDataset(null); |
62 |
1 |
AlignmentI ds = al.getDataset(); |
63 |
1 |
SequenceFeature sf1 = new SequenceFeature("f1", "foo", 2, 3, "far"); |
64 |
1 |
SequenceFeature sf2 = new SequenceFeature("f2", "foo", 2, 3, "far"); |
65 |
1 |
ds.getSequenceAt(0).addSequenceFeature(sf1); |
66 |
1 |
Hashtable unq = SeqsetUtils.uniquify(sqset, true); |
67 |
1 |
SequenceI[] sqset2 = new SequenceI[] { |
68 |
|
new Sequence(sqset[0].getName(), sqset[0].getSequenceAsString()), |
69 |
|
new Sequence(sqset[1].getName(), sqset[1].getSequenceAsString()) }; |
70 |
1 |
Assert.assertSame(sqset[0].getSequenceFeatures().get(0), sf1); |
71 |
1 |
Assert.assertTrue(sqset2[0].getSequenceFeatures().isEmpty()); |
72 |
1 |
ds.getSequenceAt(0).addSequenceFeature(sf2); |
73 |
1 |
Assert.assertEquals(sqset[0].getSequenceFeatures().size(), 2); |
74 |
1 |
SeqsetUtils.deuniquify(unq, sqset2); |
75 |
|
|
76 |
|
|
77 |
1 |
Assert.assertEquals(sqset[0].getSequenceFeatures().size(), 2); |
78 |
1 |
Assert.assertEquals(sqset2[0].getSequenceFeatures().size(), 2); |
79 |
1 |
Assert.assertSame(sqset[0].getSequenceFeatures().get(0), |
80 |
|
sqset2[0].getSequenceFeatures().get(0)); |
81 |
1 |
Assert.assertSame(sqset[0].getSequenceFeatures().get(1), |
82 |
|
sqset2[0].getSequenceFeatures().get(1)); |
83 |
|
} |
84 |
|
} |