annotate getGSMdata/test-data/getGSMdata.R @ 35:31fe37b30836 draft

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