Skip to main content

array_weights_gene_by_gene

Function array_weights_gene_by_gene 

Source
pub fn array_weights_gene_by_gene(
    exprs: &Array2<f64>,
    design: &Array2<f64>,
    weights: Option<&Array2<f64>>,
    var_design: Option<&Array2<f64>>,
    prior_n: f64,
) -> Array1<f64>
Expand description

Estimate array quality weights by the gene-by-gene update algorithm (.arrayWeightsGeneByGene).

A single forward pass over genes, each performing one Newton step of the log-linear array-variance model log(sigma_array^2) = Z2 gamma, with array weights w = exp(-Z2 gamma). This is the path limma’s arrayWeights takes for method = "genebygene" (and for method = "auto" when observation weights or missing values are present), and the estimator used inside voomWithQualityWeights.

  • exprsngenes x narrays expression matrix (NaN marks missing observations, which are dropped per gene as in lm.wfit).
  • designnarrays x p design matrix (assumed full column rank).
  • weights — optional ngenes x narrays observation weights, multiplied into the running array weights per gene.
  • var_design — optional narrays x ngam variance design Z2; defaults to contr.sum(narrays).
  • prior_n — prior support pulling weights toward 1 (limma default 10).

Returns a length-narrays vector of array weights.