[BioC] adding environment variables

Kasper Daniel Hansen kasperdanielhansen at gmail.com
Fri Oct 29 00:02:19 CEST 2010


You cannot expect the user to have write permission to the package
installation directory.  This won't work on most multi-user systems.

I was thinking of an object in the user's workspace.

Kasper

On Thu, Oct 28, 2010 at 3:38 PM, Robert M. Flight <rflight79 at gmail.com> wrote:
> Wow, I see what you are doing there, and it looks like it would be a
> good way to do it. I may investigate that in the future.
>
> In the interest of staying simple and what I can figure out right now
> that would work, I actually went with the suggestion of using an
> object to store the information. This object is created by a very
> simple function, and is stored in the directory of the package. It is
> easy to modify the object, and only has to be done once after
> installation, if it is even used.
>
> Thanks for the suggestions.
>
> -Robert
>
> Robert M. Flight, Ph.D.
> University of Louisville Bioinformatics Laboratory
> University of Louisville
> Louisville, KY
>
> PH 502-852-0467
> EM robert.flight at louisville.edu
> EM rflight79 at gmail.com
>
> Williams and Holland's Law:
>        If enough data is collected, anything may be proven by
> statistical methods.
>
>
>
> On Thu, Oct 28, 2010 at 12:49, Martin Morgan <mtmorgan at fhcrc.org> wrote:
>> On 10/28/2010 07:40 AM, Sean Davis wrote:
>>> On Thu, Oct 28, 2010 at 10:21 AM, Robert M. Flight <rflight79 at gmail.com>wrote:
>>>
>>>> Hi All,
>>>>
>>>> I am developing a package that requires information about the location
>>>> of a set of files that will be used often in the calculations. In my
>>>> current version, I define the location in the main file that calls all
>>>> the subfunctions. This works fine when you are installing from source,
>>>> but will not work so well if I want people to be able to install
>>>> binary versions of the package. Therefore, I think the best way to
>>>> encode the information would be through the use of an environment
>>>> variable, that could then be read by "Sys.getenv(VARIABLE)" when the
>>>> function is called.
>>>>
>>>> In the help, I found a few different ways to set environment
>>>> variables, but the easiest way (from my reading anyways) seemed to be
>>>> by creating the file "Renviron.site" in the R_HOME/etc directory and
>>>> adding the variable there. I am interested in opinions from the list,
>>>> or other suggestions on how to do this.
>>>>
>>>> For those who are interested, the package does a lot of parsing of
>>>> KEGG KGML files, and to speed up calculations I offer advice that they
>>>> should download a copy of the KGML directory for their organism to
>>>> their local machine, and I want the package to know where those files
>>>> are at runtime.
>>>>
>>>>
>>> You could also use an option or set of options.  See ?options for details.
>>
>> Or define an environment to store relevant information and accessors for
>> you / the user to set / get
>>
>> .kgmlOptions <- new.env(parent=emptyenv())
>>
>> setKgmlLocalRepository <-
>>    function(x) .kgmlOptions[["localRepository"]] <- normalizePath(x)
>>
>> getKgmlLocalRepository <-
>>    function() .kgmlOptions[["localRepository"]]
>>
>> If there's just the single option then active bindings could be fun, in
>> a package implemented I think as
>>
>> .onLoad <-
>>    function(...)
>> {
>>    makeActiveBinding("kgmlLocalRepository", function(x) {
>>        if (missing(x)) .kgmlOptions[["localRepository"]]
>>        else .kgmlOptions[["localRepository"]] <- normalizePath(x)
>>    }, topenv(parent.frame()))
>> }
>>
>> and used as any variable, both in and outside the package.
>>
>> kgmlLocalRepository <- "some-dir"
>> kgmlLocalRepository
>>
>> This latter is probably too clever -- the user isn't aware enough that
>> they're setting a package-global variable.
>>
>> Martin
>>
>>>
>>> Sean
>>>
>>>
>>>> Thanks in advance,
>>>>
>>>> -Robert
>>>>
>>>> Robert M. Flight, Ph.D.
>>>> University of Louisville Bioinformatics Laboratory
>>>> University of Louisville
>>>> Louisville, KY
>>>>
>>>> PH 502-852-0467
>>>> EM robert.flight at louisville.edu
>>>> EM rflight79 at gmail.com
>>>>
>>>> Williams and Holland's Law:
>>>>        If enough data is collected, anything may be proven by
>>>> statistical methods.
>>>>
>>>> _______________________________________________
>>>> Bioconductor mailing list
>>>> Bioconductor at stat.math.ethz.ch
>>>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>>>> Search the archives:
>>>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>>>
>>>
>>>       [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> Bioconductor mailing list
>>> Bioconductor at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>>
>> --
>> Computational Biology
>> Fred Hutchinson Cancer Research Center
>> 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
>>
>> Location: M1-B861
>> Telephone: 206 667-2793
>>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>



More information about the Bioconductor mailing list