vdjtools icon indicating copy to clipboard operation
vdjtools copied to clipboard

PlotFancyVJUsage error during ploting

Open splaisan opened this issue 5 years ago • 2 comments
trafficstars

I could run the tool last week but after some updates it now fails, probably due to circlize

below is the result of running the command which creates the txt file but not the plot

circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

Loading required package: RColorBrewer
Error: `reduce` argument causes reduction of sectors. You can either set
`reduce = 0`, or adjust the `gap.degree`/`gap.after` in `circos.par()`
to remove tiny sectors, or set `gap.degree`/`gap.after` as a named
vector where sector names are the vector names (tiny sectors can be
included).
Execution halted

[Thu Aug 20 13:08:57 CEST 2020 PlotFancyVJUsage] Finished

I then loaded the created R script and ran it manually until the command below

> chordDiagram(mat, annotationTrack = "grid",
+              grid.col = c(rcols, ccols),
+              preAllocateTracks = list(track.height = 0.2), transparency = 0.5)
Error: `reduce` argument causes reduction of sectors. You can either set `reduce = 0`, or adjust the `gap.degree`/`gap.after` in `circos.par()` to
remove tiny sectors, or set `gap.degree`/`gap.after` as a named vector where sector names are the vector names (tiny sectors can be
included).

I added an argument "reduce = 0" as suggested and the new commands worked and the code created the PDF.

> chordDiagram(mat, annotationTrack = "grid",
+              reduce = 0,
+              grid.col = c(rcols, ccols),
+              preAllocateTracks = list(track.height = 0.2), transparency = 0.5)

could you please confirm and help me patch my vdjtools version to not have to edit the R script every time Thanks

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.7 LTS

Matrix products: default
BLAS:   /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

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

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

other attached packages:
 [1] circlize_0.4.10     tcR_2.3.2           igraph_1.2.5        gridExtra_2.3       BiocManager_1.30.10 RColorBrewer_1.1-2  stringr_1.4.0      
 [8] forcats_0.5.0       scales_1.1.1        NMF_0.23.0          Biobase_2.48.0      BiocGenerics_0.34.0 cluster_2.1.0       rngtools_1.5       
[15] pkgmaker_0.31.1     registry_0.5-1      ggplot2_3.3.2       reshape2_1.4.4      dplyr_1.0.1         data.table_1.13.0  

loaded via a namespace (and not attached):
 [1] stringdist_0.9.6    shape_1.4.4         tidyselect_1.1.0    xfun_0.16           purrr_0.3.4         colorspace_1.4-1    vctrs_0.3.2        
 [8] generics_0.0.2      htmltools_0.5.0     yaml_2.2.1          rlang_0.4.7         pillar_1.4.6        glue_1.4.1          withr_2.2.0        
[15] foreach_1.5.0       lifecycle_0.2.0     plyr_1.8.6          munsell_0.5.0       gtable_0.3.0        GlobalOptions_0.1.2 codetools_0.2-16   
[22] knitr_1.29          doParallel_1.0.15   fansi_0.4.1         Rcpp_1.0.5          xtable_1.8-4        digest_0.6.25       stringi_1.4.6      
[29] grid_4.0.2          bibtex_0.4.2.2      cli_2.0.2           tools_4.0.2         magrittr_1.5        tibble_3.0.3        crayon_1.3.4       
[36] pkgconfig_2.0.3     ellipsis_0.3.1      gridBase_0.4-7      assertthat_0.2.1    rstudioapi_0.11     iterators_1.0.12    R6_2.4.1           
[43] compiler_4.0.2     

splaisan avatar Aug 20 '20 11:08 splaisan

I had the same issue, and here is a wrapper to do it:

#!/usr/bin/env bash

# run the command and capture the stdout
out=$(command $@)

echo "$out"

if [[ $(echo "$out" | grep -c reduce) -gt 0 ]]; then
    echo ""
    echo "Original Rscript failed, try reduce = 0 ..."
    echo "Modifying vj_pairing_plot.r ..."
    sed -i 's/mat, annotationTrack/mat, reduce = 0, annotationTrack/' vj_pairing_plot.r
    cmd=$(echo "$out" | grep "\\[RUtil\\] Executing" | sed 's/\[RUtil\] Executing //')
    echo "Run again: $cmd"
    command $cmd
else
    echo ""
    echo "Not a `reduce` failure for original script, nothing to do."
fi

Save it as vdjtools-patch.sh (or whatever name you want), then chmod +x vdjtools-patch.sh. To use it, just put it before your vdjtools command:

./vdjtools-patch.sh vdjtools PlotFancyVJUsage sample.txt output/

pwwang avatar Apr 30 '21 22:04 pwwang

Thanks, I hope the developers will implement this at some point.

splaisan avatar May 01 '21 08:05 splaisan