forked from pydna-group/pydna
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_module_genbankfixer.py
39 lines (29 loc) · 1.43 KB
/
test_module_genbankfixer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from pydna.readers import read
def test_pydna_gbtext_clean():
from pydna.genbankfixer import gbtext_clean
files = [ ("sequence.gb", "j2yAlBCZ-txSTCkakAmykAielRI"),
("NCBI_example.gb", "j2yAlBCZ-txSTCkakAmykAielRI"),
("YEplac181.txt", "lbnQtxi5LyDONRswRdG88-l8NF0"),
("pGADT7-Rec.gb", "rhnYE78wGKdqAZWiyVJzQ7HXXys"),
("P30350%20(2013-10-11%2013_49_14).dna.txt", "_aEPoGLctHcOZdQdZIh-KyBt5WY"),
("ApE_example.gb", "c47i2ifiNZVvvnLQbX5anTVVoPE"),
("VectorNTI_example.gb", "bDPbx5P4yigGWh1zK7FiG_SF8qQ"),
("hej.txt", "lbnQtxi5LyDONRswRdG88-l8NF0"), ]
for file_, seg in files:
with open("broken_genbank_files/"+file_, "r") as f:
infile = f.read()
if file_ == "hej.txt":
from Bio import BiopythonParserWarning
with pytest.warns(BiopythonParserWarning):
assert read( gbtext_clean(infile).gbtext ).seguid() == seg
else:
assert read( gbtext_clean(infile).gbtext ).seguid() == seg
def test_wrapstring():
from pydna.genbankfixer import wrapstring
assert wrapstring("0123456789",0,5,)=='01234\n56789\n\n'
assert wrapstring("0123456789",1,5,padfirst=False) == '0123\n 4567\n 89\n'
if __name__ == '__main__':
pytest.cmdline.main([__file__, "-v", "-s"])