Given a FASTA sequence, how can I design primers specifying the desired number of primers and a distance? e.g Generate 100 primers every 500bp. Thank you!
Given a FASTA sequence, how can I design primers specifying the desired number of primers and a distance? e.g Generate 100 primers every 500bp. Thank you!
Without more details, I assume standard PCR as application. I would start by cutting the fasta into equal (and maybe overlapping) chunks representing the amplicons you want, e.g. using shred.sh
from BBmap, see command-line tool to split genome FASTA into equal chunks?, and then use the command line version of Primer3 to design the primers. Manual for primer3 is also on Github, with plenty of options to customize your search.
Funnily enough, I just started writing something to do exactly this yesterday. It's still a work in progress, but so far is has the basic functionality of reading in a selection of fasta target sequences, and giving back primers that span either end of the sequence of a defined length.
Primer3 etc are much more mature though, so you might want to try them.
Here's a link to my project anyway:
linearize the fasta , split the fasta using a sliding window with awk (or see Fasta Sliding Window ), convert to primer3 input with awk, pipe into primer3.
awk '/^>/ {printf("%s%s\t",(N>0?"\n":""),$0);N++;next;} {printf("%s",$0);} END {printf("\n");}' input.fasta |\
awk -F '\t' '{L=length($2);W=500;S=100;for(i=1;i+W<=L;i+=S) {printf("PRIMER_THERMODYNAMIC_PARAMETERS_PATH=/your/path/to/primer3_config/\nSEQUENCE_ID=seq%d.%d\nSEQUENCE_TEMPLATE=%s\n=\n",NR,i,substr($2,i,W));}}' | \
/path/to/primer3-2.3.5/src/primer3_core
SEQUENCE_ID=seq1.1
SEQUENCE_TEMPLATE=GTTGATGCTCGAGATGGAGTCTACTCAGCAGATGGTGGGTTCTATTATCAACACTTCTTTTGAAGCCGCAGTTGTTGCTGCCACTTCAACATTAGAATTGATGGGTATTCAATATGATTATAATGAAGTTTTCACTAGAGTAAAGAGTAAATTTGATTATGTA(...)
PRIMER_LEFT_NUM_RETURNED=5
PRIMER_RIGHT_NUM_RETURNED=5
PRIMER_INTERNAL_NUM_RETURNED=0
PRIMER_PAIR_NUM_RETURNED=5
PRIMER_PAIR_0_PENALTY=0.899912
PRIMER_LEFT_0_PENALTY=0.864455
PRIMER_RIGHT_0_PENALTY=0.035458
PRIMER_LEFT_0_SEQUENCE=GCTGCGACTATTGATCAGGC
PRIMER_RIGHT_0_SEQUENCE=CTTCAACTTCCCCACGCTCT
PRIMER_LEFT_0=202,20
PRIMER_RIGHT_0=463,20
PRIMER_LEFT_0_TM=59.136
PRIMER_RIGHT_0_TM=59.965
PRIMER_LEFT_0_GC_PERCENT=55.000
PRIMER_RIGHT_0_GC_PERCENT=55.000
PRIMER_LEFT_0_SELF_ANY_TH=0.08
PRIMER_RIGHT_0_SELF_ANY_TH=0.00
PRIMER_LEFT_0_SELF_END_TH=0.00
PRIMER_RIGHT_0_SELF_END_TH=0.00
PRIMER_LEFT_0_HAIRPIN_TH=0.00
PRIMER_RIGHT_0_HAIRPIN_TH=0.00
PRIMER_LEFT_0_END_STABILITY=4.8500
PRIMER_RIGHT_0_END_STABILITY=4.0900
PRIMER_PAIR_0_COMPL_ANY_TH=0.00
PRIMER_PAIR_0_COMPL_END_TH=0.00
PRIMER_PAIR_0_PRODUCT_SIZE=262
(...)
=
SEQUENCE_ID=seq1.101
SEQUENCE_TEMPLATE=ATGGGTATTCAATATGATTATAATGAAGTTTTCACTAGAGTAAAGAGTAAATTTGATTATGTAATGGATGATTCTGGTGTAAAAAATAATCTCTTAGGTAAAGCTGCGACTATTGATCAGGCTTTAAACGGAAAGTTTGCTTCAGTGATAAGAAATAGAAATT(...)
PRIMER_LEFT_NUM_RETURNED=5
PRIMER_RIGHT_NUM_RETURNED=5
PRIMER_INTERNAL_NUM_RETURNED=0
PRIMER_PAIR_NUM_RETURNED=5
PRIMER_PAIR_0_PENALTY=0.899912
PRIMER_LEFT_0_PENALTY=0.864455
PRIMER_RIGHT_
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
primers for what ? pcr ? why is your post labelled with kmers ?