Thank you! This worked fine!
• 0 views
•
link
I want to change my entries in my fasta file, but I want to keep certain numbers. I work with Linux
For example
Current names:
>NODE_1_length_140009_cov_0.223002
>NODE_2_length_119367_cov_0.245541
>NODE_3_length_108076_cov_0.169347
And I want them to change to:
>lclav_contig 1 lengte 140009 cov 0.223002
>lclav_contig 2 lengte 119367 cov 0.245541
>lclav_contig 3 lengte 108076 cov 0.169347
I know i have to work with awk but I'm stuck at the moment. Thank you for the help in advance!
sed 's/NODE/lclav_contig/' {INPUT FILE} | sed 's/_/ /g' | sed 's/ /_/1' > {OUTPUT FILE}
*Apologies, should have replied inline.
echo '>NODE_1_length_140009_cov_0.223002' | sed -re 's/>[A-Z]+_([0-9])_[a-z]+_([0-9]+)_([a-z]+)_(.*)/>lclav_contig \1 lengte \2 \3 \4/g'
>lclav_contig 1 lengte 140009 cov 0.223002
Most of the tools stop handling characters after first space. New headers (new format) may create a problem, in future.
Log in to answer this question.
You can use
sedto make two changes. Replace_withspaceand thenNODEwithlclav_contig. I assumelengteis an error but if not that will be the third replacement.Thank you!
lengte is length in my native langue so no error ;)