comparison getGEO/getGEO.R @ 25:e44ea6de2d4f draft

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