Clover icon

Coverage Report

  1. Project Clover database Mon Nov 11 2024 17:27:16 GMT
  2. Package jalview.structure

File StructureImportSettings.java

 

Coverage histogram

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

Code metrics

0
20
17
3
180
104
17
0.85
1.18
5.67
1

Classes

Class Line # Actions
StructureImportSettings 36 19 16
0.9428571594.3%
StructureImportSettings.StructureParser 58 0 0
-1.0 -
StructureImportSettings.TFType 63 1 1
1.0100%
 

Contributing tests

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