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;
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 ?)
35 public class StructureImportSettings
38 * set to true to add derived sequence annotations (temp factor read from
39 * file, or computed secondary structure) to the alignment
41 private static boolean visibleChainAnnotation = false;
44 * Set true to predict secondary structure (using JMol for protein, Annotate3D
47 private static boolean processSecStr = false;
50 * Set true (with predictSecondaryStructure=true) to predict secondary
51 * structure using an external service (currently Annotate3D for RNA only)
53 private static boolean externalSecondaryStructure = false;
55 private static boolean showSeqFeatures = true;
57 public enum StructureParser
59 JMOL_PARSER, JALVIEW_PARSER
63 * Determines the default file format for structure files to be downloaded
64 * from the PDB sequence fetcher. Possible options include: PDB|mmCIF
66 private static PDBEntry.Type defaultStructureFileFormat = Type.PDB;
69 * Determines the parser used for parsing PDB format file. Possible options
70 * are : JMolParser|JalveiwParser
72 private static StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
74 public static void addSettings(boolean addAlignmentAnnotations,
75 boolean processSecStr, boolean externalSecStr)
77 StructureImportSettings.visibleChainAnnotation = addAlignmentAnnotations;
78 StructureImportSettings.processSecStr = processSecStr;
79 StructureImportSettings.externalSecondaryStructure = externalSecStr;
80 StructureImportSettings.showSeqFeatures = true;
83 public static boolean isVisibleChainAnnotation()
85 return visibleChainAnnotation;
88 public static void setVisibleChainAnnotation(
89 boolean visibleChainAnnotation)
91 StructureImportSettings.visibleChainAnnotation = visibleChainAnnotation;
94 public static boolean isProcessSecondaryStructure()
99 public static void setProcessSecondaryStructure(
100 boolean processSecondaryStructure)
102 StructureImportSettings.processSecStr = processSecondaryStructure;
105 public static boolean isExternalSecondaryStructure()
107 return externalSecondaryStructure;
110 public static void setExternalSecondaryStructure(
111 boolean externalSecondaryStructure)
113 StructureImportSettings.externalSecondaryStructure = externalSecondaryStructure;
116 public static boolean isShowSeqFeatures()
118 return showSeqFeatures;
121 public static void setShowSeqFeatures(boolean showSeqFeatures)
123 StructureImportSettings.showSeqFeatures = showSeqFeatures;
126 public static PDBEntry.Type getDefaultStructureFileFormat()
128 return defaultStructureFileFormat;
131 public static void setDefaultStructureFileFormat(
132 String defaultStructureFileFormat)
134 StructureImportSettings.defaultStructureFileFormat = PDBEntry.Type
135 .valueOf(defaultStructureFileFormat.toUpperCase(Locale.ROOT));
138 public static String getDefaultPDBFileParser()
140 return defaultPDBFileParser.toString();
143 public static void setDefaultPDBFileParser(
144 StructureParser defaultPDBFileParser)
146 StructureImportSettings.defaultPDBFileParser = defaultPDBFileParser;
149 public static void setDefaultPDBFileParser(String defaultPDBFileParser)
151 StructureImportSettings.defaultPDBFileParser = StructureParser
152 .valueOf(defaultPDBFileParser.toUpperCase(Locale.ROOT));