This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Joint RNA and ATAC analysis: 10x multiomic - Fragment Path

I am trying to follow the tutorial for Signac 1.10.0... I am getting an error when it comes to the part of the code "create ATAC assay and add it to the object" below is the code that I am running

counts <- Read10X_h5("~/Documents/multiomic/pbmc_granulocyte_sorted_10k_filtered_feature_bc_matrix.h5")
fragpath <- "../Documents/multiomic/pbmc_granulocyte_sorted_10k_atac_fragments.tsv.gz"
annotation <- GetGRangesFromEnsDb(ensdb = EnsDb.Hsapiens.v86)
seqlevels(annotation) <- paste0('chr', seqlevels(annotation))
pbmc <- CreateSeuratObject(counts = counts$`Gene Expression`,assay = "RNA")

The above code runs fine, but the code below is where I get an error:

pbmc[["ATAC"]] <- CreateChromatinAssay(counts = counts$Peaks,sep = c(":", "-"),fragments = fragpath,annotation = annotation)

This is the error I am getting:

Error in CreateFragmentObject(path = fragments, cells = cells, validate.fragments = validate.fragments, :
Fragment file does not exist.

I am assuming it has something to do with the path that I am setting... If someone could please provide insight to the correct way to set path I would appreciate it. I am currently using the atac_fragments.tsv.gz file that I am setting my path to.

atac-seq multiomic signac

1 answer

Presumably a typo since you have:

counts <- Read10X_h5("~/Documents/multiomic/pbmc_granulocyte_sorted_10k_filtered_feature_bc_matrix.h5")

But then:

fragpath <- "../Documents/multiomic/pbmc_granulocyte_sorted_10k_atac_fragments.tsv.gz"

Which should probably be:

fragpath <- "~/Documents/multiomic/pbmc_granulocyte_sorted_10k_atac_fragments.tsv.gz"

Gotta pay real close attention when providing file paths.

Thank you for the prompt response! Even with that fix I am still getting an error:

Error in CreateFragmentObject(path = fragments, cells = cells, validate.fragments = validate.fragments, :
Fragment file is not indexed.

You need the index for the file in the same location. It has the same name but ends with .tbi. If you don't have an index, you can generate one, see here.

Thank you so much. This solved my problem!!

Log in to answer this question.