CSpermute: Permute CS results

Description Usage Arguments Details Value Examples

View source: R/permutation_functions.R

Description

Apply permutation on MFA or Zhang results to obtain p-values of 1 of the components. The function asks for a CSresult object which is returned by CSanalysis. The CSpermute function will return the same CSresult object with added information such as p-values. If asked, the CSpermute function will also draw a volcanoplot and/or histograms of the p-values. If you simply want to redraw these plots, simply use the returned CSresult object by CSpermute again in the CSpermute function. If the number of permutations was not changed, this will prevent the entire permutation analysis from being redone.

Usage

1
2
3
4
5
6
CSpermute(querMat, refMat, CSresult, B = 500, mfa.factor = NULL,
  method.adjust = "none", verbose = TRUE, which = c(1, 3),
  cmpd.hist = NULL, color.columns = NULL, labels = TRUE,
  plot.type = "device", basefilename = NULL, MultiCores = FALSE,
  MultiCores.number = detectCores(logical = FALSE), MultiCores.seed = NULL,
  save.permutation = TRUE)

Arguments

querMat

Query matrix (Rows = genes and columns = compounds).

refMat

Reference matrix

CSresult

A CSresult class object.

B

Number of permutations.

mfa.factor

If permuting a CSmfa result, mfa.factor will decide of which factor the p-values should be computed. If NULL, the factor chosen in CSanalysis will be chosen (the factor chosen in the CS slot of the CSresult). NOTE: If the mfa.factor is different from the factor in the CS slot, the CS slot will be overwritten with this new factor.

method.adjust

Correction method of multiplicity adjusted p-values: "none", "holm", "hochberg", "hommel", "bonferroni", "BH", "BY" or "fdr". (Raw p-values are also always provided)

verbose

If TRUE, progression dots of the permutation analysis will be printed.

which

Choose which plot to draw:

  1. A volcano plot of the -log(p-values) versus the observed connection scores.

  2. A histogram of the permuted connection scores under the null hypothesis for a specific compound. A vertical line(s) is added for the observed CS and its p-value. The cmpd.hist parameter determines which compounds are drawn like this.

  3. Analog to which=1, but for CSRankScores.

  4. Analog to which=2, but for CSRankScores.

cmpd.hist

Reference index vector which decides which reference compounds are plotted for the histogram distribution under null hypothesis (which=2). If NULL, you can select which compounds you want interactively on the volcano plot.

color.columns

Option to color the compounds on the volcano plot (which=1). Should be a vector of colors with the length of number of references.

labels

Boolean value (default=TRUE) to use row and/or column text labels in the volcano plots (which=c(1,3)).

plot.type

How should the plots be outputted? "pdf" to save them in pdf files, device to draw them in a graphics device (default), sweave to use them in a sweave or knitr file.

basefilename

Directory including filename of the graphs if saved in pdf files

MultiCores

Logical value parallelisation should be used for permutation. FALSE by default. (This option uses clusterApplyFT in order to provide load balancing and reproducible results with MultiCores.seed)

MultiCores.number

Number of cores to be used for MultiCores=TRUE. By default total number of physical cores.

MultiCores.seed

Seed to be used for MultiCores=TRUE using see (clusterSetupRNG.FT)

save.permutation

Logical value if the scores (CLoadings, CRankingScores, ZG Scores) of each permuted data set should be saved (default=TRUE). This information is necessary to recalculate the p-values for different components as well as for producing the histograms. However for larger data, disabling this option will reduce the size of the resulting CSresult-class object.

Details

IMPORTANT! For MFA, CSpermute should only be used to compute the p-values of the Component in which the structure (loadings) of the queries is the strongest. This because in each permutation the factor with the highest average query loadings will be chosen. The ability to compute p-values of other factors (in which the query set also increased loadings) will be added in a later release.

Value

Returns the same CSresult-class object with added p-values to the CS slot and added information to the permutation.object slot. This CSresult can be reused in CSpermute to redraw the plots without calculation.

Examples

1
2
3
4
5
6
data("dataSIM",package="CSFA")
Mat1 <- dataSIM[,c(1:6)]
Mat2 <- dataSIM[,-c(1:6)]

MFA_analysis <- CSanalysis(Mat1,Mat2,"CSmfa")
MFA_analysis <- CSpermute(Mat1,Mat2,MFA_analysis,B=200)

CSFA documentation built on May 2, 2019, 7:30 a.m.