<p>Hi,</p>

<p>I'm looking for an easy way to <strong>retrieve all the genes in a list that are associated with a certain GO term</strong>, preferably using R/Bioconductor packages. 
I'm <strong>not</strong> interested in under/overrepresentation or enrichment.</p>

<p>For instance, say I have a list of 1000 genes and I want to create a sublist with only the genes known to be involved in 'heart development'.</p>

<p>Thanks!</p>

<p>Using <a href='http://www.bioconductor.org/packages/2.2/bioc/html/biomaRt.html'>biomaRt</a> within R:</p>

<pre><code>library(biomaRt)
ensembl = useMart("ensembl",dataset="hsapiens_gene_ensembl") #uses human ensembl annotations
#gets gene symbol, transcript_id and go_id for all genes annotated with GO:0007507
gene.data &lt;- getBM(attributes=c('hgnc_symbol', 'ensembl_transcript_id', 'go_id'),
                   filters = 'go_id', values = 'GO:0007507', mart = ensembl)
</code></pre>
