diff --git a/CHANGELOG.md b/CHANGELOG.md index bd6a639a..b4c24ef4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,9 @@ * `star/star_align_reads`: Align reads to a reference genome (PR #22). +* `samtools`: + - `samtools/flagstat`: Counts the number of alignments in SAM/BAM/CRAM files for each FLAG type (PR #31). + ## MAJOR CHANGES ## MINOR CHANGES diff --git a/src/samtools/flagstat/config.vsh.yaml b/src/samtools/flagstat/config.vsh.yaml index b1a81d4d..c3374a37 100644 --- a/src/samtools/flagstat/config.vsh.yaml +++ b/src/samtools/flagstat/config.vsh.yaml @@ -1,6 +1,6 @@ name: samtools_flagstat namespace: samtools -description: Counts the number of alignments in SAM/BAM/CRAM files for each FLAG type.. +description: Counts the number of alignments in SAM/BAM/CRAM files for each FLAG type. keywords: [ stats, mapping, counts, bam, sam, cram] links: homepage: https://www.htslib.org/ diff --git a/src/samtools/flagstat/test.sh b/src/samtools/flagstat/test.sh index 43a52578..7e2bf4e5 100644 --- a/src/samtools/flagstat/test.sh +++ b/src/samtools/flagstat/test.sh @@ -1,44 +1,45 @@ #!/bin/bash +test_dir="${meta_resources_dir}test_data" echo ">>> Testing $meta_functionality_name" "$meta_executable" \ - --bam "$meta_resources_dir/test_data/a.bam" \ - --bai "$meta_resources_dir/test_data/a.bam.bai" \ - --output "$meta_resources_dir/test_data/a.flagstat" + --bam "$test_dir/a.bam" \ + --bai "$test_dir/a.bam.bai" \ + --output "$test_dir/a.flagstat" echo ">>> Checking whether output exists" -[ ! -f "$meta_resources_dir/test_data/a.flagstat" ] && echo "File 'a.flagstat' does not exist!" && exit 1 +[ ! -f "$test_dir/a.flagstat" ] && echo "File 'a.flagstat' does not exist!" && exit 1 echo ">>> Checking whether output is non-empty" -[ ! -s "$meta_resources_dir/test_data/a.flagstat" ] && echo "File 'a.flagstat' is empty!" && exit 1 +[ ! -s "$test_dir/a.flagstat" ] && echo "File 'a.flagstat' is empty!" && exit 1 echo ">>> Checking whether output is correct" -diff "$meta_resources_dir/test_data/a.flagstat" "$meta_resources_dir/test_data/a_ref.flagstat" || \ +diff "$test_dir/a.flagstat" "$test_dir/a_ref.flagstat" || \ (echo "Output file chr19.flagstat does not match expected output" && exit 1) -rm "$meta_resources_dir/test_data/a.flagstat" +rm "$test_dir/a.flagstat" ############################################################################################ echo ">>> Testing $meta_functionality_name with singletons in the input" "$meta_executable" \ - --bam "$meta_resources_dir/test_data/test.paired_end.sorted.bam" \ - --bai "$meta_resources_dir/test_data/test.paired_end.sorted.bam.bai" \ - --output "$meta_resources_dir/test_data/test.paired_end.sorted.flagstat" + --bam "$test_dir/test.paired_end.sorted.bam" \ + --bai "$test_dir/test.paired_end.sorted.bam.bai" \ + --output "$test_dir/test.paired_end.sorted.flagstat" echo ">>> Checking whether output exists" -[ ! -f "$meta_resources_dir/test_data/test.paired_end.sorted.flagstat" ] && echo "File 'test.paired_end.sorted.flagstat' does not exist!" && exit 1 +[ ! -f "$test_dir/test.paired_end.sorted.flagstat" ] && echo "File 'test.paired_end.sorted.flagstat' does not exist!" && exit 1 echo ">>> Checking whether output is non-empty" -[ ! -s "$meta_resources_dir/test_data/test.paired_end.sorted.flagstat" ] && echo "File 'test.paired_end.sorted.flagstat' is empty!" && exit 1 +[ ! -s "$test_dir/test.paired_end.sorted.flagstat" ] && echo "File 'test.paired_end.sorted.flagstat' is empty!" && exit 1 echo ">>> Checking whether output is correct" -diff "$meta_resources_dir/test_data/test.paired_end.sorted.flagstat" "$meta_resources_dir/test_data/test_ref.paired_end.sorted.flagstat" || \ +diff "$test_dir/test.paired_end.sorted.flagstat" "$test_dir/test_ref.paired_end.sorted.flagstat" || \ (echo "Output file chr19.flagstat does not match expected output" && exit 1) -rm "$meta_resources_dir/test_data/test.paired_end.sorted.flagstat" +rm "$test_dir/test.paired_end.sorted.flagstat" echo "All tests succeeded!"