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

problem in createLiger function #218

Closed robin1-2 closed 3 years ago

robin1-2 commented 3 years ago

I want to integrate two rds files (each's class is large dgCMatrix). I used the following code: ifnb_liger <- createLiger(list(ctrl = controldata, stim = coviddata))

get the error: Error in createLiger(list(ctrl = controldata, stim = coviddata)) : At least one cell name is repeated across datasets; please make sure all cell names are unique.

I checked whether there are duplicates in both row and column names with the collowing codes: any(duplicated(controldata@Dimnames[[1]])) any(duplicated(coviddata@Dimnames[[1]])) any(duplicated(controldata@Dimnames[[2]])) any(duplicated(coviddata@Dimnames[[2]]))

It seems there is no duplicate at all.

How can I solve the problem? By the way, createLiger function works with the data of Liger's protocol in "Jointly defining cell types from multiple single-cell datasets using LIGER"

cgao90 commented 3 years ago

Hi, Please check if there are any cells with the same barcode (column names since LIGER expects gene-by-cell matrix) contained in both datasets.

robin1-2 commented 3 years ago

@cgao90 It worked! Thank you so much.

For the ones who got the same error, I added prefixes to column names of datasets, with paste() function:

coviddata@Dimnames[[2]] <- paste("cov", coviddata@Dimnames[[2]]) controldata@Dimnames[[2]] <- paste("ctrl", controldata@Dimnames[[2]])