rwdavies / STITCH

STITCH - Sequencing To Imputation Through Constructing Haplotypes
http://www.nature.com/ng/journal/v48/n8/abs/ng.3594.html
GNU General Public License v3.0
73 stars 19 forks source link

Suppress (or redirect) terminal prompts #76

Closed pdimens closed 1 year ago

pdimens commented 1 year ago

Is there a way to suppress or redirect the messages written to the screen by STITCH? I would prefer to redirect to a logfile so there would be a paper trail if anything went wrong, however using sink() doesn't seem to do it the way I expected it would. Using sink, the output is still appears onscreen and the logfile is empty. Here is how I've been attempting to do this, but to no avail:

sink("somefile.log")
STITCH(.....)
sink()
unlink("somefile.log")
pdimens commented 1 year ago

I solved my own problem by invoking sink twice and with a file() connection:

logfile <- file("somefile.log", open = "wt")
sink(logfile ,type = "output")
sink(logfile, type = "message")
STITCH(...)
sink()
sink()

It would be more convenient in the long term to have an option/argument to suppress/redirect the messaging