comparison extract_features.py @ 5:bcfe8e0731f8 draft

Uploaded
author bgruening
date Sun, 09 Jun 2013 09:53:26 -0400
parents 702d9e042295
children cb47e789ccaa
comparison
equal deleted inserted replaced
4:c243e17fb224 5:bcfe8e0731f8
45 if line.startswith('start gene'): 45 if line.startswith('start gene'):
46 gene_name = line[11:].strip() 46 gene_name = line[11:].strip()
47 47
48 if args.protein and line.startswith('protein sequence = ['): 48 if args.protein and line.startswith('protein sequence = ['):
49 if line.endswith(']'): 49 if line.endswith(']'):
50 line = line[20:-1] 50 protein_seq = line[20:-1]
51 protein_seq = line 51 po.write( '>%s\n%s\n' % (gene_name, '\n'.join( textwrap.wrap( protein_seq, 80 ) ) ) )
52 protein_seq = ''
52 else: 53 else:
53 line = line[20:] 54 line = line[20:]
54 protein_seq = line 55 protein_seq = line
55 56
56 if args.codingseq and line.startswith('coding sequence = ['): 57 if args.codingseq and line.startswith('coding sequence = ['):
57 if line.endswith(']'): 58 if line.endswith(']'):
58 line = line[19:-1] 59 coding_seq = line[19:-1]
59 coding_seq = line 60 co.write( '>%s\n%s\n' % (gene_name, '\n'.join( textwrap.wrap( coding_seq, 80 ) ) ) )
61 coding_seq = ''
60 else: 62 else:
61 line = line[19:] 63 line = line[19:]
62 coding_seq = line 64 coding_seq = line
63 65
64 if protein_seq: 66 if protein_seq: