annotate getGEO.R @ 6:3fb300ce65e2 draft

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