annotate getGSMdata/getGSMdata.R @ 28:c1bf6f112a19 draft

Uploaded
author testtool
date Mon, 20 Mar 2017 06:58:17 -0400
parents ac5415190777
children 0051ff360c64
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)
26
ac5415190777 Uploaded
testtool
parents: 8
diff changeset
4
8
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
5 GSE = args[1]
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
6 GSMTable = args[2]
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
7
26
ac5415190777 Uploaded
testtool
parents: 8
diff changeset
8
ac5415190777 Uploaded
testtool
parents: 8
diff changeset
9
8
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
10 search1 <- entrez_search(db = "gds", term = GSE, retmax = 1)
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
11
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
12 rec2 <- entrez_summary(db = "gds",
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
13 id = search1$ids,
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
14 version = "2.0")
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
15
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
16 extract <- extract_from_esummary(rec2,rownames(summary(rec2)))
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
17
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
18 samples <- extract$samples
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
19 colnames(samples)[which(names(samples) == "accession")] <- "ID"
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
20 colnames(samples)[which(names(samples) == "title")] <- "Phenotype"
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
21
26
ac5415190777 Uploaded
testtool
parents: 8
diff changeset
22 samples$Phenotype<-gsub("\\s", "",samples$Phenotype)
8
5e1d49abfc99 Uploaded
testtool
parents:
diff changeset
23
26
ac5415190777 Uploaded
testtool
parents: 8
diff changeset
24 write.table(samples, GSMTable, row.names = FALSE,quote=FALSE,sep="\t")
ac5415190777 Uploaded
testtool
parents: 8
diff changeset
25
ac5415190777 Uploaded
testtool
parents: 8
diff changeset
26