Skip to content

Commit

Permalink
add a 4th test, fix option names in the script
Browse files Browse the repository at this point in the history
  • Loading branch information
emmarousseau committed May 9, 2024
1 parent 48cb40b commit 6a07f1e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
- `samtools/samtools_index`: Index SAM/BAM/CRAM files (PR #35).
- `samtools/samtools_sort`: Sort SAM/BAM/CRAM files (PR #36).
- `samtools/samtools_stats`: Reports alignment summary statistics for a BAM file (PR #39).
- `samtools/samtools_view`: Views and converts SAM/BAM/CRAM files (PR #45).
- `samtools/samtools_view`: Views and converts SAM/BAM/CRAM files (PR #48).

## MAJOR CHANGES

Expand Down
9 changes: 6 additions & 3 deletions src/samtools/samtools_view/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ argument_groups:
description: |
Only output alignments overlapping the input BED FILE [null].
- name: --region_file
alternatives: --regions_file
type: file
description: |
Use an index and multi-region iterator to only output alignments overlapping the input BED FILE.
Expand Down Expand Up @@ -108,13 +107,13 @@ argument_groups:
with a known suffix.
- name: --uncompressed
alternatives: -u
type: boolean_true
description: |
Output uncompressed data. This also changes the default output format to BAM,
but this can be overridden by the explicit format options or using a filename
with a known suffix.
This option saves time spent on compression/decompression and is thus preferred
when the output is piped to another samtools command.
type: boolean_true
- name: --with_header
type: boolean_true
description: |
Expand All @@ -135,7 +134,7 @@ argument_groups:
type: boolean_true
description: |
Instead of printing the alignments, only count them and print the total number.
All filter options, such as --require-flags, --excl-flags, and --min-MQ, are taken
All filter options, such as --require_flags, --excl_flags, and --min_MQ, are taken
into account. The --unmap option is ignored in this mode.
- name: --output_unselected
alternatives: -U
Expand Down Expand Up @@ -329,6 +328,10 @@ argument_groups:
type: string
description: |
Specify a single output file format option in the form of OPTION or OPTION=VALUE.
- name: --write_index
type: boolean_true
description: |
Automatically index the output files.
resources:
- type: bash_script
Expand Down
7 changes: 4 additions & 3 deletions src/samtools/samtools_view/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ set -e
[[ "$par_fetch_pairs" == "false" ]] && unset par_fetch_pairs
[[ "$par_customized_index" == "false" ]] && unset par_customized_index
[[ "$par_no_PG" == "false" ]] && unset par_no_PG

[[ "$par_write_index" == "false" ]] && unset par_write_index
[[ "$par_remove_B" == "false" ]] && unset par_remove_B

samtools view \
${par_bam:+-b} \
Expand Down Expand Up @@ -48,8 +49,8 @@ samtools view \
${par_min_qlen:+-m "$par_min_qlen"} \
${par_expr:+-e "$par_expr"} \
${par_require_flags:+-f "$par_require_flags"} \
${par_exclude_flags:+-F "$par_exclude_flags"} \
${par_incl_flags:+--rf "$par_include_flags"} \
${par_excl_flags:+-F "$par_excl_flags"} \
${par_incl_flags:+--rf "$par_incl_flags"} \
${par_excl_all_flags:+-G "$par_excl_all_flags"} \
${par_subsample:+--subsample "$par_subsample"} \
${par_subsample_seed:+--subsample-seed "$par_subsample_seed"} \
Expand Down
8 changes: 4 additions & 4 deletions src/samtools/samtools_view/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

test_dir="${meta_resources_dir}/test_data"
temp_dir="${meta_resources_dir}/tmp"
temp_dir="${meta_resources_dir}/out"

############################################################################################

Expand All @@ -24,7 +24,7 @@ diff <(samtools view "$temp_dir/a.bam") <(samtools view "$test_dir/a.bam") || \

############################################################################################

echo ">>> Test 2: ${meta_functionality_name} with --output_format CRAM"
echo ">>> Test 2: ${meta_functionality_name} with CRAM format output"

"$meta_executable" \
--cram \
Expand Down Expand Up @@ -67,8 +67,8 @@ echo ">>> Test 4: ${meta_functionality_name} including only the forward reads fr

"$meta_executable" \
--output "$temp_dir/a.forward" \
--excl_flags "147" \
--input "$test_dir/a.sam"
--excl_flags "0x80" \
--input "$test_dir/a.sam"

echo ">>> Checking whether output exists"
[ ! -f "$temp_dir/a.forward" ] && echo "File 'a.forward' does not exist!" && exit 1
Expand Down
3 changes: 3 additions & 0 deletions src/samtools/samtools_view/test_data/a.forward
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a1 99 xx 1 1 10M = 11 20 AAAAAAAAAA **********
b1 99 xx 1 1 10M = 11 20 AAAAAAAAAA **********
c1 99 xx 1 1 10M = 11 20 AAAAAAAAAA **********

0 comments on commit 6a07f1e

Please sign in to comment.