Mercurial > repos > artbio > snvtocnv
comparison segmentation_sequenza.R @ 0:0e54da14f831 draft
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/snvtocnv commit fd049d0796cbfaa6c41a7d80e84d3a734b30acc8"
author | artbio |
---|---|
date | Thu, 18 Feb 2021 18:59:53 +0000 |
parents | |
children | 9265faa93098 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0e54da14f831 |
---|---|
1 # load packages that are provided in the conda env | |
2 options(show.error.messages = F, | |
3 error = function() { | |
4 cat(geterrmessage(), file = stderr()); q("no", 1, F)}) | |
5 Sys.setenv(TZ = "Pacific/Auckland") # turnaround the tidyverse bug "In OlsonNames() : no Olson database found" | |
6 | |
7 | |
8 library(optparse) | |
9 library(sequenza) | |
10 library(BiocParallel) | |
11 library(tidyverse) | |
12 | |
13 option_list <- list( | |
14 make_option( | |
15 c("-i", "--input"), | |
16 default = NA, | |
17 type = "character", | |
18 help = "Path to Sequenza seqz processed segments file" | |
19 ), | |
20 make_option( | |
21 c("-O", "--output_dir"), | |
22 default = NA, | |
23 type = "character", | |
24 help = "Output directory" | |
25 ), | |
26 make_option( | |
27 c("-s", "--sample_name"), | |
28 default = NA, | |
29 type = "character", | |
30 help = "Sample name" | |
31 ) | |
32 ) | |
33 | |
34 opt <- parse_args(OptionParser(option_list = option_list), | |
35 args = commandArgs(trailingOnly = TRUE)) | |
36 | |
37 data_file <- opt$input | |
38 output_dir <- opt$output_dir | |
39 sample_name <- opt$sample_name | |
40 | |
41 | |
42 ## Processing seqz files : normalisation and segmentation for chromosomes 1 to 22 | |
43 message(sprintf("\nExtraction step for %s", data_file)) | |
44 | |
45 segfile <- sequenza.extract(data_file, | |
46 verbose = TRUE) # , | |
47 # chromosome.list = as.character(c(1:22))) | |
48 | |
49 ## Estimation of cellularity and ploidy | |
50 | |
51 segfile_cp <- sequenza.fit(segfile) | |
52 message(sprintf("\nEstimation step for %s\n", data_file)) | |
53 | |
54 ## writing files and plots using default parameters | |
55 message(sprintf("\nWriting files and plots for %s\n", data_file)) | |
56 | |
57 sequenza.results(sequenza.extract = segfile, | |
58 cp.table = segfile_cp, | |
59 sample.id = sample_name, | |
60 out.dir = output_dir) | |
61 message(sprintf("\nOutput written to %s\n", output_dir)) |