Mercurial > repos > iuc > genomic_super_signature
annotate gss.R @ 0:d0cbe6cc1f04 draft default tip
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
author | iuc |
---|---|
date | Wed, 12 Jan 2022 19:07:45 +0000 |
parents | |
children |
rev | line source |
---|---|
0
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
1 suppressPackageStartupMessages(library(optparse)) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
2 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
3 ### Parsing command line ------------------------------------------------------- |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
4 option_list <- list( |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
5 make_option(c("--input"), type = "character", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
6 default = NULL, help = "Count matrix in tsv format"), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
7 make_option(c("--model"), type = "character", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
8 default = NULL, help = "RAVmodel to apply. |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
9 Currently 'C2' and 'PLIERpriors' are available"), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
10 make_option(c("--method"), type = "character", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
11 default = formals(GenomicSuperSignature::validate)$method), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
12 make_option(c("--maxFrom"), type = "character", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
13 default = formals(GenomicSuperSignature::validate)$maxFrom), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
14 make_option(c("--level"), type = "character", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
15 default = formals(GenomicSuperSignature::validate)$level), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
16 make_option(c("--scale"), type = "character", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
17 default = formals(GenomicSuperSignature::validate)$scale), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
18 make_option(c("--outDir"), type = "character", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
19 default = NULL, help = "Output file name"), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
20 make_option(c("--validate"), type = "character", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
21 default = NULL, help = "Path to save validate.csv"), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
22 make_option(c("--html"), type = "character", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
23 default = NULL, help = "Path to save HTML report"), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
24 make_option(c("--numOut"), type = "integer", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
25 default = 3, help = "The number of top validated RAVs to check"), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
26 make_option(c("--toolDir"), type = "character", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
27 default = ".", help = "Directory containing the tool scripts (e.g. gss.Rmd") |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
28 ) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
29 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
30 opt <- parse_args(OptionParser(option_list = option_list), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
31 args = commandArgs(trailingOnly = TRUE)) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
32 input <- opt$input |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
33 model <- opt$model |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
34 out_dir <- opt$outDir |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
35 num_out <- opt$numOut |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
36 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
37 if (is.null(input)) stop("Need --input.") |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
38 if (is.null(model)) stop("Need --model.") |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
39 if (is.null(out_dir)) stop("Need --outDir.") |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
40 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
41 input_name <- basename(tools::file_path_sans_ext(input)) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
42 out_dir <- normalizePath(out_dir) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
43 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
44 suppressPackageStartupMessages(library(GenomicSuperSignature)) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
45 dat <- as.matrix(read.table(file = input, header = TRUE, sep = "\t", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
46 row.names = 1)) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
47 if (model %in% c("C2", "PLIERpriors")) { |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
48 rav_model <- getModel(model) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
49 } else { |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
50 rav_model <- readRDS(model) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
51 } |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
52 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
53 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
54 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
55 ### validate ------------------------------------------------------------------- |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
56 val_all <- validate(dat, rav_model) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
57 validated_ind <- validatedSignatures(val_all, num.out = num_out, |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
58 swCutoff = 0, indexOnly = TRUE) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
59 n <- min(num_out, length(validated_ind), na.rm = TRUE) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
60 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
61 ### Save tables in csv --------------------------------------------------------- |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
62 # Validation |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
63 if (is.null(opt$validate)) { |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
64 output_fname <- file.path(out_dir, paste0(input_name, "_validate.csv")) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
65 } else { |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
66 output_fname <- opt$validate |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
67 } |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
68 write.csv(val_all, |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
69 file = output_fname, |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
70 row.names = TRUE) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
71 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
72 # GSEA |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
73 for (i in seq_len(n)) { |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
74 rav_num <- validated_ind[i] |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
75 rav_name <- paste0("RAV", rav_num) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
76 res <- gsea(rav_model)[[rav_name]] |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
77 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
78 output_fname <- paste0(input_name, "_genesets_RAV", rav_num, ".csv") |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
79 write.csv(res, |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
80 file = file.path(out_dir, output_fname), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
81 row.names = TRUE) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
82 } |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
83 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
84 # Related prior studies |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
85 for (i in seq_len(n)) { |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
86 rav_num <- validated_ind[i] |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
87 res <- findStudiesInCluster(rav_model, rav_num) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
88 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
89 output_fname <- paste0(input_name, "_literatures_RAV", rav_num, ".csv") |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
90 write.csv(res, |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
91 file = file.path(out_dir, output_fname), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
92 row.names = TRUE) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
93 } |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
94 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
95 ### Create a report ------------------------------------------------------------ |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
96 if (is.null(opt$html)) { |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
97 output_fname <- file.path(out_dir, paste0("GSS-", input_name, "-", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
98 format(Sys.Date(), format = "%Y%m%d"), ".html")) |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
99 } else { |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
100 output_fname <- opt$html |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
101 |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
102 } |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
103 rmarkdown::render( |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
104 file.path(opt$toolDir, "gss.Rmd"), params = list( |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
105 val_all = val_all, |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
106 dat = dat, |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
107 RAVmodel = rav_model, |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
108 inputName = input_name, |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
109 numOut = num_out |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
110 ), |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
111 output_file = output_fname, |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
112 intermediates_dir = ".", |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
113 knit_root_dir = "." |
d0cbe6cc1f04
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genomic_super_signature commit 1aadd5dce3b254e7714c2fdd39413029fd4b9b7a"
iuc
parents:
diff
changeset
|
114 ) |