Mercurial > repos > hackdna > pathprint
comparison consensus.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(pathprint); | |
| 6 | |
| 7 # Figure out the relative path to the galaxy-pathprint.r library. | |
| 8 script.args <- commandArgs(trailingOnly = FALSE); | |
| 9 script.name <- sub("--file=", "", script.args[grep("--file=", script.args)]) | |
| 10 script.base <- dirname(script.name) | |
| 11 library.path <- file.path(script.base, "galaxy-pathprint.r"); | |
| 12 source(library.path) | |
| 13 | |
| 14 data(GEO.metadata.matrix); | |
| 15 | |
| 16 usage <- function() { | |
| 17 stop("Usage: consensus.r <input> <threshold> <output>", call. = FALSE) | |
| 18 } | |
| 19 | |
| 20 ## Get the command line arguments. | |
| 21 args <- commandArgs(trailingOnly = TRUE) | |
| 22 | |
| 23 input <- ifelse(! is.na(args[1]), args[1], usage()) | |
| 24 threshold <- ifelse(! is.na(args[2]), as.numeric(args[2]), usage()) | |
| 25 output <- ifelse(! is.na(args[3]), args[3], usage()) | |
| 26 | |
| 27 fingerprint <- loadFingerprint(input); | |
| 28 consensus <- consensusFingerprint(fingerprint, threshold); | |
| 29 | |
| 30 saveConsensus(consensus, output); | |
| 31 | |
| 32 quit("no", 0) |
