annotate getGEO/getGEO.R @ 68:fc93085430a8 draft

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