From f92235bef4d34cfdc4f019ae029a9d64b3039fc8 Mon Sep 17 00:00:00 2001 From: Andre Date: Sun, 20 Oct 2024 22:12:32 -0400 Subject: [PATCH] Test_13: Pipeline --- pipeline/PharmCAT_Pipeline.wdl | 43 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/pipeline/PharmCAT_Pipeline.wdl b/pipeline/PharmCAT_Pipeline.wdl index 8df3458..9ea5bcf 100644 --- a/pipeline/PharmCAT_Pipeline.wdl +++ b/pipeline/PharmCAT_Pipeline.wdl @@ -266,8 +266,11 @@ task pipeline_task { # cohorts, such as UK Biobank). Input VCF files must at least comply with # Variant Call Format (VCF) Version >= 4.2. + # Resolver a variável `vcf_file` fora do bloco condicional + vcf_file="~{vcf_file}" + # option 1: User add on VCF or TSV file in the vcf_file input - if [[ -n "~{vcf_file}" && -f ~{vcf_file} ]]; then + if [[ -n ~{vcf_file} && -f ~{vcf_file} ]]; then # mkdir -p data cp ~{vcf_file} wf/data echo "Processing list of VCF files as a single block from: ~{vcf_file}" >> $log_file @@ -276,26 +279,23 @@ task pipeline_task { eval $cmd # Option 2: None VCF or TSV input. Check directory content to process - - elif [[ -z "~{vcf_file}" ]]; then - # if [[ $(ls wf/data/*.vcf.* 2>/dev/null | wc -l) -gt 0 ]]; then - # echo "Processing all individual VCF files in the directory: wf/data/" >> $log_file - - # VCFs_list="wf/VCFs_list.txt" - # ls wf/data/*.vcf.* > $VCFs_list - - # while read -r vcf_file; do - # echo "Processing individual VCF file: $vcf_file" >> $log_file - # cmd="pharmcat_pipeline $vcf_file $arg" - # echo "Running command: $cmd" >> $log_file - # eval $cmd - # done < $VCFs_list - # else - # echo "No VCF files found in files/input_directory. Exiting." >> $log_file - # exit 1 - # fi - - echo "dentro da opcao de diretorio" >> $log_file + elif [[ -z "$vcf_file" ]]; then + if [[ $(ls wf/data/*.vcf.* 2>/dev/null | wc -l) -gt 0 ]]; then + echo "Processing all individual VCF files in the directory: wf/data/" >> $log_file + + VCFs_list="wf/VCFs_list.txt" + ls wf/data/*.vcf.* > $VCFs_list + + while read -r vcf_file; do + echo "Processing individual VCF file: $vcf_file" >> $log_file + cmd="pharmcat_pipeline $vcf_file $arg" + echo "Running command: $cmd" >> $log_file + eval $cmd + done < $VCFs_list + else + echo "No VCF files found in wf/data/. Exiting." >> $log_file + exit 1 + fi else echo "No VCF or list of VCFs provided or found in directory. Exiting." >> $log_file @@ -303,6 +303,7 @@ task pipeline_task { fi + # Run the command echo "Pharmcat_pipeline finished" >> $log_file