CoGA analyses are also available in the R command line interface. Below, we describe how to perform the differential network analyses. For a detailed description of the function parameters and return values, check it out in the R command line interface, by typing the command ?[function_name].

##### Preparing the dataset

###### Read gene expression data

expr <- readExprTxtFile([path_to_txt_file])

###### Read phenotype data

labels <- readClsFile([path_to_cls_file])

###### Read annotation data

annotation <- readChipFile([path_to_chip_file])

###### Collapse dataset to gene symbols

collapsingMethod <- [collapsing_method_name] connectivityBasedCollapsing <- list("connectivityBasedCollapsing"=TRUE_or_FALSE) expr <- collapseExprData(expr, annotation, collapsingMethod, connectivityBasedCollapsing)

The available options for [collapsing_method_name] are:

- maxMean
- minMean
- absMaxMean
- absMinMean
- maxRowVariance
- me
- average

If [collapsing_method_name] is "me", the "connectivityBasedCollapsing" parameter will be ignored.

###### Read a collection of gene sets

geneSets <- readGmtFile([path_to_gmt_file])

##### Setting the execution parameters

###### Network inference method

For using the absolute correlation coefficient as the association measure, create the following variables:

networkInference <- [correlation_measure_name]Cor abs <- TRUE pvalue <- FALSE
fdr <- FALSE

For using one minus the test p-value to measure the association between the gene products, create the following variables:

networkInference <- [correlation_measure_name]Test abs <- TRUE pvalue <- TRUE
fdr <- FALSE

For using one minus the test q-value as the association measure, create the following variables:

networkInference <- [correlation_measure_name]Test abs <- TRUE pvalue <- TRUE
fdr <- TRUE

The [correlation_measure_name] must be replaced by one of the following options:

- pearson
- spearman
- kendall

If your graph is weighted, you must set the following variables:

weighted <- TRUE threshold <- NULL

If the graph is unweighted, then set them to:

weighted <- FALSE threshold <- value

Replaces "value" by the desired threshold (only gene links with value higher then "value" will remain in the network).

Then, create the function for performing the network inference:

adjacencyMatrix <- adjacencyMatrix(networkInference, abs, pvalue, fdr, weighted, threshold)

###### Methods for comparing networks

method <- [network_test_name]

If the graph is unweighted, the available values for [network_test_name] are:

- spectralDensityTest
- spectralEntropyTest
- degreeDistributionTest
- degreeCentralityTest
- betweennessCentralityTest
- closenessCentralityTest
- eigenvectorCentralityTest
- clusteringCoefficientTest
- shortestPathTest

For weighted networks, the available methods are:

- spectralDensityTest
- spectralEntropyTest
- degreeDistributionTest
- degreeCentralityTest
- betweennessCentralityTest
- closenessCentralityTest
- eigenvectorCentralityTest
- clusteringCoefficientTest
- shortestPathTest

###### Number of sample label permutations

numPermutations < [value]

Where [value] is the desired number of sample permutations

###### Seed for random permutations generation

To use different sample label permutations for each gene set, define the "seed" as NULL:

seed < NULL

Otherwise, set it to the desired value:

seed < [value]

##### Running differential network analysis

If [network_test_name] is "spectralDensityTest", "spectralEntropyTest" or "degreeDistributionTest" you must set a criterion for the bandwidth selection:

options <- list("bandwidth"="Sturges")

or:

options <- list("bandwidth"="Silverman")

To save the partial results in a file, set the parameter:

resultsFile <- [path_to_results_file]

If [path_to_results_file] is NULL, then the partial results will not be saved.

To print execution messages, set the parameter "print" to TRUE:

print <- TRUE

To print execution messages, set the parameter "print" to TRUE:

print <- TRUE

To perform the differential network analysis, type the command:

results <- diffNetAnalysis(method, options, expr, labels, geneSets, adjacencyMatrix, numPermutations, print, resultsFile, seed)