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"
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?
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. whywith_go
only requires one value instead of a vector ofTRUE