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;
24 import java.util.Locale;
26 import jalview.bin.ApplicationSingletonProvider;
27 import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
30 import jalview.datamodel.PDBEntry;
31 import jalview.datamodel.PDBEntry.Type;
34 * bean holding settings for structure IO. TODO: tests for validation of values
35 * TODO: tests for race conditions (all fields are static, is that correct ?)
40 public class StructureImportSettings implements ApplicationSingletonI
42 private StructureImportSettings()
47 private static StructureImportSettings getInstance()
49 return ApplicationSingletonProvider
50 .getInstance(StructureImportSettings.class);
53 * set to true to add derived sequence annotations (temp factor read from
54 * file, or computed secondary structure) to the alignment
56 private boolean visibleChainAnnotation = false;
59 * Set true to predict secondary structure (using JMol for protein, Annotate3D
62 private static boolean processSecStr = false;
65 * Set true (with predictSecondaryStructure=true) to predict secondary
66 * structure using an external service (currently Annotate3D for RNA only)
68 private boolean externalSecondaryStructure = false;
70 private static boolean showSeqFeatures = true;
72 public enum StructureParser
74 JMOL_PARSER, JALVIEW_PARSER
78 * Determines the default file format for structure files to be downloaded
79 * from the PDB sequence fetcher. Possible options include: PDB|mmCIF
81 private PDBEntry.Type defaultStructureFileFormat = Type.PDB; // TODO 2.12 should be mmCIF now ?
84 * Determines the parser used for parsing PDB format file. Possible options
85 * are : JMolParser|JalveiwParser
87 private StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
89 public static void addSettings(boolean addAlignmentAnnotations,
90 boolean processSecStr, boolean externalSecStr)
92 StructureImportSettings s = getInstance();
93 s.visibleChainAnnotation = addAlignmentAnnotations;
94 s.processSecStr = processSecStr;
95 s.externalSecondaryStructure = externalSecStr;
96 s.showSeqFeatures = true;
99 public static boolean isVisibleChainAnnotation()
101 return getInstance().visibleChainAnnotation;
104 public static void setVisibleChainAnnotation(
105 boolean visibleChainAnnotation)
107 getInstance().visibleChainAnnotation = visibleChainAnnotation;
110 public static boolean isProcessSecondaryStructure()
112 return getInstance().processSecStr;
115 public static void setProcessSecondaryStructure(
116 boolean processSecondaryStructure)
118 getInstance().processSecStr = processSecondaryStructure;
121 public static boolean isExternalSecondaryStructure()
123 return getInstance().externalSecondaryStructure;
126 public static void setExternalSecondaryStructure(
127 boolean externalSecondaryStructure)
129 getInstance().externalSecondaryStructure = externalSecondaryStructure;
132 public static boolean isShowSeqFeatures()
134 return getInstance().showSeqFeatures;
137 public static void setShowSeqFeatures(boolean showSeqFeatures)
139 getInstance().showSeqFeatures = showSeqFeatures;
142 public static PDBEntry.Type getDefaultStructureFileFormat()
144 return getInstance().defaultStructureFileFormat;
147 public static void setDefaultStructureFileFormat(
148 String defaultStructureFileFormat)
150 getInstance().defaultStructureFileFormat = PDBEntry.Type
151 .valueOf(defaultStructureFileFormat.toUpperCase(Locale.ROOT));
154 public static String getDefaultPDBFileParser()
156 return getInstance().defaultPDBFileParser.toString();
159 public static void setDefaultPDBFileParser(
160 StructureParser defaultPDBFileParser)
162 getInstance().defaultPDBFileParser = defaultPDBFileParser;
165 public static void setDefaultPDBFileParser(String defaultPDBFileParser)
167 getInstance().defaultPDBFileParser = StructureParser
168 .valueOf(defaultPDBFileParser.toUpperCase(Locale.ROOT));