|
0
|
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 usage <- function() {
|
|
|
15 stop("Usage: similar_experiments.r <input> <output>", call. = FALSE)
|
|
|
16 }
|
|
|
17
|
|
|
18 ## Get the command line arguments.
|
|
|
19 args <- commandArgs(trailingOnly = TRUE)
|
|
|
20
|
|
|
21 input <- ifelse(! is.na(args[1]), args[1], usage())
|
|
|
22 output <- ifelse(! is.na(args[2]), args[2], usage())
|
|
|
23
|
|
|
24 threshold <- 0.8
|
|
|
25
|
|
|
26 fingerprint <- loadFingerprint(input);
|
|
|
27 consensus <- consensusFingerprint(fingerprint, threshold);
|
|
|
28 distance <- calculateDistanceToGEO(consensus);
|
|
|
29
|
|
|
30 # Display only the first 50 closest experiments
|
|
|
31 #distance <- distance[1:50,]
|
|
|
32
|
|
|
33 generateSimilarExperiments(distance, output);
|
|
|
34
|
|
|
35 quit("no", 0)
|