Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

*** empty log message ***

  • Loading branch information...
commit ac66581d509ff6c77643988307e43e7a0c1b4166 1 parent 43837ba
grouse authored
Showing with 24 additions and 9 deletions.
  1. +24 −9 Bio/Wise/__init__.py
View
33 Bio/Wise/__init__.py
@@ -1,10 +1,12 @@
#!/usr/bin/env python2.3
-__version__ = "$Revision: 1.6 $"
+__version__ = "$Revision: 1.7 $"
import os
import sys
+from Bio.SeqIO.FASTA import FastaReader, FastaWriter
+
try:
import poly
@@ -55,23 +57,36 @@ def align(cmdline, pair, kbyte=None, force_type=None, dry_run=False, quiet=False
"""
Returns a filehandle
"""
- temp_file = _NamedTemporaryFile(mode='r')
+ output_file = _NamedTemporaryFile(mode='r')
+ input_files = _NamedTemporaryFile(mode="w"), _NamedTemporaryFile(mode="w")
+
+ if dry_run:
+ print _build_align_cmdline(cmdline,
+ pair,
+ output_file.name,
+ kbyte,
+ force_type,
+ quiet)
+ return
+
+ for filename, input_file in zip(pair, input_files):
+ input_file.close()
+ FastaWriter(file(input_file.name, "w")).write(FastaReader(file(filename)).next())
+
+ input_file_names = [input_file.name for input_file in input_files]
+
cmdline_str = _build_align_cmdline(cmdline,
- pair,
- temp_file.name,
+ input_file_names,
+ output_file.name,
kbyte,
force_type,
quiet)
- if dry_run:
- print cmdline_str
- return
-
if debug:
print >>sys.stderr, cmdline_str
os.system(cmdline_str)
- return temp_file
+ return output_file
def all_pairs(singles):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.