1
$\begingroup$

I'm fairly new to bioinformatics, so please be gentle ;0

Is there a way to query a particular gene using a script in R/Bioconductor? I'm particularly interested in Gene Ontology terms. There are many websites that, given the gene name, will return relevant GO terms. My question is, can it be automated?

$\endgroup$
1
$\begingroup$

Please ask questions about Bioconductor on the Bioconductor support site.

Bioconductor also distributes 'annotation' packages with curated information. These don't rely on a web service, so are always available, and are fixed at each (6 month) Bioconductor release, but are less comprehensive. Choose your organism

BiocInstaller::biocLite(c("org.Hs.eg.db", "GO.db"))  # first time only
library("org.Hs.eg.db"); library("GO.db")

Query for GO ids

symbols = c("BRCA1", "BRCA2")
df = select(org.Hs.eg.db, symbols, columns="GO", keytype="SYMBOL")

Symbol - GO mappings are 1:many, so

> dim(df)
[1] 149   4
> head(df)
  SYMBOL         GO EVIDENCE ONTOLOGY
1  BRCA1 GO:0000151      NAS       CC
2  BRCA1 GO:0000724      IDA       BP
3  BRCA1 GO:0000724      TAS       BP
4  BRCA1 GO:0000794      IEA       CC
5  BRCA1 GO:0003677      TAS       MF
6  BRCA1 GO:0003682      IEA       MF

Use the GO.db package to gain more insight into the GO ids

> head(select(GO.db, df$GO, "TERM"))
'select()' returned many:1 mapping between keys and columns
        GOID                                                    TERM
1 GO:0000151                                ubiquitin ligase complex
2 GO:0000724 double-strand break repair via homologous recombination
3 GO:0000724 double-strand break repair via homologous recombination
4 GO:0000794                            condensed nuclear chromosome
5 GO:0003677                                             DNA binding
6 GO:0003682                                       chromatin binding

See the vignettes on the AnnotationDbi landing page, the annotation-related work flows, and the training material on the Bioconductor web site.

$\endgroup$
1
$\begingroup$

Take a look at the biomaRt package. This package allows you to access some databases in R directly. Quote from the user's guide:

The package enables retrieval of large amounts of data in a uniform way without the need to know the underlying database schemas or write complex SQL queries. Examples of BioMart databases are Ensembl, Uniprot and HapMap. These major databases give biomaRt users direct access to a diverse set of data and enable a wide range of powerful online queries from R.

In the user's guide you will find anything you need, i.e. description and example tasks, for doing queries on HGNC symbols, GO terms, and more.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.