Hi Everyone
I was recently asked to compare the primers we produced in our lab with the published primers and see if they are 100% similar or not. This was an SWGA experiment but you can use the code snippet for any other cases as well.
I started with BlastN but since primers were really small (10bp), it was difficult to get anything even when the database was of primers itself. I therefore thought of returning to the basics and use Needleman–Wunsch
algorithm for this purpose.
mamba install -c bioconda emboss
## First I split my query primer file into separate fasta files using
awk '/^>/ {out = substr($1, 2) ".fasta"; print > out} !/^>/ {print >> out}' query/query.fasta
## Then I used the needle command of emboss to carry out primer to primer global alignment
ls -1 *.fasta | while read p;
do
needle $p published/published.fasta -gapopen 10 -gapextend 0.5 -outfile $p.needle;
done
This will produce .needle
files (this isn't a new file format just the way I like saving the results with tool name) which will contain the alignment results with all the published primers in the published.fasta
file. So needle
command will perform one-against-all alignment.
Further if you want you can retrieve the Identity value and create all-vs-all identity heatmap for your paper.
If you think there is a better way to do this, I am all ears!! Please drop comments and suggestions.
Interesting. I hope you also have a way to visualize the all-vs-all primer comparison as something like this where the Y-axis have published primers and x-axis have in-house primers