Clover icon

jalviewX

  1. Project Clover database Wed Oct 31 2018 15:13:58 GMT
  2. Package jalview.structure

File StructureImportSettings.java

 

Coverage histogram

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

Code metrics

0
17
14
2
153
83
14
0.82
1.21
7
1

Classes

Class Line # Actions
StructureImportSettings 33 17 14 2
0.935483993.5%
StructureImportSettings.StructureParser 55 0 0 0
-1.0 -
 

Contributing tests

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