andrewrech / antigen.garnish

Other
46 stars 13 forks source link

error with README.md example #82

Closed ghost closed 6 years ago

ghost commented 6 years ago

I am receiving an error running the README.md example that is due to not have parenthetical : Error in .::stats : unused argument (na.omit)

library(magrittr)
library(antigen.garnish)

  # download an example VCF
    dt <- "antigen.garnish_example.vcf" %T>%
    utils::download.file("http://get.rech.io/antigen.garnish_example.vcf", ., method = "libcurl") %>%

  # extract variants
    garnish_variants

full output:

trying URL 'http://get.rech.io/antigen.garnish_example.vcf'
Content type 'text/x-vcard; charset=utf-8' length 6690 bytes
==================================================
downloaded 6690 bytes

Loading VCFs
Scanning file to determine attributes.
File attributes:
  meta lines: 56
  header line: 57
  variant count: 3
  column count: 11
Meta line 56 read in.
All meta lines processed.
gt matrix initialized.
Character matrix gt created.
  Character matrix gt rows: 3
  Character matrix gt cols: 11
  skip: 0
  nrows: 3
  row_num: 0
Processed variant: 3
All variants processed
Error in .::stats : unused argument (na.omit)

It looks like it is failing during variant caller look-up

vcf@meta %>%
        unlist %>%
        stringr::str_extract(stringr::regex("(Strelka)|(Mutect)|(VarScan)|(samtools mpileup)|(somaticsniper)|(freebayes)|(virmid)",
          ignore_case = TRUE)) %>%
        stats::na.omit %>%
                 unlist %>%
data.table::first

Calling both stats::na.omit() and data.table::first() with parenthetical does returns [1] "strelka". Is this an environment issue with my install?

> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS

Matrix products: default
BLAS: /home/ubuntu/.anaconda2/lib/R/lib/libRblas.so
LAPACK: /home/ubuntu/.anaconda2/lib/R/lib/libRlapack.so

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

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

other attached packages:
[1] data.table_1.10.4-3 magrittr_1.5        vcfR_1.7.0
[4] RevoUtils_10.0.8

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16      lattice_0.20-35   ape_5.1           memuse_4.0-0
 [5] viridisLite_0.3.0 permute_0.9-4     MASS_7.3-48       grid_3.4.3
 [9] nlme_3.1-131      stringi_1.1.7     vegan_2.4-6       Matrix_1.2-12
[13] pinfsc50_1.1.0    tools_3.4.3       stringr_1.3.0     parallel_3.4.3
[17] compiler_3.4.3    cluster_2.0.6     mgcv_1.8-22
leeprichman commented 6 years ago

This is a bug with magrittr interpreting namespaces as arguments after %>% that’s present in the CRAN but not the dev version of magrittr. If you devtools::install_github(“tidyverse/magrittr”) you should be good to go.

leeprichman commented 6 years ago

I am comfortable adding parenthesis after those function calls though if you guys think we should @andrewrech

andrewrech commented 6 years ago

perhaps we should just not using the pipe at all in the examples given the difficulty of interpreting %>% by new users. whatever you guys decide is of course fine with me! thanks

leeprichman commented 6 years ago

Error here is in source. I will go back though and remove from examples for clarity too. To deal with the source code, rather than try to find and add parentheticals to all these hanging function calls, I will add a magrittr version check to pipeline entry points. Thoughts?

ghost commented 6 years ago

I'd go with a magrittr version check for now. I was adding a more detailed installation instructions on a wiki and I can add an explanation.

leeprichman commented 6 years ago

Wiki sounds so great. Ok I’ll leave readme and documentation alone then and just add version check.

andrewrech commented 6 years ago

Sounds great. I think the README being absolutely useable and clear would be a big improvement.

leeprichman commented 6 years ago

resolved with andrewrech/antigen.garnish@bc47daf77fae05efd66b933d1a2994bf7b09d6d1