simulation_Ic_sample: Calculating (and plot) random Ic scores (Mojtahedi et al....

Description Usage Arguments Value Author(s) Examples

View source: R/BioTIP_update_4_09282020_v3.R

Description

Run B times of sample-label shuffling to calculate the Ic score, where x should be the same as the length of identified BioTiP and B is self-defined.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
simulation_Ic_sample(
  counts,
  sampleNo,
  Ic = NULL,
  genes,
  B = 1000,
  ylim = NULL,
  main = "simulation of samples",
  fun = c("cor", "BioTIP"),
  shrink = TRUE,
  use = c("everything", "all.obs", "complete.obs", "na.or.complete",
    "pairwise.complete.obs"),
  output = c("Ic", "PCCg", "PCCs"),
  plot = FALSE
)

Arguments

counts

A numeric matrix or data frame. The rows and columns represent unique transcript IDs (geneID) and sample names, respectively.

sampleNo

An integer of sample size at the tipping-point state.

Ic

A numeric value. Ic score of identified CTS (gene-set), useful when plot is TRUE. Default is NULL.

genes

A character vector of identified CTS gene unique ids.

B

An integer indicating number of times to run this simulation, default 1000.

ylim

An integer vector of length 2. Default is NULL.

main

A character vector. The title of the plot. Default is NULL.

fun

An optional character string indicating the R functon to calculate correlations for all possible pairs of columns of a matrix. When using "BioTIP", The method is modified to ignore missing values, analogous to how cor(X, use = "pairwise.complete.obs") works. Note that the "BioTIP" option only function together with shrink = TRUE.

shrink

A flag specifying whether to shrink the correlation or not. This appraoch uses the method outlined by Schafer and Strimmer in "A Shrinkage Approach to Large-Scale Covariance Matrix Estimation and Implications for Functional Genomics" (2005) Comparing to fun='cor', the 'BioTIP' method without shinkage is modified to ignore missing values, analogous to how cor(X, use = "pairwise.complete.obs") works.

use

An optional character string, when fun=="cor", it gives a method for computing covariances in the presence of missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs".

output

A string. Please select from 'Ic', 'PCCg', or 'PCCs'. Uses 'Ic' by default. 'PCCg' is the PCC between genes (numerator) and 'PCCs' is PCC between samples (denominator)

plot

A Bollen value indicating whether a density plot will be plotted.

Value

A vector of B values of BioTIP (or Ic) scores calculated for the state of interest.

Author(s)

Zhezhen Wang zhezhen@uchicago.edu; Xinan H Yang xyang2@uchicago.edu

Examples

1
2
3
4
5
6
7
counts = matrix(sample(1:100, 27), 3, 9)
colnames(counts) = 1:9
row.names(counts) = c('loci1', 'loci2', 'loci3')
CTS = c('loci1', 'loci2')
randomS <- simulation_Ic_sample(counts,  sampleNo=3,  Ic=3.4,  genes=CTS,  B=3, 
                       fun='BioTIP', plot=TRUE)
dim(randomS)

BioTIP documentation built on Nov. 8, 2020, 6:27 p.m.