diff --git a/src/umi_tools/umi_tools_extract/config.vsh.yaml b/src/umi_tools/umi_tools_extract/config.vsh.yaml index a980f149..b93c8cb9 100644 --- a/src/umi_tools/umi_tools_extract/config.vsh.yaml +++ b/src/umi_tools/umi_tools_extract/config.vsh.yaml @@ -28,6 +28,7 @@ argument_groups: description: File containing the input data for the R2 reads (if paired). If provided, a need to be provided. example: sample_R2.fastq - name: --bc_pattern + alternatives: -p type: string description: | The UMI barcode pattern to use e.g. 'NNNNNN' indicates that the first 6 nucleotides @@ -38,7 +39,7 @@ argument_groups: - name: "Output" arguments: - - name: --read1_out + - name: --output type: file required: true description: Output file for read 1. diff --git a/src/umi_tools/umi_tools_extract/script.sh b/src/umi_tools/umi_tools_extract/script.sh index 32958c16..5e41865d 100644 --- a/src/umi_tools/umi_tools_extract/script.sh +++ b/src/umi_tools/umi_tools_extract/script.sh @@ -7,7 +7,6 @@ set -exo pipefail test_dir="${metal_executable}/test_data" -[[ "$par_paired" == "false" ]] && unset par_paired [[ "$par_error_correct_cell" == "false" ]] && unset par_error_correct_cell [[ "$par_reconcile_pairs" == "false" ]] && unset par_reconcile_pairs [[ "$par_three_prime" == "false" ]] && unset par_three_prime @@ -19,29 +18,37 @@ test_dir="${metal_executable}/test_data" # Check if we have the correct number of input files and patterns for paired-end or single-end reads # For paired-end rends, check that we have two read files, two patterns -if [ -n "$par_paired" ]; then - if [ -z "$par_input" ] || [ -z "$par_read2_in" ] || - [ -z "$par_bc_pattern" ] || [ -z "$par_bc_pattern2" ]; - then - echo "Paired end input requires two read files, two UMI patterns, and two output files" +# Check for paired-end inputs +if [ -n "$par_input" ] && [ -n "$par_read2_in" ]; then + # Paired-end checks: Ensure both UMI patterns are provided + if [ -z "$par_bc_pattern" ] || [ -z "$par_bc_pattern2" ]; then + echo "Paired end input requires two UMI patterns." exit 1 fi -else # For single-end reads, check that we have only one read file, one pattern - if [ -n "$par_read2_in" ] || [ -n "$par_bc_pattern2" ]; then - echo "Single end input requires only one read file and one UMI pattern" +elif [ -n "$par_input" ]; then + # Single-end checks: Ensure no second read or UMI pattern for the second read is provided + if [ -n "$par_bc_pattern2" ]; then + echo "Single end input requires only one read file and one UMI pattern." exit 1 - # if par_umi_discard_read is not empty or not 0: - elif [ -n "$par_umi_discard_read" ] && [ "$par_umi_discard_read" != 0 ]; then + fi + # Check that discard_read is not set or set to 0 for single-end reads + if [ -n "$par_umi_discard_read" ] && [ "$par_umi_discard_read" != 0 ]; then echo "umi_discard_read is only valid when processing paired end reads." exit 1 fi +else + # No inputs provided + echo "No input files provided." + exit 1 fi + + umi_tools extract \ -I "$par_input" \ ${par_read2_in:+ --read2-in "$par_read2_in"} \ - -S "$par_read1_out" \ + -S "$par_output" \ ${par_read2_out:+--read2-out "$par_read2_out"} \ ${par_extract_method:+--extract-method "$par_extract_method"} \ --bc-pattern "$par_bc_pattern" \ diff --git a/src/umi_tools/umi_tools_extract/test.sh b/src/umi_tools/umi_tools_extract/test.sh index ed8d4741..0de5d5b3 100644 --- a/src/umi_tools/umi_tools_extract/test.sh +++ b/src/umi_tools/umi_tools_extract/test.sh @@ -8,7 +8,6 @@ echo ">>> Testing $meta_functionality_name" echo ">>> Test 1: Testing for paired-end reads" "$meta_executable" \ - --paired \ --input "$test_dir/scrb_seq_fastq.1_30"\ --read2_in "$test_dir/scrb_seq_fastq.2_30" \ --bc_pattern "CCCCCCNNNNNNNNNN"\ @@ -17,7 +16,7 @@ echo ">>> Test 1: Testing for paired-end reads" --umi_separator '_' \ --grouping_method directional \ --umi_discard_read 0 \ - --read1_out scrb_seq_fastq.1_30.extract \ + --output scrb_seq_fastq.1_30.extract \ --read2_out scrb_seq_fastq.2_30.extract \ --random_seed 1 @@ -39,7 +38,6 @@ rm scrb_seq_fastq.1_30.extract scrb_seq_fastq.2_30.extract echo ">>> Test 2: Testing for paired-end reads with umi_discard_reads option" "$meta_executable" \ - --paired \ --input "$test_dir/scrb_seq_fastq.1_30" \ --read2_in "$test_dir/scrb_seq_fastq.2_30" \ --bc_pattern CCCCCCNNNNNNNNNN \ @@ -48,7 +46,7 @@ echo ">>> Test 2: Testing for paired-end reads with umi_discard_reads option" --umi_separator '_' \ --grouping_method directional \ --umi_discard_read 2 \ - --read1_out scrb_seq_fastq.1_30.extract \ + --output scrb_seq_fastq.1_30.extract \ --random_seed 1 echo ">> Checking if the correct files are present" @@ -71,7 +69,7 @@ echo ">>> Test 3: Testing for single-end reads" --extract_method regex \ --umi_separator '_' \ --grouping_method directional \ - --read1_out slim_30.extract \ + --output slim_30.extract \ --random_seed 1 echo ">> Checking if the correct files are present"