CIF Parser Edge Cases — Quotes, Text Fields and Wrapped Loops (.cif)
A CIF built entirely out of the constructs that break naive parsers: quoted values containing apostrophes and hashes, a semicolon-delimited multi-line text field, the distinct '?' and '.' markers, a standard uncertainty written as 1.2345(7), and a loop whose rows wrap across lines. Every one of them is legal CIF.
data_parser_edge_cases
_simple_value 42
_quoted_single 'a value with spaces'
_quoted_double "another value, with a comma"
_apostrophe_inside 'the sample's label'
_hash_not_a_comment 'value with a # inside quotes'
_value_unknown ?
_value_inapplicable .
_number_with_su 1.2345(7)
_negative_number -0.00042
_exponent_number 1.5e-3
_semicolon_text_field
;
A multi-line semicolon-delimited text field.
It may contain 'quotes', "double quotes", # hashes and a lone ; that is not
at the start of a line, and it ends only at a semicolon in column one.
;
loop_
_pair_name
_pair_value
alpha 1
beta 2
gamma 3
loop_
_wrapped_a
_wrapped_b
_wrapped_c
1 2
3
4 5 6
# a real comment, outside any value
Specifications
- Tags
- 10
- Loops
- 2
- Semicolon Text Fields
- 1
- Apostrophe Inside Quotes
- true
- Hash Inside Quotes
- true
- Unknown Marker
- ?
- Inapplicable Marker
- .
- Standard Uncertainty Notation
- 1.2345(7)
- Wrapped Loop Rows
- values continue across lines
Testing contract
Expected to pass- Scenario
- Parse the file and report the value of each tag plus the row count of both loops.
- Expected result
- The second loop yields two rows of three values despite wrapping across four lines, _value_unknown and _value_inapplicable are distinguished, and the hash inside quotes is not treated as a comment.
What is a .cif file?
CIF (Crystallographic Information File) is the IUCr's standard text format for crystal structures. It is a tagged plain-text format in which `_data_name value` pairs and `loop_` blocks carry unit-cell parameters, symmetry operations, atom sites with fractional coordinates and occupancies, and full experimental provenance. mmCIF, its macromolecular profile, is now the archival format of the Protein Data Bank.
How to use this file
Use an example .cif file to test crystallography parsers and structure viewers, exercising loop_ construct handling, quoted and multi-line semicolon-delimited values, and the reconstruction of Cartesian coordinates from fractional ones and the cell parameters.
How to use this file for testing
“CIF Parser Edge Cases — Quotes, Text Fields and Wrapped Loops (.cif)” is a deterministic Novus Examples fixture for Scientific data, Editor testing, Error handling. Citation catalogs (BibTeX, RIS), chemistry structures (MDL Molfile, PDB), and gridded binary data (NetCDF, FITS) — for testing reference managers, molecule viewers, and scientific-data loaders.
Documented properties for this file: CIF · 877 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.
Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.
Scientific fixtures are small, valid, and fully synthetic — no real organism, patient, sample, or observation. Point your parser or loader at the file and check it reads the documented records, variables, or headers; binary formats ship a readable twin or metadata listing for comparison.
Related files
- molIntentionally Corrupt Molfile — Counts Line Disagrees With the Atom Block (.mol)An intentionally corrupt molfile whose counts line declares twelve atoms while the atom block contains nine, so a parser reading by count consumes three bond lines as atoms. Everything else about the file is well formed, which is what makes the failure quiet.

- csvCensored Values and Detection Limits — Non-Numeric Results (.csv)Nine laboratory results where only four are plain numbers: two are below the detection limit, one is above range, two are missing in different spellings, and one is a legitimate small negative near the blank. Coercing the censored strings to numbers or to NaN both bias the summary, and the file distinguishes every case explicitly.

- jsonIEEE-754 float64 Boundary Values — JSON With No NaN Literal (.json)The same boundary values as strict RFC 8259 JSON, where non-finite numbers are null in the numeric field and text in the string field because the standard has no NaN or Infinity literal. It is the fixture for the encoder that emits bare NaN and produces JSON nothing else will parse.

- jsonIntegers Beyond 2^53 in JSON — Silent Identifier Corruption (.json)Six large integers written both as JSON numbers and as strings, including the 2^53 boundary where consecutive integers stop being distinguishable in a double. A parser backed by doubles turns 9007199254740993 into 9007199254740992 and reports no error at all.

- fastqIntentionally Corrupt FASTQ — Final Record Missing Its Quality Line (.fastq)An intentionally corrupt FASTQ whose first five records are complete and whose sixth ends after the plus line, leaving no quality string. A four-line-block reader must report an incomplete final record rather than pairing the sequence with an empty quality string.

- mtxIntentionally Corrupt Matrix Market — Declared Count Exceeds the Entries (.mtx)An intentionally corrupt Matrix Market file whose banner and size line are perfectly valid and whose entry block stops seven lines short of the declared count. A reader that preallocates from the declared count and never checks ends up with seven silent zeros.

Generated by generation/scientific.py. Free for any use, no attribution required — license.