Clover icon

Coverage Report

  1. Project Clover database Mon Sep 2 2024 17:57:51 BST
  2. Package jalview.gui

File AssociatePDBFileTest.java

 

Code metrics

4
18
5
1
137
97
8
0.44
3.6
5
1.6

Classes

Class Line # Actions
AssociatePDBFileTest 57 18 8
0.925925992.6%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.gui;
22   
23    import java.awt.Color;
24    import java.io.File;
25    import java.util.Iterator;
26   
27    import org.junit.Assert;
28    import org.testng.annotations.AfterMethod;
29    import org.testng.annotations.BeforeClass;
30    import org.testng.annotations.BeforeMethod;
31    import org.testng.annotations.Test;
32   
33    import jalview.analysis.AlignmentAnnotationUtils;
34    import jalview.api.FeatureColourI;
35    import jalview.bin.Cache;
36    import jalview.bin.Jalview;
37    import jalview.datamodel.Alignment;
38    import jalview.datamodel.AlignmentI;
39    import jalview.datamodel.HiddenColumns;
40    import jalview.datamodel.PDBEntry;
41    import jalview.datamodel.Sequence;
42    import jalview.datamodel.SequenceFeature;
43    import jalview.datamodel.SequenceGroup;
44    import jalview.datamodel.SequenceI;
45    import jalview.io.DataSourceType;
46    import jalview.io.FileLoader;
47    import jalview.project.Jalview2xmlTests;
48    import jalview.renderer.ResidueShaderI;
49    import jalview.schemes.BuriedColourScheme;
50    import jalview.schemes.FeatureColour;
51    import jalview.schemes.HelixColourScheme;
52    import jalview.schemes.JalviewColourScheme;
53    import jalview.schemes.StrandColourScheme;
54    import jalview.schemes.TurnColourScheme;
55    import jalview.util.MessageManager;
56   
 
57    public class AssociatePDBFileTest
58    {
59    AlignFrame af;
60   
 
61  1 toggle @BeforeClass(alwaysRun = true)
62    public static void setUpBeforeClass() throws Exception
63    {
64  1 setUpJvOptionPane();
65    /*
66    * use read-only test properties file
67    */
68  1 Cache.loadProperties("test/jalview/io/testProps.jvprops");
69  1 Jalview.main(new String[] { "--nonews" });
70    }
71   
 
72  1 toggle @AfterMethod(alwaysRun = true)
73    public void tearDown()
74    {
75  1 if (Desktop.instance != null)
76  1 Desktop.instance.closeAll_actionPerformed(null);
77    }
78   
79    /**
80    * configure (read-only) properties for test to ensure Consensus is computed
81    * for colour Above PID testing
82    */
 
83  1 toggle @BeforeMethod(alwaysRun = true)
84    public void setUp()
85    {
86  1 Cache.loadProperties("test/jalview/io/testProps.jvprops");
87  1 Cache.applicationProperties.setProperty("SHOW_IDENTITY",
88    Boolean.TRUE.toString());
89  1 af = new FileLoader().LoadFileWaitTillLoaded(">1GAQ|A/19-314\n"
90    + "ESKKQEEGVVTNLYKPKEPYVGRCLLNTKITGDDAPGETWHMVFSTEGKIPYREGQSIGVIADGVDKNGKPH\n"
91    + "KVRLYSIASSAIGDFGDSKTVSLCVKRLIYTNDAGEIVKGVCSNFLCDLQPGDNVQITGPVGKEMLMPKDPN\n"
92    + "ATIIMLATGTGIAPFRSFLWKMFFEKHDDYKFNGLGWLFLGVPTSSSLLYKEEFGKMKERAPENFRVDYAVS\n"
93    + "REQTNAAGERMYIQTRMAEYKEELWELLKKDNTYVYMCGLKGMEKGIDDIMVSLAEKDGIDWFDYKKQLKRG\n"
94    + "DQWNVEVY\n" + ">1GAQ|B/1-98\n"
95    + "ATYNVKLITPEGEVELQVPDDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSYLDDGQIADG\n"
96    + "WVLTCHAYPTSDVVIETHKEEELTGA\n" + ">1GAQ|C/19-314\n"
97    + "ESKKQEEGVVTNLYKPKEPYVGRCLLNTKITGDDAPGETWHMVFSTEGKIPYREGQSIGVIADGVDKNGKPH\n"
98    + "KVRLYSIASSAIGDFGDSKTVSLCVKRLIYTNDAGEIVKGVCSNFLCDLQPGDNVQITGPVGKEMLMPKDPN\n"
99    + "ATIIMLATGTGIAPFRSFLWKMFFEKHDDYKFNGLGWLFLGVPTSSSLLYKEEFGKMKERAPENFRVDYAVS\n"
100    + "REQTNAAGERMYIQTRMAEYKEELWELLKKDNTYVYMCGLKGMEKGIDDIMVSLAEKDGIDWFDYKKQLKRG\n"
101    + "DQWNVEVY\n", DataSourceType.PASTE);
102   
103    /*
104    * wait for Consensus thread to complete
105    */
106  1 do
107    {
108  1 try
109    {
110  1 Thread.sleep(50);
111    } catch (InterruptedException x)
112    {
113    }
114  1 } while (af.getViewport().getCalcManager().isWorking());
115    }
116   
 
117  1 toggle public static void setUpJvOptionPane()
118    {
119  1 JvOptionPane.setInteractiveMode(false);
120  1 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
121    }
122   
 
123  1 toggle @Test(groups = "Functional")
124    public void testAssociatePDBFile()
125    {
126  1 String assoc_file = "examples/1gaq.txt";
127  1 for (SequenceI toassoc : af.getViewport().getAlignment().getSequences())
128    {
129  3 PDBEntry pe = new AssociatePdbFileWithSeq().associatePdbWithSeq(
130    assoc_file, DataSourceType.FILE, toassoc, false,
131    Desktop.instance);
132  3 Assert.assertNotNull(pe);
133  3 Assert.assertNotEquals(
134    toassoc.getDatasetSequence().getAnnotation().length, 0);
135    }
136    }
137    }