RN_calc_LPV: RN_calc_LPV

View source: R/RN_calc_LPV.R

RN_calc_LPVR Documentation

RN_calc_LPV

Description

This function calculates local p-values from expression data, output as -log10(p-value).

Usage

RN_calc_LPV(X, design, bind = TRUE)

Arguments

X

data.frame with expression values. It may contain additional non numeric columns (eg. a column with gene names)

design

The design matrix. Refer to the help for RN_calc for further info.

bind

See Value (Default = TRUE)

Value

If bind is TRUE the function returns a data.frame with the original expression values from data.frame X and attached columns with the -log10(p-values) computed for each sample, otherwise only the matrix of -log10(p-values) is returned.

Author(s)

Giulio Pavesi - Dep. of Biosciences, University of Milan

Federico Zambelli - Dep. of Biosciences, University of Milan

Examples

data("RN_Brain_Example_tpm", "RN_Brain_Example_design")
LPV <- RN_calc_LPV(RN_Brain_Example_tpm, RN_Brain_Example_design)
## The function is currently defined as

function(X, design = NULL, bind = TRUE)
{
  if(is.null(design))
  {
    design <- .RN_default_design(sum(sapply(X, is.numeric)))
  }
  
	rnums <- sapply(X, is.numeric)

	.RN_design_check(X, design, rnums)
	RL <- .RN_get_replicate_list(design)
	
	l1 <- rep("LOC_LPV", length(X[rnums]))
	l2 <- colnames(X[rnums])
	PV <- apply(X[rnums],  1, '.RN_calc_LPV_row', RL = RL)
	PV <- t(PV)
	colnames(PV) <- paste(l1, l2, sep="_")

	if(bind)
	{
		return (cbind(X, PV))
	}
	else
		return (PV)
}

RNentropy documentation built on April 13, 2022, 5:22 p.m.