Skip to content

Commit

Permalink
Merge pull request #118 from USEPA/112-create-subsections-and-reorder…
Browse files Browse the repository at this point in the history
…-mc5_mthdsr

112 create subsections and reorder mc5 mthdsr
  • Loading branch information
Ashley-Ko authored Aug 8, 2023
2 parents d59dd85 + 8afb2f3 commit 523588f
Show file tree
Hide file tree
Showing 14 changed files with 451 additions and 224 deletions.
43 changes: 26 additions & 17 deletions R/mc2_mthds.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,40 +27,49 @@
#' @section Available Methods:
#'
#' More information about the level 2 multiple-concentration processing is
#' available in the package vignette, "Pipeline_Overview."
#' available in the package vignette, "Data_processing."
#'
#' \subsection{Correction Methods}{
#' \describe{
#' \item{log2}{Transform the corrected response value (cval) to log-scale (base 2).}
#' \item{log10}{Transform the corrected response value (cval) to log-scale (base 10).}
#' \item{rmneg}{Exclude wells with negative corrected response values (cval) and downgrading
#' their well quality (wllq); if cval < 0, wllq = 0.}
#' their well quality (wllq); if \eqn{cval<0, wllq=0}{cval<0, wllq=0}.}
#' \item{rmzero}{Exclude wells with corrected response values (cval) equal to zero and
#' downgrading their well quality (wllq); if cval = 0, wllq = 0.}
#' \item{mult25}{Multiply corrected response value (cval) by 25; 25*cval.}
#' \item{mult100}{Multiply corrected response value (cval) by 100; 100*cval.}
#' downgrading their well quality (wllq); if \eqn{cval=0, wllq=0}{cval=0, wllq=0}.}
#' \item{mult25}{Multiply corrected response value (cval) by 25; \eqn{25*cval}{25*cval}.}
#' \item{mult100}{Multiply corrected response value (cval) by 100; \eqn{100*cval}{100*cval}.}
#' \item{negshift}{Shift corrected response values (cval) by subtracting the minimum cval and
#' adding 1, such that the new minimum is 1; cval - min + 1.}
#' \item{mult2.5}{Multiply corrected response value (cval) by 2.5; 2.5*cval.}
#' \item{mult3}{Multiply corrected response value (cval) by 3; 3*cval.}
#' \item{mult6}{Multiply corrected response value (cval) by 6; 6*cval.}
#' adding 1, such that the new minimum is 1; \eqn{cval-min+1}{cval-min+1}.}
#' \item{mult2.5}{Multiply corrected response value (cval) by 2.5; \eqn{2.5*cval}{2.5*cval}.}
#' \item{mult3}{Multiply corrected response value (cval) by 3; \eqn{3*cval}{3*cval}.}
#' \item{mult6}{Multiply corrected response value (cval) by 6; \eqn{6*cval}{6*cval}.}
#' \item{sub100}{Center data around zero by subtracting the corrected response value (cval) from
#' 100; 100 - cval. Typically used if data was pre-normalized around 100 with responses
#' decreasing to 0.}
#' 100; \eqn{100-cval}{100-cval}. Typically used if data was pre-normalized around 100 with
#' responses decreasing to 0.}
#' \item{zscore.npwlls}{Convert the corrected response value (cval) to an absolute Z-Score based
#' on the neutral and positive control wells (wllts = n and p), by assay plate ID (apid);
#' cval = |(cval - (mean cval for wllt = n and p)) / (sd cval for wllt = n and p)|.}
#' \eqn{cval=|(cval-mean(cval~for~wllt~=~n~and~p)/sd(cval~for~wllt~=~n~and~p)|}{cval=
#' |(cval-mean(cval for wllt = n and p)/sd(cval for wllt = n and p)|}.}
#' \item{sub1}{Center data around zero by subtracting the corrected response value (cval) from 1;
#' 1 - cval. Typically used if data was pre-normalized around 1 with responses decreasing to 0.}
#' \eqn{1-cval}{1-cval}. Typically used if data was pre-normalized around 1 with responses
#' decreasing to 0.}
#' }
#' }
#'
#' \subsection{Aggregation Methods}{
#' \describe{
#' \item{agg.mean.rep.apid}{Aggregate technical replicates by taking the plate-wise mean per sample id (spid), assay plate (apid), and concentration index (cndx).}
#' \item{agg.median.rep.apid}{Aggregate technical replicates by taking the plate-wise median per sample id (spid), assay plate (apid), and concentration index (cndx).}
#' \item{agg.percent.rep.spid}{Use for binary data. Aggregate technical replicates as percentage by taking the sum of hits relative to total replicates per sample id (spid) and concentration index (cndx); cval = (sum(rval)/.N)*100.}
#' \item{agg.percent.rep.spid.min1}{Use for binary data. Aggregate technical replicates as percentage by taking the sum of hits relative to total replicates per per sample id (spid) and concentration index (cndx), where there is more than one replicate; cval = (sum(rval)/.N)*100, where .N>1.}
#' \item{agg.mean.rep.apid}{Aggregate technical replicates by taking the plate-wise mean per
#' sample id (spid), assay plate (apid), and concentration index (cndx).}
#' \item{agg.median.rep.apid}{Aggregate technical replicates by taking the plate-wise median per
#' sample id (spid), assay plate (apid), and concentration index (cndx).}
#' \item{agg.percent.rep.spid}{Use for binary data. Aggregate technical replicates as percentage
#' by taking the sum of hits relative to total replicates per sample id (spid) and concentration
#' index (cndx); \eqn{cval = (sum(rval)/.N)*100}{cval = (sum(rval)/.N)*100}.}
#' \item{agg.percent.rep.spid.min1}{Use for binary data. Aggregate technical replicates as
#' percentage by taking the sum of hits relative to total replicates per per sample id (spid) and
#' concentration index (cndx), where there is more than one replicate;
#' \eqn{cval=(sum(rval)/.N)*100,~where~.N>1}{cval = (sum(rval)/.N)*100, where .N>1}.}
#' }
#' }
#'
Expand Down
49 changes: 27 additions & 22 deletions R/mc3_mthds.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#'
#' @details
#' The functions contained in the list returned by \code{mc3_mthds} take
#' 'aeids' (a numeric vector of aeid values) and returns a list of expressions
#' \code{aeids} (a numeric vector of aeid values) and returns a list of expressions
#' to be executed in the \code{mc3} (not exported) function environment. The
#' functions are described here for reference purposes, The
#' \code{mc3_mthds} function is not exported, nor is it intended for use.
Expand All @@ -34,7 +34,7 @@
#' are applied by aeid.
#'
#' More information about the level 3 multiple-concentration processing is
#' available in the package vignette, "Pipeline_Overview."
#' available in the package vignette, "Data_processing."
#'
#' \subsection{bval Methods}{
#' \describe{
Expand Down Expand Up @@ -109,7 +109,7 @@
#' \item{pval.apid.v.min}{Calculate the positive control value (pval) as the plate-wise
#' minimum, by assay plate ID (apid), of the medians of the corrected values (cval) for
#' viability control wells (wllt = v) by apid and concentration.}
#' \item{pval.zero}{Set the positive control value (pval) to 0; pval = 0.}
#' \item{pval.zero}{Set the positive control value (pval) to 0; \eqn{pval = 0}{pval = 0}.}
#' \item{pval.apid.owlls.med}{Calculate the positive control value (pval) as the plate-wise
#' median, by assay plate ID (apid), of the corrected values (cval) for single-concentration
#' negative control wells (wllt = o).}
Expand All @@ -124,7 +124,7 @@
#' \item{pval.twlls.99pct}{Calculate positive control value (pval) as the 99th percentile of
#' all corrected value (cvals) of the test compound wells (wllt = t).}
#' \item{pval.neg.100}{Calculate positive control value (pval) as -100 for endpoints in the
#' down direction; pval = -100.}
#' down direction; \eqn{pval = -100}{pval = -100}.}
#' }
#' }
#'
Expand All @@ -133,34 +133,37 @@
#' \item{resp.pc}{Calculate the normalized response (resp) as a percent of control, i.e. the
#' ratio of the difference between the corrected (cval) and baseline (bval) values divided the
#' difference between the positive control (pval) and baseline (bval) values multiplied by 100;
#' resp = (cval-bval)/(pval-bval)*100.}
#' \eqn{resp = (cval-bval)/(pval-bval)*100}{resp = (cval-bval)/(pval-bval)*100}.}
#' \item{resp.pc.pval.cor}{Calculate the normalized response (resp) as a percent of control,
#' i.e. the ratio of the difference between the corrected (cval) and baseline (bval) values
#' divided the positive control (pval) value multiplied by 100; resp = (cval-bval)/pval*100.}
#' divided the positive control (pval) value multiplied by 100;
#' \eqn{resp = (cval-bval)/pval*100}{resp = (cval-bval)/pval*100}.}
#' \item{resp.fc}{Calculate the normalized response (resp) as the fold change, i.e. the ratio
#' of the corrected (cval) and baseline (bval) values; resp = cval/bal.}
#' of the corrected (cval) and baseline (bval) values; \eqn{resp = cval/bal}{resp = cval/bal}.}
#' \item{resp.logfc}{Calculate the normalized response (resp) as the fold change of logged,
#' i.e. the difference between corrected (cval) and baseline (bval) log-scale values.}
#' \item{resp.log2}{Transform the response values to log-scale (base 2).}
#' \item{resp.mult25}{Multiply the normalized response value (resp) by 25; 25*resp.}
#' \item{resp.mult25}{Multiply the normalized response value (resp) by 25;
#' \eqn{25*resp}{25*resp}.}
#' \item{resp.scale.mad.log2fc}{Scale the normalized response value (resp) by the ratio of
#' log2(1.2) and 3 multiplied by the baseline median absolute deviation (bmad) of the unscaled
#' normalized response values (resp); log2(1.2) / 3(bmad)*resp.}
#' normalized response values (resp); \eqn{(\log_{2}{1.2})/3*bmad*resp}{log2(1.2)/3*bmad*resp}.}
#' \item{resp.scale.quant.log2fc}{Scale the normalized response value (resp). First, determine
#' the maximum difference (md) by finding the maximum between the absolute difference of the
#' 1st percentile minus the 50th percentile and the absolute difference of the 99th percentile
#' minus the 50th percentile. Then multiply resp by log2(1.2) divided by 20 percent of md;
#' log2(1.2) / 0.2(md)*resp.}
#' \item{resp.multneg1}{Multiply the normalized response value (resp) by -1; -1*resp.}
#' \eqn{(\log_{2}{1.2})/0.2*md*resp}{log2(1.2)/0.2*md*resp}.}
#' \item{resp.multneg1}{Multiply the normalized response value (resp) by -1;
#' \eqn{-1*resp}{-1*resp}.}
#' \item{resp.shiftneg.3bmad}{Shift all the normalized response values (resp) less than -3
#' multiplied by the baseline median absolute deviation (bmad) to 0; if resp < -3*bmad,
#' resp = 0.}
#' multiplied by the baseline median absolute deviation (bmad) to 0; if
#' \eqn{resp < -3*bmad,~resp = 0}{resp < -3*bmad, resp = 0}.}
#' \item{resp.shiftneg.6bmad}{Shift all the normalized response values (resp) less than -6
#' multiplied by the baseline median absolute deviation (bmad) to 0; if resp < -6*bmad,
#' resp = 0.}
#' multiplied by the baseline median absolute deviation (bmad) to 0; if
#' \eqn{resp < -6*bmad,~resp = 0}{resp < -6*bmad, resp = 0}.}
#' \item{resp.shiftneg.10bmad}{Shift all the normalized response values (resp) less than 10
#' multiplied by the baseline median absolute deviation (bmad) to 0; if resp < -10*bmad,
#' resp = 0.}
#' multiplied by the baseline median absolute deviation (bmad) to 0; if
#' \eqn{resp < -10*bmad,~resp = 0}{resp < -10*bmad, resp = 0}.}
#' \item{resp.blineshift.3bmad.repi}{Shift the normalized response value (resp) with a baseline
#' correction, by replicate index (repi), with a window of 3 multiplied by the baseline median
#' absolute deviation (bmad).}
Expand All @@ -172,17 +175,19 @@
#' \item{resp.blineshift.50.spid}{Shift the normalized response value (resp) with a baseline
#' correction, by sample ID (spid), with a window of 50.}
#' \item{none}{Set the corrected response value (cval) as the normalized response value (resp);
#' cval = resp. No additional mc3 methods needed for endpoint-specific normalization.}
#' \eqn{cval = resp}{cval = resp}. No additional mc3 methods needed for endpoint-specific
#' normalization.}
#' \item{resp.zerocenter.fc}{Calculate the normalized response (resp) as a zero center fold
#' change, i.e. 1 minus the ratio of corrected (cval) and baseline (bval) values;
#' resp = 1 - (cval/bval). Typically used for increasing responses.}
#' \eqn{resp=1-cval/bval}{resp = 1 - cval/bval}. Typically used for increasing responses.}
#' \item{resp.incr.zerocenter.fc}{Calculate the normalized response (resp) as a zero center
#' fold change, i.e. the ratio of the the corrected (cval) and baseline (bval) values minus 1;
#' resp = cval/bval - 1. Typically used for increasing responses.}
#' \item{resp.mult100}{Multiply the normalized response value (resp) by 100; 100*resp.}
#' \eqn{resp=cval/bval-1}{resp = cval/bval - 1}. Typically used for increasing responses.}
#' \item{resp.mult100}{Multiply the normalized response value (resp) by 100;
#' \eqn{100*resp}{100*resp}.}
#' }
#' }
#'
#'
#' @note
#' This function is not exported and is not intended to be used by the user.

