Skip to content
Prev Previous commit
Next Next commit
Support initial comments in MMCif files (e.g. those generated by PyMOL)
  • Loading branch information
sbliven committed Jun 8, 2018
commit c3cec9187eae380878a462495cbb98dbfdcdce5e
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ public void parse(BufferedReader buf)

// the first line is a data_PDBCODE line, test if this looks like a mmcif file
line = buf.readLine();
while( line != null && (line.isEmpty() || line.startsWith(COMMENT_CHAR))) {
line = buf.readLine();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to handle comments in first line!

Is an empty first line also valid CIF?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think blank lines are permitted anywhere in CIF, but I could be wrong. I try to write permissive parsers. It seems like it shouldn't break the spec so we might as well be robust to it either way.

if (line == null || !line.startsWith(MMCIF_TOP_HEADER)){
logger.error("This does not look like a valid mmCIF file! The first line should start with 'data_', but is: '" + line+"'");
triggerDocumentEnd();
Expand Down