annotate distance.r @ 0:0cebe436a553 draft default tip

Initial upload.
author hackdna
date Fri, 17 May 2013 14:29:33 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
1 #!/usr/bin/env Rscript
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
2
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
3 #sink(file("/dev/null", "w"), type = "message");
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
4
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
5 library(pathprint);
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
6
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
7 # Figure out the relative path to the galaxy-pathprint.r library.
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
8 script.args <- commandArgs(trailingOnly = FALSE);
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
9 script.name <- sub("--file=", "", script.args[grep("--file=", script.args)])
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
10 script.base <- dirname(script.name)
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
11 library.path <- file.path(script.base, "galaxy-pathprint.r");
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
12 source(library.path)
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
13
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
14 data(GEO.metadata.matrix);
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
15
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
16 usage <- function() {
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
17 stop("Usage: distance.r <input> <output> <output2>", call. = FALSE)
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
18 }
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
19
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
20 ## Get the command line arguments.
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
21 args <- commandArgs(trailingOnly = TRUE)
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
22
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
23 input <- ifelse(! is.na(args[1]), args[1], usage())
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
24 output <- ifelse(! is.na(args[2]), args[2], usage())
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
25 output2 <- ifelse(! is.na(args[3]), args[3], usage())
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
26
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
27 fingerprint <- loadFingerprint(input);
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
28 distance <- calculateDistanceToPluripotent(fingerprint, verbose = 0);
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
29 saveDistance(distance, output);
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
30
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
31 generateHistograms(distance, output2);
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
32
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
33 quit("no", 0)