Skip to content

Commit

Permalink
bring back gene symbol support
Browse files Browse the repository at this point in the history
  • Loading branch information
oganm committed Sep 13, 2024
1 parent d54bc6e commit 191efc0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ermineR
Title: Gene set analysis with multifunctionality assessment
Version: 1.0.1.9000
Version: 1.0.2.9000
Authors@R: person("Ogan", "Mancarci", email = "[email protected]", role = c("aut", "cre"))
Description: ErmineR is an interface to the ermineJ gene set analysis software (http://erminej.msl.ubc.ca).
Depends: R (>= 3.4.0)
Expand Down
18 changes: 16 additions & 2 deletions R/ermineR.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ermineR = function(annotation = NULL,
} else{
nullAnnot = FALSE
}
if('character' %in% class(annotation)){
if('character' %in% class(annotation) && !grepl('Generic_[a-z]*$',annotation)){
if(!file.exists(annotation)){
message('Attempting to download annotation file')
annoTemp = tempfile()
Expand All @@ -85,7 +85,21 @@ ermineR = function(annotation = NULL,
annotation = annoTemp

}
} else if('data.frame' %in% class(annotation)) {
}else if('character' %in% class(annotation) && grepl('Generic_[a-z]*$',annotation)){

annot = tryCatch(suppressWarnings(gemma.R::get_platform_annotations(platform = paste0(annotation,'_ncbiIds'),
annotType = 'noParents',
memoised = FALSE,
unzip = TRUE)),
error = function(e){
stop('"annotation" is not a valid file or exists in Pavlidis lab annotations. Use listGemmaAnnotations() to get a list of available annotations.')
})
annot$ElementName = annot$GeneSymbols
temp = tempfile()
annot %>% readr::write_tsv(temp)
annotation = temp

}else if('data.frame' %in% class(annotation)) {
temp = tempfile()
annotation %>% readr::write_tsv(temp)
annotation = temp # replace the annotation object with the newly created file name
Expand Down
8 changes: 7 additions & 1 deletion R/miscFuns.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ listGemmaAnnotations = function(){
annots = httr::GET('https://gemma.msl.ubc.ca/annots/')$content %>% rawToChar() %>% XML::getHTMLLinks() %>%
{.[grepl('noParents',.)]} %>% stringr::str_extract('.*?(?=_noParents)')

return(annots)
platforms = gemma.R::get_platforms_by_ids() %>% gemma.R::get_all_pages()
generics = platforms$platform.shortName %>%
grepl('Generic_[a-z]*_ncbiIds',.) %>%
{platforms$platform.shortName[.]}


return(c(platforms$platform.shortName,generics %>% gsub('_ncbiIds','',.)))
}


Expand Down

0 comments on commit 191efc0

Please sign in to comment.