f168413ebfc9039263058a179b91041b9c69b0c8
[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   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
116 }