Skip to main content

duplicate_correlation

Function duplicate_correlation 

Source
pub fn duplicate_correlation(
    y: &[f64],
    n_genes: usize,
    n_samples: usize,
    design: &[f64],
    n_coef: usize,
    block: &[usize],
    weights: Option<&Recycled<f64>>,
    trim: f64,
) -> Result<f64, EdgeErrors>
Expand description

Consensus intra-block correlation, limma’s duplicateCorrelation.

Fits y_g = X beta_g + Z u_g + e_g for each gene, with u_g a random block effect, and reports tanh of the trimmed mean of the Fisher z-transformed per-gene correlations sigma_block^2 / (sigma_block^2 + sigma_e^2).

Fits y_g = X beta_g + Z u_g + e_g per gene with u_g a random block effect, and reports tanh of the trimmed mean of the Fisher z-transformed per-gene correlations sigma_block^2 / (sigma_block^2 + sigma_e^2).

Returns exactly zero, as limma does, when every block has a single member or the block factor already lies in the column space of the design.

A gene contributes only with more than n_coef + 2 observations, more than one block and fewer blocks than n_obs - 1; others are dropped from the trimmed mean, not counted as zero.

edgePython replaces the per-gene mixed model with a one-way ANOVA moment estimator and drops several of limma’s admission rules. This follows limma. See UPSTREAM_DEVIATIONS.md A14.

§Params

  • y - Row-major n_genes * n_samples log-expression values
  • n_genes - Number of genes
  • n_samples - Number of samples
  • design - Row-major n_samples * n_coef design matrix
  • n_coef - Number of design columns
  • block - Block label per sample; only equality of labels matters
  • weights - Optional gene by sample observation weights. Non-positive or non-finite weights mark the observation missing, as limma does.
  • trim - Fraction trimmed from each tail of the z-transformed correlations, in [0, 0.5). limma’s default is 0.15.

§Returns

The consensus correlation, or EdgeErrors on a shape mismatch, an out-of-range trim, or when no gene yielded a correlation at all.

§References

Smyth, Michaud and Scott, Bioinformatics 21:2067-2075, 2005