Thanks for your response. How to get those sequences along their corresponding header?
Input file in .fasta format containing many sequences with different headers.
• 0 views
•
link
Hello Everyone,
I want to filter sequence based on length between 15 - 30 nt from large file of RNA sequences (fasta format).
How to do this?
I appreciate any help.
Thanks
Assuming that your sequences are on one line:
$ awk '{ \
if ($0 ~ /^>/) { \
header = $0; \
} \
else { \
l = length($0); \
if ((l >= 15) && (l <= 30)) { \
printf("%s\n%s\n", header, $0); \
} \
} \
}' foo.fa
Look at this Biostars question if you need to preprocess your FASTA file to put its sequences on one line.
Log in to answer this question.