welch-lab / liger

R package for integrating and analyzing multiple single-cell datasets
GNU General Public License v3.0
389 stars 78 forks source link

makeFeaturematrix not available #160

Closed ankushs0128 closed 4 years ago

ankushs0128 commented 4 years ago

makeFeaturematrixfunctionality not available

gene.counts <- makeFeatureMatrix(genes.bc, barcodes) Error in makeFeatureMatrix(genes.bc, barcodes) : could not find function "makeFeatureMatrix"

gene.counts <- liger:::makeFeatureMatrix(genes.bc, barcodes) Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : object 'makeFeatureMatrix' not found

ankushs0128 commented 4 years ago

installing updated Liger solves the issue

jykr commented 3 years ago

Installing github version didn't fixed the issue for me. I just ended up writing R function. Just logging in case it would be useful for anyone.

MakeFeatureMatrix <- function(bedmat, barcodes){
    require(dplyr)
    bedmat = genes.bc
    gc_pairs = separate_rows(select(bedmat, c("V4", "V7")), V7, sep = ";")
    gc_pairs = subset(gc_pairs, V7 %in% barcodes)
    genes = genes.bc$V4
    gc_pairs$gene_idx = match(gc_pairs$V4, genes)
    gc_pairs$bc_idx = match(gc_pairs$V7, barcodes)
    output = Matrix::sparseMatrix(i = gc_pairs$gene_idx, 
                                  j = gc_pairs$bc_idx, 
                                 x = 1L, 
                                 dims = c(length(genes), length(barcodes)),
                                 dimnames = list(genes, barcodes)
                                 )
    return(output)
}
skpalan commented 3 years ago

Hi Jayoung @jykr , thanks for your reply. LIGER is now available on CRAN, you can install this verison which should fix this problem as well.