[Bioc-devel] Error: invalid graphics state in creating vignettes

Jianhong Ou, Ph.D. j|@nhong@ou @end|ng |rom duke@edu
Tue Apr 23 14:57:30 CEST 2019


Hi Sunyong,

plotMotifLogo does not compatible with par now. Please use grid to plot the multiple panels in one canvas. I am working on this but it takes time.

Jianhong.

On 4/23/19, 12:47 AM, "Bioc-devel on behalf of Shin, Sunyoung" <bioc-devel-bounces using r-project.org on behalf of Sunyoung.Shin using utdallas.edu> wrote:

    Dear all,
    
    I got an error message: invalid graphics state as below from BUILD report for atSNP 0.99.23 (https://urldefense.proofpoint.com/v2/url?u=https-3A__master.bioconductor.org_packages_3.9_bioc_html_atSNP.html&d=DwIGaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=PXg851DHXyo-Gs3eMIfeo49gUXVh-JSZu_MZDDxGun8&m=PbqNdXfVMLxlePSjrHOEN8-tkQLva8Pg6UAfB4VOTUw&s=lESpOegy3zU7jKZUfxiUhG5mSg7qotzhof_KHZmVEB8&e=). This occurs on every platform: malbec2, tokay2, and celaya2. Running  devtools::check()  on my local computer does not produce the error. I would appreciate it if anyone can help debugging.
    
    * creating vignettes ... ERROR
    
    --- re-building ‘atsnp-vignette.rmd’ using rmarkdown
    Quitting from lines 292-294 (atsnp-vignette.rmd)
    Error: processing vignette 'atsnp-vignette.rmd' failed with diagnostics:
    invalid graphics state
    --- failed re-building ‘atsnp-vignette.rmd’
    
    SUMMARY: processing the following file failed:
      ‘atsnp-vignette.rmd’
    
    Error: Vignette re-building failed.
    Execution halted
    
    The graphing function which makes the error is plotMotifMatch(match.seq,  motif.lib = motif_library). Below is the part of the code that is needed  to be fixed, I think.
    
    {
      par(mfrow=c(4,1), oma=c(1,1,4,1))
      plot.new()
      par(mar=c(1.5, 3, 4, 2))
      plotMotifLogo(pcm2pfm(ref_aug_pwm), "Best match to the reference genome", yaxis=FALSE, xaxis=FALSE, xlab="", ylab="PWM", ...)
    if(motif.match$ref_strand=='+') {
    arrows((min(which(colSums(ref_aug_pwm)!=0))-1)/ncol(ref_aug_pwm), -0.17, max(which(colSums(ref_aug_pwm)!=0))/ncol(ref_aug_pwm), -0.17, length = 0.1, angle = 15, code = 2, col = "blue", lwd = 1.5, xpd=NA)
      mtext("5'", 1, adj=(min(which(colSums(ref_aug_pwm)!=0))-1)/ncol(ref_aug_pwm), padj=1, col="blue", cex=1)
      mtext("3'", 1, adj=max(which(colSums(ref_aug_pwm)!=0))/ncol(ref_aug_pwm), padj=1, col="blue", cex=1)
    } else {
    arrows(max(which(colSums(ref_aug_pwm)!=0))/ncol(ref_aug_pwm), -0.17, (min(which(colSums(ref_aug_pwm)!=0))-1)/ncol(ref_aug_pwm), -0.17, length = 0.1, angle = 15, code = 2, col = "blue", lwd = 1.5, xpd=NA)
      mtext("5'", 1, adj=max(which(colSums(ref_aug_pwm)!=0))/ncol(ref_aug_pwm), padj=1, col="blue", cex=1)
      mtext("3'", 1, adj=(min(which(colSums(ref_aug_pwm)!=0))-1)/ncol(ref_aug_pwm), padj=1, col="blue", cex=1)
    }
      par(mar = c(4, 3, 1.5, 2))
    plotMotifLogo(pcm2pfm(ref_aug_match_pwm), font="mono,Courier", yaxis=FALSE, xlab="", ylab=paste("(", motif.match$ref_strand, ")", sep=""), ...)
    segments(snp_loc/motif.match$snp_ref_length, 0, snp_loc/motif.match$snp_ref_length, 1, col="blue", lty=3, lwd=2)
    segments(snp_loc/motif.match$snp_ref_length, 1, (snp_loc+1)/motif.match$snp_ref_length, 1, col="blue", lty=3, lwd=2)
    segments((snp_loc+1)/motif.match$snp_ref_length, 0, (snp_loc+1)/motif.match$snp_ref_length, 1, col="blue", lty=3, lwd=2)
    segments(snp_loc/motif.match$snp_ref_length, 0, (snp_loc+1)/motif.match$snp_ref_length, 0, col="blue", lty=3, lwd=2)
      if(motif.match$ref_strand=="+")   {
      mtext("5'", 1,  adj=0, padj=1, col="blue", cex=1)
      mtext("3'", 1,  adj=1, padj=1, col="blue", cex=1)
    } else {
      mtext("3'", 1, adj=0, padj=1, col="blue", cex=1)
      mtext("5'", 1, adj=1, padj=1, col="blue", cex=1)
      }
    par(mar=c(1.5, 3, 4, 2))
    plotMotifLogo(pcm2pfm(snp_aug_match_pwm), "Best match to the SNP genome", font="mono,Courier", yaxis=FALSE, xlab="", ylab=paste("(", motif.match$snp_strand, ")", sep=""), ...)
    segments(snp_loc/motif.match$snp_ref_length, 0, snp_loc/motif.match$snp_ref_length, 1, col="blue", lty=3, lwd=2)
    segments(snp_loc/motif.match$snp_ref_length, 1, (snp_loc+1)/motif.match$snp_ref_length, 1, col="blue", lty=3, lwd=2)
    segments((snp_loc+1)/motif.match$snp_ref_length, 0, (snp_loc+1)/motif.match$snp_ref_length, 1, col="blue", lty=3, lwd=2)
    segments(snp_loc/motif.match$snp_ref_length, 0, (snp_loc+1)/motif.match$snp_ref_length, 0, col="blue", lty=3, lwd=2)
      if(motif.match$snp_strand=="+")   {
      mtext("5'", 1,  adj=0, padj=1, col="blue", cex=1)
      mtext("3'", 1,  adj=1, padj=1, col="blue", cex=1)
    } else {
      mtext("3'", 1, adj=0, padj=1, col="blue", cex=1)
      mtext("5'", 1, adj=1, padj=1, col="blue", cex=1)
      }
    par(mar=c(4, 3, 1.5, 2))
    plotMotifLogo(pcm2pfm(snp_aug_pwm), yaxis=FALSE, xaxis=FALSE, xlab="", ylab="PWM", ...)
    if(motif.match$snp_strand=='+') {
    arrows((min(which(colSums(snp_aug_pwm)!=0))-1)/ncol(snp_aug_pwm), -0.17, max(which(colSums(snp_aug_pwm)!=0))/ncol(snp_aug_pwm), -0.17, length = 0.1, angle = 15, code = 2, col = "blue", lwd = 1.5, xpd=NA)
      mtext("5'", 1, adj=(min(which(colSums(snp_aug_pwm)!=0))-1)/ncol(snp_aug_pwm), padj=1, col="blue", cex=1)
      mtext("3'", 1, adj=max(which(colSums(snp_aug_pwm)!=0))/ncol(snp_aug_pwm), padj=1, col="blue", cex=1)
    } else {
    arrows(max(which(colSums(snp_aug_pwm)!=0))/ncol(snp_aug_pwm), -0.17, (min(which(colSums(snp_aug_pwm)!=0))-1)/ncol(snp_aug_pwm), -0.17, length = 0.1, angle = 15, code = 2, col = "blue", lwd = 1.5, xpd=NA)
      mtext("5'", 1, adj=max(which(colSums(snp_aug_pwm)!=0))/ncol(snp_aug_pwm), padj=1, col="blue", cex=1)
      mtext("3'", 1, adj=(min(which(colSums(snp_aug_pwm)!=0))-1)/ncol(snp_aug_pwm), padj=1, col="blue", cex=1)
    }
    title(main=paste(motif.match$motif, " Motif Scan for ", motif.match$snpid, sep=""), outer=TRUE, cex.main=cex.main)
    }
    
    Just in case, I added the sessionInfo() of the local run.
    
    sessionInfo()
    
    R version 3.5.2 (2018-12-20)
    Platform: x86_64-apple-darwin15.6.0 (64-bit)
    Running under: macOS Mojave 10.14.3
    
    Matrix products: default
    BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
    LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
    
    locale:
    [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
    
    attached base packages:
    [1] stats     graphics  grDevices utils     datasets  methods   base
    
    other attached packages:
    [1] atSNP_0.99.23  usethis_1.4.0  devtools_2.0.1
    
    
    Best,
    
    Sunyoung
    
    
    
    	[[alternative HTML version deleted]]
    
    _______________________________________________
    Bioc-devel using r-project.org mailing list
    https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel&d=DwIGaQ&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=PXg851DHXyo-Gs3eMIfeo49gUXVh-JSZu_MZDDxGun8&m=PbqNdXfVMLxlePSjrHOEN8-tkQLva8Pg6UAfB4VOTUw&s=F94BcjXL4z7uzm48trzSORaQp9mAk3B6ZnZslsvLJEE&e=
    



More information about the Bioc-devel mailing list