View source: R/preprocessing_filtering_reduction.R
rebin_matrix | R Documentation |
This functions is best used to re-count large number of small bins or peaks (e.g. <= 5000bp) into equal or larger sized bins. The genome is either cut in fixed bins (e.g. 50,000bp) or into an user defined number of bins. Bins are calculated based on the canconical chromosomes. Note that if peaks are larger than bins, or if peaks are overlapping multiple bins, the signal is added to each bin. Users can increase the minimum overlap to consider peaks overlapping bins (by default 150bp, size of a nucleosome) to disminish the number of peaks overlapping multiple region. Any peak smaller than the minimum overlapp threshold will be dismissed. Therefore, library size might be slightly different from peaks to bins if signal was duplicated into multiple bins or ommitted due to peaks smaller than minimum overlap.
rebin_matrix(
mat,
bin_width = 50000,
custom_annotation = NULL,
minoverlap = 500,
verbose = TRUE,
ref = "hg38",
nthreads = 1,
rebin_function = rebin_helper
)
mat |
A matrix of peaks x cells |
bin_width |
Width of bins to produce in base pairs (minimum 500) (50000) |
custom_annotation |
A GenomicRanges object specifying the new features to count the matrix on instead of recounting on genomic bins. If not NULL, takes predecency over bin_width. |
minoverlap |
Minimum overlap between the original bins and the new features to consider the peak as overlapping the bin . We recommand to put this number at exactly half of the original bin size (e.g. 500bp for original bin size of 1000bp) so that no original bins are counted twice. (500) |
verbose |
Verbose |
ref |
Reference genome to use (hg38) |
nthreads |
Number of threads to use for paralell processing |
A sparse matrix of larger bins or peaks.
mat = create_scDataset_raw()$mat
binned_mat = rebin_matrix(mat,bin_width = 10e6)
dim(binned_mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.