Skip to content

Commit

Permalink
handle input --gff has multiple=true
Browse files Browse the repository at this point in the history
  • Loading branch information
Leila011 committed Aug 1, 2024
1 parent 5ad22f3 commit 061b593
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/agat/agat_sq_stat_basic/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions src/agat/agat_sq_stat_basic/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"}
12 changes: 6 additions & 6 deletions src/agat/agat_sq_stat_basic/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 061b593

Please sign in to comment.