changeset 2:556ebcea6989 draft

Uploaded
author testtool
date Wed, 18 Jan 2017 10:13:19 -0500
parents 1ab7612c5107
children 0656483350d5
files getGEO.R
diffstat 1 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getGEO.R	Wed Jan 18 10:13:19 2017 -0500
@@ -0,0 +1,52 @@
+require("BiocGenerics", quietly = TRUE)
+require("data.table", quietly = TRUE)
+require("GEOquery", quietly = TRUE)
+require("rtracklayer", quietly = TRUE)
+require("FDb.InfiniumMethylation.hg19", quietly = TRUE)
+
+options(warn = -1)
+args <- commandArgs(trailingOnly = TRUE)
+GSMTable = args[1]
+MetaTable = args[2]
+IlmnTable = args[3]
+gmTable = args[4]
+
+TAB = fread(GSMTable)
+
+if (is.null(TAB)) {
+  stop("Must specify input files")
+} else {
+  GEODataTable <- getGEO(TAB$ID[1], getGPL = FALSE)
+  IlmnIDTable <- Table(GEODataTable)
+  MetaData <- data.frame(Meta(GEODataTable))
+
+  
+  write.csv(MetaData, MetaTable, row.names = FALSE, sep = "\t")
+}
+
+hm450.hg19 <- getPlatform()
+
+IlmnInfo <-
+  data.table(
+    IlmnID = names(hm450.hg19),
+    CHR = as.data.frame(hm450.hg19@seqnames)$value,
+    BP = as.numeric(hm450.hg19@elementMetadata$probeStart)
+  )
+
+
+write.csv(IlmnInfo, IlmnTable, row.names = FALSE, sep = "\t")
+
+
+if (length(TAB$ID) > 1) {
+  mysamples <-
+    do.call("data.table", lapply(TAB$ID[-1], function(x)
+      Table(getGEO(x, getGPL = FALSE))[, -1]))
+
+  gmSet <- data.table(IlmnIDTable[, -1], mysamples)
+
+} else {
+  gmSet <- Table(getGEO(TAB$ID, getGPL = FALSE))
+}
+
+
+write.csv(gmSet, gmTable, row.names = FALSE, sep = "\t")