Skip to content

Commit

Permalink
bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
tgaspe committed Aug 8, 2024
1 parent bac80a5 commit 6a81a19
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/bedtools/bedtools_genomecov/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ argument_groups:
Change strand af the mate read (so both reads from the same strand) useful for strand specific
Works for BAM files only
- name: --5_prime
- name: --five_prime
alternatives: -5
type: boolean_true
description: |
Calculate coverage of 5" positions (instead of entire interval).
- name: --3_prime
- name: --three_prime
alternatives: -3
type: boolean_true
description: |
Expand Down
8 changes: 4 additions & 4 deletions src/bedtools/bedtools_genomecov/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
[[ "$par_pair_end_coverage" == "false" ]] && unset par_pair_end_coverage
[[ "$par_fragment_size" == "false" ]] && unset par_fragment_size
[[ "$par_du" == "false" ]] && unset par_du
[[ "$par_5_prime" == "false" ]] && unset par_5_prime
[[ "$par_3_prime" == "false" ]] && unset par_3_prime
[[ "$par_five_prime" == "false" ]] && unset par_five_prime
[[ "$par_three_prime" == "false" ]] && unset par_three_prime
[[ "$par_trackline" == "false" ]] && unset par_trackline

bedtools genomecov \
Expand All @@ -28,8 +28,8 @@ bedtools genomecov \
${par_pair_end_coverage:+-pc} \
${par_fragment_size:+-fs} \
${par_du:+-du} \
${par_5_prime:+-5} \
${par_3_prime:+-3} \
${par_five_prime:+-5} \
${par_three_prime:+-3} \
${par_trackline:+-trackline} \
${par_strand:+-strand "$par_strand"} \
${par_max:+-max "$par_max"} \
Expand Down
38 changes: 26 additions & 12 deletions src/bedtools/bedtools_genomecov/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@ echo "Creating Test Data..."
mkdir -p test_data

# Create and populate input files
printf "chr1\t248956422\nchr3\t242193529\nchr2\t198295559\n" > "test_data/genome.txt"
printf "chr2:172936693-172938111\t128\t228\tmy_read/1\t37\t+\nchr2:172936693-172938111\t428\t528\tmy_read/2\t37\t-\n" > "test_data/example.bed"
printf "chr2:172936693-172938111\t128\t228\tmy_read/1\t60\t+\t128\t228\t255,0,0\t1\t100\t0\nchr2:172936693-172938111\t428\t528\tmy_read/2\t60\t-\t428\t528\t255,0,0\t1\t100\t0\n" > "test_data/example.bed12"
# Create and populate example.gff file
printf "##gff-version 3\n" > "test_data/example.gff"
printf "chr1\t.\tgene\t1000\t2000\t.\t+\t.\tID=gene1;Name=Gene1\n" >> "test_data/example.gff"
printf "chr3\t.\tmRNA\t1000\t2000\t.\t+\t.\tID=transcript1;Parent=gene1\n" >> "test_data/example.gff"
printf "chr1\t.\texon\t1000\t1200\t.\t+\t.\tID=exon1;Parent=transcript1\n" >> "test_data/example.gff"
printf "chr2\t.\texon\t1500\t1700\t.\t+\t.\tID=exon2;Parent=transcript1\n" >> "test_data/example.gff"
printf "chr1\t.\tCDS\t1000\t1200\t.\t+\t0\tID=cds1;Parent=transcript1\n" >> "test_data/example.gff"
printf "chr1\t.\tCDS\t1500\t1700\t.\t+\t2\tID=cds2;Parent=transcript1\n" >> "test_data/example.gff"
printf "chr1\t248956422\nchr2\t198295559\nchr3\t242193529\n" > "test_data/genome.txt"
printf "chr2\t128\t228\tmy_read/1\t37\t+\nchr2\t428\t528\tmy_read/2\t37\t-\n" > "test_data/example.bed"
printf "chr2\t128\t228\tmy_read/1\t60\t+\t128\t228\t255,0,0\t1\t100\t0\nchr2\t428\t528\tmy_read/2\t60\t-\t428\t528\t255,0,0\t1\t100\t0\n" > "test_data/example.bed12"

# expected output
cat > "test_data/expected_default.bed" <<EOF
chr2 0 198295359 198295559 0.999999
chr2 1 200 198295559 1.0086e-06
chr1 0 248956422 248956422 1
chr3 0 242193529 242193529 1
genome 0 689445310 689445510 1
genome 1 200 689445510 2.90088e-07
EOF

# Test 1:
mkdir test1
Expand All @@ -56,11 +57,24 @@ echo "> Run bedtools_genomecov on BED file"
# checks
assert_file_exists "output.bed"
assert_file_not_empty "output.bed"
#assert_identical_content "output.bed" "../test_data/expected_default.bed"
assert_identical_content "output.bed" "../test_data/expected_default.bed"
echo "- test1 succeeded -"

cd ..

# Test 2: ibam option and pair end option and fragment size option

# Test 3: depth option

# Test 4: strand option

# Test 5: 5' end option

# Test 6: max option

# Test 7: scale option

# Test 8: trackopts option


echo "---- All tests succeeded! ----"
Expand Down

0 comments on commit 6a81a19

Please sign in to comment.