In R, I'm using GEOquery to download microarray datasets and am trying to work out a way to suppress the messages that the getGEO function always writes to the screen:
> gse <- getGEO('GSE31365')
ftp://ftp.ncbi.......
Found 1 file(s)
GSE31365_....
trying URL ;ftp://......
==============......
. None of the usual suspects can suppress these messages: capture.output, suppressWarnings, suppressMessages in R itself, this isn't an issue; but I'm calling an R script within a snakemake run: R(....) block, and I get page after page of the following:
|======================= | 100% ~0 s remaining
So, I was wondering a) how I can suppress the download messages from GEOquery; or b) how to suppress R messages from bubbling up into snakemake; and c) does anyone know what the available values are for the GEOquery option 'download.file.method.GEOquery'
1 answer
Indeed, some messages from getGEO (like those coming from getGEOfile which getGEO calls) are suppressed by supressMessages, but not those coming from download.file, which has an argument (quiet) that needs to be set in order to suppress feedback.
download.file.method.GEOquery is by default set to auto, which according to the help page for download.file will select libcurl because the URL is https. I think any of the options listed in ?download.file can be tried with download.file.method.GEOquery but they may not work if the URL is https (tested it with "internal" and failed).
Log in to answer this question.
This seems to relate to the snakemake/rpy2 connection to R. in R,
interactive()returns TRUE if you're working in R, and FALSE if you call Rscript. Curiously,interactive() == TRUEwhen R(...) is called inside snakemakeIn fact this had nothing to do with GEOquery and resulted from my using dplyr::do(), a function that prints out a progress_bar, within one of my GEOquery-related functions.
FYI: The dplyr progress bar can be suppressed with
options('dplyr.show_progress' = FALSE).; and is suppressed in a knitr-run or a non-interactive run.