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

Changeset 35:31fe37b30836 (2017-07-31)
Previous changeset 34:faa0cd8ed36a (2017-07-31) Next changeset 36:6fa59a224fb1 (2017-07-31)
Commit message:
Uploaded
added:
getGSMdata/test-data/getGSMdata.R
b
diff -r faa0cd8ed36a -r 31fe37b30836 getGSMdata/test-data/getGSMdata.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/getGSMdata/test-data/getGSMdata.R Mon Jul 31 12:37:58 2017 -0400
[
@@ -0,0 +1,26 @@
+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"
+
+samples$Phenotype<-gsub("\\s", "",samples$Phenotype) 
+
+write.table(samples, GSMTable, row.names = FALSE,quote=FALSE,sep="\t")
+
+