compareGOspecies: Visual representation for the results of functional...

View source: R/compareGOspecies.R

compareGOspeciesR Documentation

Visual representation for the results of functional enrichment analysis to compare two species and a series of categories

Description

compareGOspecies function provides a simple workflow to compare results of functional enrichment analysis for two species.

To use this function you will need two matrices with a column which, represents the features to be compared (e.g.feature). This function will extract the unique GO terms for two matrices and it will generate a presence-absence matrix where rows will represent a combination of categories and species (e.g H.sapiens AID) and columns will represent the GO terms analyzed. Further, this function will calculate Jaccard distances and it will provide as outputs a list with four slots: 1.) A principal coordinates analysis (PCoA) 2.) The Jaccard distance matrix 3.) A list of shared GO terms between species 4.) Finally, a list of the unique GO terms and the belonging to the respective species.

Usage

compareGOspecies(
  df1,
  df2,
  GOterm_field,
  species1,
  species2,
  skipPCoA = FALSE,
  paired_lists = TRUE
)

Arguments

df1

A data frame with the results of a functional enrichment analysis for the species 1 with an extra column "feature" with the features to be compared

df2

A data frame with the results of a functional enrichment analysis for the species 2 with an extra column "feature" with the features to be compared

GOterm_field

This is a string with the column name of the GO terms (e.g; "Functional_Category")

species1

This is a string with the species name for species 1 (e.g; "H. sapiens")

species2

This is a string with the species name for species 2 (e.g; "A. thaliana")

skipPCoA

This is a boolean to indicate if the PCoA graphics can be skipped

paired_lists

This is a boolean to indicate if both species have same comparable categories (gene lists). If the paired_lists is FALSE the counts will be done only for species and categories will be kept in the outcomes. Please use carefully when paired_lists = FALSE.

Value

This function will return a list with four slots: graphics, distance shared_GO_list, and unique_GO_list

Note

Do not use "-" in the feature column. This will lead to wrong results!

Examples


#Loading example datasets
data(H_sapiens_compress)
data(A_thaliana_compress)
#Defining the column with the GO terms to be compared
GOterm_field <- "Functional_Category"
#Defining the species names
species1 <- "H. sapiens"
species2 <- "A. thaliana"

#Running function
x <- compareGOspecies(df1=H_sapiens_compress,
                      df2=A_thaliana_compress,
                      GOterm_field=GOterm_field,
                      species1=species1,
                      species2=species2,
                      skipPCoA=FALSE,
                      paired_lists=TRUE)

## Not run: 
#Displaying PCoA results
 x$graphics
# Checking shared GO terms between species
 print(tapply(x$shared_GO_list$feature,x$shared_GO_list$feature,length))
 
## End(Not run)


GOCompare documentation built on Dec. 10, 2022, 1:08 a.m.