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.ApplicationSingletonProvider;
24 import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
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 implements ApplicationSingletonI
38 private StructureImportSettings()
43 private static StructureImportSettings getInstance()
45 return (StructureImportSettings) ApplicationSingletonProvider
46 .getInstance(StructureImportSettings.class);
50 * set to true to add derived sequence annotations (temp factor read from
51 * file, or computed secondary structure) to the alignment
53 private boolean visibleChainAnnotation = false;
56 * Set true to predict secondary structure (using JMol for protein, Annotate3D
59 private boolean processSecStr = false;
62 * Set true (with predictSecondaryStructure=true) to predict secondary
63 * structure using an external service (currently Annotate3D for RNA only)
65 private boolean externalSecondaryStructure = false;
67 private boolean showSeqFeatures = true;
69 public enum StructureParser
71 JMOL_PARSER, JALVIEW_PARSER
75 * Determines the default file format for structure files to be downloaded
76 * from the PDB sequence fetcher. Possible options include: PDB|mmCIF
78 private PDBEntry.Type defaultStructureFileFormat = Type.PDB;
81 * Determines the parser used for parsing PDB format file. Possible options
82 * are : JMolParser|JalveiwParser
84 private StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
86 public static void addSettings(boolean addAlignmentAnnotations,
87 boolean processSecStr, boolean externalSecStr)
89 StructureImportSettings s = getInstance();
90 s.visibleChainAnnotation = addAlignmentAnnotations;
91 s.processSecStr = processSecStr;
92 s.externalSecondaryStructure = externalSecStr;
93 s.showSeqFeatures = true;
96 public static boolean isVisibleChainAnnotation()
98 return getInstance().visibleChainAnnotation;
101 public static void setVisibleChainAnnotation(
102 boolean visibleChainAnnotation)
104 getInstance().visibleChainAnnotation = visibleChainAnnotation;
107 public static boolean isProcessSecondaryStructure()
109 return getInstance().processSecStr;
112 public static void setProcessSecondaryStructure(
113 boolean processSecondaryStructure)
115 getInstance().processSecStr = processSecondaryStructure;
118 public static boolean isExternalSecondaryStructure()
120 return getInstance().externalSecondaryStructure;
123 public static void setExternalSecondaryStructure(
124 boolean externalSecondaryStructure)
126 getInstance().externalSecondaryStructure = externalSecondaryStructure;
129 public static boolean isShowSeqFeatures()
131 return getInstance().showSeqFeatures;
134 public static void setShowSeqFeatures(boolean showSeqFeatures)
136 getInstance().showSeqFeatures = showSeqFeatures;
139 public static PDBEntry.Type getDefaultStructureFileFormat()
141 return getInstance().defaultStructureFileFormat;
144 public static void setDefaultStructureFileFormat(
145 String defaultStructureFileFormat)
147 getInstance().defaultStructureFileFormat = PDBEntry.Type
148 .valueOf(defaultStructureFileFormat.toUpperCase());
151 public static String getDefaultPDBFileParser()
153 return getInstance().defaultPDBFileParser.toString();
156 public static void setDefaultPDBFileParser(
157 StructureParser defaultPDBFileParser)
159 getInstance().defaultPDBFileParser = defaultPDBFileParser;
162 public static void setDefaultPDBFileParser(String defaultPDBFileParser)
164 getInstance().defaultPDBFileParser = StructureParser
165 .valueOf(defaultPDBFileParser.toUpperCase());