Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/file/tip/utils/case_to_fasta.py
Дата изменения: Unknown
Дата индексирования: Wed Apr 13 04:47:13 2016
Кодировка:
allpy: b556c96c6719 utils/case_to_fasta.py

allpy

view utils/case_to_fasta.py @ 1168:b556c96c6719

blocks3d/www Makefile: never check certificates of github, they are too confusing for wget
author Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru>
date Mon, 26 May 2014 17:20:29 +0400
parents
children
line source
1 #!/usr/bin/python
2 import os
3 import sys
4 from allpy import protein, markups
6 try:
7 self, keyword = sys.argv
8 assert keyword == "-s"
9 except Exception:
10 self = os.path.basename(sys.argv[0])
11 print "Usage: %s -s < infile.markup > outfile.fasta" % self
12 print ""
13 print "Accept input alignment in markup format on stdin."
14 print "Print the alignment to stdout in fasta format with case preserved."
15 sys.exit(1)
17 infile = sys.stdin
18 outfile = sys.stdout
20 aln = protein.Alignment().append_file(infile, format='markup')
22 for seq in aln.sequences:
23 for monomer in seq:
24 if monomer.case == 'lower':
25 monomer.code1 = monomer.code1.lower()
26 else:
27 monomer.code1 = monomer.code1.upper()
29 aln.to_file(outfile)
31 # vim: set et ts=4 sts=4 sw=4: