permutationPval: calculate permutation pval for association between X and Z if...

Description Usage Arguments Value Author(s) Examples

View source: R/permutationPval.R

Description

calculate permutation pval for association between X and Z if both are connected to Y

Usage

1
2
3
4
5
6
7
8
permutationPval(interactions2permute = nodeX ~ nodeY,
  associations2test = nodeX ~ nodeZ, node_attr = NULL, data,
  statistic = nodeX + nodeZ ~ .N, select_nodes = NULL, N = 1000,
  cores = NULL, cluster_type = "PSOCK", seed = NULL,
  also_permuteYZ = F, clustermq = F, clustermq_mem = 4000,
  clustermq_jobs = 100, clustermq_template = list(),
  split_comp_inner_N = NULL, clustermq_fail_on_error = TRUE,
  clustermq_log_worker = FALSE)

Arguments

interactions2permute

formula specifying columns that contain X-Y interactions that will be permuted

associations2test

formula specifying columns that contain X-Z correspondence: empirical p-values for the association of X with Z will be tested, NOTE: Y-Z interactions are assumed

node_attr

formula or list of formulas specifying columns that contain attributes of X, Y or Z or their combination (X ~ degree, X + Z ~ pvalue)

data

data.table containing interaction data and attributes

statistic

formula that specifies how to calculate statistic using attibutes from node_attr by node X in interactions2permute and Z in associations2test, details: permutationPvalHelper. In data.table synthax: DT[, (observed/permuted)statistic := eval(right-hand-side of formula), by = .(eval(column names in the left-hand-side of formula))]

select_nodes

formula or list of formulas specifying which nodes of specific node type to select before permutation based on condition (X ~ degree > 10)

N

number of times to run permutation of PPI network

cores

specify how many cores to use for parallel processing, default (NULL) is to detect all cores on the machine and use all minus one. When using LSF cluster you must specify the number of cores to use because detectCores doen't know how much cores you have requested from LSF (with bsub -n) and detects all cores on the actual physical node.

cluster_type

Type of the cluster to create when using R parrallel (clusterApply). Type "FORK" means cluster nodes share objects in memory. Details: (makeCluster)

seed

seed for RNG for reproducible sampling

also_permuteYZ

logical, permute Y-Z interactions in addition to X-Y (specified in interactions2permute) ?

clustermq

if TRUE uses clustermq job scheduling (Q) instead of local parallelisation (parReplicate) = F, = 4000, = 100, clustermq_template = list(), split_comp_inner_N

clustermq_mem

memory in MB to allocate for each job (ignored unless clustermq == TRUE)

clustermq_jobs

maximal number of computing cluster jobs to use (ignored unless clustermq == TRUE)

clustermq_template

Add specific arguments to computing cluster job submission call. Not needed in most cases. Details: Q (ignored unless clustermq == TRUE)

split_comp_inner_N

parallel evaluation of permutations is split into the outer and inner replicate calls helps to save memory by decreasing the total size of the result. This argument let's you manually specify the number of inner replicate calls. This has to be optimised for data size when using clustermq (ignored unless clustermq == TRUE)

clustermq_fail_on_error

If TRUE clustermq will fail if one of the jobs returns an error. Details: Q (ignored unless clustermq == TRUE)

clustermq_log_worker

If TRUE clustermq will save log of worker jobs. Where in is save is determined by clustermq.template

formula

argument for permutationPvalPlot, formula specifying attribute of which nodes to plot like this: nodeX + nodeZ ~ p.value. The default is to plot p.value histogram for nodeX and nodeZ as specified in the x object

x

argument for permutationPvalPlot, output of permutationPval, class "XYZinteration_XZEmpiricalPval"

...

argument for permutationPvalPlot, base R plotting parameters

Value

object of S3 class "XYZinteration_XZEmpiricalPval" (list), containing permutationPval function call, standardised node names, and data.table containing the original data but appended with empirical p-value (p.value), observed_statistic, YmissingZ_perX, and higher_counts, not_missing used to calculate p-value

Author(s)

Vitalii Kleshchevnikov

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
res = permutationPval(interactions2permute = nodeX ~ nodeY,
 associations2test = nodeX ~ nodeZ, node_attr = NULL,
 data, statistic = nodeX + nodeZ ~ .N, select_nodes = NULL, N = 1000,
 cores = NULL, seed = NULL, also_permuteYZ = F, clustermq = F)

# print
res

# plot p-value distribution (hist)
plot(res)

# plot the number of Y without Z per X (hist),
# formula is used to subset the table before plotting
# to avoid plotting single number multiple times
plot(res, nodeX ~ YmissingZ_perX)

## End(Not run)

vitkl/NetFeaturePval documentation built on May 19, 2019, 9:39 p.m.