Hi. I am writing a function doing home-brewed chromosomal plots but I have
run in to a problem when I want to make it more general.

 

When you load your home-made package created with the help of AnnBuilder
environments become available with different information.

 

######################################################

ls("package:Hum30kbatch1to5")

 [1] "Hum30kbatch1to5"            

 [2] "Hum30kbatch1to5ACCNUM"      

 [3] "Hum30kbatch1to5CHR"         

 [4] "Hum30kbatch1to5CHRLENGTHS"  

 [5] "Hum30kbatch1to5CHRLOC"      

 [6] "Hum30kbatch1to5ENZYME"      

 [7] "Hum30kbatch1to5ENZYME2PROBE"

 [8] "Hum30kbatch1to5GENENAME"    

 [9] "Hum30kbatch1to5GO"          

[10] "Hum30kbatch1to5GO2ALLPROBES"

[11] "Hum30kbatch1to5GO2PROBE"    

[12] "Hum30kbatch1to5LOCUSID"     

[13] "Hum30kbatch1to5MAP"         

[14] "Hum30kbatch1to5MAPCOUNTS"   

[15] "Hum30kbatch1to5OMIM"        

[16] "Hum30kbatch1to5ORGANISM"    

[17] "Hum30kbatch1to5PATH"        

[18] "Hum30kbatch1to5PATH2PROBE"  

[19] "Hum30kbatch1to5PFAM"        

[20] "Hum30kbatch1to5PMID"        

[21] "Hum30kbatch1to5PMID2PROBE"  

[22] "Hum30kbatch1to5PROSITE"     

[23] "Hum30kbatch1to5QC"          

[24] "Hum30kbatch1to5QCDATA"      

[25] "Hum30kbatch1to5REFSEQ"      

[26] "Hum30kbatch1to5SUMFUNC"     

[27] "Hum30kbatch1to5SYMBOL"      

[28] "Hum30kbatch1to5UNIGENE"

######################################################

 

I thought they all were environments and if you want to call an environment
from within a function you could use something like:

 

getEnvironment <- function(chipName, environment)

            {

                        get(paste(chipName, environment, sep = ""), mode =
"environment")

            }

 

To prevent having to pass every environment that I want to use in the
function as an argument.

 

But I discovered that the "Hum30kbatch1to5CHRLENGTHS" was a vector rather
than an environment and that it is accessible from my workspace. If I type
just

 

###############################################

> Hum30kbatch1to5CHRLENGTHS

        1         2         3         4         5         6 

246127941 243615958 199344050 191731959 181034922 170914576 

        7         8         9        10        11        12 

158545518 146308819 136372045 135037215 134482954 132078379 

       13        14        15        16        17        18 

113042980 105311216 100256656  90041932  81860266  76115139 

       19        20        21        22         X         Y 

 63811651  63741868  46976097  49396972 153692391  50286555 

        M 

    16571

###############################################

then I get the lengths of the different chromosomes.

 

How do I get hold of this information from within a function if I do not
want to give the whole object as an argument? I only want to provide the
name of my package and then get hold of all information. Could one use get?
But how? I tried something like

 

get("Hum30kbatch1to5","CHRLENGTHS", mode = "numeric")

Error in as.environment(pos) : no item called "CHRLENGTHS" on the search
list

 

but that didn't work since it isn't accessible in my workspace.

 

Help please?

 

Best regards

 

// Johan L

 

****************************************************************************
***************

Johan Lindberg

Royal Institute of Technology

AlbaNova University Center

Stockholm Center for Physics, Astronomy and Biotechnology

Department of Molecular Biotechnology

Visiting address:

Roslagstullsbacken 21, Floor 3

106 91 Stockholm, Sweden

Delivering address:

Roslagstullsbacken 30B

104 06 Stockholm, Sweden

Phone (office) +46 8 553 783 44

Fax + 46 8 553 784 81

http://www.ktharray.se/

****************************************************************************
*************** 

 


	[[alternative HTML version deleted]]

