Skip to content

Commit c46e665

Browse files
committed
commit changes after successful test with singularity
1 parent ddf627a commit c46e665

File tree

2 files changed

+48
-18
lines changed

2 files changed

+48
-18
lines changed

inst/typeseq2/launch.sh

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
#!/bin/bash
22
set -x
33
# TypeSeq2 HPV
4-
VERSION="2.2008.2101"
4+
VERSION="2.1.1.2"
55
#autorundisable
66
echo Pipeline version $VERSION
77

8-
cp ../../*.bam ./
9-
cp ../../raw_peak_signal ./
10-
cp ../../sigproc_results/analysis.bfmask.stats ./
11-
cp ../../basecaller_results/BaseCaller.json ./
12-
cp ../../basecaller_results/datasets_basecaller.json ./
13-
cp ../../basecaller_results/ionstats_tf.json ./
14-
cp ../../ionstats_alignment.json ./
8+
ln ../../*.bam ./
159

10+
mkdir tmp
1611

17-
docker run -i -v $(pwd):/mnt -v /mnt:/user_files \
18-
cgrlab/typeseqhpv:development_191226 \
12+
singularity exec --bind $(pwd):/mnt --bind $(pwd)/tmp:/tmp --bind /mnt:/user_files /mnt/DCEG/CGF/Sequencing/Analysis/Research/TypeSeq_dev/typeseqhpv2_v1.sif \
1913
Rscript /TypeSeqHPV2/workflows/TypeSeq2.R \
2014
--is_torrent_server yes \
2115
--config_file config_file.csv \
@@ -24,7 +18,7 @@ docker run -i -v $(pwd):/mnt -v /mnt:/user_files \
2418
--grouping_defs grouping_defs.csv \
2519
--cores 22 \
2620
--manifest manifest.csv \
27-
--ram 80G \
21+
--ram 24G \
2822
--tvc_cores 4
2923

3024
rm *rawlib.bam

workflows/TypeSeq2.R

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,34 @@ command_line_args = tibble(
3535
filteringTable = optigrab::opt_get('filteringTable')) %>%
3636
glimpse()
3737

38+
#### Define workers
39+
future::plan(multiprocess)
40+
41+
# num_cores = availableCores() - 1
42+
num_cores = availableCores(methods="system") - 1
43+
44+
tvc_cores <- as.numeric(command_line_args$tvc_cores)
45+
46+
if(is.null(tvc_cores)){
47+
tvc_scores <- 4
48+
}
49+
50+
# workers <- floor(num_cores/tvc_cores)
51+
workers <- num_cores - 1
52+
53+
54+
55+
plan_workers <- function(workers, num_cores){
56+
if(is.null(workers) || workers<1){
57+
workers <- 1
58+
}
59+
cat(sprintf("Number of cores: %d and workers: %d \n", num_cores, workers))
60+
future::plan(multicore, workers = workers)
61+
}
62+
63+
64+
65+
3866
#### B. create workflow plan ####
3967
pkgconfig::set_config("drake::strings_in_dots" = "literals")
4068
ion_plan <- drake::drake_plan(
@@ -58,12 +86,20 @@ ion_plan <- drake::drake_plan(
5886
glimpse(),
5987

6088
#### 5. run tvc on demux bams ####
61-
vcf_files = sorted_bam %T>%
89+
vcf_files = {
90+
tmp_workers <- floor(num_cores/tvc_cores)
91+
plan_workers(tmp_workers, num_cores)
92+
93+
rv <- sorted_bam %T>%
6294
map_df(~ system(paste0("cp ", args_df$reference, " ./"))) %T>%
6395
map_df(~ system(paste0("samtools faidx ", basename(args_df$reference)))) %>%
6496
split(.$sample) %>%
6597
future_map_dfr(tvc_cli, args_df) %>%
66-
glimpse(),
98+
glimpse()
99+
100+
plan_workers(workers, num_cores)
101+
rv
102+
},
67103

68104
#### 6. merge vcf files in to 1 table ####
69105
variant_table = vcf_files %>%
@@ -110,15 +146,15 @@ ion_plan <- drake::drake_plan(
110146
#### C. execute workflow plan ####
111147
system("mkdir vcf")
112148

113-
future::plan(multiprocess)
114149

115-
num_cores = availableCores() - 1
116-
future::plan(multicore, workers = num_cores)
150+
# future::plan(multicore, workers = workers)
151+
plan_workers(workers, num_cores)
117152

118153
drake::make(ion_plan)
119154
#### E. make html block for torrent server ####
120155
html_block = if ( command_line_args$is_torrent_server == "yes") {
121-
render("/TypeSeqHPV2/inst/typeseq2/torrent_server_html_block.R",
122-
output_dir = "./")}
156+
system("cp /TypeSeqHPV2/inst/typeseq2/torrent_server_html_block.R ./")
123157

158+
render("./torrent_server_html_block.R", output_dir = "./")
159+
}
124160

0 commit comments

Comments
 (0)