Help with Mofa2
Entering edit mode
11 weeks ago
Chris ▴ 230

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(
    ranges = peaks.granges,
    motifs = CreateMotifObject(motif.matrix, pfm)

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

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

multiome mofa2 • 204 views

Login before adding your answer.

Traffic: 2634 users visited in the last hour
Help About
Access RSS

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

Powered by the version 2.3.6