Answers.Body: <p>BED files are 0-based. I link this old but gold <a href="https://www.biostars.org/p/84686/" rel="nofollow noreferrer">biostars</a> thread for more background. Essentially, from normal counting with start 1 you subtract 1 from the start coordinate.</p>
  <p>For example in the sequence <code>ATCGGG</code> the <code>TCGGG</code> substring would have &quot;normal&quot; (aka human-readable) coordinates 2-6, but in BED format that would be:</p>
  <pre><code>chrSomething    1    6
  </code></pre>
  <p>Here is the bedtools &quot;proof&quot;:</p>
  <pre class="lang-bash prettyprint-override"><code>$ cat foo.bed
  chrSomething    1       6
  
  $ cat foo.fa
  &gt;chrSomething
  ATCGGG
  
  $ bedtools getfasta -fi foo.fa -bed foo.bed
  &gt;chrSomething:1-6
  TCGGG
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-03T12:10:28.930Z
Answers.LastActivityDate: 2023-08-04T06:38:16.237Z
Answers.LastEditDate: 2023-08-04T06:38:16.237Z
Answers.UserDisplayName: ATpoint
Body: <p>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 <code>bedtools getfasta -fi genome.fa -fo gene.fa -bed input.bed</code>
  I tried this in bedtools versions 2.27.1 and 2.30.1</p>
  
Tags: <genome><bed><bedtools>
Title: Why doesn't bedtools getfasta pick up the first base?
ThreadText: # Why doesn't bedtools getfasta pick up the first base?
  
  (Asked by: username_0 on 2023-08-03)
  
  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
  
  **Tags:** genome, bed, bedtools
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-08-03. Score: 3 | Accepted answer
  
  BED files are 0-based. I link this old but gold [biostars](https://www.biostars.org/p/84686/) 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":
  
  ```bash
  $ cat foo.bed
  chrSomething    1       6
  
  $ cat foo.fa
  >chrSomething
  ATCGGG
  
  $ bedtools getfasta -fi foo.fa -bed foo.bed
  >chrSomething:1-6
  TCGGG
  
  ```
  
  
  ---
  
  