Build branch main with version main (f91567d)

Build pipeline: viash-hub.biobox.main-cc5jz

Source commit: f91567d467

Source message: add outdir argument (#181)

* add outdir argument

* added tests, small changes

* update example outdir
This commit is contained in:
CI
2025-06-24 10:57:17 +00:00
parent 71f1661df8
commit 9cc17eaa6f
341 changed files with 923 additions and 726 deletions

View File

@@ -29,6 +29,18 @@ argument_groups:
description: "At least one of the output options (--html, --zip, --summary, --data)\
\ must be used.\n"
arguments:
- type: "file"
name: "--outdir"
description: "Output directory where the results will be saved.\n"
info: null
example:
- "results"
must_exist: true
create_parent: true
required: false
direction: "output"
multiple: false
multiple_sep: ";"
- type: "file"
name: "--html"
description: "Create the HTML report of the results. \n'*' wild card must be provided\
@@ -339,9 +351,9 @@ build_info:
output: "target/executable/fastqc"
executable: "target/executable/fastqc/fastqc"
viash_version: "0.9.4"
git_commit: "219ba1d3d0d7fbc66393595534bb6c333b08b238"
git_commit: "f91567d467e6be79a5f71b24a54864ab13bdd278"
git_remote: "https://github.com/viash-hub/biobox"
git_tag: "v0.2.0-37-g219ba1d"
git_tag: "v0.2.0-38-gf91567d"
package_config:
name: "biobox"
version: "main"

View File

@@ -452,9 +452,9 @@ RUN echo "fastqc: $(fastqc --version | sed -n 's/^FastQC //p')" > /var/software_
LABEL org.opencontainers.image.authors="Theodoro Gasperin Terra Camargo"
LABEL org.opencontainers.image.description="Companion container for running component fastqc"
LABEL org.opencontainers.image.created="2025-06-23T06:29:32Z"
LABEL org.opencontainers.image.created="2025-06-24T10:40:49Z"
LABEL org.opencontainers.image.source="https://github.com/s-andrews/FastQC"
LABEL org.opencontainers.image.revision="219ba1d3d0d7fbc66393595534bb6c333b08b238"
LABEL org.opencontainers.image.revision="f91567d467e6be79a5f71b24a54864ab13bdd278"
LABEL org.opencontainers.image.version="main"
VIASHDOCKER
@@ -586,6 +586,11 @@ function ViashHelp {
echo " At least one of the output options (--html, --zip, --summary, --data) must"
echo " be used."
echo ""
echo " --outdir"
echo " type: file, output, file must exist"
echo " example: results"
echo " Output directory where the results will be saved."
echo ""
echo " --html"
echo " type: file, multiple values allowed, output, file must exist"
echo " example: *.html"
@@ -786,6 +791,17 @@ while [[ $# -gt 0 ]]; do
fi
shift 1
;;
--outdir)
[ -n "$VIASH_PAR_OUTDIR" ] && ViashError Bad arguments for option \'--outdir\': \'$VIASH_PAR_OUTDIR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
VIASH_PAR_OUTDIR="$2"
[ $# -lt 2 ] && ViashError Not enough arguments passed to --outdir. Use "--help" to get more information on the parameters. && exit 1
shift 2
;;
--outdir=*)
[ -n "$VIASH_PAR_OUTDIR" ] && ViashError Bad arguments for option \'--outdir=*\': \'$VIASH_PAR_OUTDIR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
VIASH_PAR_OUTDIR=$(ViashRemoveFlags "$1")
shift 1
;;
--html)
[ -n "$VIASH_PAR_HTML" ] && ViashError Bad arguments for option \'--html\': \'$VIASH_PAR_HTML\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
VIASH_PAR_HTML="$2"
@@ -1341,6 +1357,9 @@ if [[ -n "$VIASH_META_MEMORY_PIB" ]]; then
fi
# create parent directories of output files, if so desired
if [ ! -z "$VIASH_PAR_OUTDIR" ] && [ ! -d "$(dirname "$VIASH_PAR_OUTDIR")" ]; then
mkdir -p "$(dirname "$VIASH_PAR_OUTDIR")"
fi
if [ ! -z "$VIASH_PAR_HTML" ] && [ ! -d "$(dirname "$VIASH_PAR_HTML")" ]; then
mkdir -p "$(dirname "$VIASH_PAR_HTML")"
fi
@@ -1377,6 +1396,11 @@ if [ ! -z "$VIASH_PAR_INPUT" ]; then
done
VIASH_PAR_INPUT=$(IFS=';' ; echo "${VIASH_TEST_INPUT[*]}")
fi
if [ ! -z "$VIASH_PAR_OUTDIR" ]; then
VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_OUTDIR")" )
VIASH_PAR_OUTDIR=$(ViashDockerAutodetectMount "$VIASH_PAR_OUTDIR")
VIASH_CHOWN_VARS+=( "$VIASH_PAR_OUTDIR" )
fi
if [ ! -z "$VIASH_PAR_HTML" ]; then
VIASH_TEST_HTML=()
IFS=';'
@@ -1509,6 +1533,7 @@ cat > "\$tempscript" << 'VIASHMAIN'
## VIASH START
# The following code has been auto-generated by Viash.
$( if [ ! -z ${VIASH_PAR_INPUT+x} ]; then echo "${VIASH_PAR_INPUT}" | sed "s#'#'\"'\"'#g;s#.*#par_input='&'#" ; else echo "# par_input="; fi )
$( if [ ! -z ${VIASH_PAR_OUTDIR+x} ]; then echo "${VIASH_PAR_OUTDIR}" | sed "s#'#'\"'\"'#g;s#.*#par_outdir='&'#" ; else echo "# par_outdir="; fi )
$( if [ ! -z ${VIASH_PAR_HTML+x} ]; then echo "${VIASH_PAR_HTML}" | sed "s#'#'\"'\"'#g;s#.*#par_html='&'#" ; else echo "# par_html="; fi )
$( if [ ! -z ${VIASH_PAR_ZIP+x} ]; then echo "${VIASH_PAR_ZIP}" | sed "s#'#'\"'\"'#g;s#.*#par_zip='&'#" ; else echo "# par_zip="; fi )
$( if [ ! -z ${VIASH_PAR_SUMMARY+x} ]; then echo "${VIASH_PAR_SUMMARY}" | sed "s#'#'\"'\"'#g;s#.*#par_summary='&'#" ; else echo "# par_summary="; fi )
@@ -1549,8 +1574,8 @@ $( if [ ! -z ${VIASH_META_MEMORY_PIB+x} ]; then echo "${VIASH_META_MEMORY_PIB}"
set -eo pipefail
# Check if both outputs are empty, at least one must be passed.
if [[ -z "\$par_html" ]] && [[ -z "\$par_zip" ]] && [[ -z "\$par_summary" ]] && [[ -z "\$par_data" ]]; then
echo "Error: At least one of the output arguments (--html, --zip, --summary, and --data) must be passed."
if [[ -z "\$par_outdir" ]] && [[ -z "\$par_html" ]] && [[ -z "\$par_zip" ]] && [[ -z "\$par_summary" ]] && [[ -z "\$par_data" ]]; then
echo "Error: At least one of the output arguments (--outdir, --html, --zip, --summary, and --data) must be passed."
exit 1
fi
@@ -1576,6 +1601,16 @@ function clean_up {
}
trap clean_up EXIT
# Set output directory
if [[ -n "\$par_outdir" ]]; then
if [[ ! -d "\$par_outdir" ]]; then
mkdir -p "\$par_outdir"
fi
output_dir="\$par_outdir"
else
output_dir="\$tmpdir"
fi
# Create input array
IFS=";" read -ra input <<< \$par_input
@@ -1595,35 +1630,50 @@ fastqc \\
\${par_quiet:+--quiet} \\
\${meta_cpus:+--threads "\$meta_cpus"} \\
\${meta_temp_dir:+--dir "\$meta_temp_dir"} \\
--outdir "\${tmpdir}" \\
--outdir "\${output_dir}" \\
"\${input[@]}"
# Move output files
for file in "\${input[@]}"; do
# Removes everthing after the first dot of the basename
# Removes everything after the first dot of the basename
sample_name=\$(basename "\${file}" | sed 's/\\..*\$//')
if [[ -n "\$par_html" ]]; then
input_html="\${tmpdir}/\${sample_name}_fastqc.html"
html_file="\${par_html//\\*/\$sample_name}"
mv "\$input_html" "\$html_file"
input_html="\${output_dir}/\${sample_name}_fastqc.html"
if [[ ! -f "\$input_html" ]]; then
echo "WARNING: HTML file '\$input_html' does not exist"
else
html_file="\${par_html//\\*/\$sample_name}"
cp "\$input_html" "\$html_file"
fi
fi
if [[ -n "\$par_zip" ]]; then
input_zip="\${tmpdir}/\${sample_name}_fastqc.zip"
zip_file="\${par_zip//\\*/\$sample_name}"
mv "\$input_zip" "\$zip_file"
input_zip="\${output_dir}/\${sample_name}_fastqc.zip"
if [[ ! -f "\$input_zip" ]]; then
echo "WARNING: ZIP file '\$input_zip' does not exist"
else
zip_file="\${par_zip//\\*/\$sample_name}"
cp "\$input_zip" "\$zip_file"
fi
fi
if [[ -n "\$par_summary" ]]; then
summary_file="\${tmpdir}/\${sample_name}_fastqc/summary.txt"
new_summary="\${par_summary//\\*/\$sample_name}"
mv "\$summary_file" "\$new_summary"
summary_file="\${output_dir}/\${sample_name}_fastqc/summary.txt"
if [[ ! -f "\$summary_file" ]]; then
echo "WARNING: Summary file '\$summary_file' does not exist"
else
new_summary="\${par_summary//\\*/\$sample_name}"
cp "\$summary_file" "\$new_summary"
fi
fi
if [[ -n "\$par_data" ]]; then
data_file="\${tmpdir}/\${sample_name}_fastqc/fastqc_data.txt"
new_data="\${par_data//\\*/\$sample_name}"
mv "\$data_file" "\$new_data"
data_file="\${output_dir}/\${sample_name}_fastqc/fastqc_data.txt"
if [[ ! -f "\$data_file" ]]; then
echo "WARNING: Data file '\$data_file' does not exist"
else
new_data="\${par_data//\\*/\$sample_name}"
cp "\$data_file" "\$new_data"
fi
fi
# Remove the extracted directory
rm -r "\${tmpdir}/\${sample_name}_fastqc"
done
VIASHMAIN
bash "\$tempscript" &
@@ -1648,6 +1698,9 @@ if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then
done
VIASH_PAR_INPUT="$VIASH_TEST_INPUT"
fi
if [ ! -z "$VIASH_PAR_OUTDIR" ]; then
VIASH_PAR_OUTDIR=$(ViashDockerStripAutomount "$VIASH_PAR_OUTDIR")
fi
if [ ! -z "$VIASH_PAR_HTML" ]; then
VIASH_PAR_HTML=$(ViashDockerStripAutomount "$VIASH_PAR_HTML")
fi
@@ -1685,6 +1738,10 @@ fi
# check whether required files exist
if [ ! -z "$VIASH_PAR_OUTDIR" ] && [ ! -e "$VIASH_PAR_OUTDIR" ]; then
ViashError "Output file '$VIASH_PAR_OUTDIR' does not exist."
exit 1
fi
if [ ! -z "$VIASH_PAR_HTML" ] && ! compgen -G "$VIASH_PAR_HTML" > /dev/null; then
ViashError "Output file '$VIASH_PAR_HTML' does not exist."
exit 1