From 061b593597a66929679218f7f368c0491c9a1533 Mon Sep 17 00:00:00 2001 From: Leila011 Date: Thu, 1 Aug 2024 17:19:38 +0200 Subject: [PATCH] handle input --gff has multiple=true --- src/agat/agat_sq_stat_basic/config.vsh.yaml | 1 + src/agat/agat_sq_stat_basic/script.sh | 12 ++++++++++-- src/agat/agat_sq_stat_basic/test.sh | 12 ++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/agat/agat_sq_stat_basic/config.vsh.yaml b/src/agat/agat_sq_stat_basic/config.vsh.yaml index 89b0d841..3ba1ef9d 100644 --- a/src/agat/agat_sq_stat_basic/config.vsh.yaml +++ b/src/agat/agat_sq_stat_basic/config.vsh.yaml @@ -23,6 +23,7 @@ argument_groups: Input GTF/GFF file. Several files can be processed at once: -i file1 -i file2 type: file required: true + multiple: true direction: input example: input.gff - name: --genome_size diff --git a/src/agat/agat_sq_stat_basic/script.sh b/src/agat/agat_sq_stat_basic/script.sh index 2e11d0d7..038b9592 100644 --- a/src/agat/agat_sq_stat_basic/script.sh +++ b/src/agat/agat_sq_stat_basic/script.sh @@ -6,6 +6,14 @@ # unset flags [[ "$par_inflate" == "false" ]] && unset par_inflate +# Convert a list of file names to multiple -gff arguments +input_files="" +IFS=";" read -ra file_names <<< "$par_gff" +for file in "${file_names[@]}"; do + input_files+="--gff $file " +done +unset IFS + # take care of --genome (can originally be either a fasta file or an integer) if [[ -n "$par_genome_size" ]]; then genome_arg=$par_genome_size @@ -15,8 +23,8 @@ fi # run agat_convert_sp_bed2gff.pl agat_sq_stat_basic.pl \ - --gff "$par_gff" \ + $input_files \ ${genome_arg:+--genome "${genome_arg}"} \ - -o "$par_output" \ + --output "${par_output}" \ ${par_inflate:+--inflate} \ ${par_config:+--config "${par_config}"} diff --git a/src/agat/agat_sq_stat_basic/test.sh b/src/agat/agat_sq_stat_basic/test.sh index f3d79222..c99aa912 100644 --- a/src/agat/agat_sq_stat_basic/test.sh +++ b/src/agat/agat_sq_stat_basic/test.sh @@ -9,18 +9,18 @@ out_dir="${meta_resources_dir}/out_data" echo "> Run $meta_name with test data" "$meta_executable" \ --gff "$test_dir/1.gff" \ - --output "$out_dir/output.gff" - + --output "$out_dir/output.txt" + echo ">> Checking output" -[ ! -f "$out_dir/output.gff" ] && echo "Output file output.gff does not exist" && exit 1 +[ ! -f "$out_dir/output.txt" ] && echo "Output file output.txt does not exist" && exit 1 echo ">> Check if output is empty" -[ ! -s "$out_dir/output.gff" ] && echo "Output file output.gff is empty" && exit 1 +[ ! -s "$out_dir/output.txt" ] && echo "Output file output.txt is empty" && exit 1 echo ">> Check if output matches expected output" -diff "$out_dir/output.gff" "$test_dir/agat_sq_stat_basic_1.gff" +diff "$out_dir/output.txt" "$test_dir/agat_sq_stat_basic_1.gff" if [ $? -ne 0 ]; then - echo "Output file output.gff does not match expected output" + echo "Output file output.txt does not match expected output" exit 1 fi