dotter.py
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:2k
- #!/usr/bin/python
- # $Id: dotter.py,v 1000.0 2003/10/31 21:37:23 gouriano Exp $
- #
- # Author: Josh Cherry
- #
- # launch dotter (from gbench) using sequences we're handed
- import sys
- import string
- import commands
- import os
- def writefasta(seq, fname):
- s = ">" + fname + "n"
- for pos in range(0, len(seq), 60):
- s += seq[pos:pos+60]
- s += 'n'
- f = open(fname, "w")
- f.write(s)
- f.close
- input = sys.stdin.read()
- l = string.split(input)
- if len(l) != 1 and len(l) != 2:
- sys.stderr.write("need exactly 1 or 2 sequences; you supplied %dn" % len(l))
- sys.exit(1)
- # if given just one sequence, 'double' it to plot against itself
- if len(l) == 1:
- l = [ l[0], l[0] ]
- writefasta(l[0], 'seq1.fasta')
- writefasta(l[1], 'seq2.fasta')
- # run dotter in background
- # redirect all output to /dev/null (otherwise interpreter goes zombie)
- os.system('dotter seq1.fasta seq2.fasta >& /dev/null &')
- # cheesey: wait a few seconds so dotter can read its files,
- # then delete them
- import time
- time.sleep(5)
- os.system('rm seq1.fasta seq2.fasta')
- # ===========================================================================
- # $Log: dotter.py,v $
- # Revision 1000.0 2003/10/31 21:37:23 gouriano
- # PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.1
- #
- # Revision 1.1 2003/06/24 16:41:12 jcherry
- # Initial versions of scripts for use with gbench
- #
- # ===========================================================================
- #
- # ===========================================================================
- # PRODUCTION $Log: dotter.py,v $
- # PRODUCTION Revision 1000.0 2003/10/31 21:37:23 gouriano
- # PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.1
- # PRODUCTION
- # ===========================================================================
- #