constantAmateur / SoupX

R package to quantify and remove cell free mRNAs from droplet based scRNA-seq data
254 stars 35 forks source link

Error in loading data #5

Closed justinesjw closed 6 years ago

justinesjw commented 6 years ago

Hello!

I'm trying to apply my data on SoupX but I kept getting this error and can not seem to solve it

Error in intI(j, n = x@Dim[2], dn[[2]], give.dn = FALSE) : 'NA' indices are not (yet?) supported for sparse Matrices

Can you please advise if i might have gone wrong anywhere?

sessionInfo()

R version 3.4.1 (2017-06-30) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS release 6.5 (Final) Matrix products: default BLAS: /mnt/software/stow/R-3.4.1/lib64/R/lib/libRblas.so LAPACK: /mnt/software/stow/R-3.4.1/lib64/R/lib/libRlapack.so locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] SoupX_0.3.0 devtools_1.13.5 Seurat_2.3.0 Matrix_1.2-14 [5] cowplot_0.9.2 ggplot2_3.0.0

Thanks!

constantAmateur commented 6 years ago

Hello,

This looks like an issue with your input data, probably missing or duplicated gene names although without some example data I'm just guessing. Are you trying to process 10X data with load10X?

justinesjw commented 6 years ago

Hey,

Sorry for the incomplete information. Here is the line that i ran: scl = load10X(path, keepDroplets = TRUE)

In the folder there is both filtered and raw data folder

filtered_gene_bc_matrices raw_gene_bc_matrices

Yea, i'm processing 10X data and there are duplicated genes in the data. I'm previously processing the data in python and I usually remove the duplicated genes after loading it.

constantAmateur commented 6 years ago

You will either need to edit your input matricies to exclude the duplicates before loading with load10X, or manually load the matrices in R, exclude duplicates, then construct the SoupChannel object yourself.

Having a look at the source code for load10X should give you an idea how to manually construct the SoupChannel object yourself.

justinesjw commented 6 years ago

Hello,

If anyone is facing the same error, at this line in load10X:

cells = gsub('-1','',cells[,1])

It's removing part of the sample names which leads to producing NAs when running

cellIdxs = match(cells,colnames(tod))

Thanks!!

kvshams commented 5 years ago

@justinesjw Tried similar to your command and still getting the error. Can you please explain how I can solve this issue?

kvshams commented 5 years ago

@justinesjw I found that there is the duplicate barcode (xxxxx-1 & xxxxxxx-2) so included one extra line in load10X to replace -2 also, but still getting the same error. Any fix so far?

justinesjw commented 5 years ago

Hi, i commented off this line

cells = gsub('-1','',cells[,1])

is that what u did too?

kvshams commented 5 years ago

@justinesjw Yes I was doing like this cells = gsub('-2,'',cells$V1) cells = gsub('-1','',cells[,1]) still getting the error

justinesjw commented 5 years ago

hey..

I meant comment off this line like this #cells = gsub('-1','',cells[,1])

Cause cell ranger arranges your cells groups by barcodes and end with number (eg. 1, 2,3, ...) image

but SoupX only remove the tags with '-1's in filtered_gene_bc_matrices

cells = read.delim(file.path(dataDir,'filtered_gene_bc_matrices',ref,'barcodes.tsv'),sep='\t',header=FALSE)
cells = gsub('-1','',cells[,1])

After only replacing the '-1's in filtered_gene_bc_matrices, they try to match the cell names in raw_gene_bc_matrices to the filtered_gene_bc_matrices. This is where NAs occur cellIdxs = match(cells,colnames(tod))

This where the error pops out

channels[[channelNames[i]]] = SoupChannel(tod,tod[,cellIdxs,drop=FALSE],channelName=channelNames[i],ref=ref,path=dataDir,dataType='10X',...)

sorry for the lengthy post

I hope it helped v(^.^)v