Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added script to batch queries to primer3 from a multifasta file.

  • Loading branch information...
commit d51a7efefdba18986fd1e8fac37f75dc333ddff7 1 parent 4289731
Damien Leroux authored
Showing with 22 additions and 0 deletions.
  1. +22 −0 batch_primer3.py
22 batch_primer3.py
View
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+from query_primer3 import query_primer3
+import fasta
+import sys
+import re
+import os
+
+if len(sys.argv) < 2:
+ print "Usage: %s multi_fasta PRIMER3_ARG=VALUE..."
+
+mfas = fasta.read_from(sys.argv[1])
+primer3args = sys.argv[2:]
+
+bad_chr = re.compile("[^a-zA-Z0-9_-]")
+
+basedir, basename = os.path.split(sys.argv[1])
+
+for i, s in enumerate(mfas):
+ out = os.path.join(basedir, bad_chr.sub('_', s.header) + '.primer3')
+ print '[%i/%i]' % (1 + i, len(mfas)), "Querying", s.header
+ query_primer3(['SEQUENCE=' + s.sequence, '-o', out] + primer3args)
Please sign in to comment.
Something went wrong with that request. Please try again.