Getting Sequence Based On Chromosome No And Coordinates From Whole Genome Fasta File
I am having chromosome no or fasta header and coordinates and their orientation. For example
Chr:start:end:strand
chr8:1100023:1100050:+
(this list is quite long say about 15000 coordinates)
and whole genome sequence in fasta format in other file, for example:
>(fasta)chr8
sequence
Is there any tool or program or utility available to extract the sequences on the basis of coordinates from genome sequence file.
Any help will be highly appreciated.
Thanks in advance
• 15,244 views
•
link
3 answers
Samtools can do this.
#First, index your fasta file (only have to do this once)
samtools faidx reference.fa
#then extract the sequences you want
samtools faidx ref.fasta 1:1234-9876
• 124 views
•
link
look at extractseq from emboss
you could do something like (not tested) in bash:
extractseq chr8.fasta -reg $(awk 'BEGIN{FS=":" ; ORS=","}{print $2 ".." $3 }' inputfile) stdout -separate
• 2 views
•
link
Log in to answer this question.