Skip to content

Commit

Permalink
Test Script
Browse files Browse the repository at this point in the history
  • Loading branch information
tgaspe committed Jul 30, 2024
1 parent 3676351 commit 8430eb5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/bedtools/bedtools_bamtofastq/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ argument_groups:
type: file
description: Output FASTQ file.
required: true

- name: Options
arguments:

- name: --output_fq2
alternatives: -fq2
type: file
description: |
FASTQ for second end. Used if BAM contains paired-end data.
BAM should be sorted by query name is creating paired FASTQ.
- name: Options
arguments:
- name: --tags
type: boolean_true
description: |
Expand Down
53 changes: 52 additions & 1 deletion src/bedtools/bedtools_bamtofastq/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
#!/bin/bash

#viash ns build -q bedtools_bamtofastq --setup cb
# viash ns build -q bedtools_bamtofastq --setup cb

# exit on error
set -e

## VIASH START
meta_executable="target/executable/bedtools/bedtools_sort/bedtools_bamtofastq"
meta_resources_dir="src/bedtools/bedtools_bamtofastq"
## VIASH END

#############################################
# helper functions
assert_file_exists() {
[ -f "$1" ] || { echo "File '$1' does not exist" && exit 1; }
}
assert_file_not_empty() {
[ -s "$1" ] || { echo "File '$1' is empty but shouldn't be" && exit 1; }
}
assert_file_contains() {
grep -q "$2" "$1" || { echo "File '$1' does not contain '$2'" && exit 1; }
}
assert_identical_content() {
diff -a "$2" "$1" \
|| (echo "Files are not identical!" && exit 1)
}
#############################################

# Create directories for tests
echo "Creating Test Data..."
mkdir -p test_data

# Create and populate example files

# Create expected output files


# Test 1:
mkdir test1
cd test1

echo "> Run bedtools bamtofastq on BAM file"
"$meta_executable" \
--input "example.bam" \
--output_fq "output.fastq"

# checks
assert_file_exists "output.fastq"
assert_file_not_empty "output.fastq"
assert_identical_content "output.fastq" "../test_data/expected.fastq"
echo "- test1 succeeded -"

cd ..

# Test 2:

0 comments on commit 8430eb5

Please sign in to comment.