-
What is the best way to go from a file like
to a table of GO slim terms that could be easily grepped? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Good question! but have you every thought about the reverse. Say you wanted all genes related to Immune Response? why not just search for GO:0006955? |
Beta Was this translation helpful? Give feedback.
-
To address your first question:
That will pull GO terms from input file ( Then, use # Load necessary libraries
library(GSEABase)
library(tidyverse)
# Expects GO terms to be in first column of input file
## Get max number of fields
# Needed to handle reading in file with different number of columns in each row
max_fields <- max(na.omit((count.fields(item, sep = "\t", blank.lines.skip = TRUE))))
## Read in tab-delimited GOseq file
# Use "max_fields" to populate all columns with a sequentially numbered header
go_seqs <- read.table(item,
sep = "\t",
header = TRUE,
col.names = paste0("V",seq_len(max_fields)),
fill = TRUE)
## Grab just the individual GO terms from the "category" column)
goterms <- as.character(go_seqs$V1)
### Use GSEA to map GO terms to GOslims
## Store goterms as GSEA object
myCollection <- GOCollection(goterms)
## Use generic GOslim file to create a GOslim collection
# I downloaded goslim_generic.obo from http://geneontology.org/docs/go-subset-guide/
# then i moved it to the R library for GSEABase in the extdata folder
# in addition to using the command here - I think they're both required.
slim <- getOBOCollection("~/data/goslim_generic.obo")
## Map GO terms to GOslims and select Biological Processes group
slims <- goSlim(myCollection, slim, "BP", verbose = TRUE) EDITED: Forgot to address GO to GOslim part of question. |
Beta Was this translation helpful? Give feedback.
To address your first question:
awk '{print $2}' steven_GO.txt | tr "," "\n"
That will pull GO terms from input file (
steven_GO.txt
) and then create a newline-delimited file of all the GO terms.Then, use
GSEAbase
in R to map to Biological Process GOslims (note: Requiresgoslim_generic.obo
from http://geneontology.org/docs/go-subset-guide/) :