generate_reduced_graph: Generate a reduced iGraph

Description Usage Arguments Value

View source: R/network_generation.R

Description

(INTERNAL) A wrapper functions that calls the functions to generate a network from raw data and reduce the network by a given method. Graph generation is using graph.adjacency internally. Methods implemented are network_reduction_by_p_value (reduction by statistical significance of correlation) and network_reduction_by_pickHardThreshold (using WGCNA function pickHardThreshold.fromSimilarity that finds a suitable cutoff value to get a scale-free network). If no method is given, no reduction will be performed. When using the reduction method 'p_value' the user can specify an alpha significance value and a method for p-value adjustment. When using the reduction by 'pickHardthreshold' a R-Squared Cutoff can be specified and a cut vector can be supplied. The adjacency matrix of correlations is computed using cor. The handling of missing data can be specified. Both the adjacency of correlations and the graph object can be saved optionally.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
generate_reduced_graph(
  measurement_data,
  identifiers,
  correlation_method = "spearman",
  reduction_method = "p_value",
  save_correlation_filename = NULL,
  handling_missing_data = "all.obs",
  p_value_adjustment_method = "BH",
  reduction_alpha = 0.05,
  r_squared_cutoff = 0.85,
  cut_vector = seq(0.2, 0.8, by = 0.05),
  print_graph_info = FALSE,
  n_threads = parallel::detectCores() - 1,
  parallel_chunk_size = 10^6
)

Arguments

measurement_data

Data frame containing raw data (e.g. mRNA expression data, protein abundance, etc.). Analyzed components (e.g. genes) in rows, samples (e.g. patients) in columns.

identifiers

Data frame containing biological identifiers and the corresponding node ID created in create_unique_layer_node_ids. The column containing node IDs has to be named 'node_id'.

correlation_method

A character string specifying the method to be used for correlation calculation by cor. Can be any of "spearman", "pearson" or "kendall".

reduction_method

A character string specifying the method to be used for network reduction. 'p_value' for hard thresholding based on the statistical significance of the computed correlation. 'pickHardThreshold' for a cutoff based on the scale-freeness criterion (calls 'WGCNA::pickHardThreshold').

save_correlation_filename

(optional) Set a name for saving the matrix of correlations. Will be saved as .rds file.

handling_missing_data

A character string specifying the handling of missing data. Use "all.obs" (default) or "pairwise.complete.obs". Argument is passed to 'WGCNA::cor()'.

p_value_adjustment_method

String of the correction method applied to p-values. Passed to p.adjust.

reduction_alpha

A number indicating the alpha value applied for thresholding.

r_squared_cutoff

A number indicating the desired minimum scale free topology fitting index R^2.

cut_vector

A vector of hard threshold cuts for which the scale free topology fit indices are to be calculated.

print_graph_info

A boolean value specifying if a summary of the reduced graph should be printed.

n_threads

Number of threads for parallel computation of p-values during p-value reduction.

parallel_chunk_size

Number of p-values in smallest work unit when computing in parallel during network reduction with method 'p_value'.

Value

iGraph graph object of the reduced network.


molnet-org/molnet documentation built on Dec. 21, 2021, 8:59 p.m.