annotate getGSMdata.R @ 4:7b6d8d0b3253 draft

Uploaded
author testtool
date Mon, 06 Feb 2017 05:08:20 -0500
parents c90a3ff42982
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
1 require("rentrez", quietly = TRUE)
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
2
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
3 args <- commandArgs(trailingOnly = TRUE)
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
4 GSE = args[1]
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
5 GSMTable = args[2]
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
6
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
7 search1 <- entrez_search(db = "gds", term = GSE, retmax = 1)
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
8
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
9 rec2 <- entrez_summary(db = "gds",
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
10 id = search1$ids,
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
11 version = "2.0")
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
12
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
13 extract <- extract_from_esummary(rec2,rownames(summary(rec2)))
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
14
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
15 samples <- extract$samples
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
16 colnames(samples)[which(names(samples) == "accession")] <- "ID"
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
17 colnames(samples)[which(names(samples) == "title")] <- "Phenotype"
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
18
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
19 write.table(samples, GSMTable, row.names = FALSE, sep = "\t",quote = FALSE)
c90a3ff42982 Uploaded
testtool
parents:
diff changeset
20