annotate getGSMdata/getGSMdata.R @ 36:6fa59a224fb1 draft

Uploaded
author testtool
date Mon, 31 Jul 2017 12:38:24 -0400
parents faa0cd8ed36a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
6fa59a224fb1 Uploaded
testtool
parents: 34
diff changeset
1 require("rentrez", quietly = TRUE)
6fa59a224fb1 Uploaded
testtool
parents: 34
diff changeset
2
8
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