This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bedtools flank error for negative strand

Hi everyone,

I am currently having troubles with using bedtools flank on negative strand. I want to have the 6000bp upstream of my chromosomal loci. I used this and it worked for my positive strand, but not negative strand.

bedtools flank -i SRR14194206_minus_bottom_sorted_removed_no_overlap_gene.bed -g biomart_test_2.bed -l 6000 -r 0 -s > test.bed

Here is the output:

chr1    191448889   26432282    ID=FL_L1-0331   .   -   191442811   191448889   L1.3_300bp5NoF  290 5916    6078    0.9733465
chr22   22282812    22288812    ID=FL_L1-5209   .   -   22276801    22282812    L1.3_300bp5NoF  262 4222    6011    0.702379

Instead of giving out coordinates of chr1:191,448,889-191,454,889 (6000 bp upstream), it gives out this output of chr1:191,448,889-26,432,282, whose start coordinate is bigger than end coordinate (invalid for .bed file). I have tried to switch up -l 0 -r 6000 -s and eliminated the -s parameter, but this gave me the 6000bp downstream of negative strand instead of upstream.

Any insights of what I am doing wrong? Thank you!

bedtools bash

I checked my output file again and realized that some coordinates were correct but some were wrong like the example above. Could this be a bug?

1 answer

When I upgraded to bedtools/2.30.0, this problem was resolved. Also, I used a different genome file (Homo_sapiens.GRCh38.107.chr.chromlabel.bed) and it was more comprehensive than the one I used before.

Log in to answer this question.