Clover icon

Coverage Report

  1. Project Clover database Thu Dec 4 2025 14:43:25 GMT
  2. Package jalview.structure

File StructureImportSettings.java

 

Coverage histogram

../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
22
19
3
196
115
19
0.86
1.16
6.33
1

Classes

Class Line # Actions
StructureImportSettings 41 21 18
0.9487179594.9%
StructureImportSettings.StructureParser 73 0 0
-1.0 -
StructureImportSettings.TFType 78 1 1
1.0100%
 

Contributing tests

This file is covered by 103 tests. .

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.structure;
22   
23   
24    import java.util.Locale;
25   
26    import jalview.bin.ApplicationSingletonProvider;
27    import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
28   
29   
30    import jalview.datamodel.PDBEntry;
31    import jalview.datamodel.PDBEntry.Type;
32    import jalview.util.MessageManager;
33   
34    /**
35    * bean holding settings for structure IO. TODO: tests for validation of values
36    * TODO: tests for race conditions (all fields are static, is that correct ?)
37    *
38    * @author tcofoegbu
39    *
40    */
 
41    public class StructureImportSettings implements ApplicationSingletonI
42    {
 
43  55 toggle private StructureImportSettings()
44    {
45    // private singleton
46    }
47   
 
48  1469 toggle private static StructureImportSettings getInstance()
49    {
50  1469 return ApplicationSingletonProvider
51    .getInstance(StructureImportSettings.class);
52    }
53    /**
54    * set to true to add derived sequence annotations (temp factor read from
55    * file, or computed secondary structure) to the alignment
56    */
57    private boolean visibleChainAnnotation = false;
58   
59    /**
60    * Set true to predict secondary structure (using JMol for protein, Annotate3D
61    * for RNA)
62    */
63    private static boolean processSecStr = false;
64   
65    /**
66    * Set true (with predictSecondaryStructure=true) to predict secondary
67    * structure using an external service (currently Annotate3D for RNA only)
68    */
69    private boolean externalSecondaryStructure = false;
70   
71    private static boolean showSeqFeatures = true;
72   
 
73    public enum StructureParser
74    {
75    JMOL_PARSER, JALVIEW_PARSER
76    }
77   
 
78    public static enum TFType
79    {
80    DEFAULT, PLDDT, QMEANDISCO;
81   
 
82  349 toggle @Override
83    public String toString()
84    {
85  349 return MessageManager.getString(
86    "label.tftype_" + this.name().toLowerCase(Locale.ROOT));
87    }
88    }
89   
90    /**
91    * Determines the default file format for structure files to be downloaded
92    * from the PDB sequence fetcher. Possible options include: PDB|mmCIF
93    */
94    private PDBEntry.Type defaultStructureFileFormat = Type.PDB; // TODO 2.12 should be mmCIF now ?
95   
96    /**
97    * Determines the parser used for parsing PDB format file. Possible options
98    * are : JMolParser|JalveiwParser
99    */
100    private StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
101   
102    private static TFType temperatureFactorType;
103   
 
104  14 toggle public static void addSettings(boolean addAlignmentAnnotations,
105    boolean processSecStr, boolean externalSecStr)
106    {
107  14 StructureImportSettings s = getInstance();
108  14 s.visibleChainAnnotation = addAlignmentAnnotations;
109  14 s.processSecStr = processSecStr;
110  14 s.externalSecondaryStructure = externalSecStr;
111  14 s.showSeqFeatures = true;
112    }
113   
 
114  139 toggle public static boolean isVisibleChainAnnotation()
115    {
116  139 return getInstance().visibleChainAnnotation;
117    }
118   
 
119  5 toggle public static void setTemperatureFactorType(TFType t)
120    {
121  5 StructureImportSettings.temperatureFactorType = t;
122    }
123   
 
124  8 toggle public static void setVisibleChainAnnotation(
125    boolean visibleChainAnnotation)
126    {
127  8 getInstance().visibleChainAnnotation = visibleChainAnnotation;
128    }
129   
 
130  139 toggle public static boolean isProcessSecondaryStructure()
131    {
132  139 return getInstance().processSecStr;
133    }
134   
 
135  8 toggle public static void setProcessSecondaryStructure(
136    boolean processSecondaryStructure)
137    {
138  8 getInstance().processSecStr = processSecondaryStructure;
139    }
140   
 
141  139 toggle public static boolean isExternalSecondaryStructure()
142    {
143  139 return getInstance().externalSecondaryStructure;
144    }
145   
 
146  5 toggle public static void setExternalSecondaryStructure(
147    boolean externalSecondaryStructure)
148    {
149  5 getInstance().externalSecondaryStructure = externalSecondaryStructure;
150    }
151   
 
152  307 toggle public static boolean isShowSeqFeatures()
153    {
154  307 return getInstance().showSeqFeatures;
155    }
156   
 
157  35 toggle public static void setShowSeqFeatures(boolean showSeqFeatures)
158    {
159  35 getInstance().showSeqFeatures = showSeqFeatures;
160    }
161   
 
162  0 toggle public static PDBEntry.Type getDefaultStructureFileFormat()
163    {
164  0 return getInstance().defaultStructureFileFormat;
165    }
166   
 
167  335 toggle public static void setDefaultStructureFileFormat(
168    String defaultStructureFileFormat)
169    {
170  335 getInstance().defaultStructureFileFormat = PDBEntry.Type
171    .valueOf(defaultStructureFileFormat.toUpperCase(Locale.ROOT));
172    }
173   
 
174  14 toggle public static String getDefaultPDBFileParser()
175    {
176  14 return getInstance().defaultPDBFileParser.toString();
177    }
178   
 
179  6 toggle public static void setDefaultPDBFileParser(
180    StructureParser defaultPDBFileParser)
181    {
182  6 getInstance().defaultPDBFileParser = defaultPDBFileParser;
183    }
184   
 
185  320 toggle public static void setDefaultPDBFileParser(String defaultPDBFileParser)
186    {
187  320 getInstance().defaultPDBFileParser = StructureParser
188    .valueOf(defaultPDBFileParser.toUpperCase(Locale.ROOT));
189    }
190   
 
191  150 toggle public static TFType getTemperatureFactorType()
192    {
193  150 return temperatureFactorType;
194    }
195   
196    }