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

allpy

view test/test_io_emboss.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 import re
2 from StringIO import StringIO
4 from allpy import protein
6 def test_stringio_conversions():
7 # MSF is not supported by any other handler, except EMBOSS,
8 # so by testing MSF we essentially test EMBOSS
9 a = (protein.Alignment().
10 append_row_from_string("a-c-d", name="Seq1").
11 append_row_from_string("tgcga", name="Seq2"))
13 o = StringIO()
14 a.to_file(o, "fasta")
15 got = o.getvalue()
16 expect = ">Seq1\nA-C-D\n>Seq2\nTGCGA\n"
17 assert expect == got, "Expected:\n%r\nGot:\n%r" % (expect, got)
19 o = StringIO()
20 a.to_file(o, "msf")
21 got = o.getvalue()
22 got = re.sub('(stdout MSF: 5 Type: N) .*', r'\1', got)
23 expect = (
24 "!!NA_MULTIPLE_ALIGNMENT 1.0\n"
25 "\n"
26 " stdout MSF: 5 Type: N 03/06/11 CompCheck: 1918 ..\n"
27 "\n"
28 " Name: Seq1 Len: 5 Check: 882 Weight: 1.00\n"
29 " Name: Seq2 Len: 5 Check: 1036 Weight: 1.00\n"
30 "\n"
31 "//\n"
32 "\n"
33 " 1 5\n"
34 "Seq1 A.C.D\n"
35 "Seq2 TGCGA\n"
36 "\n"
37 )
38 expect = re.sub('(stdout MSF: 5 Type: N) .*', r'\1', expect)
39 assert expect == got, "Expected:\n%r\nGot:\n%r" % (expect, got)
41 o.name = 'whoopie.msf'
42 o.seek(0)
43 b = protein.Alignment().append_file(o, format='msf')
44 assert b.rows_as_strings() == ["A-C-D", "TGCGA"]
45 assert b.sequences[0].source == o.name
47 # vim: set et ts=4 sts=4 sw=4: