annots_to_geneGO: Convert annotation table to gene or annotation list for topGO

Description Usage Arguments Value Examples

View source: R/annots.r

Description

Takes a data frame or tibble that maps genes to annotations, and creates either a list of genes or a list of annotation terms that can be ussed with annFUN.gene2GO or annFUN.GO2genes.

Usage

1
annots_to_geneGO(annots, direction = "geneID2GO")

Arguments

annots

A tibble or data frame that has columns 'gene_id' and 'annots'. Column 'annots' must be a comma-separated charachter string with all the terms that annotate a given 'gene_id'.

direction

Either "geneID2GO" or "GO2geneID". Direction of the list that is produced.

Value

A named list. If 'direction = "geneID2GO"', then the list has one element per 'gene_id' (named after that gene), and each element of the list is a character vector with all the terms that annotate that gene. If 'direction = "GO2geneID"', the the list has one element per annotation term in 'annots' (named after that term), and each element of the list is a character vector with all the genes annotated with that term.

Examples

1
2
3
4
d <- tibble::tibble(gene_id = c('gene1', 'gene2', 'gene3'),
                    terms = c(NA, 'term1,term2', 'term2, term3'))
annots_to_geneGO(d, direction = "geneID2GO")
annots_to_geneGO(d, direction = "GO2geneID")

surh/HMVAR documentation built on Aug. 18, 2021, 1:21 a.m.