Help with Mofa2
0
0
Entering edit mode
7 months ago
Chris ▴ 260

Hi Biostars friends,

I try to run this tutorial on my multiome data. The error I got mean my for loop tried to reach an index seem doesn't exist but don't know how to troubleshoot. Would you please have a suggestion? Thank you so much!

for (i in c("distal","promoter")) {

  # Create GRanges
  peaks.granges <- feature_metadata.atac_0 %>%
    .[peak_type==i] %>%
    .[,c("chr","start","end","peak")] %>%
    makeGRangesFromDataFrame(keep.extra.columns = TRUE, ignore.strand = TRUE)

  # Scan motifs throughout the DNA sequence of each peak and create a binary matrix of motif-peak presence.
  motif.matrix <- CreateMotifMatrix(
    features = peaks.granges,
    pwm = pfm,
    genome = 'hg38',
    use.counts = FALSE
  ) %>% as.matrix

  # AddChromatinAssay to the Seurat object
  seurat@assays[[paste0("ATAC_",i)]] <- CreateChromatinAssay(
    seurat@assays$ATAC@counts[peaks.granges$peak,], 
    ranges = peaks.granges,
    motifs = CreateMotifObject(motif.matrix, pfm)
  )

}
Error in .subscript.2ary(x, i, , drop = TRUE) : subscript out of bounds.

https://raw.githack.com/bioFAM/MOFA2_tutorials/master/R_tutorials/10x_scRNA_scATAC.html

The error is because of this: seurat@assays$ATAC@counts[peaks.granges$peak,] but I still don't know what to do.

multiome mofa2 • 319 views
ADD COMMENT

Login before adding your answer.

Traffic: 1758 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6