This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Blog: Perform Primer to Primer comparison to see and show if the primers produced are new or 100% similar to published primers

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.

primers emboss needle

1 answer

You can also use bowtie v.1.x.

$ more test.fa
>te1
TCAATGCCAT
>te2
GGTCTACGTC
>te3
CGTGGGCACT
>te4
GCCGAGGACA
>te5
TACGAGCGCT

Build an index with reference

$ bowtie-build test.fa small

Align your sequences. Here I will simply provide them on the command line using -c option. Sequence 1 aligns with one error where as sequence 3 does not align.

$ bowtie -x small -c GGTCTACATC,GCCGAGGACA,TATCGATCGA,GGTCTACGTC
0       +       te2     0       GGTCTACATC      IIIIIIIIII      0       7:G>A
1       +       te4     0       GCCGAGGACA      IIIIIIIIII      0
3       +       te2     0       GGTCTACGTC      IIIIIIIIII      0
# reads processed: 4
# reads with at least one alignment: 3 (75.00%)
# reads that failed to align: 1 (25.00%)
Reported 3 alignments

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

enter image description here

Log in to answer this question.