Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read10X to read files that are not named as barcodes.tsv, features.tsv, matrix.mtx #4096

Closed
luenhchang opened this issue Feb 18, 2021 · 5 comments

Comments

@luenhchang
Copy link

Hi,
I have seen most examples that use Read10X(dir.data=folder_path) where the folder_path contains three files barcodes.tsv, features.tsv, matrix.mtx

But my downloaded files are like
GSM4138110_HNSCC_1_PBMC_barcodes.tsv
GSM4138110_HNSCC_1_PBMC_genes.tsv
GSM4138110_HNSCC_1_PBMC_matrix.mtx

Is there any possibility to read these files as their original names?

I can certainly change the file names to barcodes.tsv, features.tsv, matrix.mtx but this is not a good programming practice.

Thanks

@samuel-marsh
Copy link
Collaborator

Hi,

I just submitted PR to Seurat team to add functionality to Read10X #4101. You can check out the code and run function yourself if you want to try in meantime or can wait for response from Seurat Team as they may alter my PR as needed.

Best,
Sam

@luenhchang
Copy link
Author

Thanks Sam

@samuel-marsh
Copy link
Collaborator

Happy to help!

@satijalab
Copy link
Collaborator

Thanks @samuel-marsh . we'll look at the PR and appreciate the effort as this is a feature i've wanted myself

@saketkc
Copy link
Collaborator

saketkc commented Mar 16, 2021

Hi @luenhchang and @samuel-marsh, thanks for your patience. We now have a function ReadMtx in the develop branch that allows reading any 10X-like files. Some examples are below. Hopefully this addresses your problem. We are thinking about more generic ways to load GEO files into Seurat easily and might have more automated support for it in the future.

Example1: GEO link

mtx <- "https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE132044&format=file&file=GSE132044%5Fmixture%5Fhg19%5Fmm10%5Fcount%5Fmatrix%2Emtx%2Egz"
cells <- "https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE132044&format=file&file=GSE132044%5Fmixture%5Fhg19%5Fmm10%5Fcell%2Etsv%2Egz" 
features <- "https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE132044&format=file&file=GSE132044%5Fmixture%5Fhg19%5Fmm10%5Fgene%2Etsv%2Egz"

counts <- ReadMtx(mtx = mtx, cells = cells, features = features, feature.column = 1)

Example2: GEO link

mtx <- "ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE126nnn/GSE126836/suppl/GSE126836_SN_MD5828_matrix.mtx.gz"
features <- "ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE126nnn/GSE126836/suppl/GSE126836_SN_MD5828_genes.csv.gz"
cells <- "ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE126nnn/GSE126836/suppl/GSE126836_SN_MD5828_barcodes.csv.gz"
counts1 <- ReadMtx(mtx = mtx, cells = cells, features = features, 
                   feature.column = 1, skip.cell = 1, skip.feature = 1)

Example 3: Local

mtx <- "~/data/pbmc10k/filtered_feature_bc_matrix/matrix.mtx.gz"
cells <- "~/data/pbmc10k/filtered_feature_bc_matrix/barcodes.tsv.gz"
features <- "~/data/pbmc10k/filtered_feature_bc_matrix/features.tsv.gz"
counts <- ReadMtx(mtx = mtx, cells = cells, features = features)

@saketkc saketkc closed this as completed Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants