annotate histogram.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 usage <- function() {
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
15 stop("Usage: histogram.r <input> <output>", call. = FALSE)
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
16 }
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
17
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
18 ## Get the command line arguments.
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
19 args <- commandArgs(trailingOnly = TRUE)
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
20
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
21 input <- ifelse(! is.na(args[1]), args[1], usage())
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
22 output <- ifelse(! is.na(args[2]), args[2], usage())
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
23
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
24 distance <- loadDistance(input);
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
25 generateHistograms(distance, output);
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
26
0cebe436a553 Initial upload.
hackdna
parents:
diff changeset
27 quit("no", 0)