X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fio%2FImportHomologyModelTest.java;fp=test%2Fjalview%2Fio%2FImportHomologyModelTest.java;h=292a34d1b09d3774ce1e08bc5d2405956127e59a;hb=465bbc45e7e922194709436aa4f68a980cf12aea;hp=0000000000000000000000000000000000000000;hpb=4de772ef30866239786437fbe03d3f877019d459;p=jalview.git diff --git a/test/jalview/io/ImportHomologyModelTest.java b/test/jalview/io/ImportHomologyModelTest.java new file mode 100644 index 0000000..292a34d --- /dev/null +++ b/test/jalview/io/ImportHomologyModelTest.java @@ -0,0 +1,108 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ +package jalview.io; + +import jalview.bin.Cache; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; + +import org.junit.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +public class ImportHomologyModelTest +{ + + public static String base = "examples/testdata/phyre2/"; + + public static String profile_msa = base + "query.jal", + profile_annot = base + "query.jal.ann"; + + public static String templaten[] = new String[] { "c1o1nA_", "c3pt8B_", + "d1scta_" }; + + AlignmentI al; + AlignFrame af; + + /** + * Ensure 'process secondary structure from PDB and add annotations' are set + * in preferences, and load PDB example file 1gaq + * + * @throws Exception + */ + @BeforeMethod(alwaysRun = true) + public void setup() throws Exception + { + Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("ADD_SS_ANN", + Boolean.TRUE.toString()); + FileLoader loader = new FileLoader(false); + af = loader.LoadFileWaitTillLoaded(profile_msa, + FormatAdapter.FILE); + Desktop.addInternalFrame(af, "homology models", 800, 500); + al = af.getViewport().getAlignment(); + af.loadJalviewDataFile(profile_annot, FormatAdapter.FILE, null, null); + // if file was loaded, the view should have a reference sequence set + Assert.assertTrue(al.hasSeqrep()); + } + + + @Test(groups = { "Functional" }) + public void testModelsAssociated() + { + for (String template : templaten) + { + SequenceI templseq = al.findName(template); + Assert.assertNotNull("Couldn't find template sequence for " + + template, templseq); + PDBEntry querymdl = al.getSeqrep().getPDBEntry(template); + PDBEntry templmdl = templseq.getPDBEntry(template); + Assert.assertEquals(querymdl.getFile(), templmdl.getFile()); + } + } + + /** + * @throws java.lang.Exception + */ + @BeforeClass(alwaysRun = true) + public static void setUpBeforeClass() throws Exception + { + jalview.bin.Jalview.main(new String[] { "-props", + "test/jalview/io/testProps.jvprops" }); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass(alwaysRun = true) + public static void tearDownAfterClass() throws Exception + { + jalview.gui.Desktop.instance.closeAll_actionPerformed(null); + } + + +}