R/online_gst_sch_1_show_collection.R

Defines functions .nchar1 search_show_collection

Documented in search_show_collection

#' Show collctions for msigdb_search()
#'
#' @param email email that registered for MSigDB database.
#'
#' @return collections from MsigDB website.
#' @export
#'
#' @examples
#' \donttest{
#' search_show_collection("your email")
#' # or
#' email <- 'your email'
#' search_show_collection()
#' }
search_show_collection <- function(email){
    if (missing(email)) email = get('email',envir = .GlobalEnv)
    h <- httr::GET(URLencode('http://www.gsea-msigdb.org/gsea/msigdb/search.jsp'),
                   httr::authenticate(email, "password"))
    x <- httr::content(h)
    x |>
        rvest::html_nodes(xpath='//select[@name="collection"]//option') |>
        rvest::html_attr('value') |>
        .nchar1()
}
.nchar1 <- function(x) x[nchar(x)>=1]

Try the msig package in your browser

Any scripts or data that you put into this service are public.

msig documentation built on June 29, 2021, 9:08 a.m.