annotate GEO/getGEO.R @ 4:f25d7a84e555 draft

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