A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/stuart-lab/signac/issues/355 below:

Error message when running FindTransferAnchors() · Issue #355 · stuart-lab/signac · GitHub

Hi,

Thanks a lot for developing this very useful package. I got an error message when running FindTransferAnchors() to transfer the label from one scATAC data to another scATAC data.

Below is my code:

library(Seurat)
library(Signac)
library(S4Vectors)
library(patchwork)

# load reference data: scATAC
ref <- readRDS("scATAC_ref.rds")
DefaultAssay(ref) <- "peaks"

# load signac object
query <- readRDS("scATAC_query.rds")
DefaultAssay(query) <- "peaks"

# find peaks that intersect in both datasets
intersecting.regions <- findOverlaps(query = query, subject = ref)

# find the coordinates of peaks in the sci-ATAC-seq that intersect peaks in the 10x
intersections.tenx <- unique(queryHits(intersecting.regions))

# choose a subset of intersecting peaks
peaks.use <- sort(granges(query)[sample(intersections.tenx, size = 10000, replace = FALSE)])

# count fragments per cell overlapping the set of peaks in the 10x data
query_peaks_ref <- FeatureMatrix(
  fragments = Fragments(ref),
  features = peaks.use,
  cells = colnames(ref)
)

### create a new assay and add it to ref
ref[['qPeaks']] <- CreateChromatinAssay(
  counts = query_peaks_ref,
  min.cells = 1,
  ranges = peaks.use,
  genome = 'hg38'
)

DefaultAssay(ref) <- 'qPeaks'
ref <- RunTFIDF(ref)

### create a new assay in the query dataset containing the common peaks
peaknames <- GRangesToString(grange = peaks.use)

query[['qPeaks']] <- CreateChromatinAssay(
  counts <- GetAssayData(query, assay = "peaks", slot = "counts")[peaknames, ],
  ranges = peaks.use,
  genome = "hg38"
)

DefaultAssay(query) <- "qPeaks"
query <- RunTFIDF(query)

### find transfer anchors
transfer.anchors <- FindTransferAnchors(
  reference = ref,
  query = query,
  reference.assay = 'qPeaks',
  query.assay = 'qPeaks',
  reduction = 'cca',
  features = rownames(ref),
  k.filter = NA
)

Then, I got the error message below:

Binding matrix rows
Error in `rownames<-`(`*tmp*`, value = newmat.names) : 
  attempt to set 'rownames' on an object with no dimensions

I checked rownames for query and ref datasets. Both look fine:

Could you please help to solve this problem? Thank you so much!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4