From 6a81a19c61faa0b412584671db0bee75dd367e24 Mon Sep 17 00:00:00 2001 From: tgaspe Date: Thu, 8 Aug 2024 09:48:07 -0300 Subject: [PATCH] bug fixing --- .../bedtools_genomecov/config.vsh.yaml | 4 +- src/bedtools/bedtools_genomecov/script.sh | 8 ++-- src/bedtools/bedtools_genomecov/test.sh | 38 +++++++++++++------ 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/bedtools/bedtools_genomecov/config.vsh.yaml b/src/bedtools/bedtools_genomecov/config.vsh.yaml index 40e9a97e..452153b5 100644 --- a/src/bedtools/bedtools_genomecov/config.vsh.yaml +++ b/src/bedtools/bedtools_genomecov/config.vsh.yaml @@ -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: | diff --git a/src/bedtools/bedtools_genomecov/script.sh b/src/bedtools/bedtools_genomecov/script.sh index 5dac5946..06a120b7 100644 --- a/src/bedtools/bedtools_genomecov/script.sh +++ b/src/bedtools/bedtools_genomecov/script.sh @@ -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 \ @@ -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"} \ diff --git a/src/bedtools/bedtools_genomecov/test.sh b/src/bedtools/bedtools_genomecov/test.sh index 5305438f..40cff0ff 100644 --- a/src/bedtools/bedtools_genomecov/test.sh +++ b/src/bedtools/bedtools_genomecov/test.sh @@ -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" < 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! ----"