Repository navigation
pmdshodh 0.3.1
pmdshodh 0.3.1 has the fixes from the 0.3 audit (docs/audit-0.3.md, findings B1–B7). For valid input, default-mode scores and kept reads are unchanged from 0.3.0. The JSON run summary is now format_version 3.
Fixed
-rwith a FASTA whose.faino longer matches it (for example, rewrapped after indexing) gave wrong reference bases with no error. It is now an input error asking to index the FASTA again (B1).- An absurd CIGAR with
-rcould use gigabytes of memory or abort the run. It is now an input error at once (B3). --pmdtools-compatnow matches PMDtools 0.60 in five more cases. These areNoverNwith-r(B2), reads flagged unmapped that still have an alignment (B4), reads without reference bases (B5), hard-clipped reads (B6), andfilterthresholds outside PMDtools' range, such as-t -1000000(B7).
Install
pip install pmdshodh==0.3.1Or download the binary for your platform below and check it against SHA256SUMS. A Bioconda package is still to come.
Changes
Changed
- JSON run summary
format_version3 (was 2):reads.skippedhas a new reason,no_reference_bases, counted only with--pmdtools-compat(see Fixed, B5). Other fields are unchanged.reportreads versions 1 to 3.
Fixed
- With
-r, a FASTA that no longer matched its.faiindex (for example, rewrapped after indexing) was read with wrong reference bases, with no error, from its second 1 MiB block on. In a synthetic 2.5 Mb test, one read scored 6.55 from 8 sites instead of −1.17 from 22.samtools faidxreturns wrong bases in this case too. pmdshodh now checks that every line break is where the index puts it, and that each sequence starts after its header line. A mismatch stops the run with an input error (exit 2) asking to index the FASTA again. This was already the case for CRAM input from an uncompressed FASTA, and now also covers bgzip-compressed FASTA. Output for correctly indexed FASTAs is unchanged. Found by the 0.3 audit (docs/audit-0.3.md, B1). --pmdtools-compat -rtreated anNread base over anNreference base as a match when it built the MD tag, butsamtools calmdwrites it as a mismatch. Only reads that also have PMDtools' combined-CIGAR reconstruction (docs/blackbox.md 1.6c) were affected: an insertion or soft clip together with a deletion, which shifts MD letters along the read. On 583 generated reads, 15 differed fromsamtools calmd | pmdtools0.60, by up to 0.085. They now match, with a largest difference of 2e-14. Default mode is unchanged, becauseNis never a C or G site. Found by the 0.3 audit (docs/audit-0.3.md, B2).- With
-r, a record whose CIGAR covers far more read bases than its SEQ had a per-base vector built before its length was checked. A 4,000,000,000-base insertion used 7.3 GB for 39 s before the error, and a 2×10¹⁶-base one aborted the run (exit 134) instead of stopping with an input error. CIGAR lengths are now checked first, and summed without overflow, so they can no longer wrap round to SEQ's length. The reference window end is computed with an overflow check too. Such records are now an input error (exit 2) at once, with or without-r. Valid reads are unaffected. Found by fuzzing in the 0.3 audit (docs/audit-0.3.md, B3). --pmdtools-compatskipped reads flagged unmapped that still have a CIGAR and MD tag, but PMDtools ignores flags and scores them. bwa writes such reads when they overhang a reference end, which is common with many short references. On a BAM of Motala3's chr21 reads aligned to 3,511 contigs of 10 kb, compat scored 307,139 reads against PMDtools' 309,320. It now scores them from MD, also with-r, and matches PMDtools on all 309,320 reads (largest difference 4.1e-14). Unmapped reads without an alignment, or with one that cannot be scored, are still counted as unmapped. Default mode still skips all unmapped reads; this is now listed as a departure in docs/design.md §5. Found by the 0.3 audit (docs/audit-0.3.md, B4).--pmdtools-compatscored reads that PMDtools drops with "bad reference sequence reconstruction": reads whose rebuilt reference has no uppercase A, C, G or T, for example reads aligned only toN(20 of 755,825 reads of ENA ERR4589292), reads made only of=bases, or reads with only lowercase MD letters (rule found by black-box probes, docs/blackbox.md 1.6e). Compat now drops them, counted asskipped.no_reference_bases. They have no informative sites, so no score changes and kept reads are unaffected. Default mode still scores them (0 from 0 sites). Found by the 0.3 audit (docs/audit-0.3.md, B5).--pmdtools-compatscored reads with a hard clip (H) in their CIGAR, but PMDtools drops every such read, whatever its flags, with the message it prints forNandPCIGARs (rule found by black-box probes, docs/blackbox.md 1.6f). bwa mem writes hard clips on supplementary alignments: on the aligner sweep'sbwa_mem_pe.bam, compat scored 197,064 reads against PMDtools' 197,046, and onbwa_mem_se.bam95,177 against 95,168. Compat now drops them, counted asskipped.unsupported_cigar(orskipped.clipswith--no-clips), and matches PMDtools by read name and flag on both files (largest difference 4.2e-14). No other read changes. Default mode still scores hard-clipped reads (departure D3, docs/design.md §5). Found by the 0.3 audit (docs/audit-0.3.md, B6).filter --pmdtools-compatapplied any--thresholdor--upper-threshold, but PMDtools filters only when--thresholdis above −10000 or--upperthresholdis below 1,000,000. Otherwise it acts as if neither was given and writes no reads (rule found by black-box probes, docs/blackbox.md 1.7b). So-t -1000000, a common way to keep every read, kept all reads in compat and none in PMDtools. Compat now keeps no reads in that case, and prints a note on stderr explaining why. Thresholds inside the range are unaffected:filter -t 3writes identical records before and after on three real BAMs, in both modes. Default mode still applies any finite bound. Found by the 0.3 audit (docs/audit-0.3.md, B7).
What's Changed
- Add the 0.3 audit plan by @dpatel511 in #49
- Add edge-case tests from the audit coverage map by @dpatel511 in #50
- Check FASTA line layout against its index (audit B1) by @dpatel511 in #51
- Write N over N as a mismatch in compat -r MD (audit B2) by @dpatel511 in #52
- Add property tests from the audit plan by @dpatel511 in #53
- Record the audit real-data matrix by @dpatel511 in #54
- Check CIGAR read length before allocating (audit B3) by @dpatel511 in #55
- Add fuzz targets from the audit plan by @dpatel511 in #56
- Score placed unmapped reads in compat mode (audit B4) by @dpatel511 in #57
- Record the audit's new test data and findings B4 and B5 by @dpatel511 in #58
- Drop reads without reference bases in compat mode (audit B5) by @dpatel511 in #59
- Drop hard-clipped reads in compat mode (audit B6) by @dpatel511 in #60
- Keep no reads for out-of-range compat thresholds (audit B7) by @dpatel511 in #61
- Prepare 0.3.1 by @dpatel511 in #62
Full Changelog: v0.3.0...v0.3.1