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