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