R/geo_characteristics.R
geo_characteristics.Rd
This function builds a data.frame from the GEO characteristics extracted for a given sample. The names of the of columns correspond to the field names. For a given SRA project, this information can be combined for all samples as shown in the examples section.
geo_characteristics(pheno)
A DataFrame-class as created by geo_info.
A 1 row data.frame with the characteristic fields as column names and the values as the entries on the first row. If the authors of the study used the same names for all samples, you can then combine them using rbind.
## Load required library
library("SummarizedExperiment")
## Get the GEO accession ids
# geoids <- sapply(colData(rse_gene_SRP009615)$run[1:2], find_geo)
## The previous example code works nearly all the time but it
## can occassionally fail depending on how rentrez is doing.
## This code makes sure that the example code runs.
geoids <- tryCatch(
sapply(colData(rse_gene_SRP009615)$run[1:2], find_geo),
error = function(e) {
c(
"SRR387777" = "GSM836270",
"SRR387778" = "GSM836271"
)
}
)
## Get the data from GEO
geodata <- do.call(rbind, sapply(geoids, geo_info))
## Add characteristics in a way that we can access easily later on
geodata <- cbind(geodata, geo_characteristics(geodata))
## Explore the original characteristics and the result from
## geo_characteristics()
geodata[, c("characteristics", "cells", "shrna.expression", "treatment")]
#> DataFrame with 2 rows and 4 columns
#> characteristics cells
#> <CharacterList> <character>
#> 1 cells: K562,shRNA expression: no,treatment: Puromycin K562
#> 2 cells: K562,shRNA expression: ye..,treatment: Puromycin.. K562
#> shrna.expression treatment
#> <character> <character>
#> 1 no Puromycin
#> 2 yes, targeting SRF Puromycin, doxycycline