MarioniLab / DropletUtils

Clone of the Bioconductor repository for the DropletUtils package.
https://bioconductor.org/packages/devel/bioc/html/DropletUtils.html
56 stars 27 forks source link

downsampleReads error #89

Closed harshini-c closed 2 years ago

harshini-c commented 2 years ago

Hi,

I just installed DropletUtils with R version 4.2.0 and Bioconductor 3.15

I wanted to downsample my 10x scRNAseq matrix from one condition. However, i get the following error:

Error in get_cell_barcodes(sample, "barcode", barcode.length) : c++ exception (unknown reason)

Could you please let me know how to resolve this?

I am attaching a screenshot of the error here as well.

Thank you!

image
jonathangriffiths commented 2 years ago

The release DropletUtils is building fine and the tests include this function, alongside loading of the molecule info data. In your case, you seem to have a problem with data loading rather than with the downsampling itself. Please could you check if your file actually exists, or if it has been otherwise broken in some way? For instance, can you load it with read10xMolInfo?

harshini-c commented 2 years ago

Thank you for your quick reply.

my input file in the above case was the filtered_feature_bc_matrix.h5 file from cell ranger. and it was giving the above error. However when i load it in Seurat, it loads fine. there are no errors.

I did change it to molecule_info.h5 and it was able to load with read10xMolInfo and I was also able to run downsampleReads

My question is whether the molecule_info.h5 is simialr to the filtered_feature_bc_matrix.h5 or the raw_feature_bc_matrix.h5 file from cell ranger. I would want to use the info from filtered_feature_bc_matrix.h5

Thank you for your help!

LTLA commented 2 years ago

?downsampleReads:

Arguments:

 sample: A string containing the path to the molecule information HDF5
          file.

https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/output/molecule_info

?read10xCounts:

Arguments:

 samples: ...

          Alternatively, each string may contain a path to a HDF5 file
          in the sparse matrix format generated by 10X. These can be
          mixed with directory names when ‘type="auto"’.

          ...

https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/advanced/h5_matrices

And then, ?downsampleMatrix:

Arguments:

       x: An integer or numeric matrix-like object containing counts.

It should be fairly straightforward to join the dots.

harshini-c commented 2 years ago

Thank you.

This is what i tried

test <- read10xCounts('./scRNAseq_Neu_WT/outs/filtered_feature_bc_matrix.h5')

downsampled_test <- downsampleMatrix(counts(test),prop=0.5)

I had two conditions and the read depth for one condition per cell was half the other condition. So my goal was to downsample. Please let me know if this would be the correct approach.

Thank you for all your help as i try to understand this!

jonathangriffiths commented 2 years ago

That ought to have successfully downsampled the matrix that you loaded. If you are loading the data from your other sample in the same way, then it sounds like it should have achieved what you wanted. I'm glad this has helped (though in future, please raise analysis questions on the bioconductor support site rather than here)

harshini-c commented 2 years ago

Thank you very much for your quick response and help in this regard! Appreciate it.