Export Tn5 insertion coverage tracks as bigwig files, one per group of cells. Fragments are split by group, the genome is tiled, and the number of fragment ends (Tn5 insertion sites) falling in each tile is counted and (optionally) normalized before writing the bigwig files. Note that each fragment contributes two insertion events (one at each end), so the tracks represent insertion-site coverage rather than fragment pileup.
Arguments
- object
A Seurat object
- assay
Name of assay to use
- group.by
The metadata variable used to group the cells
- idents
Identities to include (defined by group.by parameter)
- normMethod
Normalization method for the bigwig files. Default
RC.RCwill divide the number of insertions in a tile by the total number of fragments in the group. A scaling factor of 10^4 will be applied.ncellswill divide the number of insertions in a tile by the number of cells in the group.none(orNULL) will apply no normalization. The name of a metadata column can also be passed, in which case insertions will be divided by the sum of that column over the cells in the group, with a scaling factor of 10^4 applied.- tileSize
The size of the tiles in the bigwig file
- minCells
The minimum number of cells in a group for it to be exported. Groups with fewer than
minCellscells are skipped.- cutoff
The maximum number of insertions for a single cell in a given genomic tile. Counts above this value are capped before summing across cells. Note that cells are identified by their fragment-file barcode, so when an assay contains multiple fragment files this cap is shared between any cells that have the same barcode in different files.
- chromosome
A vector of chromosomes to export. If
NULL, use all chromosomes present inseqlengths.- seqlengths
Chromosome lengths used to define the genomic tiles. Can be a named numeric vector of chromosome lengths, or any object with a
seqlengthsmethod such as aBSgenomeorSeqinfo::Seqinfo()object. IfNULL, the chromosome lengths stored in the object are used; note that these are frequently unset, in which caseseqlengthsmust be supplied.- outdir
Directory to write the output bigwig files. Defaults to the current working directory.
- temp.dir
Directory to write the intermediate per-group bed files. Defaults to a temporary directory (
base::tempdir()).- cleanup
Remove the intermediate per-group bed files after writing the bigwig files. Default
TRUE.- verbose
Display messages
Examples
if (FALSE) { # \dontrun{
# chromosome lengths can be supplied as a BSgenome object, a Seqinfo, or a
# named numeric vector
ExportBigwig(
object,
group.by = "celltype",
seqlengths = BSgenome.Hsapiens.UCSC.hg38::BSgenome.Hsapiens.UCSC.hg38
)
} # }