Expand Down
9 changes: 5 additions & 4 deletions R/mc4_mthds.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#'
#' @details
#' The functions contained in the list returned by \code{mc4_mthds} take
#' 'aeids' (a numeric vector of aeid values) and returns a list of expressions
#' \code{aeids} (a numeric vector of aeid values) and returns a list of expressions
#' to be executed in the \code{mc4} (not exported) function environment. The
#' functions are described here for reference purposes, The
#' \code{mc4_mthds} function is not exported, nor is it intended for use.
Expand All @@ -31,7 +31,7 @@
#' are applied by aeid.
#'
#' More information about the level 4 multiple-concentration processing is
#' available in the package vignette, "Pipeline_Overview."
#' available in the package vignette, "Data_processing."
#'
#' \describe{
#' \item{bmad.aeid.lowconc.twells}{Calculate the baseline median absolute value (bmad) as the
Expand All @@ -42,8 +42,9 @@
#' (wllt = n).}
#' \item{onesd.aeid.lowconc.twells}{Calculate one standard deviation of the normalized response
#' for test compound wells (wllt = t) with a concentration index (cndx) of 1 or 2;
#' onesd = sqrt(sum((resp - mean resp)^2)/sample size - 1). Used to establish BMR and therefore
#' required for tcplfit2 processing.}
#' \eqn{onesd=\sqrt{\sum{(resp-mean(resp))^{2}}/(n-1)}}{onesd = sqrt(sum((resp - mean
#' resp)^2)/sample size - 1)}. Used to establish BMR and therefore required for tcplfit2
#' processing.}
#' \item{bidirectional.false}{Limits bidirectional fitting and processes data in positive
#' analysis direction only. Use for gain-of-signal or inverted data.}
#' }
Expand Down
Loading

0 comments on commit 523588f

Please sign in to comment.