Skip to content

Commit

Permalink
adding n_score option
Browse files Browse the repository at this point in the history
  • Loading branch information
tgaspe committed Aug 26, 2024
1 parent 17fd355 commit 950c902
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bedtools/bedtools_bed12tobed6/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ argument_groups:

- name: Options
arguments:
- name: --n
- name: --n_score
alternatives: -n
type: boolean_true
description: |
Expand All @@ -63,4 +63,5 @@ engines:
runners:
- type: executable
- type: nextflow
- type: nextflow

4 changes: 4 additions & 0 deletions src/bedtools/bedtools_bed12tobed6/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

set -eo pipefail

# Unset parameters
[[ "$par_n_score" == "false" ]] && unset par_n_score

# Execute bedtools bed12tobed6 conversion
bedtools bed12tobed6 \
${par_n_score:+-n} \
-i "$par_input" \
> "$par_output"
23 changes: 23 additions & 0 deletions src/bedtools/bedtools_bed12tobed6/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ chr21 10079666 10120808 uc002yiv.1 0 -
chr21 10080031 10081687 uc002yiw.1 0 -
chr21 10081660 10120796 uc002yix.2 0 -
EOF
# Expected output bed6 file
cat <<EOF > "$TMPDIR/expected_n.bed6"
chr21 10079666 10120808 uc002yiv.1 1 -
chr21 10080031 10081687 uc002yiw.1 1 -
chr21 10081660 10120796 uc002yix.2 1 -
EOF

# Test 1: Default conversion BED12 to BED6
mkdir "$TMPDIR/test1" && pushd "$TMPDIR/test1" > /dev/null
Expand All @@ -58,5 +64,22 @@ echo "- test1 succeeded -"

popd > /dev/null

# Test 2: Conversion BED12 to BED6 with -n option
mkdir "$TMPDIR/test2" && pushd "$TMPDIR/test2" > /dev/null

echo "> Run bedtools_bed12tobed6 on BED12 file with -n option"
"$meta_executable" \
--input "../example.bed12" \
--output "output.bed6" \
--n_score

# checks
assert_file_exists "output.bed6"
assert_file_not_empty "output.bed6"
assert_identical_content "output.bed6" "../expected_n.bed6"
echo "- test2 succeeded -"

popd > /dev/null

echo "---- All tests succeeded! ----"
exit 0

0 comments on commit 950c902

Please sign in to comment.