| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.bin; |
| 22 |
|
|
| 23 |
|
import java.util.Date; |
| 24 |
|
import java.util.List; |
| 25 |
|
|
| 26 |
|
import org.testng.Assert; |
| 27 |
|
import org.testng.annotations.AfterClass; |
| 28 |
|
import org.testng.annotations.AfterMethod; |
| 29 |
|
import org.testng.annotations.BeforeClass; |
| 30 |
|
import org.testng.annotations.DataProvider; |
| 31 |
|
import org.testng.annotations.Test; |
| 32 |
|
|
| 33 |
|
import jalview.api.AlignViewportI; |
| 34 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 35 |
|
import jalview.datamodel.AlignmentI; |
| 36 |
|
import jalview.datamodel.SequenceI; |
| 37 |
|
import jalview.gui.AlignFrame; |
| 38 |
|
import jalview.gui.AlignmentPanel; |
| 39 |
|
import jalview.gui.Desktop; |
| 40 |
|
import jalview.gui.JvOptionPane; |
| 41 |
|
import jalview.gui.StructureViewerBase; |
| 42 |
|
|
| |
|
| 95.2% |
Uncovered Elements: 4 (83) |
Complexity: 20 |
Complexity Density: 0.36 |
|
| 43 |
|
public class CommandsTest2 |
| 44 |
|
{ |
| |
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 45 |
1 |
@BeforeClass(alwaysRun = true)... |
| 46 |
|
public static void setUpBeforeClass() throws Exception |
| 47 |
|
{ |
| 48 |
1 |
Cache.loadProperties("test/jalview/bin/commandsTest.jvprops"); |
| 49 |
1 |
Date oneHourFromNow = new Date( |
| 50 |
|
System.currentTimeMillis() + 3600 * 1000); |
| 51 |
1 |
Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", oneHourFromNow); |
| 52 |
1 |
if (Desktop.instance != null) |
| 53 |
1 |
Desktop.instance.closeAll_actionPerformed(null); |
| 54 |
|
|
| 55 |
|
} |
| 56 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 57 |
1 |
@AfterClass(alwaysRun = true)... |
| 58 |
|
public static void resetProps() |
| 59 |
|
{ |
| 60 |
1 |
Cache.loadProperties("test/jalview/testProps.jvprops"); |
| 61 |
|
} |
| 62 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 63 |
1 |
@BeforeClass(alwaysRun = true)... |
| 64 |
|
public void setUpJvOptionPane() |
| 65 |
|
{ |
| 66 |
1 |
JvOptionPane.setInteractiveMode(false); |
| 67 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
| 68 |
|
} |
| 69 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 70 |
23 |
@AfterMethod(alwaysRun = true)... |
| 71 |
|
public void tearDown() |
| 72 |
|
{ |
| 73 |
23 |
Desktop.closeDesktop(); |
| 74 |
|
} |
| 75 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 76 |
20 |
@Test(... |
| 77 |
|
groups = |
| 78 |
|
{ "Functional", "testTask1" }, |
| 79 |
|
dataProvider = "structureOpeningArgsParams", |
| 80 |
|
singleThreaded = true) |
| 81 |
|
public void do_structureOpeningArgsTest(String cmdLine, int seqNum, |
| 82 |
|
int annNum, int pdbPerSeqNum, int viewerNum) |
| 83 |
|
{ |
| 84 |
20 |
_do_structureOpeningArgsTest(cmdLine, seqNum, annNum, pdbPerSeqNum, |
| 85 |
|
viewerNum); |
| 86 |
|
} |
| 87 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 88 |
3 |
@Test(... |
| 89 |
|
groups = |
| 90 |
|
{ "Network", "testTask1" }, |
| 91 |
|
dataProvider = "structureOpeningArgsNetworkParams", |
| 92 |
|
singleThreaded = true) |
| 93 |
|
public void do_network_structureOpeningArgsTest(String cmdLine, |
| 94 |
|
int seqNum, int annNum, int pdbPerSeqNum, int viewerNum) |
| 95 |
|
{ |
| 96 |
3 |
_do_structureOpeningArgsTest(cmdLine, seqNum, annNum, pdbPerSeqNum, |
| 97 |
|
viewerNum); |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| |
|
| 94.7% |
Uncovered Elements: 3 (57) |
Complexity: 11 |
Complexity Density: 0.27 |
|
| 103 |
23 |
public void _do_structureOpeningArgsTest(String cmdLine, int seqNum,... |
| 104 |
|
int annNum, int strucPerSeqNum, int viewerNum) |
| 105 |
|
{ |
| 106 |
23 |
String[] args = cmdLine.split("\\s+"); |
| 107 |
|
|
| 108 |
23 |
CommandsTest.callJalviewMain(args); |
| 109 |
44 |
while (Desktop.instance != null |
| 110 |
|
&& Desktop.instance.operationsAreInProgress()) |
| 111 |
|
{ |
| 112 |
21 |
try |
| 113 |
|
{ |
| 114 |
|
|
| 115 |
21 |
Thread.sleep(viewerNum * 50); |
| 116 |
|
} catch (InterruptedException e) |
| 117 |
|
{ |
| 118 |
0 |
e.printStackTrace(); |
| 119 |
|
} |
| 120 |
|
} |
| 121 |
23 |
; |
| 122 |
|
|
| 123 |
23 |
AlignFrame[] afs = Desktop.getDesktopAlignFrames(); |
| 124 |
23 |
Assert.assertNotNull(afs); |
| 125 |
23 |
Assert.assertTrue(afs.length > 0); |
| 126 |
|
|
| 127 |
23 |
AlignFrame af = afs[0]; |
| 128 |
23 |
Assert.assertNotNull(af); |
| 129 |
|
|
| 130 |
23 |
AlignmentPanel ap = af.alignPanel; |
| 131 |
23 |
Assert.assertNotNull(ap); |
| 132 |
|
|
| 133 |
23 |
AlignmentI al = ap.getAlignment(); |
| 134 |
23 |
Assert.assertNotNull(al); |
| 135 |
|
|
| 136 |
23 |
List<SequenceI> seqs = al.getSequences(); |
| 137 |
23 |
Assert.assertNotNull(seqs); |
| 138 |
|
|
| 139 |
23 |
if (seqNum > -1) |
| 140 |
|
{ |
| 141 |
16 |
Assert.assertEquals(seqs.size(), seqNum, "Wrong number of sequences"); |
| 142 |
|
} |
| 143 |
|
|
| 144 |
23 |
AlignViewportI av = ap.getAlignViewport(); |
| 145 |
23 |
Assert.assertNotNull(av); |
| 146 |
|
|
| 147 |
23 |
AlignmentAnnotation[] aas = al.getAlignmentAnnotation(); |
| 148 |
23 |
int visibleAnn = 0; |
| 149 |
23 |
int dcount = 0; |
| 150 |
|
|
| 151 |
23 |
if (strucPerSeqNum > -1) |
| 152 |
|
{ |
| 153 |
16 |
for (AlignmentAnnotation aa : aas) |
| 154 |
|
{ |
| 155 |
120 |
if (aa.visible) |
| 156 |
104 |
visibleAnn++; |
| 157 |
120 |
if (aa.sequenceRef != null) |
| 158 |
|
{ |
| 159 |
44 |
Assert.assertEquals( |
| 160 |
|
aa.sequenceRef.getDatasetSequence().getAllPDBEntries() |
| 161 |
|
.size(), |
| 162 |
|
strucPerSeqNum, |
| 163 |
|
"Unexpected number of structures for sequence"); |
| 164 |
|
} |
| 165 |
|
} |
| 166 |
|
} |
| 167 |
|
|
| 168 |
23 |
if (annNum > -1) |
| 169 |
|
{ |
| 170 |
16 |
Assert.assertEquals(visibleAnn, annNum, |
| 171 |
|
"Wrong number of visible annotations"); |
| 172 |
|
} |
| 173 |
|
|
| 174 |
23 |
if (viewerNum > -1) |
| 175 |
|
{ |
| 176 |
23 |
List<StructureViewerBase> openViewers = Desktop.instance |
| 177 |
|
.getStructureViewers(ap, null); |
| 178 |
23 |
Assert.assertNotNull(openViewers); |
| 179 |
23 |
int count = 0; |
| 180 |
23 |
for (StructureViewerBase svb : openViewers) |
| 181 |
|
{ |
| 182 |
30 |
if (svb.isVisible()) |
| 183 |
|
{ |
| 184 |
30 |
count++; |
| 185 |
|
} |
| 186 |
|
} |
| 187 |
23 |
Assert.assertEquals(count, viewerNum, |
| 188 |
|
"Wrong number of structure viewers opened"); |
| 189 |
|
} |
| 190 |
|
} |
| 191 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 192 |
1 |
@DataProvider(name = "structureOpeningArgsNetworkParams")... |
| 193 |
|
public Object[][] structureOpeningArgsNetworkParams() |
| 194 |
|
{ |
| 195 |
|
|
| 196 |
|
|
| 197 |
|
|
| 198 |
|
|
| 199 |
|
|
| 200 |
|
|
| 201 |
|
|
| 202 |
1 |
return new Object[][] { |
| 203 |
|
|
| 204 |
|
|
| 205 |
|
|
| 206 |
|
|
| 207 |
|
{ "--gui --nonews --nosplash --debug " |
| 208 |
|
+ "--open https://www.jalview.org/examples/uniref50.fa " |
| 209 |
|
+ "--colour=gecos-flower " |
| 210 |
|
+ "--structure=[seqid=FER1_SPIOL]https://www.jalview.org/examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
| 211 |
|
+ "--paematrix=https://www.jalview.org/examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
| 212 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
| 213 |
|
15, 7, 1, 1 }, |
| 214 |
|
|
| 215 |
|
|
| 216 |
|
|
| 217 |
|
|
| 218 |
|
{ "--gui --nonews --nosplash --debug " |
| 219 |
|
+ "--open=https://www.jalview.org/examples/uniref50.fa " |
| 220 |
|
+ "--colour=gecos-flower " |
| 221 |
|
+ "--structure=[seqid=FER1_SPIOL]https://www.jalview.org/examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
| 222 |
|
+ "--paematrix=https://www.jalview.org/examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
| 223 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
| 224 |
|
15, 7, 1, 1 }, |
| 225 |
|
|
| 226 |
|
|
| 227 |
|
|
| 228 |
|
|
| 229 |
|
{ "--gui --nonews --nosplash --debug " |
| 230 |
|
+ "--append=https://www.jalview.org/examples/uniref50.fa " |
| 231 |
|
+ "--colour=gecos-flower " |
| 232 |
|
+ "--structure=[seqid=FER1_SPIOL]https://www.jalview.org/examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
| 233 |
|
+ "--paematrix=https://www.jalview.org/examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
| 234 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
| 235 |
|
15, 7, 1, 1 }, }; |
| 236 |
|
} |
| 237 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 238 |
1 |
@DataProvider(name = "structureOpeningArgsParams")... |
| 239 |
|
public Object[][] structureOpeningArgsParams() |
| 240 |
|
{ |
| 241 |
|
|
| 242 |
|
|
| 243 |
|
|
| 244 |
|
|
| 245 |
|
|
| 246 |
|
|
| 247 |
|
|
| 248 |
1 |
String stdargs = "--gui --nonews --nosplash --debug "; |
| 249 |
1 |
String stdargs2 = stdargs |
| 250 |
|
+ "--nowebservicediscovery --props=test/jalview/bin/commandsTest.jvprops "; |
| 251 |
1 |
return new Object[][] { |
| 252 |
|
|
| 253 |
|
|
| 254 |
|
|
| 255 |
|
{ stdargs + "--append=examples/uniref50.fa " |
| 256 |
|
+ "--colour=gecos-flower " |
| 257 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
| 258 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
| 259 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
| 260 |
|
15, 7, 1, 1 }, |
| 261 |
|
{ stdargs + "--append=examples/uniref50.fa " |
| 262 |
|
+ "--colour=gecos-flower " |
| 263 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
| 264 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
| 265 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops2 ", |
| 266 |
|
15, 4, 1, 1 }, |
| 267 |
|
{ stdargs + "--append=examples/uniref50.fa " |
| 268 |
|
+ "--colour=gecos-flower " |
| 269 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
| 270 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
| 271 |
|
+ "--noshowssannotations " |
| 272 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
| 273 |
|
15, 4, 1, 1 }, |
| 274 |
|
{ stdargs + "--append=examples/uniref50.fa " |
| 275 |
|
+ "--colour=gecos-flower " |
| 276 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
| 277 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
| 278 |
|
+ "--noshowannotations " |
| 279 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
| 280 |
|
15, 3, 1, 1 }, |
| 281 |
|
{ stdargs + "--append=examples/uniref50.fa " |
| 282 |
|
+ "--colour=gecos-flower " |
| 283 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
| 284 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
| 285 |
|
+ "--noshowannotations " + "--noshowssannotations " |
| 286 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
| 287 |
|
15, 0, 1, 1 }, |
| 288 |
|
{ stdargs + "--append=examples/uniref50.fa " |
| 289 |
|
+ "--colour=gecos-flower " |
| 290 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
| 291 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
| 292 |
|
+ "--noshowannotations " + "--noshowssannotations " |
| 293 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
| 294 |
|
15, 0, 1, 1 }, |
| 295 |
|
{ stdargs2 + "--argfile=test/jalview/bin/commandsTest2.argfile1 ", |
| 296 |
|
16, 19, 5, 3 }, |
| 297 |
|
{ stdargs2 + "--argfile=test/jalview/bin/commandsTest2.argfile2 ", |
| 298 |
|
16, 0, 5, 2 }, |
| 299 |
|
{ stdargs2 + "--open=./examples/test_fab41.result/sample.a2m " |
| 300 |
|
+ "--allstructures " |
| 301 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb " |
| 302 |
|
+ "--structureviewer=none " |
| 303 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_2_model_4.pdb " |
| 304 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_3_model_2.pdb", |
| 305 |
|
16, 10, 3, 0 }, |
| 306 |
|
{ stdargs2 + "--open=./examples/test_fab41.result/sample.a2m " |
| 307 |
|
+ "--allstructures " |
| 308 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb " |
| 309 |
|
+ "--noallstructures " + "--structureviewer=none " |
| 310 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_2_model_4.pdb " |
| 311 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_3_model_2.pdb", |
| 312 |
|
16, 10, 3, 2 }, |
| 313 |
|
|
| 314 |
|
|
| 315 |
|
{ stdargs2 + "--open=./examples/plantfdx.fa ", 15, 4, 0, 0 }, |
| 316 |
|
{ stdargs2 + "--open=./examples/plantfdx.fa " |
| 317 |
|
+ "--annotations=./examples/testdata/plantfdx.annotations ", |
| 318 |
|
15, 10, 0, 0 }, |
| 319 |
|
{ stdargs2 + "--open=./examples/plantfdx.fa " |
| 320 |
|
+ "--annotations=./examples/testdata/plantfdx.annotations " |
| 321 |
|
+ "--annotations=./examples/testdata/FER1_SPIOL.plddt " |
| 322 |
|
+ "--annotations=./examples/testdata/FER1_SPIOL.paematrix ", |
| 323 |
|
15, 12, 0, 0 }, |
| 324 |
|
|
| 325 |
|
{ stdargs2 + "--open=./examples/uniref50.fa " |
| 326 |
|
+ "--structure=./examples/AF-P83527-F1-model_v4.cif --seqid=FER_CAPAA " |
| 327 |
|
+ "--structure=./examples/SM-P83527-FER_CAPAA.pdb --seqid=FER_CAPAA --nosuperpose " |
| 328 |
|
+ "--structure=./examples/AlphaFold/AF-P00221-F1-model_v4.pdb --seqid=FER1_SPIOL ", |
| 329 |
|
-1, -1, -1, 3 }, |
| 330 |
|
{ stdargs2 + "--open=./examples/uniref50.fa " |
| 331 |
|
+ "--structure=./examples/AF-P83527-F1-model_v4.cif --seqid=FER_CAPAA --viewerid=id1 " |
| 332 |
|
+ "--structure=./examples/SM-P83527-FER_CAPAA.pdb --seqid=FER_CAPAA --nosuperpose --viewerid=id1 " |
| 333 |
|
+ "--structure=./examples/AlphaFold/AF-P00221-F1-model_v4.pdb --seqid=FER1_SPIOL ", |
| 334 |
|
-1, -1, -1, 2 }, |
| 335 |
|
{ stdargs2 + "--open=./examples/uniref50.fa " |
| 336 |
|
+ "--structure=./examples/AF-P83527-F1-model_v4.cif --seqid=FER_CAPAA --viewerid=id1 " |
| 337 |
|
+ "--structure=./examples/SM-P83527-FER_CAPAA.pdb --seqid=FER_CAPAA --nosuperpose --viewerid=id1 " |
| 338 |
|
+ "--structure=./examples/AlphaFold/AF-P00221-F1-model_v4.pdb --seqid=FER1_SPIOL --viewerid=id2 ", |
| 339 |
|
-1, -1, -1, 2 }, |
| 340 |
|
{ stdargs2 + "--open=./examples/uniref50.fa " |
| 341 |
|
+ "--structure=./examples/AF-P83527-F1-model_v4.cif --seqid=FER_CAPAA --viewerid=id1 " |
| 342 |
|
+ "--structure=./examples/SM-P83527-FER_CAPAA.pdb --seqid=FER_CAPAA --nosuperpose --viewerid=id1 " |
| 343 |
|
+ "--structure=./examples/AlphaFold/AF-P00221-F1-model_v4.pdb --seqid=FER1_SPIOL --viewerid=id1 ", |
| 344 |
|
-1, -1, -1, 1 }, |
| 345 |
|
{ stdargs2 + "--open=./examples/uniref50.fa " |
| 346 |
|
+ "--structuresfile=./examples/structuresfile.txt ", |
| 347 |
|
-1, -1, -1, 1 }, |
| 348 |
|
{ stdargs2 + "--open=./examples/uniref50.fa " |
| 349 |
|
+ "--structuresfile=./examples/structuresfile.txt " |
| 350 |
|
+ "--structure=./examples/SM-P83527-FER_CAPAA.pdb --seqid=FER_CAPAA --nosuperpose --viewerid=id1 " |
| 351 |
|
+ "--structuresfile=./examples/structuresfile2.txt ", |
| 352 |
|
-1, -1, -1, 3 }, |
| 353 |
|
{ stdargs2 + "--open=./examples/uniref50.fa " |
| 354 |
|
+ "--structuresfile=./examples/structuresfile.txt " |
| 355 |
|
+ "--structure=./examples/SM-P83527-FER_CAPAA.pdb --seqid=FER_CAPAA --nosuperpose --viewerid=THIS " |
| 356 |
|
+ "--structuresfile=./examples/structuresfile2.txt ", |
| 357 |
|
-1, -1, -1, 2 }, |
| 358 |
|
|
| 359 |
|
|
| 360 |
|
|
| 361 |
|
}; |
| 362 |
|
} |
| 363 |
|
} |