+
+ @Test(groups = { "Functional" }, dataProvider = "openStructureFileParams")
+ public void openStructureFileForSequenceTest(String alfile, String seqid,
+ String sFilename, TFType tft, String paeFilename,
+ boolean showRefAnnotations, boolean doXferSettings,
+ ViewerType viewerType, int seqNum, int annNum, int viewerNum,
+ String propsFile)
+ {
+ Cache.loadProperties(
+ propsFile == null ? "test/jalview/io/testProps.jvprops"
+ : propsFile);
+
+ Jalview.main(
+ propsFile == null ? null : new String[]
+ { "--props", propsFile });
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.OK_OPTION);
+
+ FileLoader fileLoader = new FileLoader(true);
+ FileFormatI format = null;
+ File alFile = new File(alfile);
+ try
+ {
+ format = new IdentifyFile().identify(alFile, DataSourceType.FILE);
+ } catch (FileFormatException e1)
+ {
+ Assert.fail(
+ "Unknown file format for '" + alFile.getAbsolutePath() + "'");
+ }
+
+ AlignFrame af = fileLoader.LoadFileWaitTillLoaded(alFile,
+ DataSourceType.FILE, format);
+ AlignmentPanel ap = af.alignPanel;
+ Assert.assertNotNull("No alignPanel", ap);
+
+ AlignmentI al = ap.getAlignment();
+ Assert.assertNotNull(al);
+
+ SequenceI seq = al.findName(seqid);
+ Assert.assertNotNull("Sequence '" + seqid + "' not found in alignment",
+ seq);
+
+ StructureChooser.openStructureFileForSequence(null, null, ap, seq,
+ false, sFilename, tft, paeFilename, false, showRefAnnotations,
+ doXferSettings, viewerType);
+
+ List<SequenceI> seqs = al.getSequences();
+ Assert.assertNotNull(seqs);
+
+ Assert.assertEquals("Wrong number of sequences", seqNum, seqs.size());
+
+ AlignViewportI av = ap.getAlignViewport();
+ Assert.assertNotNull(av);
+
+ AlignmentAnnotation[] aas = al.getAlignmentAnnotation();
+ int visibleAnn = 0;
+ for (AlignmentAnnotation aa : aas)
+ {
+ if (aa.visible)
+ visibleAnn++;
+ }
+ Assert.assertEquals("Wrong number of viewed annotations", annNum,
+ visibleAnn);
+
+ if (viewerNum > -1)
+ {
+ try
+ {
+ Thread.sleep(100);
+ } catch (InterruptedException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ List<StructureViewerBase> openViewers = Desktop.instance
+ .getStructureViewers(ap, null);
+ Assert.assertNotNull(openViewers);
+ Assert.assertEquals("Wrong number of structure viewers opened",
+ viewerNum, openViewers.size());
+ }
+
+ if (af != null)
+ {
+ af.setVisible(false);
+ af.dispose();
+ }
+ }
+
+ @DataProvider(name = "openStructureFileParams")
+ public Object[][] openStructureFileParams()
+ {
+ /*
+ String alFile,
+ String seqid,
+ String structureFilename,
+ TFType tft,
+ String paeFilename,
+ boolean showRefAnnotations,
+ boolean doXferSettings, // false for Commands
+ ViewerType viewerType,
+ int seqNum,
+ int annNum,
+ int viewerNum,
+ String propsFile
+ */
+ return new Object[][] {
+ /*
+ */
+ { "examples/uniref50.fa", "FER1_SPIOL",
+ "examples/AlphaFold/AF-P00221-F1-model_v4.cif", TFType.DEFAULT,
+ "examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json",
+ true, false, null, 15, 7, 0, null },
+ { "examples/uniref50.fa", "FER1_SPIOL",
+ "examples/AlphaFold/AF-P00221-F1-model_v4.cif", TFType.PLDDT,
+ "examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json",
+ true, false, null, 15, 7, 0, null },
+ { "examples/uniref50.fa", "FER1_SPIOL",
+ "examples/AlphaFold/AF-P00221-F1-model_v4.cif", TFType.PLDDT,
+ "examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json",
+ false, false, null, 15, 4, 0, null },
+ { "examples/uniref50.fa", "FER1_SPIOL",
+ "examples/AlphaFold/AF-P00221-F1-model_v4.cif", TFType.DEFAULT,
+ "examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json",
+ true, false, ViewerType.JMOL, 15, 7, 1, null },
+ { "examples/uniref50.fa", "FER1_SPIOL",
+ "examples/AlphaFold/AF-P00221-F1-model_v4.cif", TFType.PLDDT,
+ "examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json",
+ true, false, ViewerType.JMOL, 15, 7, 1, null },
+ { "examples/uniref50.fa", "FER1_SPIOL",
+ "examples/AlphaFold/AF-P00221-F1-model_v4.cif", TFType.PLDDT,
+ "examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json",
+ false, false, ViewerType.JMOL, 15, 4, 1, null }, };
+ }
+