Skip to content
Novus Examples
csv425 B

SAM CIGAR Span Reference — Query versus Reference Length (.csv)

Each alignment's CIGAR decomposed into how many query bases and how many reference bases it consumes, with the resulting 1-based reference end. The three records where those numbers differ are the whole reason CIGAR arithmetic is worth testing.

Preview — first 8 linescsv
read_id,flag,reverse_strand,cigar,ref_start_1_based,ref_end_1_based,reference_span,query_length,operations
NX_READ_001,0,false,60M,101,160,60,60,6 0 M
NX_READ_002,0,false,10S50M,141,190,50,60,1 0 S 5 0 M
NX_READ_003,0,false,30M2D30M,181,242,62,60,3 0 M 2 D 3 0 M
NX_READ_004,16,true,25M3I32M,221,277,57,60,2 5 M 3 I 3 2 M
NX_READ_005,0,false,20M5I35M,261,315,55,60,2 0 M 5 I 3 5 M
NX_READ_006,16,true,60M,301,360,60,60,6 0 M

Specifications

Rows
6
Columns
9
Rule
M/=/X consume both; I/S consume query only; D/N consume reference only
Records Where Spans Differ
3
Describes
the paired SAM file

Testing contract

Reference control
Scenario
Compute the reference span and query length of every CIGAR in the paired SAM file and diff against this table.
Expected result
All six rows match, 10S50M consumes 60 query bases but only 50 reference bases, and 30M2D30M consumes 60 query bases against a 62-base reference span.

What is a .csv file?

CSV (Comma-Separated Values) is a plain-text tabular format where rows are lines and fields are separated by commas, with quoting rules for values that contain delimiters, quotes, or newlines. It has no formal type system and depends on encoding and dialect conventions. It is the most portable format for tabular data exchange.

How to use this file

Use an example CSV to test parsers against quoting and embedded-delimiter edge cases, header handling, encoding detection, and import pipelines into databases or spreadsheets.

How to use this file for testing

“SAM CIGAR Span Reference — Query versus Reference Length (.csv)” is a deterministic Novus Examples fixture for Scientific data, Editor testing, Conversion testing. 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: 6 rows · 9 columns. 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.

Code examples

import pandas as pd

df = pd.read_csv("cigar-reference.csv")
print(df.head())
print(df.dtypes)

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