Skill Tracer
Skills › Scientific Agent Skills › pysam › sources.md

sources.md

148 lines · skills/pysam/references/sources.md at 5f2bc03

Open on GitHub
1# Authoritative Sources
2
3Last researched: **2026-10-01**
4
5Skill baseline: **pysam 0.24.1**, released **2026-09-07**, wrapping
6**HTSlib/samtools/bcftools 1.24**.
7
8Use these sources in priority order when refreshing this skill. Do not assume
9that the newest standalone HTSlib release is the version embedded in the
10current pysam wheel.

Authoritative Sources

Last researched: 2026-10-01

Skill baseline: pysam 0.24.1, released 2026-09-07, wrapping HTSlib/samtools/bcftools 1.24.

Use these sources in priority order when refreshing this skill. Do not assume that the newest standalone HTSlib release is the version embedded in the current pysam wheel.

Raw lines 1 to 11
12## Pysam Release and Package Metadata
14- [pysam on PyPI](https://pypi.org/project/pysam/) — current published version,
15 release date, wheels, release history, and provenance attestations
16- [Pysam release notes](https://pysam.readthedocs.io/en/stable/release.html) —
17 0.24 CRAM changes, Python support, bundled component versions, bug fixes, and
18 deprecations
19- [pysam-developers/pysam](https://github.com/pysam-developers/pysam) —
20 upstream source and current development state
21- [pysam 0.24.1 source tag](https://github.com/pysam-developers/pysam/tree/v0.24.1)
22 — version-specific implementation and tests
24As of the research date, PyPI identifies 0.24.1 as latest. The 0.24 release
25notes state:
27- tested Python versions: 3.9 through 3.15 (RC2)
28- wheels: macOS and Linux, ARM and x86-64
29- bundled HTSlib/samtools/bcftools: 1.24
30- default newly written CRAM: 3.1
31- implicit EBI CRAM reference fetching: removed
32- `format_options`: Python `str` values work as documented
33- top-level CIGAR constants remain compatibility aliases; prefer
34 `pysam.CIGAR_OPS`
36Re-check all of these before changing the version pin.

Pysam Release and Package Metadata

As of the research date, PyPI identifies 0.24.1 as latest. The 0.24 release notes state:

  • tested Python versions: 3.9 through 3.15 (RC2)
  • wheels: macOS and Linux, ARM and x86-64
  • bundled HTSlib/samtools/bcftools: 1.24
  • default newly written CRAM: 3.1
  • implicit EBI CRAM reference fetching: removed
  • format_options: Python str values work as documented
  • top-level CIGAR constants remain compatibility aliases; prefer pysam.CIGAR_OPS

Re-check all of these before changing the version pin.

Raw lines 12 to 37
38## Official Pysam Documentation
40- [Documentation index](https://pysam.readthedocs.io/en/stable/index.html)
41- [Installation](https://pysam.readthedocs.io/en/stable/installation.html)
42- [Usage guide](https://pysam.readthedocs.io/en/stable/usage.html)
43- [API reference](https://pysam.readthedocs.io/en/stable/api.html)
44- [FAQ](https://pysam.readthedocs.io/en/stable/faq.html)
45- [Release notes](https://pysam.readthedocs.io/en/stable/release.html)
46- [Glossary](https://pysam.readthedocs.io/en/stable/glossary.html)
48Use the API reference for signatures and documented defaults. Use the FAQ for
49iterator lifetime, threading, coordinate, pileup, and quality-editing
50behavior. Where prose in the older usage guide conflicts with the current API,
51verify against the 0.24 source/tests and installed runtime.
53One known example: a real Python file object exposing `fileno()` works with
54`AlignmentFile`, while `io.BytesIO` does not. The API constructor documents
55file-object support; the usage guide's broad statement about "true python file
56objects" is too general.

Official Pysam Documentation

Use the API reference for signatures and documented defaults. Use the FAQ for iterator lifetime, threading, coordinate, pileup, and quality-editing behavior. Where prose in the older usage guide conflicts with the current API, verify against the 0.24 source/tests and installed runtime.

One known example: a real Python file object exposing fileno() works with AlignmentFile, while io.BytesIO does not. The API constructor documents file-object support; the usage guide's broad statement about "true python file objects" is too general.

Raw lines 38 to 57
58## Bundled Tool Manuals
60Pysam 0.24 wraps the 1.24 tool line. Consult manuals matching that line when
61using dispatchers:
63- [samtools 1.24 manual](https://www.htslib.org/doc/1.24/samtools.html)
64- [bcftools 1.24 manual](https://www.htslib.org/doc/1.24/bcftools.html)
65- [tabix 1.24 manual](https://www.htslib.org/doc/1.24/tabix.html)
66- [bgzip 1.24 manual](https://www.htslib.org/doc/1.24/bgzip.html)
67- [faidx 1.24 format/manual](https://www.htslib.org/doc/1.24/faidx.html)
68- [HTSlib documentation index](https://www.htslib.org/doc/)
70Pysam dispatchers emulate command-line subcommands but capture stdout/stderr.
71The pysam usage guide, not only the tool manual, defines `catch_stdout`,
72`save_stdout`, `split_lines`, `get_messages()`, and `SamtoolsError`.

Bundled Tool Manuals

Pysam 0.24 wraps the 1.24 tool line. Consult manuals matching that line when using dispatchers:

Pysam dispatchers emulate command-line subcommands but capture stdout/stderr. The pysam usage guide, not only the tool manual, defines catch_stdout, save_stdout, split_lines, get_messages(), and SamtoolsError.

Raw lines 58 to 73
74## CRAM References
76- [Pysam 0.24 release notes](https://pysam.readthedocs.io/en/stable/release.html#release-0-24-0)
77 — CRAM 3.1 default and removal of implicit EBI lookup
78- [Samtools reference-sequence guidance](https://www.htslib.org/doc/1.24/samtools.html)
79 — CRAM reference search order and `REF_PATH`/`REF_CACHE`
80- [Using CRAM within Samtools](https://www.htslib.org/workflow/cram.html) —
81 reference-based compression, M5 tags, local caches, and workflow concepts
83The older CRAM workflow page describes historical fallback to EBI. For pysam
840.24/HTSlib 1.24 behavior, the 0.24 release notes and matching samtools manual
85take precedence: implicit EBI lookup is no longer the default.

CRAM References

The older CRAM workflow page describes historical fallback to EBI. For pysam 0.24/HTSlib 1.24 behavior, the 0.24 release notes and matching samtools manual take precedence: implicit EBI lookup is no longer the default.

Raw lines 74 to 86
87## Canonical Format Specifications
89- [HTS format specifications index](https://samtools.github.io/hts-specs/)
90- [SAM/BAM and BAI specification](https://samtools.github.io/hts-specs/SAMv1.pdf)
91- [SAM optional tags specification](https://samtools.github.io/hts-specs/SAMtags.pdf)
92- [CRAM 3 specification](https://samtools.github.io/hts-specs/CRAMv3.pdf)
93- [VCF 4.5 specification](https://samtools.github.io/hts-specs/VCFv4.5.pdf)
94- [BCF 2 quick reference](https://samtools.github.io/hts-specs/BCFv2_qref.pdf)
95- [Tabix index specification](https://samtools.github.io/hts-specs/tabix.pdf)
96- [CSI specification](https://samtools.github.io/hts-specs/CSIv1.pdf)
97- [BED 1 specification](https://samtools.github.io/hts-specs/BEDv1.pdf)
99Use format specifications for coordinate fields, flags, tags, header
100semantics, binary encodings, and index limits. Use pysam documentation for how
101those concepts are translated into Python properties.

Canonical Format Specifications

Use format specifications for coordinate fields, flags, tags, header semantics, binary encodings, and index limits. Use pysam documentation for how those concepts are translated into Python properties.

Raw lines 87 to 102
103## Source and Runtime Discrepancies Verified in 0.24.1
105The current release notes, API, installation guide, usage guide, FAQ, 1.24
106manuals, and the tagged Cython implementation were reviewed. Key source files:
108- [Alignment iteration, coverage, CRAM and pileup](https://github.com/pysam-developers/pysam/blob/v0.24.1/pysam/libcalignmentfile.pyx)
109- [CIGAR, sequence orientation and pileup columns](https://github.com/pysam-developers/pysam/blob/v0.24.1/pysam/libcalignedsegment.pyx)
110- [Variants, headers, fetch and write modes](https://github.com/pysam-developers/pysam/blob/v0.24.1/pysam/libcbcf.pyx)
111- [FASTA/FASTQ index and bounds behavior](https://github.com/pysam-developers/pysam/blob/v0.24.1/pysam/libcfaidx.pyx)
112- [Tabix constructor, indexes and parsers](https://github.com/pysam-developers/pysam/blob/v0.24.1/pysam/libctabix.pyx)
113- [Dispatcher error and message handling](https://github.com/pysam-developers/pysam/blob/v0.24.1/pysam/utils.py)
115Native synthetic tests on macOS/Python 3.13.3 confirmed:
117- Alignment fetch can return placed unmapped records; no-region variant fetch
118 rewinds and streams without an index.
119- `get_num_aligned()` includes D/N entries; actual base depth needs exclusions.
120- `count_coverage` sizes arrays from numeric start/stop, clips at the contig,
121 and does not derive array bounds from region/end aliases.
122- CRAI index counters are unavailable, not observed zero-read counts.
123- `FastaFile` can create an implicit index; explicit index paths prevent it.
124 End overruns clip rather than reliably raising.
125- Tabix CSI requires `index=`; the loaded path is `filename_index`, and the
126 0.24.1 implementation resets `threads` to 1.
127- `wbu` raises; `wb0` is level-zero BGZF BCF. Appending a `fileformat` meta-line
128 to a fresh `VariantHeader` duplicates the version line.
129- `get_messages()` may be stale after a dispatcher exception; use the exception.
131The per-skill tests generate tiny SAM/BAM/CRAM, VCF/BCF, FASTA/FASTQ and
132BGZF/tabix fixtures. No clinical or other biological result is validated.
133Linux networking-library loading, authenticated remote storage, institutional
134reference caches, and Cython extension ABI builds were not executed. The
135`example.org` remote-I/O URLs are explicitly illustrative, not service APIs.

Source and Runtime Discrepancies Verified in 0.24.1

The current release notes, API, installation guide, usage guide, FAQ, 1.24 manuals, and the tagged Cython implementation were reviewed. Key source files:

Native synthetic tests on macOS/Python 3.13.3 confirmed:

  • Alignment fetch can return placed unmapped records; no-region variant fetch rewinds and streams without an index.
  • get_num_aligned() includes D/N entries; actual base depth needs exclusions.
  • count_coverage sizes arrays from numeric start/stop, clips at the contig, and does not derive array bounds from region/end aliases.
  • CRAI index counters are unavailable, not observed zero-read counts.
  • FastaFile can create an implicit index; explicit index paths prevent it. End overruns clip rather than reliably raising.
  • Tabix CSI requires index=; the loaded path is filename_index, and the 0.24.1 implementation resets threads to 1.
  • wbu raises; wb0 is level-zero BGZF BCF. Appending a fileformat meta-line to a fresh VariantHeader duplicates the version line.
  • get_messages() may be stale after a dispatcher exception; use the exception.

The per-skill tests generate tiny SAM/BAM/CRAM, VCF/BCF, FASTA/FASTQ and BGZF/tabix fixtures. No clinical or other biological result is validated. Linux networking-library loading, authenticated remote storage, institutional reference caches, and Cython extension ABI builds were not executed. The example.org remote-I/O URLs are explicitly illustrative, not service APIs.

Raw lines 103 to 136
137## Refresh Checklist
139When updating:
1411. Check PyPI for the newest published pysam.
1422. Read all release notes since the pinned version.
1433. Record the embedded HTSlib/samtools/bcftools version.
1444. Verify supported Python versions and wheel platforms.
1455. Re-check CRAM defaults and reference lookup.
1466. Compare API signatures in `api.html` and the tagged source.
1477. Run bundled scripts against the new version.
1488. Re-run Agent Skills validation and the security scanner.

Refresh Checklist

When updating:

  1. Check PyPI for the newest published pysam.
  2. Read all release notes since the pinned version.
  3. Record the embedded HTSlib/samtools/bcftools version.
  4. Verify supported Python versions and wheel platforms.
  5. Re-check CRAM defaults and reference lookup.
  6. Compare API signatures in api.html and the tagged source.
  7. Run bundled scripts against the new version.
  8. Re-run Agent Skills validation and the security scanner.
Raw lines 137 to 148