Skip to content

fix: store CL BAM tag as scalar integer for samtools filtering#91

Open
jayhesselberth wants to merge 2 commits into
mainfrom
fix/cl-tag-scalar
Open

fix: store CL BAM tag as scalar integer for samtools filtering#91
jayhesselberth wants to merge 2 commits into
mainfrom
fix/cl-tag-scalar

Conversation

@jayhesselberth
Copy link
Copy Markdown
Member

Summary

  • The CL (charging likelihood) BAM tag was stored as a byte array (B:C,[220]) because it was copied verbatim from Remora's ML tag. This prevented filtering with samtools view -d CL:>=200.
  • Adds --to-scalar flag to transfer_tags.py that converts single-element array tags to scalar integers (CL:i:220) during transfer.
  • Updates get_charging_table.py to handle both scalar int (new) and array (legacy) CL values for backward compatibility.

Test plan

  • Unit tests for --to-scalar conversion in test_transfer_tags.py
  • Unit test for scalar int CL tag in test_get_charging_table.py
  • Existing array-based tests still pass (backward compat)
  • pixi run dry-run passes
  • After a full pipeline run, verify: samtools view -d 'CL:>=200' bam/final/sample/sample.bam | head

🤖 Generated with Claude Code

The CL (charging likelihood) tag was stored as a byte array (B:C,[220])
because it was copied verbatim from Remora's ML tag. This prevented
filtering with `samtools view -d CL:>=200`. Converting to a scalar
integer (CL:i:220) enables standard samtools tag filtering.

- Add --to-scalar flag to transfer_tags.py for array-to-scalar conversion
- Update transfer_bam_tags rule to pass --to-scalar CL
- Update get_charging_table.py to handle both scalar and array CL values
- Add tests for scalar conversion and backward compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant