Mercurial > repos > testtool > get_geo
comparison getGEO.R @ 2:556ebcea6989 draft
Uploaded
author | testtool |
---|---|
date | Wed, 18 Jan 2017 10:13:19 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:1ab7612c5107 | 2:556ebcea6989 |
---|---|
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(warn = -1) | |
8 args <- commandArgs(trailingOnly = TRUE) | |
9 GSMTable = args[1] | |
10 MetaTable = args[2] | |
11 IlmnTable = args[3] | |
12 gmTable = args[4] | |
13 | |
14 TAB = fread(GSMTable) | |
15 | |
16 if (is.null(TAB)) { | |
17 stop("Must specify input files") | |
18 } else { | |
19 GEODataTable <- getGEO(TAB$ID[1], getGPL = FALSE) | |
20 IlmnIDTable <- Table(GEODataTable) | |
21 MetaData <- data.frame(Meta(GEODataTable)) | |
22 | |
23 | |
24 write.csv(MetaData, MetaTable, row.names = FALSE, sep = "\t") | |
25 } | |
26 | |
27 hm450.hg19 <- getPlatform() | |
28 | |
29 IlmnInfo <- | |
30 data.table( | |
31 IlmnID = names(hm450.hg19), | |
32 CHR = as.data.frame(hm450.hg19@seqnames)$value, | |
33 BP = as.numeric(hm450.hg19@elementMetadata$probeStart) | |
34 ) | |
35 | |
36 | |
37 write.csv(IlmnInfo, IlmnTable, row.names = FALSE, sep = "\t") | |
38 | |
39 | |
40 if (length(TAB$ID) > 1) { | |
41 mysamples <- | |
42 do.call("data.table", lapply(TAB$ID[-1], function(x) | |
43 Table(getGEO(x, getGPL = FALSE))[, -1])) | |
44 | |
45 gmSet <- data.table(IlmnIDTable[, -1], mysamples) | |
46 | |
47 } else { | |
48 gmSet <- Table(getGEO(TAB$ID, getGPL = FALSE)) | |
49 } | |
50 | |
51 | |
52 write.csv(gmSet, gmTable, row.names = FALSE, sep = "\t") |