GreenleafLab / ArchR

ArchR : Analysis of Regulatory Chromatin in R (www.ArchRProject.com)
MIT License
385 stars 138 forks source link

correlateMatrices with integrated snRNA Error: no mapping #1327

Closed rcorces closed 2 years ago

rcorces commented 2 years ago

Discussed in https://github.com/GreenleafLab/ArchR/discussions/1323

Originally posted by **jacobHog** March 8, 2022 Hello, I am trying to identify positive TF-regulators of my constrained integrated RNA using ArchR. The constrained integration is completed using: Proj1 <- addGeneIntegrationMatrix( ArchRProj = Clean_merged_3, useMatrix = "GeneScoreMatrix", matrixName = "GeneIntegrationMatrix", reducedDims = "IterativeLSI", seRNA = seRNA, addToArrow = TRUE, groupList = groupList, groupRNA = "celltype", sampleCellsATAC = 2500, sampleCellsRNA = 2500, nameCell = "predictedCell_Co", nameGroup = "predictedGroup_Co", nameScore = "predictedScore_Co", genesUse=c, force=TRUE ) Where "Clean_merged_3" is my ATAC-seq data cleaned and "seRNA" is my RNA-seq data cleaned. ``` > **Clean_merged_3** ___ .______ ______ __ __ .______ / \ | _ \ / || | | | | _ \ / ^ \ | |_) | | ,----'| |__| | | |_) | / /_\ \ | / | | | __ | | / / _____ \ | |\ \\___ | `----.| | | | | |\ \\___. /__/ \__\ | _| `._____| \______||__| |__| | _| `._____| class: ArchRProject outputDirectory: /data/Grontved/students/JBH/snATAC_ArchR_results/All_Merged/Wat samples(8): 6580 6581 ... 6590 6591 sampleColData names(1): ArrowFiles cellColData names(18): Sample TSSEnrichment ... Clustering Clus numberOfCells(1): 54899 medianTSS(1): 20.008 medianFrags(1): 4406 > **seRNA** An object of class Seurat 21980 features across 95879 samples within 1 assay Active assay: RNA (21980 features, 2000 variable features) 4 dimensional reductions calculated: pca, umap, harmony, umap_reference ``` My issue is that when I am performing Identification of Positive TF-regulators (15.4 Full Manual) I get the following error: _Code:_ ``` seGroupMotif <- getGroupSE(ArchRProj = Proj1, useMatrix = "GeneIntegrationMatrix", groupBy = "Clus") seZ <- seGroupMotif[rowData(seGroupMotif)$seqnames=="z",] rowData(seZ)$maxDelta <- lapply(seq_len(ncol(seZ)), function(x){ rowMaxs(assay(seZ) - assay(seZ)[,x]) }) %>% Reduce("cbind", .) %>% rowMaxs corGIM_MM <- correlateMatrices( ArchRProj = Proj1, useMatrix1 = "GeneIntegrationMatrix", useMatrix2 = "MotifMatrix", reducedDims = "IterativeLSI" ) ``` _Code end_ Output: ArchR logging to : ArchRLogs/ArchR-correlateMatrices-3f182cbede25-Date-2022-03-08_Time-11-56-49.log If there is an issue, please report to github with logFile! Error: Matching of useMatrix1 and useMatrix2 resulted in no mappings! Why is this error shown? Do I have to apply some additional functions on the Proj1 object before starting with the positive TF-regulators analysis? Thanks
rcorces commented 2 years ago

Hi @rcorces! Thanks for using ArchR! Please make sure that your post belongs in the Issues section. Only bugs and error reports belong in the Issues section. Usage questions and feature requests should be posted in the Discussions section, not in Issues.
Before we help you, you must respond to the following questions unless your original post already contained this information: 1. If you've encountered an error, have you already searched previous Issues to make sure that this hasn't already been solved? 2. Can you recapitulate your error using the tutorial code and dataset? If so, provide a reproducible example. 3. Did you post your log file? If not, add it now.

rcorces commented 2 years ago

@jacobHog - Your issue is that the names from your matrices dont match. This has been posted previously - https://github.com/GreenleafLab/ArchR/issues/829

You can see the names of the matrices using this code which comes directly from the function

  featureDF1 <- ArchR:::.getFeatureDF(getArrowFiles(ArchRProj), useMatrix1)
  featureDF2 <- ArchR:::.getFeatureDF(getArrowFiles(ArchRProj), useMatrix2)

  #Check Seqnames
  featureDF1 <- ArchR:::.checkSeqnames(featureDF1, useMatrix1, useSeqnames1, matrixClass1, logFile)
  featureDF2 <- ArchR:::.checkSeqnames(featureDF2, useMatrix2, useSeqnames2, matrixClass2, logFile)

  #Create Match Names
  featureDF1$matchName <- toupper(featureDF1$name)
    featureDF2$matchName <- toupper(featureDF2$name)

This should show you why your names dont match. You can try to use removeFromName1 or removeFromName2 params to solve the problem