snapatac2.pp.recipe_10x_metrics#

snapatac2.pp.recipe_10x_metrics(bam_file, output_fragment_file, output_h5ad_file, peaks=None, **kwargs)[source]#

Preprocess raw Bam files and generate a set of QC metrics similar to the 10x Genomics pipeline.

Parameters:
  • bam_file (Path) – Path to the input BAM file.

  • output_fragment_file (Path) – Path to the output fragment file.

  • output_h5ad_file (Path) – Path to the output h5ad file.

  • peaks (Union[Path, list[str], None]) – Path to the peak file or a list of peak regions. If None, MACS3 will be used to call peaks. Default is None.

  • **kwargs – Additional arguments for the functions used in the recipe.

Returns:

A dictionary containing the QC metrics.

Return type:

dict

Examples

>>> import snapatac2 as snap
>>> bam_file = snap.datasets.pbmc500(type='bam')
>>> metrics = snap.pp.recipe_10x_metrics(bam_file, 'fragments.tsv.gz', 'data.h5ad', barcode_tag='CB', source='10x', chrom_sizes=snap.genome.hg38, gene_anno=snap.genome.hg38)
>>> print(metrics)