allpy
changeset 771:4ed26f8afeac
extract_pfam: do not overwrite (skip over) existsing files
author | Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru> |
---|---|
date | Tue, 12 Jul 2011 17:56:42 +0400 |
parents | c3532d119351 |
children | a1e8b96686ea |
files | utils/extract_pfam.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/utils/extract_pfam.py Tue Jul 12 17:12:05 2011 +0400 1.2 +++ b/utils/extract_pfam.py Tue Jul 12 17:56:42 2011 +0400 1.3 @@ -139,15 +139,16 @@ 1.4 assert len(aln.sequences) >= options.min_depth, "Alignment too thin" 1.5 1.6 def output_aln(aln): 1.7 - filename = "pfam_%s_%s.markup" % (aln.ac, aln.id) 1.8 - with open(filename, "w") as outfile: 1.9 + with open(aln.filename, "w") as outfile: 1.10 aln.to_file(outfile, format="markup") 1.11 - print "Wrote %s" % filename 1.12 + print "Wrote %s" % aln.filename 1.13 1.14 def process_aln(aln): 1.15 out_aln = Alignment() 1.16 out_aln.ac = aln.ac 1.17 out_aln.id = aln.id 1.18 + out_aln.filename = "pfam_%s_%s.markup" % (out_aln.ac, out_aln.id) 1.19 + assert not os.path.exists(out_aln.filename), "File already exists" 1.20 for seq in aln: 1.21 try: 1.22 out_seq = None