Skip to content

Instantly share code, notes, and snippets.

@daskelly
Created December 18, 2018 15:23
Show Gist options
  • Save daskelly/9ebe9db871c435edb10ebe21fba0a3e1 to your computer and use it in GitHub Desktop.
Save daskelly/9ebe9db871c435edb10ebe21fba0a3e1 to your computer and use it in GitHub Desktop.
Version of Seurat's Read10X function for 10X cellranger 3 data
read10x <- function(dir) {
names <- c("barcodes.tsv", "features.tsv", "matrix.mtx")
for (i in 1:length(names)) {
R.utils::gunzip(paste0(dir, "/", names[i], ".gz"))
}
file.copy(paste0(dir, "/features.tsv"), paste0(dir, "/genes.tsv"))
mat <- Seurat::Read10X(dir)
file.remove(paste0(dir, "/genes.tsv"))
for (i in 1:length(names)) {
R.utils::gzip(paste0(dir, "/", names[i]))
}
mat
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment