Repository 'get_gsm'
hg clone https://toolshed.g2.bx.psu.edu/repos/testtool/get_gsm

Changeset 3:c90a3ff42982 (2017-02-06)
Previous changeset 2:7c896d0c6119 (2017-02-06) Next changeset 4:7b6d8d0b3253 (2017-02-06)
Commit message:
Uploaded
added:
getGSMdata.R
b
diff -r 7c896d0c6119 -r c90a3ff42982 getGSMdata.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/getGSMdata.R Mon Feb 06 05:08:04 2017 -0500
[
@@ -0,0 +1,20 @@
+require("rentrez", quietly = TRUE)
+
+args <- commandArgs(trailingOnly = TRUE)
+GSE = args[1]
+GSMTable = args[2]
+
+search1 <- entrez_search(db = "gds", term = GSE, retmax = 1)
+
+rec2 <- entrez_summary(db = "gds",
+                       id = search1$ids,
+                       version = "2.0")
+
+extract <- extract_from_esummary(rec2,rownames(summary(rec2)))
+
+samples <- extract$samples
+colnames(samples)[which(names(samples) == "accession")] <- "ID"
+colnames(samples)[which(names(samples) == "title")] <-  "Phenotype"
+
+write.table(samples, GSMTable, row.names = FALSE, sep = "\t",quote = FALSE)
+