annotate getGEO/getGEO.R @ 11:2418fe6a0d12 draft

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