annotate GEO/getGEO.R @ 24:487566ba7b28 draft

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