Skip to content

Commit

Permalink
commit changes after successful test with singularity
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhu365 committed Oct 22, 2021
1 parent ddf627a commit c46e665
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 18 deletions.
16 changes: 5 additions & 11 deletions inst/typeseq2/launch.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
#!/bin/bash
set -x
# TypeSeq2 HPV
VERSION="2.2008.2101"
VERSION="2.1.1.2"
#autorundisable
echo Pipeline version $VERSION

cp ../../*.bam ./
cp ../../raw_peak_signal ./
cp ../../sigproc_results/analysis.bfmask.stats ./
cp ../../basecaller_results/BaseCaller.json ./
cp ../../basecaller_results/datasets_basecaller.json ./
cp ../../basecaller_results/ionstats_tf.json ./
cp ../../ionstats_alignment.json ./
ln ../../*.bam ./

mkdir tmp

docker run -i -v $(pwd):/mnt -v /mnt:/user_files \
cgrlab/typeseqhpv:development_191226 \
singularity exec --bind $(pwd):/mnt --bind $(pwd)/tmp:/tmp --bind /mnt:/user_files /mnt/DCEG/CGF/Sequencing/Analysis/Research/TypeSeq_dev/typeseqhpv2_v1.sif \
Rscript /TypeSeqHPV2/workflows/TypeSeq2.R \
--is_torrent_server yes \
--config_file config_file.csv \
Expand All @@ -24,7 +18,7 @@ docker run -i -v $(pwd):/mnt -v /mnt:/user_files \
--grouping_defs grouping_defs.csv \
--cores 22 \
--manifest manifest.csv \
--ram 80G \
--ram 24G \
--tvc_cores 4

rm *rawlib.bam
50 changes: 43 additions & 7 deletions workflows/TypeSeq2.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,34 @@ command_line_args = tibble(
filteringTable = optigrab::opt_get('filteringTable')) %>%
glimpse()

#### Define workers
future::plan(multiprocess)

# num_cores = availableCores() - 1
num_cores = availableCores(methods="system") - 1

tvc_cores <- as.numeric(command_line_args$tvc_cores)

if(is.null(tvc_cores)){
tvc_scores <- 4
}

# workers <- floor(num_cores/tvc_cores)
workers <- num_cores - 1



plan_workers <- function(workers, num_cores){
if(is.null(workers) || workers<1){
workers <- 1
}
cat(sprintf("Number of cores: %d and workers: %d \n", num_cores, workers))
future::plan(multicore, workers = workers)
}




#### B. create workflow plan ####
pkgconfig::set_config("drake::strings_in_dots" = "literals")
ion_plan <- drake::drake_plan(
Expand All @@ -58,12 +86,20 @@ ion_plan <- drake::drake_plan(
glimpse(),

#### 5. run tvc on demux bams ####
vcf_files = sorted_bam %T>%
vcf_files = {
tmp_workers <- floor(num_cores/tvc_cores)
plan_workers(tmp_workers, num_cores)

rv <- sorted_bam %T>%
map_df(~ system(paste0("cp ", args_df$reference, " ./"))) %T>%
map_df(~ system(paste0("samtools faidx ", basename(args_df$reference)))) %>%
split(.$sample) %>%
future_map_dfr(tvc_cli, args_df) %>%
glimpse(),
glimpse()

plan_workers(workers, num_cores)
rv
},

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

future::plan(multiprocess)

num_cores = availableCores() - 1
future::plan(multicore, workers = num_cores)
# future::plan(multicore, workers = workers)
plan_workers(workers, num_cores)

drake::make(ion_plan)
#### E. make html block for torrent server ####
html_block = if ( command_line_args$is_torrent_server == "yes") {
render("/TypeSeqHPV2/inst/typeseq2/torrent_server_html_block.R",
output_dir = "./")}
system("cp /TypeSeqHPV2/inst/typeseq2/torrent_server_html_block.R ./")

render("./torrent_server_html_block.R", output_dir = "./")
}

0 comments on commit c46e665

Please sign in to comment.