Skip to content

Commit a2f900c

Browse files
committed
Fixed bug: NPE for CrystalBuilder on 4hhb. Moved TestCrystalBuilder to integrationtest.
1 parent cfd6f4a commit a2f900c

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

biojava-structure/src/test/java/org/biojava/nbio/structure/xtal/TestCrystalBuilder.java renamed to biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/xtal/TestCrystalBuilder.java

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@
1818
* http://www.biojava.org/
1919
*
2020
*/
21-
package org.biojava.nbio.structure.xtal;
21+
package org.biojava.nbio.structure.test.xtal;
2222

2323
import org.biojava.nbio.structure.Structure;
2424
import org.biojava.nbio.structure.StructureException;
2525
import org.biojava.nbio.structure.StructureIO;
2626
import org.biojava.nbio.structure.align.util.AtomCache;
2727
import org.biojava.nbio.structure.contact.StructureInterfaceList;
28+
import org.biojava.nbio.structure.xtal.CrystalBuilder;
2829
import org.junit.Test;
2930

3031
import java.io.IOException;
3132

32-
import static org.junit.Assert.assertTrue;
33+
import static org.junit.Assert.*;
3334

3435
public class TestCrystalBuilder {
3536

@@ -42,7 +43,7 @@ public void test1NMR() throws IOException, StructureException {
4243

4344
StructureIO.setAtomCache(cache);
4445

45-
cache.setUseMmCif(false);
46+
cache.setUseMmCif(true);
4647
Structure s1 = StructureIO.getStructure("1NMR");
4748

4849
CrystalBuilder cb = new CrystalBuilder(s1);
@@ -60,7 +61,7 @@ public void test1B8G() throws IOException, StructureException {
6061

6162
StructureIO.setAtomCache(cache);
6263

63-
cache.setUseMmCif(false);
64+
cache.setUseMmCif(true);
6465
Structure s1 = StructureIO.getStructure("1B8G");
6566
CrystalBuilder cb = new CrystalBuilder(s1);
6667
StructureInterfaceList interfaces = cb.getUniqueInterfaces(5.5);
@@ -78,7 +79,7 @@ public void test2MFZ() throws IOException, StructureException {
7879

7980
StructureIO.setAtomCache(cache);
8081

81-
cache.setUseMmCif(false);
82+
cache.setUseMmCif(true);
8283
Structure s1 = StructureIO.getStructure("2MFZ");
8384
CrystalBuilder cb = new CrystalBuilder(s1);
8485
StructureInterfaceList interfaces = cb.getUniqueInterfaces(5.5);
@@ -95,7 +96,7 @@ public void test4MF8() throws IOException, StructureException {
9596

9697
StructureIO.setAtomCache(cache);
9798

98-
cache.setUseMmCif(false);
99+
cache.setUseMmCif(true);
99100
Structure s1 = StructureIO.getStructure("4MF8");
100101
CrystalBuilder cb = new CrystalBuilder(s1);
101102
StructureInterfaceList interfaces = cb.getUniqueInterfaces(5.5);
@@ -115,11 +116,30 @@ public void test2H2Z() throws IOException, StructureException {
115116

116117
StructureIO.setAtomCache(cache);
117118

118-
cache.setUseMmCif(false);
119+
cache.setUseMmCif(true);
119120
Structure s1 = StructureIO.getStructure("2H2Z");
120121
CrystalBuilder cb = new CrystalBuilder(s1);
121122
StructureInterfaceList interfaces = cb.getUniqueInterfaces(5.5);
122123
assertTrue(interfaces.size()>=3);
123124

124125
}
126+
127+
@Test
128+
public void test4HHB() throws IOException, StructureException {
129+
130+
// 4hhb is a very old entry with a non-standard coordinate frame convention, we should calculate only AU contacts
131+
132+
AtomCache cache = new AtomCache();
133+
134+
StructureIO.setAtomCache(cache);
135+
136+
cache.setUseMmCif(true);
137+
Structure s1 = StructureIO.getStructure("4HHB");
138+
CrystalBuilder cb = new CrystalBuilder(s1);
139+
StructureInterfaceList interfaces = cb.getUniqueInterfaces(5.5);
140+
// 5 interfaces in the AU: the 4 of the tetramer + 1 cross-interface
141+
assertEquals(5, interfaces.size());
142+
143+
}
144+
125145
}

biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public CrystalBuilder(Structure structure) {
128128
if (this.crystallographicInfo.isNonStandardCoordFrameConvention()) {
129129
logger.warn("Non-standard coordinate frame convention, will only calculate asymmetric unit interfaces.");
130130
this.isCrystallographic = false;
131+
this.numOperatorsSg = 1; // we force here to 1 or otherwise it gets filled from sg above
131132
}
132133

133134
} else {

0 commit comments

Comments
 (0)