Entering edit mode
                    emisecherre
        
    
        •
    
    0
        @emisecherre-23089
        Last seen 5.2 years ago
        
    Hello ! I'm trying to build a R devtools package, with this code :
ensembl = biomaRt::useMart("ensembl",dataset="hsapiens_gene_ensembl")
  goterm=biomaRt::getBM(attributes=c("hgnc_symbol",'go_id'), mart = ensembl) #mapping genes-go termes
  goterm=subset(goterm, !(goterm$go_id==""))
  goterm=subset(goterm, !(goterm$hgnc_symbol==""))
  gc=biomaRt::getBM(attributes=c("hgnc_symbol","entrezgene_id"),mart=ensembl) #mapping genes symbol - entrez genes id
  ensfull=gc$entrezgene_id[!is.na(gc$entrezgene_id))] #entrez genes existant pour l'humain
  ens=gprofiler2::gconvert(genes, organism="hsapiens", target='ENTREZGENE_ACC')$target #entrez gene de nos genes
  ensint=factor(as.integer(ensfull %in% ens))#preparation des donnees pour l'analyse GO
  names(ensint)=ensfull
  ensint
  #go termes enrichis BP
  GOdataBP <- methods::new("topGOdata", ontology = "BP", allGenes = ensint, annot = topGO::annFUN.org, mapping="org.Hs.eg.db", ID="entrez")
  resultFisBP <- topGO::runTest(GOdataBP, algorithm = "classic", statistic = "fisher")
  allResBP <- topGO::GenTable(GOdataBP, classic = resultFisBP, orderBy = "classic", ranksOf = "classic",topNodes=20)
The thing is, methods::new doesn't recognize the topGOdata Class, and add topGO::topGOdata doesn't fix the issue. Anyone know how to fix it ?

It's exactly this error, the thing is that i can't use "library" to load topGO and i don't know an other way which works with devtools...
Are you using roxygen2 to describe the imports of your package? If so, add
to one of your source files, and add
to your descriptino file. Be sure to run
devtools::document()to update the NAMESPACE, which should automatically include a lineimport(topGO).