1 """Expression for IPI format.
2
3 IPI is nearly swissprot, but contains some differents which makes the
4 Swissprot parsers choke.
5 """
6
7 import warnings
8 warnings.warn("Bio.expressions was deprecated, as it does not work with recent versions of mxTextTools. If you want to continue to use this module, please get in contact with the Biopython developers at biopython-dev@biopython.org to avoid permanent removal of this module from Biopython", DeprecationWarning)
9
10
11
12 from Bio import Std
13 import Martel
14 from Martel import Time
15 import sprot40
16
17
18 ID_exp = Martel.Group("ID",
19 Martel.Str("ID ") + \
20 Std.dbid(Martel.Group("entry_name", Martel.Re("[\w.]+")),
21 {"type": "primary", "dbname": "sp"}) + \
22 Martel.Spaces() + \
23 Martel.Word("data_class_table") + \
24 Martel.Str(";") + Martel.Spaces() + \
25 Martel.Word("molecule_type") + \
26 Martel.Str(";") + Martel.Spaces() + \
27 Martel.Digits("sequence_length") + \
28 Martel.Str(" AA.") + \
29 Martel.AnyEol()
30 )
31
32
33
34
35
36
37 DT_created_exp = (Martel.Str("DT ") +
38 Time.make_expression("%(DD)-%(Jan)-%(YYYY)") + \
39 Martel.Str(" (IPI Human rel. ") + \
40 Martel.Float("release") + \
41 Martel.Str(", Created)") + Martel.AnyEol())
42
43 DT_seq_update_exp = (Martel.Str("DT ") +
44 Time.make_expression("%(DD)-%(Jan)-%(YYYY)") + \
45 Martel.Str(" (IPI Human rel. ") + \
46 Martel.Float("release") + \
47 Martel.Str(", Last sequence update)") + Martel.AnyEol())
48
49 DT_ann_update_exp = (Martel.Str("DT ") +
50 Time.make_expression("%(DD)-%(Jan)-%(YYYY)") + \
51 Martel.Str(" (IPI Human rel. ") + \
52 Martel.Float("release") + \
53 Martel.Str(", Last annotation update)") + Martel.AnyEol())
54
55
56 replacements = [
57 ("ID", ID_exp),
58 ("DT_created", DT_created_exp),
59 ("DT_seq_update", DT_seq_update_exp),
60 ("DT_ann_update", Martel.Opt(DT_ann_update_exp))
61 ]
62
63 record = Martel.replace_groups(sprot40.record, replacements)
64
65
66 format_expression = Martel.replace_groups(
67 sprot40.format_expression, replacements)
68
69 format = Martel.replace_groups(sprot40.format, replacements)
70