Skip to content

Instantly share code, notes, and snippets.

@slavailn
Last active April 22, 2024 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slavailn/dc6f6801117965ee66ab0832df7082b5 to your computer and use it in GitHub Desktop.
Save slavailn/dc6f6801117965ee66ab0832df7082b5 to your computer and use it in GitHub Desktop.
Download GEO datasets with GEOquery
library(GEOquery)
# Download existing RA datasets
# Study 1
# Teixeira VH, Olaso R, Martin-Magniette ML, Lasbleiz S et al. Transcriptome
# analysis describing new immunity and defense genes in peripheral blood
# mononuclear cells of rheumatoid arthritis patients.
# PLoS One 2009 Aug 27;4(8):e6803. PMID: 19710928
# Reference: GSE15573
# Download GSE15573
gse <- getGEO("GSE15573")
class(gse)
show(gse)
show(pData(phenoData(gse[[1]]))[1:4,])
class(gse[[1]])
# The expression set is a first element of the list
eset <- gse[[1]]
head(pData(eset))
class(eset)
# Save expression set
save( eset, file="GSE15573_ESet.RData" )
# Save the expression matrix
write.csv(exprs(eset), file="GSE15573_expressions.csv")
# Get sample data
write.csv(pData(eset), file="GSE15573_phenodata.csv")
# Get annotation
gpl <- getGEO(eset@annotation)
class(gpl)
head(gpl@dataTable@table)
annotation <- gpl@dataTable@table
head(annotation)[1:3,]
# Save annotation
write.csv(annotation, file="GSE15573_annotation.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment