mdp: Molecular Degree of Perturbation

Description Usage Arguments Value Loading pathways Selecting mean or median Examples

View source: R/mdp.R

Description

Based on the Molecular Distance to Health, this function calculates scores to each sample based on their perturbation from healthy

Usage

1
2
3
mdp(data, pdata, control_lab, directory = "", pathways, print = TRUE,
  measure = c("mean", "median"), std = 2, fraction_genes = 0.25,
  save_tables = TRUE, file_name = "")

Arguments

data

data frame of gene expression data with the gene symbols in the row names

pdata

data frame of phenodata with a column headed Class and the other headed Sample.

control_lab

character vector specifying the control class

directory

(optional) character string of output directory

pathways

(optional) list whose names are pathways and elements are genes in the pathway. see details section for more information

print

set as default to TRUE for pdfs of the sample scores to be saved

measure

'medan' as default, can change to 'median'. mean will select for z-score and median will select for modified z-score. (see details)

std

numeric set as default to 2, this governs the thresholding of expression data. z-scored expression values with absolute value less than 'std' will be set to 0.

fraction_genes

numeric fraction of genes that will contribute to the top perturbed genes. Set as default to 0.25

save_tables

Set as default to TRUE. Tables of zscore and gene and sample scores will be saved.

file_name

(optional) character string that will be added to the saved file names

Value

A list: zscore, gene_scores, gene_freq, sample_scores, perturbed_genes

Loading pathways

a list of pathways can be loaded from a .gmt file using the fgsea function using fgsea::gmtPathways('gmt.file.location')

Selecting mean or median

if median is selected, the z-score will be calculated using the median, and the standard deviation will be estimated using the median absolute deviation, utilising the mad function.

Examples

1
2
3
4
5
6
7
8
# basic run
mdp(example_data,example_pheno,'baseline')
# run with pathways
pathway_file <- system.file('extdata', 'ReactomePathways.gmt', 
package = 'mdp')
mypathway <- fgsea::gmtPathways(pathway_file) # load a gmt file
mdp(data=example_data,pdata=example_pheno,control_lab='baseline',
pathways=mypathway)

melissalever/mdp documentation built on Aug. 8, 2021, 10:45 p.m.