comparison fingerprint.r @ 0:0cebe436a553 draft default tip

Initial upload.
author hackdna
date Fri, 17 May 2013 14:29:33 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0cebe436a553
1 #!/usr/bin/env Rscript
2
3 #sink(file("/dev/null", "w"), type = "message");
4
5 library(affy)
6 library(GEOquery);
7 library(pathprint);
8
9 # Figure out the relative path to the galaxy-pathprint.r library.
10 script.args <- commandArgs(trailingOnly = FALSE);
11 script.name <- sub("--file=", "", script.args[grep("--file=", script.args)])
12 script.base <- dirname(script.name)
13 library.path <- file.path(script.base, "galaxy-pathprint.r");
14 source(library.path)
15
16 data(GEO.metadata.matrix);
17
18 usage <- function() {
19 sink(stderr(), type = "message");
20 stop("Usage: fingerprint.r [ARGS]", call. = FALSE)
21 }
22
23 ## Get the command line arguments.
24 args <- commandArgs(trailingOnly = TRUE)
25
26 type <- ifelse(! is.na(args[1]), args[1], usage())
27
28 if (type == "geo") {
29 geoID <- ifelse(! is.na(args[2]), args[2], usage());
30 output <- ifelse(! is.na(args[3]), args[3], usage());
31
32 fingerprint <- generateFingerprint(geoID);
33 } else if (type == "cel") {
34 input <- ifelse(! is.na(args[2]), args[2], usage());
35 output <- ifelse(! is.na(args[3]), args[3], usage());
36
37 fingerprint <- loadFingerprintFromCELFile(input);
38 } else if (type == "expr") {
39 input <- ifelse(! is.na(args[2]), args[2], usage());
40 platform <- ifelse(! is.na(args[3]), args[3], usage());
41 output <- ifelse(! is.na(args[4]), args[4], usage());
42
43 fingerprint <- loadFingerprintFromExprsFile(input, platform);
44 } else {
45 usage();
46 };
47
48 saveFingerprint(fingerprint, output);
49
50 quit("no", 0)