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.Jalview;
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 static StructureImportSettings getInstance()
39 Jalview j = Jalview.getInstance();
40 return (j.structureImportSettings == null
41 ? j.structureImportSettings = new StructureImportSettings()
42 : j.structureImportSettings);
46 * set to true to add derived sequence annotations (temp factor read from
47 * file, or computed secondary structure) to the alignment
49 private boolean visibleChainAnnotation = false;
52 * Set true to predict secondary structure (using JMol for protein, Annotate3D
55 private boolean processSecStr = false;
58 * Set true (with predictSecondaryStructure=true) to predict secondary
59 * structure using an external service (currently Annotate3D for RNA only)
61 private boolean externalSecondaryStructure = false;
63 private boolean showSeqFeatures = true;
65 public enum StructureParser
67 JMOL_PARSER, JALVIEW_PARSER
71 * Determines the default file format for structure files to be downloaded
72 * from the PDB sequence fetcher. Possible options include: PDB|mmCIF
74 private PDBEntry.Type defaultStructureFileFormat = Type.PDB;
77 * Determines the parser used for parsing PDB format file. Possible options
78 * are : JMolParser|JalveiwParser
80 private StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
82 public static void addSettings(boolean addAlignmentAnnotations,
83 boolean processSecStr, boolean externalSecStr)
85 StructureImportSettings s = getInstance();
86 s.visibleChainAnnotation = addAlignmentAnnotations;
87 s.processSecStr = processSecStr;
88 s.externalSecondaryStructure = externalSecStr;
89 s.showSeqFeatures = true;
92 public static boolean isVisibleChainAnnotation()
94 return getInstance().visibleChainAnnotation;
97 public static void setVisibleChainAnnotation(
98 boolean visibleChainAnnotation)
100 getInstance().visibleChainAnnotation = visibleChainAnnotation;
103 public static boolean isProcessSecondaryStructure()
105 return getInstance().processSecStr;
108 public static void setProcessSecondaryStructure(
109 boolean processSecondaryStructure)
111 getInstance().processSecStr = processSecondaryStructure;
114 public static boolean isExternalSecondaryStructure()
116 return getInstance().externalSecondaryStructure;
119 public static void setExternalSecondaryStructure(
120 boolean externalSecondaryStructure)
122 getInstance().externalSecondaryStructure = externalSecondaryStructure;
125 public static boolean isShowSeqFeatures()
127 return getInstance().showSeqFeatures;
130 public static void setShowSeqFeatures(boolean showSeqFeatures)
132 getInstance().showSeqFeatures = showSeqFeatures;
135 public static PDBEntry.Type getDefaultStructureFileFormat()
137 return getInstance().defaultStructureFileFormat;
140 public static void setDefaultStructureFileFormat(
141 String defaultStructureFileFormat)
143 getInstance().defaultStructureFileFormat = PDBEntry.Type
144 .valueOf(defaultStructureFileFormat.toUpperCase());
147 public static String getDefaultPDBFileParser()
149 return getInstance().defaultPDBFileParser.toString();
152 public static void setDefaultPDBFileParser(
153 StructureParser defaultPDBFileParser)
155 getInstance().defaultPDBFileParser = defaultPDBFileParser;
158 public static void setDefaultPDBFileParser(String defaultPDBFileParser)
160 getInstance().defaultPDBFileParser = StructureParser
161 .valueOf(defaultPDBFileParser.toUpperCase());