Skip to content

Commit

Permalink
geo
Browse files Browse the repository at this point in the history
  • Loading branch information
GuangchuangYu committed Nov 5, 2024
1 parent 6fab57e commit f9a0868
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions inst/prototype/GEO.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

get_gse <- function(gseID) {
gsecat <- sub("\\d{3}$", "nnn", gseID)
gsesoft <- sprintf("%s_family.soft.gz", gseID)
url <- sprintf("https://ftp.ncbi.nlm.nih.gov/geo/series/%s/%s/soft/%s", gsecat, gseID, gsesoft)
yulab.utils:::mydownload(url, destfile = gsesoft)
GEOquery::getGEO(filename = gsesoft)
}

get_gsm <- function(gse) {
lapply(GEOquery::GSMList(gse), function(x) x@header$supplementary_file)
}



download_gsm <- function(gsm) {
for (x in gsm) {
destfile <- sub(".*/([^/]+)$", "\\1", x)
yulab.utils:::mydownload(x, destfile = destfile)
}
}

gseID <- "GSE123904"

gse <- get_gse(gseID)
gsm <- get_gsm(gse)

download_gsm(gsm)

0 comments on commit f9a0868

Please sign in to comment.