Extract fasta sequence from multifasta file using id and position in range
Hi,
I have a multifasta file from which I want to extract sequence based on id and position of sequence in specific range. Please suggest some tool or program that can be useful. My seq file is:
>seq1
ATGGAGAGCCTTGTCCCTGGTTTCAACGAGAAAACACACGTCC
>seq2
AACTCAGTTTGCCTGTTTTACAGGTTCGCGACGTGCTCGTACGTGGCT
>seq3
TTGGAGACTCCGTGGAGGAGGTCTTATCAGAGGCACGTCAACATCTTAAAGATGGCACTTGTGGCTTAG
My id file is:
seq1 5 15
seq2 2 10
seq3 10 20
• 2,152 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Use
seqtk(LINK).You can use the following code:
To use this code you first need to delete empty lines from your sequence file:
if you don't want to modify the original file, try:
If each of your sequences is one line, you can use this code too:
If you want to add start and stop to the header, you can use this echo instead of
echo ">"$id:The output:
; donewas missing from two of my commands. I added them.You have tagged
R, but are asking for any tools. Can you clarify your requirements?