Skip to content

Commit 126d3cf

Browse files
committed
A test for CRYST1 parsing issue
1 parent 9378955 commit 126d3cf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestNonDepositedFiles.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import static org.junit.Assert.*;
2424

2525
import java.io.BufferedReader;
26+
import java.io.ByteArrayInputStream;
2627
import java.io.IOException;
2728
import java.io.InputStream;
2829
import java.io.InputStreamReader;
@@ -408,6 +409,23 @@ public void testWaterOnlyChainCif() throws IOException {
408409
assertSame(c, cAsymId);
409410

410411
}
412+
413+
/**
414+
* Some PDB files coming from phenix or other software can have a CRYST1 line without z and not padded with white-spaces
415+
* for the space group column.
416+
* @throws Exception
417+
* @since 5.0.0
418+
*/
419+
@Test
420+
public void testCryst1Parsing() throws Exception {
421+
String cryst1Line = "CRYST1 11.111 11.111 111.111 70.00 80.00 60.00 P 1";
422+
Structure s;
423+
PDBFileParser pdbPars = new PDBFileParser();
424+
try(InputStream is = new ByteArrayInputStream(cryst1Line.getBytes()) ) {
425+
s = pdbPars.parsePDBFile(is);
426+
}
427+
assertEquals("P 1", s.getPDBHeader().getCrystallographicInfo().getSpaceGroup().getShortSymbol());
428+
}
411429

412430

413431
private static int[] countEntityTypes(List<EntityInfo> entities) {

0 commit comments

Comments
 (0)