topoGraph

The R source code topoGraph.R is available for the cyclohedron test and general topographical tests.
Our code requires the free statistical software package R, available here. Here we describe how to perform basic tasks related to the topographical tests, focusing on the cyclohedron test.

1. Data specifications

The data file must be a CSV (comma-separated values) file, where the first column consists of identifying labels (such as gene names), and the rows are the corresponding data vectors.


2. Example: cyclohedron test

We illustrate the use of the basic functions with the example data file (named `Sample.csv') that we provide. The first column consists of the gene identifiers, "Gene1" to "Gene20." The first row labels the time points. The source code containing the R functions is topoGraph.R.
First, we call the source code and load the data file from an R command line (here, we assume that both files are in the current working directory):

source("topoGraph.R")
dataset<-loaddata("Sample.csv")

Next, we calculate the count of each data vector, which is done by the following command:

counts<-cycleCounts(dataset)

This defines ''counts,'' a vector which lists the counts of the data vectors in the order given by the data file. To list the genes according to their count ranking, we call the function rankby which outputs the labels of the genes. The following command outputs the top ten genes.

> rankby(row.names(dataset),counts)[1:10]
[1] "Gene1" "Gene2" "Gene17" "Gene20" "Gene19" "Gene3" "Gene6" "Gene18" "Gene4" "Gene8"


3. Other topographical tests

Other topographical models can also be performed. For example, the associahedron test (the graphical model corresponding to the path) can be performed, by first specifying the graph G and then calculating the counts:

G<-buildGraph(17,`line')
counts2<-preimagesizes(dataset,G)