Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/raw-rev/7bc44212ca15
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 07:50:05 2012
Кодировка:

# HG changeset patch
# User Mmmasha!
# Date 1340110544 -14400
# Node ID 7bc44212ca158e7dc5993d4b1c17110128f4fc38
# Parent 0736e1bbd1867261af421f3f85fad0583aeb6793# Parent e0eb2d0f0822ab144208f926a50de07ee7f7cc6d
Automated merge with ssh://kodomo/allpy

diff -r 0736e1bbd186 -r 7bc44212ca15 allpy/fileio/markup.py
--- a/allpy/fileio/markup.py Thu Jun 14 20:24:26 2012 +0400
+++ b/allpy/fileio/markup.py Tue Jun 19 16:55:44 2012 +0400
@@ -101,7 +101,7 @@
if sequence.name == record['sequence_name']:
description = record.get('sequence_description')
if description:
- assert sequence.description == description
+ assert sequence.description == description, "Descriptions don't match: {0} != {1} for {2}".format(sequence.description, description, sequence.name)
cls = get_markups_class(record['class'])
cls.from_record(sequence, record, name=record.get('name'))
return
diff -r 0736e1bbd186 -r 7bc44212ca15 utils/markup_to_html.py
--- a/utils/markup_to_html.py Thu Jun 14 20:24:26 2012 +0400
+++ b/utils/markup_to_html.py Tue Jun 19 16:55:44 2012 +0400
@@ -13,10 +13,14 @@
template_file = join(template_prefix, "markup_to_html.html")

parser = optparse.OptionParser(description=__doc__, usage="%prog [options] [infile]")
+parser.add_option("-t", "--template-file", default=template_file,
+ help="HTML template file")
parser.add_option("-o", "--outfile",
help="Output file name, default: stdout")
+parser.add_option("-p", "--import-path", default=".",
+ help="Path to imported module")
parser.add_option("-m", "--import-module",
- help="Import this module before anything, useful for custom markup classes")
+ help="import this module before anything, useful for custom markup classes")
options, args = parser.parse_args()

outfile = options.outfile and open(options.outfile, "w") or sys.stdout
@@ -24,9 +28,11 @@
if len(args) > 1:
parser.error("Too many arguments on the command line")

+module = None
+
if options.import_module:
- sys.path.append(".")
- __import__(options.import_module)
+ sys.path.insert(0, options.import_path)
+ module = __import__(options.import_module)

aln = protein.Alignment().append_file(infile, format="markup")

@@ -43,6 +49,9 @@
items += repr_items([('sequence ' + k, v) for k, v in vars(sequence).items() if k != 'markups'])
monomer.description = "\n".join(items)

+if hasattr(module, 'init'):
+ module.init(aln)
+
rows = aln.rows_as_lists()
-template = Template(open(template_file).read())
+template = Template(open(options.template_file).read())
outfile.write(template.render(vars()))