#
# Fetch sample data for GEO accession GSE193889
#

library(GEOquery)

ACC = "GSE193889"

gse <- getGEO(ACC)

# One ExpressionSet per platform. This series has one.
eset <- gse[[1]]

# One row per sample. Repeated GEO fields get a .1 suffix.
meta <- pData(eset)

design <- data.frame(
    sample = meta$title,
    gsm = meta$geo_accession,
    tissue = sub("^tissue: ", "", meta$characteristics_ch1),
    antibody = sub("^antibody: ", "", meta$characteristics_ch1.1),
    srx = sub(".*=", "", meta$relation.1)
)

write.csv(design, "geo.csv", row.names = FALSE)
