precellar.utils.bam_to_fastq#

precellar.utils.bam_to_fastq(input, output_dir, *, compression_level=None)#

Convert a BAM file to a FASTQ file.

This function reads a BAM file and convert the alignments back to a FASTQ file. The function will ignore secondary/supplementary alignments.

Parameters:
  • input (str) – File path or url to the input BAM file.

  • output_dir (Path) – Directory containing the output FASTQ files.

  • compression (Literal['gzip', 'zst'] | None) – Compression algorithm to use. If None, the compression algorithm will be inferred from the file extension.

  • compression_level (int | None) – Compression level to use.