This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Question about awk command line - follow-up
$ awk -vPRIMER="ACTG" '{if ($0~/^>/) { print $0; } else { print PRIMER$0; }}' in.fa > out.fa

(by Alex Reynolds)

Can this code be modified to add primer sequence in the end of the complete sequence, what we have generated in the previous code? And I assume we will already use the reverse complement sequence so that we dont have to include that thing in the code.

sequence

yes... i tried to post on there... but may be,,because it was solved... it didnot catch attention.... ... thus i had to post as a new post

1 answer

Reposition PRIMER$0 to $0PRIMER to move the string to the end.

Thankyou very-3 much @Alex Reynolds !!!

with your code, i tried to mix both command, and guess what ... it worked !!!

awk -vfPRIMER="forwardprimer" -vrPRIMER="reverseprimer" '{if ($0~/^>/) { print $0; } else { print fPRIMER$0rPRIMER; }}' in.fasta > out.fasta

Log in to answer this question.