Thanks, It works well. Fuyou
• 0 views
•
link
Hi, I have some reads like as:
>seq_5150639_x4
GGAACGAGATCGTCTGCAGTTGGC
>seq_5150619_x40
AACCGCCTGTAGAAATGCATGATT
X4 or X40 indicate how many reads same with the read. I want to remove lower than 10. How can I remove them? Thanks, Fuyou
Assuming the FASTA input is single-line:
awk and get the last part of the record header, split by the underscore (_)true-like value and print the headertrue-like valueFor example:
$ awk '{ \
if ($0 ~ /^>/) { \
n = split($0, a, "_"); \
r = int(substr(a[n], 2)); \
f = 0; \
if (r >= 10) { \
f = 1; \
print $0; \
} \
} \
else if (f) { \
print $0; \
} \
}' input.fa > output.fa
Thanks, It works well. Fuyou
Log in to answer this question.
Do you mean you want to remove reads whose ids containing
x10, x9 ...?the anwser is awk, again.
please, validate your previous questions: sequence head change! ; Add a sequence name! ; ...