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 jalview.bin.Instance;
24 import jalview.datamodel.PDBEntry;
25 import jalview.datamodel.PDBEntry.Type;
28 * bean holding settings for structure IO. TODO: tests for validation of values
29 * TODO: tests for race conditions (all fields are static, is that correct ?)
34 public class StructureImportSettings
37 private StructureImportSettings()
42 private static StructureImportSettings getInstance()
44 Instance j = Instance.getInstance();
45 return (j.structureImportSettings == null
46 ? j.structureImportSettings = new StructureImportSettings()
47 : j.structureImportSettings);
51 * set to true to add derived sequence annotations (temp factor read from
52 * file, or computed secondary structure) to the alignment
54 private boolean visibleChainAnnotation = false;
57 * Set true to predict secondary structure (using JMol for protein, Annotate3D
60 private boolean processSecStr = false;
63 * Set true (with predictSecondaryStructure=true) to predict secondary
64 * structure using an external service (currently Annotate3D for RNA only)
66 private boolean externalSecondaryStructure = false;
68 private boolean showSeqFeatures = true;
70 public enum StructureParser
72 JMOL_PARSER, JALVIEW_PARSER
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 PDBEntry.Type defaultStructureFileFormat = Type.PDB;
82 * Determines the parser used for parsing PDB format file. Possible options
83 * are : JMolParser|JalveiwParser
85 private StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
87 public static void addSettings(boolean addAlignmentAnnotations,
88 boolean processSecStr, boolean externalSecStr)
90 StructureImportSettings s = getInstance();
91 s.visibleChainAnnotation = addAlignmentAnnotations;
92 s.processSecStr = processSecStr;
93 s.externalSecondaryStructure = externalSecStr;
94 s.showSeqFeatures = true;
97 public static boolean isVisibleChainAnnotation()
99 return getInstance().visibleChainAnnotation;
102 public static void setVisibleChainAnnotation(
103 boolean visibleChainAnnotation)
105 getInstance().visibleChainAnnotation = visibleChainAnnotation;
108 public static boolean isProcessSecondaryStructure()
110 return getInstance().processSecStr;
113 public static void setProcessSecondaryStructure(
114 boolean processSecondaryStructure)
116 getInstance().processSecStr = processSecondaryStructure;
119 public static boolean isExternalSecondaryStructure()
121 return getInstance().externalSecondaryStructure;
124 public static void setExternalSecondaryStructure(
125 boolean externalSecondaryStructure)
127 getInstance().externalSecondaryStructure = externalSecondaryStructure;
130 public static boolean isShowSeqFeatures()
132 return getInstance().showSeqFeatures;
135 public static void setShowSeqFeatures(boolean showSeqFeatures)
137 getInstance().showSeqFeatures = showSeqFeatures;
140 public static PDBEntry.Type getDefaultStructureFileFormat()
142 return getInstance().defaultStructureFileFormat;
145 public static void setDefaultStructureFileFormat(
146 String defaultStructureFileFormat)
148 getInstance().defaultStructureFileFormat = PDBEntry.Type
149 .valueOf(defaultStructureFileFormat.toUpperCase());
152 public static String getDefaultPDBFileParser()
154 return getInstance().defaultPDBFileParser.toString();
157 public static void setDefaultPDBFileParser(
158 StructureParser defaultPDBFileParser)
160 getInstance().defaultPDBFileParser = defaultPDBFileParser;
163 public static void setDefaultPDBFileParser(String defaultPDBFileParser)
165 getInstance().defaultPDBFileParser = StructureParser
166 .valueOf(defaultPDBFileParser.toUpperCase());