comparison GEO/getGEO.R @ 0:4fb1765f3979 draft

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