Iteratively reweighted least squares (IRLS) in scMultiMap
scMultiMap_IRLS.Rd
This function implements the 1st step of scMultiMap: estimate mean and variance for peaks or genes with IRLS. The output will be used as input to the 2nd step, scMultiMap_WLS(), to estimate and infer the association between genes and peaks.
Source
Cell-type-specific mapping of enhancer and target genes from single-cell multimodal data. Chang Su, Dongsoo Lee, Peng Jin, Jingfei Zhang; https://www.biorxiv.org/content/10.1101/2024.09.24.614814v1
Arguments
- X
A n by p count matrix, where n denotes the number of cells and p denotes the number of genes/peaks. It can be a length p vector when n=1.
- seq_depth
A length n vector of sequencing depths
- bsample
A length n vector of the names of biological sample the cell is from. When all cells are from the same sample, set to NULL (Default).
- irls
Whether to use IRLS. Default to TRUE. If FALSE, use ordinary least squares.
- verbose
Whether to print detailed messages. Default to FALSE.
Examples
# The following codes illustrate the use of `scMultiMap_IRLS` with toy datasets
# `small_obj` provided in this R package.
irls_list <- list()
irls_list[['gene']] <- scMultiMap_IRLS(t(as.matrix(small_obj[['RNA']]$counts)),
Matrix::colSums(small_obj[['RNA']]$counts))
irls_list[['peak']] <- scMultiMap_IRLS(t(as.matrix(small_obj[['peak']]$counts)),
Matrix::colSums(small_obj[['peak']]$counts))
print(str(irls_list[['gene']])) # estimated mean and variance for genes
#> List of 3
#> $ mu : Named num [1:100] 0.1273 0.0341 0.0241 0.0241 0.0216 ...
#> ..- attr(*, "names")= chr [1:100] "MALAT1" "LYZ" "B2M" "ACTB" ...
#> $ sigma_sq: Named num [1:100] 1.57e-03 2.05e-04 5.67e-05 7.81e-05 2.00e-04 ...
#> ..- attr(*, "names")= chr [1:100] "MALAT1" "LYZ" "B2M" "ACTB" ...
#> $ theta : num 5.05
#> NULL
print(str(irls_list[['peak']])) # estimated mean and variance for peaks
#> List of 3
#> $ mu : Named num [1:250] 0.00559 0.00359 0.00423 0.00436 0.00282 ...
#> ..- attr(*, "names")= chr [1:250] "chr11-65013281-65014841" "chr11-65026934-65027962" "chr11-65040583-65041780" "chr11-65083457-65084665" ...
#> $ sigma_sq: Named num [1:250] -5.06e-06 1.65e-06 5.43e-07 3.94e-06 3.56e-06 ...
#> ..- attr(*, "names")= chr [1:250] "chr11-65013281-65014841" "chr11-65026934-65027962" "chr11-65040583-65041780" "chr11-65083457-65084665" ...
#> $ theta : num 4.1
#> NULL