comparison getGEO/getGEO.R @ 54:7aab6e28c62e draft

Uploaded
author testtool
date Tue, 25 Apr 2017 10:28:34 -0400
parents cbc8174bd361
children fc93085430a8
comparison
equal deleted inserted replaced
53:46acdba0f6d8 54:7aab6e28c62e
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.table(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.table(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 write.table(gmSet, Data_Table, row.names = FALSE,quote=FALSE,sep="\t")
54