smorabit / hdWGCNA

High dimensional weighted gene co-expression network analysis
https://smorabit.github.io/hdWGCNA/
Other
316 stars 31 forks source link

MotifScan run failed with an error #73

Closed RajneeshSrivastava closed 1 year ago

RajneeshSrivastava commented 1 year ago

In addition to the issue raised by @yansongtongji in issue #53 , Here I am adding the script from where i got the same error for reference.

library(Seurat)
library(tidyverse)
library(cowplot)
library(patchwork)
library(WGCNA)
library(hdWGCNA)
library(igraph)
library(JASPAR2020)
library(motifmatchr)
library(TFBSTools)
library(EnsDb.Hsapiens.v86)
library(GenomicRanges)

# using the cowplot theme for ggplot
theme_set(theme_cowplot())
# set random seed for reproducibility
set.seed(12345)

seurat_obj <- readRDS("path/seurat_obj.rds') 
#This object contains all the modules detected using hdWGCNA at seurat_obj@misc$SCT!
(Thanks @smorabit for hdWGCNA)

pfm_core <- TFBSTools::getMatrixSet( x = JASPAR2020, opts = list(collection = "CORE", 
                                                                               tax_group = 'vertebrates', 
                                                                               all_versions = FALSE)
                                                                 )

# run the motif scan with these settings for the mouse dataset

 seurat_obj <- MotifScan(seurat_obj, 
                         species_genome = 'hg38', 
                         pfm = pfm_core, 
                         EnsDb = EnsDb.Hsapiens.v86) #,wgcna_name = seurat_obj@misc$SCT)

Error in match(x, table, nomatch = 0L) : 
  'match' requires vector arguments

Any idea or suggestion as from where this formatting error is coming from

Thank you! Rajneesh

smorabit commented 1 year ago

Hi Rajneesh, the motif analysis tutorial is not yet complete, so I do not suggest running it at this point in time. It will be included in the next major update to hdWGCNA.

FiggyBullet commented 1 year ago

Hi,

I encountered the same problem recently and fixed it by editing a line in the source code immediately before renaming the tf_match object column names. After this the function ran fine and the GetMotifTargets function returned a list of transcription factors and their target genes.

-- source code (not all shown) --

# use motif names as the column names: motif_df <- motif_df[motif_df$motif_ID %in% colnames(tf_match), ] # removes motif IDs not present in tf_match colnames(tf_match) <- motif_df $motif_name

cnk113 commented 1 year ago

Hmm I just tried the change but I still get the error @FiggyBullet Do you perhaps have a fork of the change?

Roger-GOAT commented 7 months ago

@FiggyBullet @cnk113 where is the tf_match? Did you fix it?

AmlMagdy commented 7 months ago

is there is any updates i have the same error yet