annotate getGSMdata/getGSMdata.R @ 23:2e92263845ee draft

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