fetchGrinnDiffCorrNetwork - Combine a grinn network queried from grinn internal database to a differential correlation network

Description

from the list of keywords and input omics data e.g. normalized expression data or metabolomics data, it is a one step function to:
1. Build an integrated network (grinn network) by connecting these keywords to a specified node type, see fetchGrinnNetwork. The keywords can be any of these node types: metabolite, protein, gene and pathway. Grinn internal database contains the networks of the following types that can be quried: metabolite-protein, metabolite-protein-gene, metabolite-pathway, protein-gene, protein-pathway and gene-pathway.
2. Compute a differential correlation network of input omics data from two conditions, see datX1, datX2, datY1, datY2. Correlation coefficients, pvalues and relation directions among entities in each condition are calculated using WGCNA functions cor and corPvalueStudent. The correlation coefficients are continuous values between -1 (negative correlation) and 1 (positive correlation), with numbers close to 1 or -1, meaning very closely correlated. Then correlation coefficients are test for differential correlations using Fisher's z-test based on DiffCorr. The differential correlation network is created by function fetchDiffCorrNetwork.
3. Combine the grinn network to the correlation network.

Usage

fetchGrinnDiffCorrNetwork(txtInput, from, to, filterSource, returnAs, dbXref, datX1, datX2, datY1, datY2, pDiff, method)

Arguments

txtInputlist of keywords containing keyword ids e.g. txtInput = list('id1', 'id2'). The keyword ids are from the specified database, see dbXref. Default is grinn id e.g. G371.
fromstring of start node. It can be one of "metabolite","protein","gene","pathway".
tostring of end node. It can be one of "metabolite","protein","gene","pathway".
filterSourcestring or list of pathway databases. The argument is required, if from or to = "pathway", see from and to. The argument value can be any of "SMPDB","KEGG","REACTOME" or combination of them e.g. list("KEGG","REACTOME").
returnAsstring of output type. Specify the type of the returned network. It can be one of "tab","json","cytoscape", default is "tab". "cytoscape" is the format used in Cytoscape.js
dbXrefstring of database name. Specify the database name used for the txtInput ids, see txtInput. It can be one of "grinn","chebi","kegg","pubchem","inchi","hmdb","smpdb","reactome","uniprot","ensembl","entrezgene". Default is "grinn". If pubchem is used, it has to be pubchem SID (substance ID).
datX1data frame containing normalized, quantified omics data e.g. expression data, metabolite intensities of one condition. Columns correspond to entities e.g. genes, metabolites, and rows to samples. Require 'nodetype' at the first row to indicate the type of entities in each column. See below for details.
datX2data frame containing normalized, quantified omics data e.g. expression data, metabolite intensities of another condition. Use the same format as datX1.
datY1data frame containing normalized, quantified omics data e.g. expression data, metabolite intensities of one condition. Use the same format as datX1. If there is only one type of dataset, it can be NULL. See below for details.
datY2data frame containing normalized, quantified omics data e.g. expression data, metabolite intensities of another condition. Use the same format as datX1. If there is only one type of dataset, it can be NULL. See below for details.
pDiffnumerical value to define the maximum value of pvalues (pvalDiff), to include edges in the output.
methodstring to define which correlation is to be used. It can be one of "pearson","kendall","spearman", see cor.

Details

To calculate the differential correlation network, require the input data from two conditions; 1 and 2. The input data are matrices in which rows are samples and columns are entities. For each condition, if datY is given, then the correlations between the columns of datX and the columns of datY are computed. Otherwise if datY is not given, the correlations of the columns of datX are computed. Then correlation coefficients are test for significant correlation pairs. The column names of the input data are required to use grinn ids. convertToGrinnID is provided for id conversion, see convertToGrinnID.

Value

list of nodes and edges. The list is with the following componens: edges and nodes. Output includes correlation coefficients, pvalues and relation directions of each conditions, and the pvalues (pvalDiff) after testing. Return empty list if found nothing

Examples


# Create metabolite-gene network from the list of metabolites using grinn ids and combine the grinn network to a differential correlation network of metabolites
kw <- c('G160','G300','G371')
dummyX1 <- rbind(nodetype=rep("metabolite"),mtcars[1:16,])
colnames(dummyX1) <- c('G1.1','G27967','G371','G4.1',letters[1:7])
rownames(dummyX1)[-1] <- paste0(rep("normal_"),1:16)
dummyX2 <- rbind(nodetype=rep("metabolite"),mtcars[17:32,])
colnames(dummyX2) <- c('G1.1','G27967','G371','G4.1',letters[1:7])
rownames(dummyX2)[-1] <- paste0(rep("cancer_"),1:16)
result <- fetchGrinnDiffCorrNetwork(txtInput=kw, from="metabolite", to="gene", datX1=dummyX1, datX2=dummyX2, pDiff=0.05)
# Create metabolite-pathway network from the list of metabolites using grinn ids and combine the grinn network to a differential correlation network of metabolites and proteins
dummyX1 <- rbind(nodetype=rep("metabolite"),mtcars[1:16,1:5])
colnames(dummyX1) <- c('G1.1','G27967','G371','G4.1','G16962')
rownames(dummyX1)[-1] <- paste0(rep("normal_"),1:16)
dummyX2 <- rbind(nodetype=rep("metabolite"),mtcars[17:32,1:5])
colnames(dummyX2) <- c('G1.1','G27967','G371','G4.1','G16962')
rownames(dummyX2)[-1] <- paste0(rep("cancer_"),1:16)
dummyY1 <- rbind(nodetype=rep("protein"),mtcars[1:16,6:10])
colnames(dummyY1) <- c('P28845','P08235','Q08AG9','P80365','P15538')
rownames(dummyY1)[-1] <- paste0(rep("normal_"),1:16)
dummyY2 <- rbind(nodetype=rep("protein"),mtcars[17:32,6:10])
colnames(dummyY2) <- c('P28845','P08235','Q08AG9','P80365','P15538')
rownames(dummyY2)[-1] <- paste0(rep("cancer_"),1:16)
result <- fetchGrinnDiffCorrNetwork(txtInput=kw, from="metabolite", to="pathway", datX1=dummyX1, datX2=dummyX2, datY1=dummyY1, datY2=dummyY2, pDiff=0.05)
         

References

Correlation-based analyses apply methods from the following publications:

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