Repository navigation
Expand file tree
/
Copy pathExperimentalTechnique.java
More file actions
138 lines (106 loc) · 3.84 KB
/
Copy pathExperimentalTechnique.java
File metadata and controls
138 lines (106 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
* BioJava development code
*
* This code may be freely distributed and modified under the
* terms of the GNU Lesser General Public Licence. This should
* be distributed with the code. If you do not have a copy,
* see:
*
* http://www.gnu.org/copyleft/lesser.html
*
* Copyright for this code is held jointly by the individual
* authors. These should be listed in @author doc comments.
*
* For more information on the BioJava project and its aims,
* or to join the biojava-l mailing list, visit the home page
* at:
*
* http://www.biojava.org/
*
*/
package org.biojava.nbio.structure;
import java.util.HashMap;
import java.util.Set;
/**
*
* An enum to represent the experimental technique of a PDB structure
*
* @author duarte_j
*
*/
public enum ExperimentalTechnique {
XRAY_DIFFRACTION ("X-RAY DIFFRACTION", true, false),
SOLUTION_NMR ("SOLUTION NMR", false, true),
SOLID_STATE_NMR ("SOLID-STATE NMR", false, true),
ELECTRON_MICROSCOPY ("ELECTRON MICROSCOPY", false, false),
ELECTRON_CRYSTALLOGRAPHY ("ELECTRON CRYSTALLOGRAPHY",true, false),
FIBER_DIFFRACTION ("FIBER DIFFRACTION", false, false),
NEUTRON_DIFFRACTION ("NEUTRON DIFFRACTION", true, false),
SOLUTION_SCATTERING ("SOLUTION SCATTERING", false, false),
// from here, not in "official list" in pdb.org advanced search: they call these "OTHER"
POWDER_DIFFRACTION ("POWDER DIFFRACTION", true, false),
FLUORESCENCE_TRANSFER ("FLUORESCENCE TRANSFER", false, false),
INFRARED_SPECTROSCOPY ("INFRARED SPECTROSCOPY", false, false);
private static final HashMap<String, ExperimentalTechnique> expTechStr2Value = initExpTechStr2Value();
private String name;
private boolean isCrystallographic;
private boolean isNmr;
private ExperimentalTechnique(String name, boolean isXtallographic, boolean isNmr) {
this.name = name;
this.isCrystallographic = isXtallographic;
this.isNmr = isNmr;
}
private static HashMap<String, ExperimentalTechnique> initExpTechStr2Value() {
HashMap<String, ExperimentalTechnique> expTechStr2Value = new HashMap<String, ExperimentalTechnique>();
for(ExperimentalTechnique exp:ExperimentalTechnique.values()) {
expTechStr2Value.put(exp.getName(), exp);
}
return expTechStr2Value;
}
public String getName() {
return name;
}
public boolean isCrystallographic() {
return isCrystallographic;
}
public boolean isNmr() {
return isNmr;
}
/**
* Returns the ExpTechnique given an experimental technique name as used in the PDB,
* e.g. "X-RAY DIFFRACTION" returns {@link ExperimentalTechnique#XRAY_DIFFRACTION}
* @param expTechniqueName the ExpTechnique value or null if string doesn't match one of the known PDB experimental strings
* @return
*/
public static ExperimentalTechnique getByName(String expTechniqueName) {
return expTechStr2Value.get(expTechniqueName);
}
/**
* Given a Set of ExperimentalTechniques returns true if at least one is crystallographic
* @return true if at least 1 of the techniques is crystallographic, false if
* none of the techniques are crystallographic
* @throws NullPointerException if input is null
*/
public static boolean isCrystallographic(Set<ExperimentalTechnique> techniques) {
for (ExperimentalTechnique et:techniques) {
if (et.isCrystallographic()) return true;
}
return false;
}
/**
* Given a Set of ExperimentalTechniques returns true if at least one is NMR
* @return true if at least 1 of the techniques is NMR, false if
* none of the techniques are NMR
* @throws NullPointerException if input is null
*/
public static boolean isNmr(Set<ExperimentalTechnique> techniques) {
for (ExperimentalTechnique et:techniques) {
if (et.isNmr()) return true;
}
return false;
}
@Override
public String toString() {
return getName();
}
}