File tree Expand file tree Collapse file tree
main/java/org/biojava/nbio/structure/io
test/java/org/biojava/nbio/structure/io Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1468,9 +1468,9 @@ private void pdb_EXPDTA_Handler(String line) {
14681468 * </pre>
14691469 */
14701470 private void pdb_CRYST1_Handler (String line ) {
1471- // for badly formatted files (e.g. phenix-produced ones), there's no z and the min length is 63
1472- if (line .length () < 63 ) {
1473- logger .warn ("CRYST1 record has fewer than 63 columns: will ignore it" );
1471+ // for badly formatted files (e.g. phenix-produced ones), there's no z and the min length is 58 (e.g. for SG 'P 1')
1472+ if (line .length () < 58 ) {
1473+ logger .warn ("CRYST1 record has fewer than 58 columns: will ignore it" );
14741474 return ;
14751475 }
14761476
Original file line number Diff line number Diff line change 2323import static org .junit .Assert .*;
2424
2525import java .io .BufferedReader ;
26+ import java .io .ByteArrayInputStream ;
2627import java .io .IOException ;
2728import java .io .InputStream ;
2829import 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 IOException
417+ * @since 5.0.0
418+ */
419+ @ Test
420+ public void testCryst1Parsing () throws IOException {
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 ) {
You can’t perform that action at this time.
0 commit comments