Merge branch 'apifix/JAL-1926_JAL-2106' into develop
[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   private static boolean processHETATMs = false;
35
36   public enum StructureParser
37   {
38     JMOL_PARSER, JALVIEW_PARSER
39   }
40
41
42   /**
43    * Determines the default file format for structure files to be downloaded
44    * from the PDB sequence fetcher. Possible options include: PDB|mmCIF
45    */
46   private static PDBEntry.Type defaultStructureFileFormat = Type.PDB;
47
48   /**
49    * Determines the parser used for parsing PDB format file. Possible options
50    * are : JMolParser|JalveiwParser
51    */
52   private static StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
53   public static void addSettings(boolean addAlignmentAnnotations,
54           boolean processSecStr, boolean externalSecStr)
55   {
56     StructureImportSettings.visibleChainAnnotation = addAlignmentAnnotations;
57     StructureImportSettings.processSecStr = processSecStr;
58     StructureImportSettings.externalSecondaryStructure = externalSecStr;
59     StructureImportSettings.showSeqFeatures = true;
60   }
61
62   public static boolean isVisibleChainAnnotation()
63   {
64     return visibleChainAnnotation;
65   }
66
67   public static void setVisibleChainAnnotation(
68           boolean visibleChainAnnotation)
69   {
70     StructureImportSettings.visibleChainAnnotation = visibleChainAnnotation;
71   }
72
73   public static boolean isProcessSecondaryStructure()
74   {
75     return processSecStr;
76   }
77
78   public static void setProcessSecondaryStructure(
79           boolean processSecondaryStructure)
80   {
81     StructureImportSettings.processSecStr = processSecondaryStructure;
82   }
83
84   public static boolean isExternalSecondaryStructure()
85   {
86     return externalSecondaryStructure;
87   }
88
89   public static void setExternalSecondaryStructure(
90           boolean externalSecondaryStructure)
91   {
92     StructureImportSettings.externalSecondaryStructure = externalSecondaryStructure;
93   }
94
95   public static boolean isShowSeqFeatures()
96   {
97     return showSeqFeatures;
98   }
99
100   public static void setShowSeqFeatures(boolean showSeqFeatures)
101   {
102     StructureImportSettings.showSeqFeatures = showSeqFeatures;
103   }
104
105   public static String getDefaultStructureFileFormat()
106   {
107     return defaultStructureFileFormat.toString();
108   }
109
110   public static void setDefaultStructureFileFormat(
111           String defaultStructureFileFormat)
112   {
113     StructureImportSettings.defaultStructureFileFormat = PDBEntry.Type
114             .valueOf(defaultStructureFileFormat);
115   }
116
117   public static boolean isProcessHETATMs()
118   {
119     return processHETATMs;
120   }
121
122   public static void setProcessHETATMs(boolean processHETATMs)
123   {
124     StructureImportSettings.processHETATMs = processHETATMs;
125   }
126
127   public static String getDefaultPDBFileParser()
128   {
129     return defaultPDBFileParser.toString();
130   }
131
132   public static void setDefaultPDBFileParser(
133           StructureParser defaultPDBFileParser)
134   {
135     StructureImportSettings.defaultPDBFileParser = defaultPDBFileParser;
136   }
137
138   public static void setDefaultPDBFileParser(String defaultPDBFileParser)
139   {
140     StructureImportSettings.defaultPDBFileParser = StructureParser
141             .valueOf(defaultPDBFileParser);
142   }
143
144 }