JAL-2157 todo: verify parser/file format enums and static/dynamic status these fields
[jalview.git] / src / jalview / structure / StructureImportSettings.java
1 package jalview.structure;
2
3 import jalview.datamodel.PDBEntry;
4 import jalview.datamodel.PDBEntry.Type;
5
6 /**
7  * bean holding settings for structure IO. TODO: tests for validation of values
8  * TODO: tests for race conditions (all fields are static, is that correct ?)
9  * 
10  * @author tcofoegbu
11  *
12  */
13 public class StructureImportSettings
14 {
15   /**
16    * set to true to add derived sequence annotations (temp factor read from
17    * file, or computed secondary structure) to the alignment
18    */
19   private static boolean visibleChainAnnotation = false;
20
21   /**
22    * Set true to predict secondary structure (using JMol for protein, Annotate3D
23    * for RNA)
24    */
25   private static boolean processSecStr = false;
26
27   /**
28    * Set true (with predictSecondaryStructure=true) to predict secondary
29    * structure using an external service (currently Annotate3D for RNA only)
30    */
31   private static boolean externalSecondaryStructure = false;
32
33   private static boolean showSeqFeatures = true;
34
35   public enum StructureParser
36   {
37     JMOL_PARSER, JALVIEW_PARSER
38   }
39
40
41   /**
42    * Determines the default file format for structure files to be downloaded
43    * from the PDB sequence fetcher. Possible options include: PDB|mmCIF
44    */
45   private static PDBEntry.Type defaultStructureFileFormat = Type.PDB;
46
47   /**
48    * Determines the parser used for parsing PDB format file. Possible options
49    * are : JMolParser|JalveiwParser
50    */
51   private static StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
52   public static void addSettings(boolean addAlignmentAnnotations,
53           boolean processSecStr, boolean externalSecStr)
54   {
55     StructureImportSettings.visibleChainAnnotation = addAlignmentAnnotations;
56     StructureImportSettings.processSecStr = processSecStr;
57     StructureImportSettings.externalSecondaryStructure = externalSecStr;
58     StructureImportSettings.showSeqFeatures = true;
59   }
60
61   public static boolean isVisibleChainAnnotation()
62   {
63     return visibleChainAnnotation;
64   }
65
66   public static void setVisibleChainAnnotation(
67           boolean visibleChainAnnotation)
68   {
69     StructureImportSettings.visibleChainAnnotation = visibleChainAnnotation;
70   }
71
72   public static boolean isProcessSecondaryStructure()
73   {
74     return processSecStr;
75   }
76
77   public static void setProcessSecondaryStructure(
78           boolean processSecondaryStructure)
79   {
80     StructureImportSettings.processSecStr = processSecondaryStructure;
81   }
82
83   public static boolean isExternalSecondaryStructure()
84   {
85     return externalSecondaryStructure;
86   }
87
88   public static void setExternalSecondaryStructure(
89           boolean externalSecondaryStructure)
90   {
91     StructureImportSettings.externalSecondaryStructure = externalSecondaryStructure;
92   }
93
94   public static boolean isShowSeqFeatures()
95   {
96     return showSeqFeatures;
97   }
98
99   public static void setShowSeqFeatures(boolean showSeqFeatures)
100   {
101     StructureImportSettings.showSeqFeatures = showSeqFeatures;
102   }
103
104   public static String getDefaultStructureFileFormat()
105   {
106     return defaultStructureFileFormat.toString();
107   }
108
109   public static void setDefaultStructureFileFormat(
110           String defaultStructureFileFormat)
111   {
112     StructureImportSettings.defaultStructureFileFormat = PDBEntry.Type
113             .valueOf(defaultStructureFileFormat.toUpperCase());
114   }
115
116   public static String getDefaultPDBFileParser()
117   {
118     return defaultPDBFileParser.toString();
119   }
120
121   public static void setDefaultPDBFileParser(
122           StructureParser defaultPDBFileParser)
123   {
124     StructureImportSettings.defaultPDBFileParser = defaultPDBFileParser;
125   }
126
127   public static void setDefaultPDBFileParser(String defaultPDBFileParser)
128   {
129     StructureImportSettings.defaultPDBFileParser = StructureParser
130             .valueOf(defaultPDBFileParser.toUpperCase());
131   }
132
133 }