/* * 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, jalview.io.DataSourceType.FILE); Desktop.addInternalFrame(af, "homology models", 800, 500); al = af.getViewport().getAlignment(); af.loadJalviewDataFile(profile_annot, jalview.io.DataSourceType.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); } }