<p>First I edited the Chromosome column of the bed file from ncbi, because it contained the accession number instead of the chromosome. Then I used the getfasta tool of the bedtools utility.</p>
<p><code>bedtools getfasta -fi input_genome_file.fa -fo output.fa -bed bed_file</code></p>
<p>The output contained the introns in the format I wanted.
If anybody had a better way, feel free to post.</p>

CC BY-SA 4.0
2023-01-16T18:00:22.310Z
Hi @venkateshwar thank you for sharing this information. Could you just confirm that this is the answer to the question you posted (it looks like it)?
M__
CC BY-SA 4.0
2023-01-17T05:21:38.890Z
@M__ Ok I will.
venkatesh war
CC BY-SA 4.0
2023-01-16T13:17:28.990Z
2023-01-16T13:17:28.990Z
venkatesh war
<p>I was able to get the exons of a particular gene as a fasta file from the NCBI genome viewer. As for introns I only found a bed file that showed where the intron starts and ends, along with its direction. What tool do I use to get the exact sequence of these 11 introns using this bed file?
And is there a more direct way?
Thank you.</p>

<gene><reference-genome><bed>
How to get a file with the introns of a gene?
# How to get a file with the introns of a gene?

(Asked by: username_0 on 2023-01-16)

I was able to get the exons of a particular gene as a fasta file from the NCBI genome viewer. As for introns I only found a bed file that showed where the intron starts and ends, along with its direction. What tool do I use to get the exact sequence of these 11 introns using this bed file?
And is there a more direct way?
Thank you.

**Tags:** gene, reference-genome, bed

---

## 1 answers

### Answer by username_0 on 2023-01-16. Score: 1

First I edited the Chromosome column of the bed file from ncbi, because it contained the accession number instead of the chromosome. Then I used the getfasta tool of the bedtools utility.

`bedtools getfasta -fi input_genome_file.fa -fo output.fa -bed bed_file`

The output contained the introns in the format I wanted.
If anybody had a better way, feel free to post.

> **Comments:**
> **username_1**: Hi @venkateshwar thank you for sharing this information. Could you just confirm that this is the answer to the question you posted (it looks like it)?  
> **username_0**: @M__ Ok I will.  

---

