Mercurial > repos > iuc > lineagespot
comparison lineagespot_verbose.R @ 1:99494998688a draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/lineagespot commit 6a6a37f2574954dae65f9ec407fe38594ed37659
author | iuc |
---|---|
date | Sun, 25 Feb 2024 09:49:20 +0000 |
parents | 6ddf5a9ce4a5 |
children |
comparison
equal
deleted
inserted
replaced
0:6ddf5a9ce4a5 | 1:99494998688a |
---|---|
11 # 'in_threshold' a parameter indicating the AF threshold for identifying variants per sample | 11 # 'in_threshold' a parameter indicating the AF threshold for identifying variants per sample |
12 # | 12 # |
13 # Rscript ${__tool_directory__}/lineagespot_verbose.R --in_vcf ${__tool_directory__}/test-data/extdata/vcf-files --in_gff3 ${__tool_directory__}/test-data/extdata/NC_045512.2_annot.gff3 --in_ref ${__tool_directory__}/test-data/extdata/ref --in_voc "B.1.617.2, B.1.1.7, B.1.351, P.1" --in_threshold 0.8 | 13 # Rscript ${__tool_directory__}/lineagespot_verbose.R --in_vcf ${__tool_directory__}/test-data/extdata/vcf-files --in_gff3 ${__tool_directory__}/test-data/extdata/NC_045512.2_annot.gff3 --in_ref ${__tool_directory__}/test-data/extdata/ref --in_voc "B.1.617.2, B.1.1.7, B.1.351, P.1" --in_threshold 0.8 |
14 # Set up R error handling to go to stderr | 14 # Set up R error handling to go to stderr |
15 options(show.error.messages = FALSE, error = function() { | 15 options(show.error.messages = FALSE, error = function() { |
16 cat(geterrmessage(), file = stderr()) | 16 cat(geterrmessage(), file = stderr()) |
17 q("no", 1, FALSE) | 17 q("no", 1, FALSE) |
18 }) | 18 }) |
19 | 19 |
20 # Import required libraries | 20 # Import required libraries |
21 | 21 |
22 library_path <- .libPaths() | 22 library_path <- .libPaths() |
23 | 23 |
24 suppressPackageStartupMessages({ | 24 suppressPackageStartupMessages({ |
25 library("getopt", lib.loc = library_path) | 25 library("getopt", lib.loc = library_path) |
26 library("data.table", lib.loc = library_path) | 26 library("data.table", lib.loc = library_path) |
27 library("lineagespot", lib.loc = library_path) | 27 library("lineagespot", lib.loc = library_path) |
28 }) | 28 }) |
29 | 29 |
30 | 30 |
31 options(stringAsfactors = FALSE, useFancyQuotes = FALSE) | 31 options(stringAsfactors = FALSE, useFancyQuotes = FALSE) |
32 | 32 |
34 args <- commandArgs(trailingOnly = TRUE) | 34 args <- commandArgs(trailingOnly = TRUE) |
35 | 35 |
36 # Get options using the spec as defined by the enclosed list | 36 # Get options using the spec as defined by the enclosed list |
37 # Read the options from the default: commandArgs(TRUE) | 37 # Read the options from the default: commandArgs(TRUE) |
38 option_specification <- matrix(c( | 38 option_specification <- matrix(c( |
39 "in_vcf", "vcf", 1, "character", | 39 "in_vcf", "vcf", 1, "character", |
40 "in_gff3", "gff3", 1, "character", | 40 "in_gff3", "gff3", 1, "character", |
41 "in_ref", "ref", 1, "character", | 41 "in_ref", "ref", 1, "character", |
42 "in_voc", "voc", 2, "character", | 42 "in_voc", "voc", 2, "character", |
43 "in_threshold", "thr", 2, "double" | 43 "in_threshold", "thr", 2, "double" |
44 ), byrow = TRUE, ncol = 4) | 44 ), byrow = TRUE, ncol = 4) |
45 | 45 |
46 options <- getopt(option_specification) | 46 options <- getopt(option_specification) |
47 | 47 |
48 if (!is.null(options$in_voc) && is.character(options$in_voc)) { | 48 if (!is.null(options$in_voc) && is.character(options$in_voc)) { |
49 options$in_voc <- unlist(strsplit(options$in_voc, split = ",")) | 49 options$in_voc <- unlist(strsplit(options$in_voc, split = ",")) |
50 } | 50 } |
51 | 51 |
52 result <- lineagespot(vcf_folder = options$in_vcf, | 52 result <- lineagespot( |
53 ref_folder = options$in_ref, | 53 vcf_folder = options$in_vcf, |
54 gff3_path = options$in_gff3, | 54 ref_folder = options$in_ref, |
55 voc = options$in_voc, | 55 gff3_path = options$in_gff3, |
56 AF_threshold = options$in_threshold) | 56 voc = options$in_voc, |
57 AF_threshold = options$in_threshold | |
58 ) | |
57 | 59 |
58 | 60 |
59 # Write output to new file which will be recognized by Galaxy | 61 # Write output to new file which will be recognized by Galaxy |
60 fwrite(result$variants.table, sep = "\t", file = "variants_table.txt", row.names = FALSE) | 62 fwrite(result$variants.table, sep = "\t", file = "variants_table.txt", row.names = FALSE) |
61 fwrite(result$lineage.hits, sep = "\t", file = "lineage_hits.txt", row.names = FALSE) | 63 fwrite(result$lineage.hits, sep = "\t", file = "lineage_hits.txt", row.names = FALSE) |