% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/duckhts.R
\name{rduckhts_bam_bin_counts}
\alias{rduckhts_bam_bin_counts}
\title{Native Fixed-Width BAM/CRAM Bin Counts}
\usage{
rduckhts_bam_bin_counts(
  con,
  path,
  bin_width,
  chrom = NULL,
  include_unmapped = FALSE,
  reference = NULL,
  index_path = NULL,
  mapq = 0,
  require_flags = 0,
  exclude_flags = 0,
  rmdup = "none",
  stats = NULL
)
}
\arguments{
\item{con}{A DuckDB connection with DuckHTS loaded}

\item{path}{Path to the input BAM or CRAM file}

\item{bin_width}{Positive fixed bin width in bases}

\item{chrom}{Optional chromosome name filter}

\item{include_unmapped}{Logical. If `TRUE`, append one synthetic row for
unmapped/no-coordinate records with `chrom = "*"`, and `start`, `end`, and
`bin_id` set to `NA`.}

\item{reference}{Optional reference FASTA path for CRAM input when required,
and for reference-GC output when `stats` includes `"gc"`}

\item{index_path}{Optional explicit BAM/CRAM index path}

\item{mapq}{Minimum mapping quality threshold applied after duplicate logic}

\item{require_flags}{Required SAM flag mask}

\item{exclude_flags}{Excluded SAM flag mask}

\item{rmdup}{Duplicate handling mode: `"none"`, `"flag"`, or `"streaming"`}

\item{stats}{Optional comma-separated subset of `"gc"` and `"mq"`}
}
\value{
A data frame with one row per fixed-width bin across the selected
  contig span, including zero-count bins, plus total, forward, reverse, and
  optional GC/MAPQ summary columns
}
\description{
Count read starts into fixed-width genomic bins with optional duplicate
handling and optional per-bin GC and MAPQ summary statistics.
}
