GOseq analysis with evidence code filter When using GOseq analysis on RNA-seq data, I often find many 'false positives'. What I mean with that is that some genes in certain categories are not really involved in the process, but are only involved due to 'Electronic Annotation' (IEA). Most of the genes are IEA. A list of all evidence codes is here.

Is it possible to (easily) do GOseq analysis without this evidence group?

I mean, I know how to do it the hard way (make a custom GO-genes annotation in e.g., biomaRt removing all IEA evidence code genes, and perform GOseq with custom genome). But is there also a easy way in GOseq available?
A bit weird to answer my own question, but for who's interested I can show the 'hard' way using biomaRt and then use goseq with gene2cat defined.

So first you need biomaRt to get annotation of the genes. I have ensembl genes from mm10.

library(biomaRt)

table &lt;- read.table(file, header = T, stringsAsFactors = F)

ensembl &lt;- useMart("ENSEMBL_MART_ENSEMBL")

ensembl &lt;- useDataset("mmusculus_gene_ensembl", mart = ensembl)

allGenes &lt;- table$Geneid

GOs &lt;- getBM(attributes=c('ensembl_gene_id', 'go_id', 'name_1006', 'go_linkage_type', 'namespace_1003'), 
      filters = 'ensembl_gene_id', 
      values = allGenes, 
      mart = ensembl)

dim(GOs)
[1] 477082      5

table(GOs$go_linkage_type)
          EXP    IBA     IC    IDA    IEA    IEP    IGI    IMP    IPI    ISA    ISM    ISO    ISS    NAS     ND    RCA    TAS 
 36931     36  27918    525  34038 210114    630   6891  30219   6205   4234     20  77365  24673    609  12821     99   3754

# I only want BP and no IEA evidence code
GOs_no_IEA &lt;- GOs[GOs$go_linkage_type != "IEA" &amp; GOs$namespace_1003 == "biological_process",]

dim(GOs_no_IEA)
[1] 111944      5


Then you can continue with goseq.

library(goseq)

All &lt;- read.table(input_All, sep = "\t", header = T)

All_genes &lt;- as.character(All$Geneid)

TopTable &lt;- read.table(input, sep = "\t", header = T)

sig_genes &lt;- as.character(TopTable$Ensembl)

# Make gene vector

gene.vector &lt;- as.integer(All_genes %in% sig_genes)

names(gene.vector) &lt;- All_genes

gene.lengths &lt;- All$Length

pwf &lt;- nullp(gene.vector, "mm10", "ensGene", bias.data = gene.lengths)
head(pwf)

GO.wall &lt;- goseq(pwf, "mm10", "ensGene", gene2cat = GOs_no_IEA[, c(1:2)], use_genes_without_cat = F, test.cats = "GO:BP")