Thank you so much ! I will try this option too !
Hello everyone I have a Fasta file of predicted elements but I want to filter by size greater than 120 bp that is less than 120 bp I want to eliminate.
>NODE_19_length_97_cov_3.030928
TTTTGACCTAACCACGTATCGTAATGAAATTAGGTTCAAACAATCAAACCATATCATAAG
GATATCAATTATGAAATCAGGGCATCTAATTGAACTTAAAAGGACATCGTCGGCCCACTG
GCCag
Thank you !
3 answers
non-awk solution:
seqkit seq -m 120 test.fa -o test.fitlered.fa
download seqkit from here: https://bioinf.shenwei.me/seqkit/download/
Here's an awk-based approach, if your FASTA records are single-lined (header on one line, sequence on the next line, and so on):
$ awk '!/^>/ { next } { getline seq } length(seq) >= 120 { print $0 "\n" seq }' input.fa > output.fa
If multi-lined (header on one line, sequence split across two or more lines), then the input.fa would need preprocessing to make it single-lined. There are other answers on Biostars that explain how to do this.
Via: http://itrylinux.com/use-awk-to-filter-fasta-file-by-minimum-sequence-length/
Thank you so much, I will try this !
Log in to answer this question.