Permalink
Browse files

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

  • Loading branch information...
1 parent 4289731 commit d51a7efefdba18986fd1e8fac37f75dc333ddff7 @bl0b committed Mar 18, 2012
Showing with 22 additions and 0 deletions.
  1. +22 −0 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)

0 comments on commit d51a7ef

Please sign in to comment.