comparison GEO/getGEO.R @ 7:5231cb49c63b draft

Uploaded
author testtool
date Mon, 20 Feb 2017 08:11:50 -0500
parents
children 0647e033c218
comparison
equal deleted inserted replaced
6:6bd7af1bcb43 7:5231cb49c63b
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.GEOquery"="wget")
8 options(warn = -1)
9
10 args <- commandArgs(trailingOnly = TRUE)
11 GSMTable = args[1]
12 protocol = args[2]
13 platform = args[3]
14 Data_Table = 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, protocol, 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, platform, 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, Data_Table, row.names = FALSE, sep = "\t")