Skip to main content
3 of 3
deleted 15 characters in body
Ram RS
  • 2.5k
  • 11
  • 29

How to import data from cell ranger to R (Seurat) using Read10X?

I am loading cellranger data into seuratobject as following, but it keeps showing Error in

Barcode file missing. Expecting barcodes.tsv.gz

the running code and result:

#clean up your environment
rm(list=ls())

# Load required libraries
library(Seurat)
library(dplyr)

# Load required library for reading Matrix Market files
library(Matrix)

# For output from CellRanger >= 3.0 with multiple data types
data_dir <- 'C:/Users/Administrator/Desktop/10x_raw'

list.files(data_dir) # Should show barcodes.tsv.gz, features.tsv.gz, and matrix.mtx.gz
[1] "GSM7494257_AML16_DX_raw_barcodes.tsv.gz" "GSM7494257_AML16_DX_raw_genes.tsv.gz"   
[3] "GSM7494257_AML16_DX_raw_matrix.mtx.gz"  

data <- Read10X(data.dir = data_dir)
Error in Read10X(data.dir = data_dir) : 
  Barcode file missing. Expecting barcodes.tsv.gz

seurat_object = CreateSeuratObject(counts = data$`Gene Expression`)
Error in data$`Gene Expression` : 
  object of type 'closure' is not subsettable

I am sure this file inside the directory. Dose anyone know what's the issue?

Thanks in advance.