knausb / vcfR

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

extract_gt_tidy dumps messages without the option to control them #78

Closed ripkrizbi closed 7 years ago

ripkrizbi commented 7 years ago

https://github.com/knausb/vcfR/blob/afa524f8325700bbade53e9b9e4c2a4632b8dd47/R/vcfR_to_tidy_functions.R#L482

this message is always on, regardless of any verbosity setting, which generates quite a bit of unwanted output when processing many files at a time.

knausb commented 7 years ago

Hello,

The vcfR tidy functions do not have a verbosity parameter. Let's see if we can create a reproducible example.

data("vcfR_test")
tidy_vcf <-  vcfR2tidy(vcfR_test)
Extracting gt element GT
Extracting gt element GQ
Extracting gt element DP
Extracting gt element HQ

This creates four messages regarding which elements are being extracted from the VCF data. If you use suppressMessages() it should produce no output.

suppressMessages(tidy_vcf <-  vcfR2tidy(vcfR_test))

Is this the behavior you're looking for? If not, would you like to propose the behavior you think would be more appropriate?

ripkrizbi commented 7 years ago

hi, thanks for the quick reply -

yes, that is the intention, and this is exactly how I'm wrapping the function to avoid messages, and it works. However, it seems to me it would make more sense to have the messages of all the functions under direct control (especially if they are of informational level) rather than to muffle them with an external function.

I was not reporting a bug, rather pointing out that you have a stray message shooter in the code :)

knausb commented 7 years ago

You've uncovered an inconsistency in style that is an artefact of collaborative work. The tidy functions in vcfR were contributed by a pull request. Elsewhere I've used a verbose option. We could change it to something like the following.

tidy_vcf <-  vcfR2tidy(vcfR_test, verbose = FALSE)

I'd default it to TRUE, but this would give you an option to turn off the message. There appears to only be the one message in the tidy functions so this would be pretty easy. Is that what you're looking for?

ripkrizbi commented 7 years ago

precisely! (it does not really matter if it is on or of by default, the important thing is to be able to control it through a parameter) many thanks!

knausb commented 7 years ago

Done! Its on the master branch on GitHub now. If you have a compiler and would like to give it a try you should be able to use the following.

devtools::install_github(repo="knausb/vcfR")

We're hoping ot get an update to CRAN in the next few weeks. This will be part of it.

Thanks!