CountPeaks: Generate a peak x cell UMI count matrix

View source: R/count_polyA.R

CountPeaksR Documentation

Generate a peak x cell UMI count matrix

Description

Generates a UMI count matrix where rows are the peaks and columns are the cells. Counts cells that are identified through a provided 'white list' of cell barcodes. If alignment done using CellRanger, this will be the barcodes.tsv file contained in the 'filtered_gene_matrices_mex' folder for example.

Usage

CountPeaks(
  peak.sites.file,
  gtf.file,
  bamfile,
  whitelist.file,
  output.dir,
  countUMI = TRUE,
  ncores = 1,
  chr.names = NULL,
  filter.chr = FALSE,
  gene.symbol.ref = "gene_name",
  CBtag = "CB",
  UMItag = "UB"
)

Arguments

peak.sites.file

a file containing peak coordinates generated by FindPeaks

gtf.file

reference (GTF) file

bamfile

scRNA-seq BAM file

whitelist.file

file of cell barcodes to count

output.dir

name of directory to write output (will be created if it doesn't exist)

countUMI

whether to count UMIs (default: TRUE)

ncores

Number of cores for multithreading

chr.names

names of chromosomes

filter.chr

names of chromosomes to filter

gene.symbol.ref

field in the GTF file containing the gene symbol

CBtag

cell barcode tag identifier present in BAM file. Default 'CB'.

UMItag

UMI barcode tag identifier present in BAM file. Default 'UB'.

Value

NULL. Writes counts to file.

Examples


extdata_path <- system.file("extdata",package = "Sierra")
reference.file <- paste0(extdata_path,"/Vignette_cellranger_genes_subset.gtf")

bamfile <- c(paste0(extdata_path,"/Vignette_example_TIP_sham.bam"),
             paste0(extdata_path,"/Vignette_example_TIP_mi.bam") )
             
whitelist.bc.file <- paste0(extdata_path,"/example_TIP_sham_whitelist_barcodes.tsv")
  
peak.merge.output.file = paste0(extdata_path, "/TIP_merged_peaks.txt")
 
## Not run:                                 
CountPeaks(peak.sites.file = peak.merge.output.file, 
             gtf.file = reference.file,
             bamfile = bamfile[1], 
             whitelist.file = whitelist.bc.file[1],
             output.dir = count.dirs[1], 
             countUMI = TRUE, 
             ncores = 1)
 
## End(Not run)



VCCRI/Sierra documentation built on July 3, 2023, 6:39 a.m.