# How to retrieve fasta sequence after local blast?

I have created a Blast database using a reference genome. Then, I have performed a local blast search in command line using a gene of interest. I have obtained some hits with the usual Blasting information. Now, I want to extract the exact matching sequence from the blast search with their corresponding start and stop position. I have a .gff file for the genes as well for the reference genome. Can you give me any suggestions on how to do that? Thanks a lot.

• Please edit your question and add an example of the relevant files so we can understand what you need. Do you have multiple HSPs you want to combine? Do you need to model splicing? If you already have the gff of the target sequence, why were you blasting? Dec 11, 2021 at 16:52

My usual approach for extracting sequence from a reference genome is to use samtools faidx:
# create genome index; slow; only do once per reference genome