annotate getGEO/getGEO.R @ 20:32aee52e7f61 draft

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