It might be nice to have a method for exporting a seurat object into 10X format (genes.tsv, barcode.tsv, matrix.mtx) so that Seurat can be used for some of the upstream procedures (normalization, variable feature selection, etc) and paired with downstream tools that operate outside of Seurat, such as scanpy and such. Would also be ideal to be able to split outputs based on orig.ident so that multiple 10X style folders can be created, one per unique orig.ident.
Also would be handy for helping collaborators get their hands on a Loupe Cell Browser file (makes running the cellranger pipeline easier to generate the Loupe file from the 10X outputs, and would be great to have the same data used across both Loupe and in R analyses). Alternately, maybe its possible to take some of 10X's code and make a Loupe compatible file for exploratory analysis using Seurat processed object. Might be worth investigating making this specific aspect as something totally separate.
Thoughts?
We would be thrilled if someone in the community would like to increase operability between Seurat and Loupe, though we unfortunately do not have the resources to do this ourselves. If you know of others who might be willing to help, please do let us know!
Using function write10xCounts() from library(DropletUtils) can be a work around. It takes your Seurat object and writes the three files you mentioned @robertamezquita.
Using version="3" command allows to save "features.tsv.gz" instead of genes.tsv.
Thanks @jdime !
Using function
write10xCounts()fromlibrary(DropletUtils)can be a work around. It takes your Seurat object and writes the three files you mentioned @robertamezquita.
Usingversion="3"command allows to save "features.tsv.gz" instead of genes.tsv.
When I perform the code, _write10xCounts(x = seurat.object, path = output.path)_, it gave the error,
_Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘writeMM’ for signature ‘"Seurat"’._
Did I used the wrong code?
I found this to work with write10xCounts(x = seurat.object@assays$RNA@counts, path = output.path)
Since it expects a sparse matrix.
I found this to work with
write10xCounts(x = seurat.object@assays$RNA@counts, path = output.path)
Since it expects a sparse matrix.
Thanks, but I found the method you provide cannot preserve the other infomation, like the "Celltype", "Clinical Info" ... in seurat object. Do you know any other way to do so?
'10x format' does not contain that information, it's just the three files specifying the gene by cell matrix.
But that information would probably be in the meta.data slot, so something like write.csv([email protected], 'metadata.csv') should work.
'10x format' does not contain that information, it's just the three files specifying the gene by cell matrix.
But that information would probably be in the meta.data slot, so something like
write.csv([email protected], 'metadata.csv')should work.
Thanks!
Using function
write10xCounts()fromlibrary(DropletUtils)can be a work around. It takes your Seurat object and writes the three files you mentioned @robertamezquita.
Usingversion="3"command allows to save "features.tsv.gz" instead of genes.tsv.
Hi @jdime,
Do you know if it is possible to convert the output from write10xCounts() to a .cloupe file for exploration with the Loupe Browser?
Thanks
The .cloupe file has more information than just the read counts. It has coordinates for the tSNE/UMAP, cell clusters and differential gene expression. Whereas the write10xCounts() outputs only the read counts. Then, I don't think that you can do that @massonix. Alternatively, you could use a webapp to re-cluster cells (MTX files) and visualize cells similar to what you'd get in *cloupe. I've used these online options: CReSCENT and alona. Or Seurat itself has some interactive plotting features.
Most helpful comment
Using function
write10xCounts()fromlibrary(DropletUtils)can be a work around. It takes your Seurat object and writes the three files you mentioned @robertamezquita.Using
version="3"command allows to save "features.tsv.gz" instead of genes.tsv.