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 package ffx.xray.parsers;
39
40 import static org.junit.Assert.assertEquals;
41 import static org.junit.Assert.assertNotNull;
42 import static org.junit.Assert.assertNull;
43 import static org.junit.Assert.assertTrue;
44
45 import ffx.algorithms.misc.AlgorithmsTest;
46 import ffx.crystal.Crystal;
47 import ffx.crystal.HKL;
48 import ffx.crystal.ReflectionList;
49 import ffx.crystal.Resolution;
50 import ffx.utilities.Keyword;
51 import ffx.xray.DiffractionRefinementData;
52
53 import java.io.File;
54
55 import org.apache.commons.configuration2.CompositeConfiguration;
56 import org.junit.Test;
57
58
59
60
61
62
63 public class CIFFilterTest extends AlgorithmsTest {
64
65 @Test
66 public void testCIFFilter2DRM() {
67 File cifFile = getResourceFile("2DRM.cif");
68
69 CompositeConfiguration properties = Keyword.loadProperties(cifFile);
70
71 CIFFilter cifFilter = new CIFFilter();
72 ReflectionList reflectionList = cifFilter.getReflectionList(cifFile);
73 assertNull(" Reflection list should be null", reflectionList);
74
75 Crystal crystal = new Crystal(29.969, 37.861, 44.506, 90.28, 90.11, 90.64, "P1");
76 Resolution resolution = new Resolution(1.30);
77 reflectionList = new ReflectionList(crystal, resolution);
78 DiffractionRefinementData refinementData =
79 new DiffractionRefinementData(properties, reflectionList);
80
81 assertTrue(
82 " CIF data not read correctly",
83 cifFilter.readFile(cifFile, reflectionList, refinementData, properties));
84
85 HKL hkl = reflectionList.getHKL(-21, -6, 7);
86 assertEquals("-21 -6 7 F", 18.6, refinementData.getF(hkl.getIndex()), 0.01);
87 assertEquals("-21 -6 7 sigF", 3.6, refinementData.getSigF(hkl.getIndex()), 0.01);
88 assertEquals("-21 -6 7 freeR value", 0, refinementData.freeR[hkl.getIndex()]);
89
90 hkl = reflectionList.getHKL(-21, -6, 8);
91 assertEquals("-21 -6 7 F", 20.2, refinementData.getF(hkl.getIndex()), 0.01);
92 assertEquals("-21 -6 7 sigF", 5.0, refinementData.getSigF(hkl.getIndex()), 0.01);
93 assertEquals("-21 -6 7 freeR value", 1, refinementData.freeR[hkl.getIndex()]);
94 }
95
96 @Test
97 public void testCIFFilter3DYC() {
98 File cifFile = getResourceFile("3DYC.ent");
99
100 CompositeConfiguration properties = Keyword.loadProperties(cifFile);
101
102 CIFFilter cifFilter = new CIFFilter();
103 ReflectionList reflectionList = cifFilter.getReflectionList(cifFile);
104 assertNotNull(" Reflection list should not be null", reflectionList);
105 DiffractionRefinementData refinementData =
106 new DiffractionRefinementData(properties, reflectionList);
107
108 assertTrue(
109 " CIF data not read in correctly",
110 cifFilter.readFile(cifFile, reflectionList, refinementData, properties));
111
112 HKL hkl = reflectionList.getHKL(58, 0, 13);
113 assertEquals("58 0 13 F", 99.7, refinementData.getF(hkl.getIndex()), 0.01);
114 assertEquals("58 0 13 sigF", 69.7, refinementData.getSigF(hkl.getIndex()), 0.01);
115 assertEquals("58 0 13 freeR value", 1, refinementData.freeR[hkl.getIndex()]);
116
117 hkl = reflectionList.getHKL(28, 20, 5);
118 assertEquals("28 20 5 F", 428.1, refinementData.getF(hkl.getIndex()), 0.01);
119 assertEquals("28 20 5 sigF", 10.1, refinementData.getSigF(hkl.getIndex()), 0.01);
120 assertEquals("28 20 5 freeR value", 0, refinementData.freeR[hkl.getIndex()]);
121 }
122 }