11import os
2- from pathlib import Path
2+ from typing import Tuple , Optional
33
4- def get_path_to_script (selected_pipeline , selected_project , selected = "all" ):
4+ def get_path_to_script (
5+ selected_pipeline : str ,
6+ selected_project : str ,
7+ selected : str = ""
8+ ):
59 NX_SHARED_PATH = "/data/scratch/shared/RSE/NF-project-configurations"
6- # e.g., /data/scratch/shared/RSE/NF-project-configurations/epi2me-human-variation/nf-long-reads/scripts
7- base_path = os .path .join (NX_SHARED_PATH , selected_pipeline , selected_project , "scripts" )
10+ base_path = os .path .join (NX_SHARED_PATH , selected_pipeline , selected_project )
811
912 script_mapping = {
10- "all" : "launch_samples.sh" ,
11- "demo" : "launch_demo.sh" ,
12- "customised" : "launch_samples.sh" ,
13+ "demo" : "scripts/launch_demo.sh" ,
14+ "customised" : "scripts/launch_samples.sh"
1315 }
1416
15- if selected in script_mapping :
16- return os . path . join ( base_path , script_mapping [ selected ] )
17+ if selected not in script_mapping :
18+ raise ValueError ( f"Invalid selection ' { selected } '. Only 'customised', 'demo' are supported." )
1719
18- raise ValueError ( f"Invalid selection ' { selected } '. Only 'customised' and 'demo' are supported." )
20+ primary_script = os . path . join ( base_path , script_mapping . get ( selected , "" ) )
1921
22+ return primary_script
2023
2124# launch command based on the project
2225def pipe_cmd (
@@ -29,7 +32,8 @@ def pipe_cmd(
2932 output_dir = "output" ,
3033 custom_sample_list = [],
3134 bed_file = "" ,
32- dry_run = False
35+ dry_run = False ,
36+ adapt_samples = False
3337):
3438 def get_pipeline_command ():
3539 """Generate the pipeline execution command based on the sample selection."""
@@ -46,18 +50,6 @@ def get_pipeline_command():
4650 base_cmd = f"sbatch -o { log_out } -e { log_err } "
4751 args += [path_to_script , work_dir , output_dir ]
4852
49- elif selected_samples == "all" :#I removed this option
50- #./your_script.sh --env "/my/custom/env" --work-dir "my_work" --outdir "my_output" --config "my_config" --params "parans.json" --bed file.bed
51- if dry_run :
52- args .append ("--dry-run" )
53-
54- args += [
55- "--work-dir" , work_dir ,
56- "--outdir" , output_dir ,
57- ]
58- if bed_file :
59- args += ["--bed" , bed_file ]
60-
6153 elif selected_samples == "customised" :
6254 if not custom_sample_list :
6355 raise ValueError ("custom_sample_list cannot be empty" )
@@ -68,6 +60,8 @@ def get_pipeline_command():
6860 "--outdir" , output_dir ,
6961 "--samples" , "\t " .join (custom_sample_list ),
7062 ]
63+ if adapt_samples :
64+ args += ["--adapt-samples" ]
7165 if bed_file :
7266 args += ["--bed" , bed_file ]
7367
0 commit comments