[Bioc-devel] Suppressing messages from Rprofile

Mike Smith gr|mbough @end|ng |rom gm@||@com
Fri Apr 9 09:26:46 CEST 2021


Thanks both for the suggestions.

I ended up piping the output to tail -n1 I've no idea how portable that is,
but presumably similar to trying a grep/sed approach.

Cheers,
Mike

On Thu, 8 Apr 2021 at 15:48, Kasper Daniel Hansen <
kasperdanielhansen using gmail.com> wrote:

> You could also preprend your cat so it outputs something like
>   INCLUDE_DIR=..
> and then use grep and sed to trim it. Of course that can also end up being
> brittle.
>
> On Wed, Apr 7, 2021 at 10:48 PM Henrik Bengtsson <
> henrik.bengtsson using gmail.com> wrote:
>
>> Correcting: the env var is R_LIBS_USER and nothing else.
>>
>> /Henrik
>>
>> On Wed, Apr 7, 2021 at 1:20 PM Henrik Bengtsson
>> <henrik.bengtsson using gmail.com> wrote:
>> >
>> > Can you go via a temporary file instead, i.e. output what you want to
>> > grab to a temporary file and pull the info from that instead?
>> >
>> > Side tracking ...
>> >
>> > > I thought about using --vanilla but I use .Rprofile to set my library
>> path,
>> > > so ignoring that file completely defeats the point in my setup.
>> >
>> > I'm a proponent of customizing the library path via .Renviron instead
>> > of via .Rprofile.  In your case, you can have a line in ~/.Renviron
>> > with:
>> >
>> >   R_USER_LIBS=~/R/%p-library/%v-bioc_3.12
>> >
>> > Alternatively, you can set it elsewhere, e.g. ~/.bashrc, in a Linux
>> > environment module that is loaded, and so on.
>> >
>> > BTW, using Rscript --no-init-file ... would skip .Rprofile while still
>> > parsing .Renviron.
>> >
>> > /Henrik
>> >
>> > On Wed, Apr 7, 2021 at 8:16 AM Mike Smith <grimbough using gmail.com> wrote:
>> > >
>> > > I have the following line in the configure.ac for rhdf5filters, which
>> > > returns the location of the HDF5 headers distributed with Rhdf5lib:
>> > >
>> > > RHDF5_INCLUDE=`"${R_HOME}/bin${R_ARCH_BIN}/Rscript" -e
>> > > 'cat(system.file("include", package="Rhdf5lib"))'`
>> > >
>> > > For me the output is a path like
>> > >  /mnt/data/R-lib/4.0.3-bioc_3.12/Rhdf5lib/include, which gets
>> inserted into
>> > > the package Makevars file, and the package compilation works.
>> > >
>> > > However I've had multiple reports (
>> > > https://github.com/grimbough/rhdf5filters/issues/11) where this
>> doesn't
>> > > work, all of which seem to relate to messages printed when an
>> Rprofile is
>> > > loaded.  They have well intentioned messages like below, which don't
>> work
>> > > so well when passed as compiler flags
>> > >
>> > > [1] "[BMRC] You have sourced the BMRC Rprofile provided at
>> > > /apps/misc/R/bmrc-r-user-tools/Rprofile"
>> > > [1] "[BMRC] Messages coming from this file (like this one) will be
>> > > prefixed with [BMRC]"
>> > > [1] "[BMRC] You are running R on host <rescomp3.hpc.in.bmrc.ox.ac.uk>
>> > > with CPU <Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz>"
>> > > [1] "[BMRC] While running on this host, local R packages will be
>> > > sourced from and installed to
>> > > /well/combat/users/ifl143/R/4.0/ivybridge"
>> > > /gpfs3/well/combat/users/ifl143/R/4.0/ivybridge/Rhdf5lib/include
>> > >
>> > > I thought about using --vanilla but I use .Rprofile to set my library
>> path,
>> > > so ignoring that file completely defeats the point in my setup.  Is
>> anyone
>> > > aware of either a more reliable way of getting the information I want
>> > > (maybe suppressing messages, different mechanism entirely, etc)?
>> > > Alternatively, is there anything definitive in WRE or the like that
>> > > suggests printing messages Rprofile is a bad idea that I can pass on
>> to the
>> > > users?
>> > >
>> > > Cheers,
>> > > Mike
>> > >
>> > >         [[alternative HTML version deleted]]
>> > >
>> > > _______________________________________________
>> > > Bioc-devel using r-project.org mailing list
>> > > https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>
>> _______________________________________________
>> Bioc-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>
>
>
> --
> Best,
> Kasper
>

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list