This example shows how to compute a network module correlated to a phenotypic feature and expand the network with information from Grinn internal database

  1. INPUT

    The table summarizes important arguments

    datXdata frame containing normalized-omic dataColumns correspond to entities e.g. genes and rows to samples e.g. normals, tumors. Require 'nodetype' at the first row to indicate the type of entities in each column.
    datPhenodata frame containing phenotypic data e.g. weight, ageColumns correspond to phenotypes and rows to samples e.g. normals, tumors.
    thresholdnumerical value from 0-1The minimum value of similarity threshold, to include edges in the output.
    xToentity type e.g. geneThe network module can be expanded to a specific entity type, by providing a value to xTo


    Compute a correlation of metabolite module to phenotypic data and expand to a grinn network metabolite-pathway, using information from REACTOME and KEGG only

    #1. load metabolomics data from a csv file
    datMet = read.csv("Lung_MET.csv", header=TRUE, row.names=1, stringsAsFactors=FALSE)
    #2. show dimensions of metabolomics data
    #3. show the first 10 rows and 10 columns
    #!!--- NOTE: The following codes convert kegg ids to grinn ids. If the input data is already the grinn ids, these steps can be skipped.
    grinnID = convertToGrinnID(txtInput=colnames(datMet), nodetype="metabolite", dbXref="kegg") #call grinn function to convert ids
    grinnID = grinnID[!duplicated(grinnID[,1]),] #keep the first mapped id
    colnames(datMet) = lapply(colnames(datMet),function(x) ifelse(length(which(grinnID$FROM_kegg == x))>0,as.character(grinnID$GRINNID[which(grinnID$FROM_kegg == x)]),x))
    #---------- END id conversion ----------#
    #4. load phenotypic data from a csv file
    datClin = read.csv("Lung_phenotype.csv", header=TRUE, row.names=1, stringsAsFactors=FALSE)
    #5. show dimensions of phenotypic data
    #6. show the first 10 rows and all columns
    #7. execute function
    result <- fetchModuGrinnNetwork(datX=datMet, datPheno=datClin, minModuleSize=5, threshold=0.3, returnAs="tab", xTo="pathway", filterSource=c("REACTOME","KEGG"))
    #8. The heatmap of module-phenotype correlations is present. Observe the heatmap and enter module color(s) seperate by space to the R terminal.
    #Enter module color(s), please separate each color by space: red
    #See below for details.

    The following heatmap is generated as a part of the calculation. Observe and choose a module or combination of modules, then enter module color(s) to the R terminal. In this example, the red module is chosen. The red module contains metabolites that negatively (negative is in blue scale, positive is in red scale) correlating to the phenotype, Final.mg.for.glycomics. The similarity threshold is 0.3 and the pvalue is in parenthesis (0.007).


    Export the network as tab-delimited files to visualize in Cytoscape

    write.table(as.matrix(result$edges),"moduleNwEdge.txt",sep="\t",row.names = F, quote = FALSE)
    write.table(as.matrix(result$nodes),"moduleNwNode.txt",sep="\t",row.names = F, quote = FALSE)

    The figure is generated by Cytoscape 3.1.1 using grinn style (grinn.xml). It is corresponding to the cytoscape file moduleNw.cys.

  5. Diagram legend


Correlation-based analyses apply methods from the following publications:

Metabolomics data used in this example are taken from the following publication:

Go to HOME | Documentation | fetchGrinnNetwork | fetchCorrGrinnNetwork | fetchDiffCorrGrinnNetwork | fetchModuGrinnNetwork | fetchGrinnCorrNetwork | input formats