Simon-Coetzee / motifBreakR

A Package For Predicting The Disruptiveness Of Single Nucleotide Polymorphisms On Transcription Factor Binding Sites.
27 stars 12 forks source link

plotMB error : #53

Closed bioarpit1 closed 3 months ago

bioarpit1 commented 10 months ago

Hi Simon-Coetzee,

Thanks for the MotifbreakR package. This works smoothly but I am getting plotMB function error. here is my test RDS file command I used

plotMB(rs9746695,"rs9746695",effect = "strong")

error message Error in if (doRev) { : the condition has length > 1 Error in exists(cacheKey, where = .rs.WorkingDataEnv, inherits = FALSE) : invalid first argument result file converted to gr -> df -> csv rs9746695.csv

Gemma-Zhang-326 commented 6 months ago

Hi, bioarpit1

I have encountered the same error as you did. Have you been able to find a solution to this error yet? Do you have any ideas what is causing the error since it's being thrown with test data in my case? Any help would be greatly appreciated. Thank you!

Best, Gemma

lewkiewicz commented 3 months ago

Hi all,

I am experiencing essentially the same error when trying to run plotMB:

Error in if (doRev) { : the condition has length > 1 Calls: plotMB Execution halted

Has anyone managed to figure it out? I will update if I do. Thanks!

Best, Stephanie

dennishazelett commented 3 months ago

Your variant has more than one alternate allele. You can specify which one you want to see in plotMB() with argument altAllele="C" etc

lewkiewicz commented 3 months ago

Thanks for your reply! I'll try that.

Best, Stephanie

lewkiewicz commented 3 months ago

Unfortunately, it still returns the same error even if the "altAllele" option is added:

plotMB(results = motifbreakr.results, rsid = "rs1870138", effect = "strong", altAllele = "G")

dennishazelett commented 3 months ago

I'm unable to replicate this error. Can you please paste the code that produced it and your sessionInfo()?

lewkiewicz commented 3 months ago

Thanks so much for any assistance you can provide! The code and sessionInfo are below. Everything seems to work until the plotting step.

code:

library(motifbreakR) library(SNPlocs.Hsapiens.dbSNP155.GRCh37) library(BSgenome.Hsapiens.UCSC.hg19) library(MotifDb) pca.snps.file <- system.file("extdata", "tspan14.snps", package = "motifbreakR") tspan14.snps <- as.character(read.table(pca.snps.file)[,1]) variants <- snps.from.rsid(rsid = tspan14.snps, dbSNP = SNPlocs.Hsapiens.dbSNP155.GRCh37, search.genome = BSgenome.Hsapiens.UCSC.hg19) motifbreakr.results <- motifbreakR(snpList = variants, pwmList = MotifDb, threshold = 0.9) plotMB(results = motifbreakr.results, rsid = "rs1870138", effect = "strong", altAllele = "G")

sessionInfo():

R version 4.3.1 (2023-06-16) Platform: x86_64-conda-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)

Matrix products: default BLAS/LAPACK: /home/lewks/miniconda3/lib/libopenblasp-r0.3.21.so; LAPACK version 3.9.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: America/New_York tzcode source: system (glibc)

attached base packages: [1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached): [1] compiler_4.3.1

dennishazelett commented 3 months ago

I am able to reproduce the error; the problem is there are too many results. I get 94 effect == "strong" motifbreakRs, which can't be rendered by plotMB(). Try more stringent parameters. I also like to filter the motif library. e.g.:

library(motifbreakR)
library(SNPlocs.Hsapiens.dbSNP155.GRCh37)
library(BSgenome.Hsapiens.UCSC.hg19)
data(motifbreakR_motif)

rs1870138 <- snps.from.rsid(
  rsid          = "rs1870138",
  dbSNP         = SNPlocs.Hsapiens.dbSNP155.GRCh37,
  search.genome = BSgenome.Hsapiens.UCSC.hg19
)

human <- subset(motifbreakR_motif, organism == "Hsapiens")

rs1870138.results <- motifbreakR(
  snpList = rs1870138, pwmList = human, threshold = 1e-05, filterp = TRUE)

plotMB(results = rs1870138.results, rsid = "rs1870138", effect = "strong", altAllele = "G")

If you want to see more results, set threshold to 5e-05 --gets you a reasonable 7 rows. Anything threshold = 5e-04 or smaller with filterp = TRUE is probably valid (but gives too many results for a graphic).

dennishazelett commented 3 months ago

One more thing, if there is a specific motif that you are interested in, or any other criteria, there is nothing stopping you from filtering your result set to the rows you'd like to see displayed by plotMB():

rs1870138.nfe2l1.results <- subset(rs1870138.results, geneSymbol == "NFE2L1::MAFG")
plotMB(results = rs1870138.nfe2l1.results, rsid = "rs1870138", effect = "strong", altAllele = "G")
lewkiewicz commented 3 months ago

Thank you so much for your help! I got plotMB to work with your recommendations.