Use with_go along with other filters in getBM function
1
0
Entering edit mode
RuBBiT0 ▴ 10
@7fec931f
Last seen 13 months ago
United States

I was trying to select genes that have GO terms, and my input is Ensembl gene ID. I looked at the listFilters() and thoughwith_go filter should be helpful.

Code should be placed in three backticks as shown below

getBM(attributes = "ensembl_gene_id",
      filters = c("ensembl_gene_id", "with_go"),
      values = c(list(ensembl_gene_id = "ENSG00000000003", with_go = TRUE)),
      mart = ensembl)

This was OK as it returns ENSG00000000003 since it has GO terms.

getBM(attributes = c("ensembl_gene_id"),
      filters = c("ensembl_gene_id", "with_go"),
      values = list(c("ENSG00000000003", "ENSG00000260153"), c(TRUE, TRUE)),
      mart = ensembl)

If I use the same format with multiple IDs, it returns an error:

Error in vapply(names(filterChunk), FUN = function(filter, values, mart) { :  
  values must be length 1,
 but FUN(X[[2]]) result is length 2

But if I only gives a single value input for with_go:

getBM(attributes = c("ensembl_gene_id"),
      filters = c("ensembl_gene_id", "with_go"),
      values = list(c("ENSG00000000003", "ENSG00000260153"), TRUE),
      mart = ensembl)

This works but confuses me because the type of with_go is boolean_list. Maybe it is related to the vapply embedded inside the getBM function when defined? Thank you.

> filterType("with_go", ensembl)
[1] "boolean_list"
Annotation biomaRt • 1.4k views
ADD COMMENT
0
Entering edit mode

Hi RuBBiT0, I'm not sure I understand what you're trying to do. Do you have a long list of Ensembl Gene IDs and you're trying to select only the ones that have some sort of GO annotation associated with them?

ADD REPLY
0
Entering edit mode

Hi Mike Smith , you are correct. I was trying to select the ones that have some GO annotations by using the with_go filter. I was confused of how multiple filters work together, i.e. why with_go only requires one value instead of a vector of TRUE

ADD REPLY
2
Entering edit mode
Mike Smith ★ 6.6k
@mike-smith
Last seen 1 hour ago
EMBL Heidelberg

You hit on the right solution with your final example. Here's a slightly modified version where I've given names to the list elements in values so it's easier to see how the match with the filters.

getBM(attributes = c("ensembl_gene_id"),
      filters = c("ensembl_gene_id", "with_go"),
      values = list(
         "ensembl_gene_id" = c("ENSG00000000003", "ENSG00000260153"), 
         "with_go" = TRUE),
      mart = ensembl)

The reason the with_go argument only takes one value is that it's equivalent to the "Limit to genes" radio button shown below in the web interface. It doesn't take a set of values just "Only" and "Exclude" (equivalent to TRUE or FALSE). The with_go filter is just a boolean saying "include only results with a GO ID" (or alternatively exclude them if it's FALSE). Essentially the two filters are applied in sequence, so first it returns all the gene IDs that match your initial list of IDs and then selects only those with one or more GO IDs associated.

BioMart boolean example

ADD COMMENT
0
Entering edit mode

Thank you! I think that makes much sense to me.

ADD REPLY

Login before adding your answer.

Traffic: 945 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6