annotate getGEO/getGEO.R @ 22:fe105dbd7e1e draft

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