Where is the source code for qAbundanceDist?
2
0
Entering edit mode
kjo ▴ 70
@kjo-11078
Last seen 7.2 years ago

The source code provided with the voom paper uses a function called qAbundanceDist, which gets loaded through the load statement shown below:

    > ls()
    [1] ""
    > load(url("http://bioinf.wehi.edu.au/voom/qAbundanceDist.RData"))
    > ls()
    [1] "qAbundanceDist"
    > class(qAbundanceDist)
    [1] "function"

If I try to view the source code for this function, what I get is this:

    > qAbundanceDist
    function (v) 
    .approxfun(x, y, v, method, yleft, yright, f)
    <bytecode: 0x2df5310="">
    <environment: 0x2275540="">

Where can I get the actual source code for this function?


BTW, this function is pretty mysterious. It's not mentioned (at least not by the name qAbundanceDist) in the voom paper, and there's no documentation for it:

    > ?qAbundanceDist
    No documentation for ‘qAbundanceDist’ in specified packages and libraries:
    you could try ‘??qAbundanceDist’
    > ??qAbundanceDist
    No vignettes or demos or help files found with alias or concept or
    title matching ‘qAbundanceDist’ using fuzzy matching.

(I emphasize, however, that I'm not looking for the function's documentation, but for its source code.)

All Google hits for source code mentioning qAbundanceDist just point to the load statement shown above.

voom • 1.1k views
ADD COMMENT
2
Entering edit mode
@gordon-smyth
Last seen 53 minutes ago
WEHI, Melbourne, Australia

The voom paper says

"The distribution of baseline values was chosen to match that from RNA-seq experiments conducted at our institution. Specifically we used the goodTuringProportions function of the edgeR package [12], which implements the Good-Turing algorithm [55], to predict the true proportion of total RNA attributable to each gene. We ran this function on a number of different libraries, pooled the predicted proportions and formed a smoothed distribution function. The baseline proportions for the simulations were then generated to follow this distribution."

The function qAbundanceDist() generates values from the smoothed empirical distribution function referred to in the article. It is analogous to functions like qnorm() or qgamma() in R, but it generates values from an empirical distribution instead of from a mathematically defined distribution. Like qnorrm() and qgamma(), the argument is a vector of values between 0 and 1. For example

> qAbundanceDist(c(0, 0.5, 1))
[1] 1.874024e-08 2.445787e-05 4.675410e-02

evaluates the minimum, median and maximum values of the distribution.

 

ADD COMMENT
2
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 9 hours ago
The city by the bay

qAbundanceDist is a function generated by the approxfun function, so the slightly mysterious .approxfun in its source probably refers to stats:::.approxfun:

> stats:::.approxfun
function (x, y, v, method, yleft, yright, f) 
.Call(C_Approx, x, y, v, method, yleft, yright, f)
<bytecode: 0x7fe45c109b50>
<environment: namespace:stats>

... which is not particularly informative. So if you really, really want the actual source code, go dig up the corresponding C code from CRAN. Or you could just trust that approxfun does what it says it does in its documentation. It's a function from one of the base R packages, so I reckon it should be fairly reliable.

ADD COMMENT
0
Entering edit mode

Thanks for the clarification.

ADD REPLY

Login before adding your answer.

Traffic: 772 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6