diff --git a/src/nanoplot/config.vsh.yaml b/src/nanoplot/config.vsh.yaml index 8dc9844f..1c22775f 100644 --- a/src/nanoplot/config.vsh.yaml +++ b/src/nanoplot/config.vsh.yaml @@ -15,13 +15,13 @@ argument_groups: arguments: - name: --fastq type: file - description: Input fastq file(s). + description: Input fastq file(s), separated by ";". example: read.fq direction: input multiple: true - name: --fasta type: file - description: Input fasta file(s). + description: Input fasta file(s), separated by ";". example: read.fa direction: input multiple: true @@ -29,7 +29,7 @@ argument_groups: type: file description: | Input fastq file(s) generated by albacore or - MinKNOW with additional information concerning channel and time. + MinKNOW with additional information concerning channel and time, separated by ";". example: read.fq direction: input multiple: true @@ -38,45 +38,45 @@ argument_groups: description: | Input fastq file(s) generated by albacore or MinKNOW with additional information concerning channel and time. Minimal data is extracted - swiftly without elaborate checks. + swiftly without elaborate checks. Separated by ";". example: read.fq direction: input multiple: true - name: --summary type: file description: | - Input summary file(s) generated by albacore or guppy. + Input summary file(s) generated by albacore or guppy, separated by ";". example: read.txt direction: input multiple: true - name: --bam type: file - description: Input sorted bam file(s). + description: Input sorted bam file(s), separated by ";". example: read.bam direction: input multiple: true - name: --ubam type: file - description: Input unmapped bam file(s). + description: Input unmapped bam file(s), separated by ";". example: read.ubam direction: input multiple: true - name: --cram type: file - description: Input sorted cram file(s). + description: Input sorted cram file(s), separated by ";". example: read.cram direction: input multiple: true - name: --pickle type: file - description: Input pickle file stored earlier. + description: Input pickle file stored earlier, separated by ";". example: read.pkl direction: input multiple: true - name: --feather alternatives: [--arrow] type: file - description: Input feather file(s). + description: Input feather file(s), separated by ";". example: read.arrow direction: input multiple: true @@ -219,11 +219,10 @@ test_resources: path: test_data engines: - type: docker - image: quay.io/biocontainers/nanoplot:1.42.0--pyhdfd78af_0 + image: quay.io/biocontainers/nanoplot:1.43.0--pyhdfd78af_1 setup: - type: docker run: | - touch ./var/software_versions.txt && \ version=$(NanoPlot --version) && \ echo "$version" > /var/software_versions.txt runners: diff --git a/src/nanoplot/script.sh b/src/nanoplot/script.sh index d4344be0..fc198e89 100644 --- a/src/nanoplot/script.sh +++ b/src/nanoplot/script.sh @@ -6,50 +6,89 @@ set -eo pipefail ## VIASH END # Unset flags -[[ "$par_verbose" == "false" ]] && unset par_verbose -[[ "$par_store" == "false" ]] && unset par_store -[[ "$par_raw" == "false" ]] && unset par_raw -[[ "$par_huge" == "false" ]] && unset par_huge -[[ "$par_no_static" == "true" ]] && unset par_no_static -[[ "$par_tsv_stats" == "false" ]] && unset par_tsv_stats -[[ "$par_only_report" == "false" ]] && unset par_only_report -[[ "$par_info_in_report" == "false" ]] && unset par_info_in_report -[[ "$par_drop_outliers" == "true" ]] && unset par_drop_outliers -[[ "$par_loglength" == "false" ]] && unset par_loglength -[[ "$par_percentqual" == "false" ]] && unset par_percentqual -[[ "$par_alength" == "false" ]] && unset par_alength -[[ "$par_barcoded" == "false" ]] && unset par_barcoded -[[ "$par_no_supplementary" == "true" ]] && unset par_no_supplementary -[[ "$par_listcolors" == "false" ]] && unset par_listcolors -[[ "$par_listcolormaps" == "false" ]] && unset par_listcolormaps -[[ "$par_no_N50" == "true" ]] && unset par_no_N50 -[[ "$par_N50" == "false" ]] && unset par_N50 -[[ "$par_hide_stats" == "true" ]] && unset par_hide_stats +unset_if_false=( + par_verbose + par_store + par_raw + par_huge + par_no_static + par_tsv_stats + par_only_report + par_info_in_report + par_drop_outliers + par_loglength + par_percentqual + par_alength + par_barcoded + par_no_supplementary + par_listcolors + par_listcolormaps + par_no_N50 + par_N50 + par_hide_stats +) + +for var in "${unset_if_false[@]}"; do + test_val="${!var}" + [[ "$test_val" == "false" ]] && unset $var +done + +par_fastq="${par_fastq//;/ }" +par_fasta="${par_fasta//;/ }" +par_fastq_rich="${par_fastq_rich//;/ }" +par_fastq_minimal="${par_fastq_minimal//;/ }" +par_summary="${par_summary//;/ }" +par_bam="${par_bam//;/ }" +par_ubam="${par_ubam//;/ }" +par_cram="${par_cram//;/ }" +par_pickle="${par_pickle//;/ }" +par_feather="${par_feather//;/ }" + + +inputs=( + "$par_fastq" + "$par_fasta" + "$par_fastq_rich" + "$par_fastq_minimal" + "$par_summary" + "$par_bam" + "$par_ubam" + "$par_cram" + "$par_pickle" + "$par_feather" +) + +one_input=false +for var in "${inputs[@]}"; do + if [ -n "$var" ]; then # if the parameter is not empty + if [ "$one_input" = "false" ]; then + one_input=true + else # Multiple input file types specified + echo "Error: Multiple input file types specified." + exit 1 + fi + fi +done + +if [ ! "$one_input" ]; then + echo "Error: No input file type specified." + exit 1 +fi + -# Multiple inputs - replace ';' with ' ' (space) -par_fastq=$(echo $par_fastq | tr ';' ' ') -par_fasta=$(echo $par_fasta | tr ';' ' ') -par_fastq_rich=$(echo $par_fastq_rich | tr ';' ' ') -par_fastq_minimal=$(echo $par_fastq_minimal | tr ';' ' ') -par_summary=$(echo $par_summary | tr ';' ' ') -par_bam=$(echo $par_bam | tr ';' ' ') -par_ubam=$(echo $par_ubam | tr ';' ' ') -par_cram=$(echo $par_cram | tr ';' ' ') -par_pickle=$(echo $par_pickle | tr ';' ' ') -par_feather=$(echo $par_feather | tr ';' ' ') # Run NanoPlot NanoPlot \ - ${par_fastq:+--fastq "$par_fastq"} \ - ${par_fasta:+--fasta "$par_fasta"} \ - ${par_fastq_rich:+--fastq_rich "$par_fastq_rich"} \ - ${par_fastq_minimal:+--fastq_minimal "$par_fastq_minimal"} \ - ${par_summary:+--summary "$par_summary"} \ - ${par_bam:+--bam "$par_bam"} \ - ${par_ubam:+--ubam "$par_ubam"} \ - ${par_cram:+--cram "$par_cram"} \ - ${par_pickle:+--pickle "$par_pickle"} \ - ${par_feather:+--feather "$par_feather"} \ + ${par_fastq:+--fastq $par_fastq} \ + ${par_fasta:+--fasta $par_fasta} \ + ${par_fastq_rich:+--fastq_rich $par_fastq_rich} \ + ${par_fastq_minimal:+--fastq_minimal $par_fastq_minimal} \ + ${par_summary:+--summary $par_summary} \ + ${par_bam:+--bam $par_bam} \ + ${par_ubam:+--ubam $par_ubam} \ + ${par_cram:+--cram $par_cram} \ + ${par_pickle:+--pickle $par_pickle} \ + ${par_feather:+--feather $par_feather} \ ${par_verbose:+--verbose} \ ${par_store:+--store} \ ${par_raw:+--raw} \ @@ -85,4 +124,6 @@ NanoPlot \ ${par_dpi:+--dpi "$par_dpi"} \ ${par_hide_stats:+--hide_stats} \ ${meta_cpus:+--threads "$meta_cpus"} \ - --outdir "$par_outdir" \ No newline at end of file + --outdir "$par_outdir" + +exit 0 diff --git a/src/nanoplot/test.sh b/src/nanoplot/test.sh index 878d04b5..cac10c17 100644 --- a/src/nanoplot/test.sh +++ b/src/nanoplot/test.sh @@ -3,12 +3,10 @@ set -eo pipefail ## VIASH START -meta_executable="$PWD/target/executable/nanoplot/nanoplot" -meta_resources_dir="$PWD/src/nanoplot" ## VIASH END # Files at runtime (.gz, .pickle and .feather) -wget "https://github.com/wdecoster/nanotest/archive/refs/heads/master.zip" +wget https://github.com/wdecoster/nanotest/archive/refs/heads/master.zip unzip master.zip ########################################################################### @@ -62,7 +60,7 @@ pushd test2 > /dev/null echo "> Run Test 2: multiple inputs (Fastq)" "$meta_executable" \ - --fastq "$meta_resources_dir/test_data/test1.fastq" "$meta_resources_dir/test_data/test2.fastq" \ + --fastq "$meta_resources_dir/test_data/test1.fastq;$meta_resources_dir/test_data/test2.fastq" \ --outdir output # Check if output directory exists @@ -109,7 +107,7 @@ echo "> Run Test 3: multiple options-1" --format jpg \ --prefix biobox_ \ --store \ - --color yellow \ + --color "yellow" \ --info_in_report \ --outdir output diff --git a/src/nanoplot/test_data/test1.fastq b/src/nanoplot/test_data/test1.fastq index 7bc0dc94..f262027d 100644 --- a/src/nanoplot/test_data/test1.fastq +++ b/src/nanoplot/test_data/test1.fastq @@ -46,5 +46,4 @@ DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD @read_10 ACTGGTATGTCGTGGTACCCTTGA + -111111111111111111111111 - +111111111111111111111111 \ No newline at end of file diff --git a/src/nanoplot/test_data/test2.fastq b/src/nanoplot/test_data/test2.fastq index 242cb659..b9283728 100644 --- a/src/nanoplot/test_data/test2.fastq +++ b/src/nanoplot/test_data/test2.fastq @@ -31,5 +31,4 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA @read_7 AATAAAGCCCGTTCCACACTTTAGCAATGTCAAGACTGTATCATCGACAGCGGTAGTTATGTAGCCAGCACATTTCATTACCCCCTCGC + -77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 - +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 \ No newline at end of file