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