annotate GEO/getGEO.R @ 7:5231cb49c63b draft

Uploaded
author testtool
date Mon, 20 Feb 2017 08:11:50 -0500
parents
children 0647e033c218
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
5231cb49c63b Uploaded
testtool
parents:
diff changeset
1 require("BiocGenerics", quietly = TRUE)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
2 require("data.table", quietly = TRUE)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
3 require("GEOquery", quietly = TRUE)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
4 require("rtracklayer", quietly = TRUE)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
5 require("FDb.InfiniumMethylation.hg19", quietly = TRUE)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
6
5231cb49c63b Uploaded
testtool
parents:
diff changeset
7 options("download.file.method.GEOquery"="wget")
5231cb49c63b Uploaded
testtool
parents:
diff changeset
8 options(warn = -1)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
9
5231cb49c63b Uploaded
testtool
parents:
diff changeset
10 args <- commandArgs(trailingOnly = TRUE)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
11 GSMTable = args[1]
5231cb49c63b Uploaded
testtool
parents:
diff changeset
12 protocol = args[2]
5231cb49c63b Uploaded
testtool
parents:
diff changeset
13 platform = args[3]
5231cb49c63b Uploaded
testtool
parents:
diff changeset
14 Data_Table = args[4]
5231cb49c63b Uploaded
testtool
parents:
diff changeset
15
5231cb49c63b Uploaded
testtool
parents:
diff changeset
16 TAB = fread(GSMTable)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
17
5231cb49c63b Uploaded
testtool
parents:
diff changeset
18 if (is.null(TAB)) {
5231cb49c63b Uploaded
testtool
parents:
diff changeset
19 stop("Must specify input files")
5231cb49c63b Uploaded
testtool
parents:
diff changeset
20 } else {
5231cb49c63b Uploaded
testtool
parents:
diff changeset
21 GEODataTable <- getGEO(TAB$ID[1], getGPL = FALSE)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
22 IlmnIDTable <- Table(GEODataTable)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
23 MetaData <- data.frame(Meta(GEODataTable))
5231cb49c63b Uploaded
testtool
parents:
diff changeset
24
5231cb49c63b Uploaded
testtool
parents:
diff changeset
25
5231cb49c63b Uploaded
testtool
parents:
diff changeset
26 write.csv(MetaData, protocol, row.names = FALSE, sep = "\t")
5231cb49c63b Uploaded
testtool
parents:
diff changeset
27 }
5231cb49c63b Uploaded
testtool
parents:
diff changeset
28
5231cb49c63b Uploaded
testtool
parents:
diff changeset
29 hm450.hg19 <- getPlatform()
5231cb49c63b Uploaded
testtool
parents:
diff changeset
30
5231cb49c63b Uploaded
testtool
parents:
diff changeset
31 IlmnInfo <-
5231cb49c63b Uploaded
testtool
parents:
diff changeset
32 data.table(
5231cb49c63b Uploaded
testtool
parents:
diff changeset
33 IlmnID = names(hm450.hg19),
5231cb49c63b Uploaded
testtool
parents:
diff changeset
34 CHR = as.data.frame(hm450.hg19@seqnames)$value,
5231cb49c63b Uploaded
testtool
parents:
diff changeset
35 BP = as.numeric(hm450.hg19@elementMetadata$probeStart)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
36 )
5231cb49c63b Uploaded
testtool
parents:
diff changeset
37
5231cb49c63b Uploaded
testtool
parents:
diff changeset
38
5231cb49c63b Uploaded
testtool
parents:
diff changeset
39 write.csv(IlmnInfo, platform, row.names = FALSE, sep = "\t")
5231cb49c63b Uploaded
testtool
parents:
diff changeset
40
5231cb49c63b Uploaded
testtool
parents:
diff changeset
41
5231cb49c63b Uploaded
testtool
parents:
diff changeset
42 if (length(TAB$ID) > 1) {
5231cb49c63b Uploaded
testtool
parents:
diff changeset
43 mysamples <-
5231cb49c63b Uploaded
testtool
parents:
diff changeset
44 do.call("data.table", lapply(TAB$ID[-1], function(x)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
45 Table(getGEO(x, getGPL = FALSE))[, -1]))
5231cb49c63b Uploaded
testtool
parents:
diff changeset
46
5231cb49c63b Uploaded
testtool
parents:
diff changeset
47 gmSet <- data.table(IlmnIDTable[, -1], mysamples)
5231cb49c63b Uploaded
testtool
parents:
diff changeset
48
5231cb49c63b Uploaded
testtool
parents:
diff changeset
49 } else {
5231cb49c63b Uploaded
testtool
parents:
diff changeset
50 gmSet <- Table(getGEO(TAB$ID, getGPL = FALSE))
5231cb49c63b Uploaded
testtool
parents:
diff changeset
51 }
5231cb49c63b Uploaded
testtool
parents:
diff changeset
52
5231cb49c63b Uploaded
testtool
parents:
diff changeset
53
5231cb49c63b Uploaded
testtool
parents:
diff changeset
54 write.csv(gmSet, Data_Table, row.names = FALSE, sep = "\t")