2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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.
21 package jalview.structure;
23 import java.util.Locale;
25 import jalview.datamodel.PDBEntry;
26 import jalview.datamodel.PDBEntry.Type;
27 import jalview.util.MessageManager;
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 ?)
36 public class StructureImportSettings
39 * set to true to add derived sequence annotations (temp factor read from
40 * file, or computed secondary structure) to the alignment
42 private static boolean visibleChainAnnotation = false;
45 * Set true to predict secondary structure (using JMol for protein, Annotate3D
48 private static boolean processSecStr = false;
51 * Set true (with predictSecondaryStructure=true) to predict secondary
52 * structure using an external service (currently Annotate3D for RNA only)
54 private static boolean externalSecondaryStructure = false;
56 private static boolean showSeqFeatures = true;
58 public enum StructureParser
60 JMOL_PARSER, JALVIEW_PARSER
63 public static enum TFType
68 public String toString()
70 return MessageManager.getString(
71 "label.tftype_" + this.name().toLowerCase(Locale.ROOT));
76 * Determines the default file format for structure files to be downloaded
77 * from the PDB sequence fetcher. Possible options include: PDB|mmCIF
79 private static PDBEntry.Type defaultStructureFileFormat = Type.PDB;
82 * Determines the parser used for parsing PDB format file. Possible options
83 * are : JMolParser|JalveiwParser
85 private static StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
87 private static TFType temperatureFactorType;
89 public static void addSettings(boolean addAlignmentAnnotations,
90 boolean processSecStr, boolean externalSecStr)
92 StructureImportSettings.visibleChainAnnotation = addAlignmentAnnotations;
93 StructureImportSettings.processSecStr = processSecStr;
94 StructureImportSettings.externalSecondaryStructure = externalSecStr;
95 StructureImportSettings.showSeqFeatures = true;
98 public static boolean isVisibleChainAnnotation()
100 return visibleChainAnnotation;
103 public static void setTemperatureFactorType(TFType t)
105 StructureImportSettings.temperatureFactorType = t;
108 public static void setVisibleChainAnnotation(
109 boolean visibleChainAnnotation)
111 StructureImportSettings.visibleChainAnnotation = visibleChainAnnotation;
114 public static boolean isProcessSecondaryStructure()
116 return processSecStr;
119 public static void setProcessSecondaryStructure(
120 boolean processSecondaryStructure)
122 StructureImportSettings.processSecStr = processSecondaryStructure;
125 public static boolean isExternalSecondaryStructure()
127 return externalSecondaryStructure;
130 public static void setExternalSecondaryStructure(
131 boolean externalSecondaryStructure)
133 StructureImportSettings.externalSecondaryStructure = externalSecondaryStructure;
136 public static boolean isShowSeqFeatures()
138 return showSeqFeatures;
141 public static void setShowSeqFeatures(boolean showSeqFeatures)
143 StructureImportSettings.showSeqFeatures = showSeqFeatures;
146 public static PDBEntry.Type getDefaultStructureFileFormat()
148 return defaultStructureFileFormat;
151 public static void setDefaultStructureFileFormat(
152 String defaultStructureFileFormat)
154 StructureImportSettings.defaultStructureFileFormat = PDBEntry.Type
155 .valueOf(defaultStructureFileFormat.toUpperCase(Locale.ROOT));
158 public static String getDefaultPDBFileParser()
160 return defaultPDBFileParser.toString();
163 public static void setDefaultPDBFileParser(
164 StructureParser defaultPDBFileParser)
166 StructureImportSettings.defaultPDBFileParser = defaultPDBFileParser;
169 public static void setDefaultPDBFileParser(String defaultPDBFileParser)
171 StructureImportSettings.defaultPDBFileParser = StructureParser
172 .valueOf(defaultPDBFileParser.toUpperCase(Locale.ROOT));
175 public static TFType getTemperatureFactorType()
177 return temperatureFactorType;