The export must keep each distinct alignment record that overlaps at least one BED interval and passes the supplied policy. BED coordinates are 0-based and half-open; boundary-spanning alignments count as overlaps, MAPQ equal to the threshold passes, and separate records sharing a query name must remain separate. An alignment returned by multiple target fetches must appear only once.
Preserve the source header and every retained record’s SAM fields and tags. Deliver a coordinate-sorted BAM plus /workspace/output/reviewer.bam.bai, and make indexed region queries work.
Keep the manifest keys already scaffolded in the script. input_records counts the source once, target_fetch_records counts every per-interval fetch hit before de-duplication, and unique_overlapping_records counts distinct overlapping alignment records before filtering. Assign each rejected unique overlap to the first matching entry in the policy’s exclusion_order; duplicate_target_hits is the repeated-fetch remainder, and the manifest counts must reconcile to output_records.
The CLI must also work with other valid input, target, policy, output, and manifest paths, creating output directories when needed.