knausb / vcfR

Tools to work with variant call format files
240 stars 54 forks source link

How to avoid to print the vcfR header? #191

Open Shicheng-Guo opened 2 years ago

Shicheng-Guo commented 2 years ago

How to avoid to print the vcfR header? It gives me some trouble for further analysis to the log files. Thanks

   *****       ***   vcfR   ***       *****
   This is vcfR 1.12.0
     browseVignettes('vcfR') # Documentation
     citation('vcfR') # Citation
   *****       *****      *****       *****
knausb commented 2 years ago

Hi @Shicheng-Guo , I'm afraid I do not understand your question. Your post reports the results of the show() method. This means that you had to have requested this information. Can you create a minimal reproducible example to illustrate the behavior you'd like to change? I have some suggestions here.

J-Moravec commented 4 months ago

@knausb This is not output of show() method, but of .onAttach function/hook: https://github.com/knausb/vcfR/blob/master/R/zzz.R

@Shicheng-Guo its annoying, isn't it? The only way to do this is with suppressStartupMessages(library("vcfR")).

Since some people just put message() instead of packageStartupMessage() in their .onAttach code, sometimes you need to do suppressMessages(library(pkg)).

Define it as silent function, like Dirk did, and use it for these annoying pkgs:

https://rdrr.io/github/eddelbuettel/dang/src/R/load.R