Learn R Programming

GOsummaries (version 2.6.0)

gosummaries.matrix: Prepare gosummaries object based on Multi Dimensional Scaling (MDS) results

Description

The Multi Dimensional Scaling (MDS) results are converted into a gosummaries object, by finding genes that have most significant Spearman correlations with each component.

Usage

"gosummaries"(x, exp = NULL, annotation = NULL, components = 1:min(ncol(x), 10), show_genes = FALSE, gconvert_target = "NAME", n_genes = ifelse(show_genes, 30, 500), organism = "hsapiens", ...)

Arguments

x
a matrix representation of multi dimensional scaling result, rows correspond to samples
exp
an expression matrix, with columns corresponding to samples (these have to be in the same order as in x)
annotation
a data.frame describing the samples, its row names should match with column names of exp (Optional)
components
numeric vector of comparisons to annotate
show_genes
logical showing if GO categories or actual genes are shown in word clouds
gconvert_target
specifies gene ID format for genes showed in word cloud. The name of the format is passed to gconvert, if NULL original IDs are shown.
n_genes
maximum number of genes shown in a word cloud
organism
the organism that the gene lists correspond to. The format should be as follows: "hsapiens", "mmusculus", "scerevisiae", etc.
...
GO annotation filtering parameters as defined in gosummaries.default

Value

A gosummaries object.

Details

This visualisation of MDS results is very similar to the one performed by gosummaries.prcomp. Difference from PCA is that, in general, we do not have the loadings for individual genes that could be used to associate genes with components. However, it is possible to find genes that are most correlated with each component. This function uses Spearman correlation coefficient to find most correlated features. The significance of the correlation values is decided using he approximation with t-distribution.

The function can also display genes instead of their GO annotations, while the sizes of the gene names correspond to the Spearman correlation p-values. The corresponding parameters are described in more detail in gosummaries.MArrayLM. This feature is important in applications, like metabolomics and metagenomics, where the features are not genes and it is not possible to run GO enrichment analysis.

Examples

Run this code
## Not run: 
# library(vegan)
# 
# data("metagenomic_example")
# 
# # Run Principal Coordinate Analysis on Bray-Curtis dissimilarity matrix 
# pcoa = cmdscale(vegdist(t(metagenomic_example$otu), "bray"), k = 3)
# 
# # By turning off the GO analysis we can show the names of taxa
# gs = gosummaries(pcoa, metagenomic_example$otu, metagenomic_example$annot, 
#                  show_genes = TRUE, gconvert_target = NULL, n_genes = 30)
# 
# plot(gs, class = "BodySite", fontsize = 8)
# ## End(Not run)

Run the code above in your browser using DataLab