View source: R/bayesian-cross-reactivity.R
crossReactivityProbability | R Documentation |
Queries a compound vs target sparse matrix as generated by the perTargetMatrix
function,
and computes the probability P(theta > threshold)
for each compound, where theta
is the probability that the compound would be active in any given new assay against a novel untested target.
This code implements the Bayesian Modeling of Cross-Reactive Compounds
method described by Dancik, V. et al. (see references). This method assumes
that the number of observed active targets out of total tested targets follows a binomial
distribution. A beta conjugate prior distribution is calculated based on the hit ratios (active/total tested)
for a reference database.
crossReactivityProbability(inputMatrix,
threshold=0.25,
prior=list(hit_ratio_mean=0.0126, hit_ratio_sd=0.0375))
crossReactivityPrior(database, minTargets=20, category=FALSE, activesOnly=FALSE)
inputMatrix |
A |
threshold |
A |
prior |
A |
database |
A |
minTargets |
The minimum number of distinct screened targets for a compound to be included in the prior probability distribution. |
category |
Include only once in prior hit ratio counts any targets which share a common annotation of this category
(as used by the |
activesOnly |
logical. Should only compounds with at least one active score be used in computing prior? Defaults to FALSE. |
This function models the hit-ratio theta (fraction of distinct targets which are active) for a given compound with a standard beta-binomial bayesian model. The observed activity values for a compound tested against N targets with n actives is assumed to follow a binomial distribution:
p(n | theta) = {N \choose n} {theta}^{n} {(1-theta)}^{N-n}
With a beta conjugate prior distribution
where the parameters a and b (alpha and beta) are calculated from the prior
mean and standard deviation of hit ratios for a large number of highly
screened compounds as follows:
mean=a/(a+b)
and sd^2=ab/((a+b)^2 (a+b+1))
.
This function then computes and returns the posterior probability
P(theta > threshold)
using the beta distribution function pbeta
.
crossReactivityProbability
returns an numeric
vector containing the probability that the hit ratio
(active targets / total targets) is greater than value threshold
for each
compound in the inputMatrix
.
crossReactivityPrior
returns a list
in the prior format described above.
Tyler Backman
Dancik, V. et al. Connecting Small Molecules with Similar Assay Performance Profiles Leads to New Biological Hypotheses. J Biomol Screen 19, 771-781 (2014).
pbeta
for the beta distribution function.
perTargetMatrix
targetSelectivity
## connect to a test database
extdata_dir <- system.file("extdata", package="bioassayR")
sampleDatabasePath <- file.path(extdata_dir, "sampleDatabase.sqlite")
sampleDB <- connectBioassayDB(sampleDatabasePath)
## retrieve activity data for three compounds
assays <- getBioassaySetByCids(sampleDB, c("2244","3715","133021"))
## collapse assays into perTargetMatrix
targetMatrix <- perTargetMatrix(assays)
## compute P(theta > 0.25)
crossReactivityProbability(targetMatrix)
## disconnect from sample database
disconnectBioassayDB(sampleDB)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.