I am using bedtools getfasta to convert genomic coordinates to sequences. I feed it a bedfile containing say chr1 s.start s.end. When I check the sequence output, it does not include the s.start base. For example if the bedfile entry is chr1 23456 23678, it gets the sequence from 23457-23678. Is this a feature and I should use a tag to make it include the first base? The command I am using is bedtools getfasta -fi genome.fa -fo gene.fa -bed input.bed I tried this in bedtools versions 2.27.1 and 2.30.1


1 Answer 1


BED files are 0-based. I link this old but gold biostars thread for more background. Essentially, from normal counting with start 1 you subtract 1 from the start coordinate.

For example in the sequence ATCGGG the TCGGG substring would have "normal" (aka human-readable) coordinates 2-6, but in BED format that would be:

chrSomething    1    6

Here is the bedtools "proof":

$ cat foo.bed
chrSomething    1       6

$ cat foo.fa

$ bedtools getfasta -fi foo.fa -bed foo.bed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.