SAM Alignments — Header, Flags and CIGAR Operations (.sam)
Six alignments against a synthetic contig with a full @HD/@SQ/@RG/@PG header, both strands via the reverse flag, and CIGAR strings covering match, soft clip, insertion and deletion. Reference span and query length come apart in three of the records, which is where CIGAR arithmetic gets tested.
@HD VN:1.6 SO:coordinate
@SQ SN:NXCTG01 LN:600
@RG ID:NX-RG-1 SM:SYNTHETIC-SAMPLE PL:SYNTHETIC
@PG ID:novus-examples PN:novus-examples VN:1.0
NX_READ_001 0 NXCTG01 101 60 60M * 0 0 GGCGCGCACGTGGGGGCCCCCAAAAAGCTCTAATGGACTGAATATTGGGGCGTTCTGATA FGHFHEGEFDGDFGHDHEEECCFGCFFBDCFBEFDBDCEAAACCEBB@CAB@ACAC@@BB RG:Z:NX-RG-1 NM:i:1
NX_READ_002 0 NXCTG01 141 60 10S50M * 0 0 AACTATCTTAGATAAGAGTAGACGAGAGCAACCAGACTACTTGTTGTGGGCTGCGAGGAC GHFHHEGFFDFHDEEGGFFFEDDDFDFFEFEDBFDCEDEEDCACDADABBBBDBA?@CC@ RG:Z:NX-RG-1 NM:i:2
NX_READ_003 0 NXCTG01 181 60 30M2D30M * 0 0 AGCGACAGATATAGCTTACCGCCGCGGCTATAAGCAAAGTGTGTCAACGAACGGCTTTCT IFFFIHEIGHEDGGHDGHEDDGFGGCFBCBDCDEDDBCCCEEEBEBCBCDABBDCAABBC RG:Z:NX-RG-1 NM:i:0
NX_READ_004 16 NXCTG01 221 60 25M3I32M * 0 0 CAAGAGCATGGGCCCAATCCGTTGATTACTGAGCTTCATCGGATCCATTAACCGTCGGGT HEFEEEIHIFFGHEGDEHCFCGGGEGDDFEEFCCEBEADBDCCEC@BCBBDDAD??AB?? RG:Z:NX-RG-1 NM:i:1
NX_READ_005 0 NXCTG01 261 60 20M5I35M * 0 0 ACGGCAAGCCGAAAAGATATTATTGATTGATCTTACATTCGATCGGTTCGCAGACCCGAG IFHIFGEHHEGEGFGFGFGDEGGCDCFFCDEFFEEEDCBCDCEADAACB@@CDBBC@@CC RG:Z:NX-RG-1 NM:i:2
NX_READ_006 16 NXCTG01 301 60 60M * 0 0 ACCCGCAGTTTGGAGTGCCTAGCGACTAATGTGACACTGTGGTATCGCTCCTTCTTAGGA GGIFIHEIEEHEFGFHGFCCFGEFGDGECCECDBBBCADDDBABBDAA@DDABACB@A@A RG:Z:NX-RG-1 NM:i:0
Specifications
- Version
- SAM 1.6
- Header Lines
- 4
- Alignments
- 6
- Cigar Operations
- M, S, I, D
- Reverse Strand Records
- 2
- Reference Name
- NXCTG01
- Reference Length
- 600
- Mandatory Columns
- 11
- Optional Tags
- RG:Z, NM:i
Testing contract
Expected to pass- Scenario
- Parse the header and all eleven mandatory columns, then compute each alignment's reference end from its CIGAR.
- Expected result
- Six records parse with two carrying flag 16 for the reverse strand, and the 30M2D30M record spans 62 reference bases while its SEQ is 60 bases long.
What is a .sam file?
SAM (Sequence Alignment/Map) is the plain-text format for sequence alignments and the human-readable counterpart of binary BAM. An optional header of `@`-prefixed lines declares the sort order and reference sequences, and each alignment line has eleven mandatory tab-separated fields — including a bitwise FLAG, a 1-based position, a CIGAR string describing the match, and the sequence and its qualities — followed by optional typed TAG:TYPE:VALUE fields.
How to use this file
Use an example .sam file to test alignment parsers and format converters, exercising FLAG bit decoding, CIGAR operations that consume the reference but not the read, and the difference between unmapped records and records on an absent reference.
How to use this file for testing
“SAM Alignments — Header, Flags and CIGAR Operations (.sam)” is a deterministic Novus Examples fixture for Scientific data, Editor 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: SAM · 1,248 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
- bedBED6 Intervals — 0-Based Half-Open Coordinates (.bed)The same six features as the GFF3 file expressed in BED's 0-based half-open coordinates, where the start is one lower and the end is unchanged. Confusing the two conventions shifts every interval by a base, and this pair makes that shift a visible diff.

- fastaFASTA Contigs — One Line Per Record (.fasta)The same four contigs written one sequence per line rather than wrapped, which is how many pipelines emit FASTA and how many line-oriented parsers assume it always looks. Comparing against the wrapped twin proves a parser joins continuation lines instead of taking the first one.

- fastaFASTA Contigs — Wrapped at 60 Columns (.fasta)Four 600-base synthetic contigs wrapped at the conventional 60 columns, with the length and an invented organism name in each header. The sequences come from a fixed seed, so they are reproducible and belong to nothing that exists.

- csvFASTQ Quality Score Reference — Both Encodings Decoded (.csv)Every twelfth base of the six reads with its Phred score, the ASCII character it takes under both offsets, and the error probability that score implies. It converts a quality-encoding argument into a lookup you can diff.

- fastqFASTQ Reads — Phred+33 (Sanger / Illumina 1.8+) (.fastq)Six 60-base reads with Phred+33 quality strings, the modern Sanger encoding used by everything since Illumina 1.8. Quality declines along each read the way real sequencing does, so a mis-decoded offset produces implausible scores rather than plausible ones.

- fastqFASTQ Reads — Phred+64 Legacy Encoding (.fastq)The identical reads and identical quality scores written with the legacy Phred+64 offset used by older Illumina pipelines. Decode it with the modern offset and every base looks 31 points better than it is, which is a silent quality inflation rather than a parse failure.

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