annotate getGEO/getGEO.R @ 65:ad054b925eda draft

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