This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Can someone provide me insight into how to extract a specific region of a FastQ file to run BLAST on?

Can someone provide me insight into how to extract a specific region of a FastQ file to run BLAST on?

genome sequence assembly alignment

1 answer

FASTQ files are not aligned, so extracting a specific region is not possible. Align first, then you can pull reads that aligned to specific regions.

Which file type should I be looking for? BAM? Then once I have a BAM or whichever file type how could I pull the specific region.

You can use samtools view to extract a specific region/chromosome etc from a sorted and indexed bam file:

samtools view -o <out.bam> <in.bam> chr1:100-1000 # saves all alignments against chromosome 1 between 100-1000 bp positions.

You can print or save the alignments to SAM format with samtools view <out.bam> > <out.sam>. You can visualize the alignments on IGV browser too.

Thank you so much this was extremely helpful!

Log in to answer this question.