[BioC] modifying smoothScatter function

Florian Hahne fhahne at fhcrc.org
Tue Aug 11 00:01:53 CEST 2009


Hi Monica,
you might want to take a look at the "transformation" argument.  The man 
page says:
transformation: function mapping the density scale to the color scale.

Guess you could simply use this, something along the lines of
smoothScatter(foo, transformation=function(x) 
(x-(min(x)))/diff(range(x)) * value of densmax)

.smoothScatterCalcDensity is not exported from the name space, so you 
will have to use the full  symbol geneplotter:::.smoothScatterCalcDensity

Please note that smoothScatter has been moved into R's base graphics 
since R-2.10, so you might have to update your function along with your 
R at the next release.
Florian
 


Monica Pisica wrote:
> Heidi,
>  
> Thanks. I will try it since i didn't call probably the function in the right way.
>  
> I will let know if this solves the problem.
>  
> Monica
>
> ----------------------------------------
>   
>> Date: Mon, 10 Aug 2009 21:03:42 +0100
>> Subject: Re: [BioC] modifying smoothScatter function
>> From: heidi at ebi.ac.uk
>> To: pisicandru at hotmail.com
>> CC: bioconductor at stat.math.ethz.ch
>>
>> HI Monica,
>>
>> I'm afraid I don't know about the smoothScatter colours; there might be an
>> elegant way of handling this. However, are you calling
>> grDevices:::.smoothScatterCalcDensity like in the original function, or
>> just .smoothScatterCalcDensity? A "." in front of a function usually means
>> that it's an internal function that isn't exported by the given package,
>> so you have to call it specifically.
>>
>> Regards
>> \Heidi
>>
>>     
>>> Hi,
>>>
>>> I am trying to use the function smoothScatter from package geneplotter.
>>> This is not a problem if i use only one set of variables, but i have
>>> several sets of variables and i would like to compare the plots. Each set
>>> has it's own range of values, so i was thinking to slightly modify the
>>> function to accept a new parameter, for example densmax, and "rescale" the
>>> real densities to the range c(min(dens), densmax).
>>>
>>> In R i've typed the function name to get it's coding and i called the new
>>> function smoothScatt to use in my own scripts. The problem is that R does
>>> not know the function ".smoothScatterCalcDensity" which is used internally
>>> to calculate the density for function smoothScatter so i cannot use my new
>>> function, even if the right libraries are loaded (i hope). Do you have any
>>> suggestions how i can rescale the colors to be able to make comparisons?
>>>
>>> I hope this is the right forum for this question. If not, pleas elet me
>>> know where to address this question.
>>>
>>> Thanks very much for any input and help,
>>>
>>> Monica
>>>
>>> PS. SessionInfo()
>>>
>>> R version 2.8.1 Patched (2009-01-22 r47686)
>>> i386-pc-mingw32
>>>
>>> locale:
>>>
>>> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
>>> States.1252;LC_MONETARY=English_United
>>> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>>>
>>> attached base packages:
>>>
>>> [1] tools stats graphics grDevices utils datasets methods
>>> base
>>>
>>> other attached packages:
>>>
>>> [1] fields_5.02 spam_0.15-4 geneplotter_1.20.0
>>> annotate_1.20.1 xtable_1.5-5
>>> [6] AnnotationDbi_1.4.3 lattice_0.17-25 Biobase_2.2.2
>>> RColorBrewer_1.0-2 mvoutlier_1.4
>>> [11] robustbase_0.4-5
>>>
>>> loaded via a namespace (and not attached):
>>>
>>> [1] DBI_0.2-4 grid_2.8.1 KernSmooth_2.23-1 RSQLite_0.7-1
>>> _________________________________________________________________
>>> [[elided Hotmail spam]]
>>>
>>> _______________________________________________
>>> 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
>>>
>>>       
>>     
> _________________________________________________________________
> [[elided Hotmail spam]]
>
> _______________________________________________
> 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
>   


-- 
Florian Hahne, PhD
Computational Biology Program
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
PO Box 19024
Seattle, Washington 98109-1024
206-667-3148
fhahne at fhcrc.org



More information about the Bioconductor mailing list