gsrap 0.10.1__py3-none-any.whl → 0.10.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
gsrap/commons/metrics.py CHANGED
@@ -58,8 +58,8 @@ def show_contributions(logger, db, goodbefore):
58
58
  return 0
59
59
 
60
60
 
61
- # create a counter for each author
62
- cnt = {author: 0 for author in db['curators']['username']}
61
+ # create a counter for each curator
62
+ cnt = {curator: 0 for curator in db['curators']['username']}
63
63
  cnt_tot = 0
64
64
 
65
65
 
@@ -67,9 +67,9 @@ def show_contributions(logger, db, goodbefore):
67
67
  if type(row['curator']) != str:
68
68
  logger.error(f"Missing curator in tab 'R', rid '{row['rid']}'.")
69
69
  return 1
70
- for author in row['curator'].split(';'):
71
- author = author.rstrip().strip()
72
- cnt[author] += 1
70
+ for curator in row['curator'].split(';'):
71
+ curator = curator.rstrip().strip()
72
+ cnt[curator] += 1
73
73
  cnt_tot += 1
74
74
 
75
75
 
@@ -77,18 +77,18 @@ def show_contributions(logger, db, goodbefore):
77
77
  if type(row['curator']) != str:
78
78
  logger.error(f"Missing curator in tab 'T', rid '{row['rid']}'.")
79
79
  return 1
80
- for author in row['curator'].split(';'):
81
- author = author.rstrip().strip()
82
- cnt[author] += 1
80
+ for curator in row['curator'].split(';'):
81
+ curator = curator.rstrip().strip()
82
+ cnt[curator] += 1
83
83
  cnt_tot += 1
84
84
 
85
85
 
86
86
  # compute percentages:
87
- pct = {author: cnt[author]/cnt_tot*100 for author in cnt.keys()}
87
+ pct = {curator: cnt[curator]/cnt_tot*100 for curator in cnt.keys()}
88
88
  # sort in descending order:
89
89
  pct = dict(sorted(pct.items(), key=lambda item: item[1], reverse=True))
90
90
  # convert to string:
91
- pct = {author: f'{round(pct[author],2)}%' for author in pct.keys()}
91
+ pct = {curator: f'{round(pct[curator],2)}%' for curator in pct.keys()}
92
92
  logger.debug(f"Contributions: {pct}.")
93
93
 
94
94
 
@@ -1,4 +1,5 @@
1
1
  import threading
2
+ import copy
2
3
 
3
4
  import cobra
4
5
 
@@ -106,7 +107,7 @@ def translate_annotate_genes(logger, model, idcollection_dict):
106
107
 
107
108
 
108
109
 
109
- def set_up_groups(logger, model, idcollection_dict):
110
+ def set_up_groups(logger, model, idcollection_dict, goodbefore):
110
111
 
111
112
 
112
113
  logger.debug("Introducing groups...")
@@ -160,18 +161,27 @@ def set_up_groups(logger, model, idcollection_dict):
160
161
  model.add_groups([actual_group])
161
162
 
162
163
 
163
-
164
- # insert custom groups:
165
- custom_groups = get_custom_groups()
166
- #
167
164
  # create a group for transporters on-the-fly
165
+ custom_groups = get_custom_groups()
168
166
  custom_groups['gr_transport'] = []
169
167
  for r in model.reactions:
170
168
  if len(r.metabolites) == 1 and list(r.metabolites)[0].id.rsplit('_',1)[-1] != 'c': # just exchanges (esclude sinks/demands)
171
169
  custom_groups['gr_transport'].append(r.id)
172
170
  if len(set([m.id.rsplit('_', 1)[-1] for m in r.metabolites])) > 1: # transport reactions
173
171
  custom_groups['gr_transport'].append(r.id)
174
- #
172
+
173
+
174
+ # handle eventual removed reactions as consequence of --goodbefore:
175
+ if type(goodbefore) == list:
176
+ modeled_rids = [r.id for r in model.reactions]
177
+ for group_id in custom_groups.keys():
178
+ for rid in copy.deepcopy(custom_groups[group_id]):
179
+ if rid not in modeled_rids:
180
+ logger.warning(f"Removing reaction '{rid}' from group '{group_id}' as consequence of --goodbefore.")
181
+ custom_groups[group_id].remove(rid)
182
+
183
+
184
+ # actually insert custom groups:
175
185
  for group_id in custom_groups.keys():
176
186
  actual_group = cobra.core.Group(
177
187
  group_id,
@@ -3,7 +3,7 @@ import sys
3
3
  import pandas as pnd
4
4
  import cobra
5
5
 
6
- from .repeating import check_author
6
+ from .repeating import check_curator
7
7
  from .repeating import check_rstring_arrow
8
8
  from .repeating import check_gpr
9
9
  from .repeating import add_reaction
@@ -14,7 +14,7 @@ from .manual import get_manual_demands
14
14
 
15
15
 
16
16
 
17
- def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to_others, outdir, goodbefore, onlyauthor):
17
+ def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to_others, outdir, goodbefore, onlycurator):
18
18
  goodbefore_reached = False
19
19
 
20
20
 
@@ -44,24 +44,24 @@ def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to
44
44
  goodbefore_reached = True
45
45
 
46
46
 
47
- # manage goodbefore/onlyauthor
47
+ # manage goodbefore/onlycurator
48
48
  if goodbefore != None and goodbefore_reached:
49
- if onlyauthor == None:
49
+ if onlycurator == None:
50
50
  logger.warning(f"Skipping metabolite '{pure_mid}' as requested with --goodbefore[0] '{goodbefore}'.")
51
51
  continue
52
52
 
53
53
 
54
54
  # parse and get curators
55
- response = check_author(logger, pure_mid, row, db, 'M')
55
+ response = check_curator(logger, pure_mid, row, db, 'M')
56
56
  if type(response) == int: return 1
57
- else: authors = response
57
+ else: curators = response
58
58
 
59
59
 
60
- # manage goodbefore/onlyauthor
60
+ # manage goodbefore/onlycurator
61
61
  if goodbefore != None and goodbefore_reached:
62
- if onlyauthor != None and onlyauthor not in authors:
63
- authors_string = '; '.join(authors)
64
- logger.warning(f"Skipping metabolite '{pure_mid}' (authors '{authors_string}') as requested with --goodbefore[0] '{goodbefore}' and --onlyauthor '{onlyauthor}'.")
62
+ if onlycurator != None and onlycurator not in curators:
63
+ curators_string = '; '.join(curators)
64
+ logger.warning(f"Skipping metabolite '{pure_mid}' (curators '{curators_string}') as requested with --goodbefore[0] '{goodbefore}' and --onlycurator '{onlycurator}'.")
65
65
  continue
66
66
 
67
67
 
@@ -122,7 +122,7 @@ def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to
122
122
  eqbiggids.add(eqbiggid)
123
123
  if pure_mid not in eqbiggids and eqbiggids != set():
124
124
  with open(f"{outdir}/logs/M.inbigg.txt", 'a') as f:
125
- print(f"Metabolites '{'; '.join(kc_ids)}' already in BiGG as {eqbiggids} ({authors} gave '{pure_mid}').", file=f)
125
+ print(f"Metabolites '{'; '.join(kc_ids)}' already in BiGG as {eqbiggids} ({curators} gave '{pure_mid}').", file=f)
126
126
 
127
127
 
128
128
  # add metabolite to model
@@ -136,7 +136,7 @@ def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to
136
136
 
137
137
 
138
138
  # write curators as annotations
139
- m.annotation['curator_codes'] = authors
139
+ m.annotation['curator_codes'] = curators
140
140
 
141
141
 
142
142
  # add annotations to model (same order of Memote)
@@ -197,7 +197,7 @@ def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to
197
197
 
198
198
 
199
199
 
200
- def introduce_reactions(logger, db, model, idcollection_dict, kegg_reaction_to_others, outdir, goodbefore, onlyauthor):
200
+ def introduce_reactions(logger, db, model, idcollection_dict, kegg_reaction_to_others, outdir, goodbefore, onlycurator):
201
201
  goodbefore_reached = False
202
202
 
203
203
 
@@ -226,24 +226,24 @@ def introduce_reactions(logger, db, model, idcollection_dict, kegg_reaction_to_o
226
226
  goodbefore_reached = True
227
227
 
228
228
 
229
- # manage goodbefore/onlyauthor
229
+ # manage goodbefore/onlycurator
230
230
  if goodbefore != None and goodbefore_reached:
231
- if onlyauthor == None:
231
+ if onlycurator == None:
232
232
  logger.warning(f"Skipping reaction '{rid}' as requested with --goodbefore[1] '{goodbefore}'.")
233
233
  continue
234
234
 
235
235
 
236
236
  # parse and get curators
237
- response = check_author(logger, rid, row, db, 'R')
237
+ response = check_curator(logger, rid, row, db, 'R')
238
238
  if type(response) == int: return 1
239
- else: authors = response
239
+ else: curators = response
240
240
 
241
241
 
242
- # manage goodbefore/onlyauthor
242
+ # manage goodbefore/onlycurator
243
243
  if goodbefore != None and goodbefore_reached:
244
- if onlyauthor != None and onlyauthor not in authors:
245
- authors_string = '; '.join(authors)
246
- logger.warning(f"Skipping reaction '{rid}' (authors '{authors_string}') as requested with --goodbefore[1] '{goodbefore}' and --onlyauthor '{onlyauthor}'.")
244
+ if onlycurator != None and onlycurator not in curators:
245
+ curators_string = '; '.join(curators)
246
+ logger.warning(f"Skipping reaction '{rid}' (curators '{curators_string}') as requested with --goodbefore[1] '{goodbefore}' and --onlycurator '{onlycurator}'.")
247
247
  continue
248
248
 
249
249
 
@@ -284,11 +284,11 @@ def introduce_reactions(logger, db, model, idcollection_dict, kegg_reaction_to_o
284
284
  eqbiggids.add(eqbiggid)
285
285
  if rid not in eqbiggids and eqbiggids != set():
286
286
  with open(f"{outdir}/logs/R.inbigg.txt", 'a') as f:
287
- print(f"Reactions '{'; '.join(kr_ids)}' already in BiGG as {eqbiggids} ({authors} gave '{rid}').", file=f)
287
+ print(f"Reactions '{'; '.join(kr_ids)}' already in BiGG as {eqbiggids} ({curators} gave '{rid}').", file=f)
288
288
 
289
289
 
290
290
  # add reaction to model
291
- response = add_reaction(logger, model, rid, authors, row, kr_ids, kegg_reaction_to_others, 'R', outdir)
291
+ response = add_reaction(logger, model, rid, curators, row, kr_ids, kegg_reaction_to_others, 'R', outdir)
292
292
  if response == 1: return 1
293
293
 
294
294
 
@@ -308,7 +308,7 @@ def introduce_reactions(logger, db, model, idcollection_dict, kegg_reaction_to_o
308
308
 
309
309
 
310
310
 
311
- def introduce_transporters(logger, db, model, idcollection_dict, kegg_reaction_to_others, outdir, goodbefore, onlyauthor):
311
+ def introduce_transporters(logger, db, model, idcollection_dict, kegg_reaction_to_others, outdir, goodbefore, onlycurator):
312
312
  goodbefore_reached = False
313
313
 
314
314
 
@@ -373,24 +373,24 @@ def introduce_transporters(logger, db, model, idcollection_dict, kegg_reaction_t
373
373
  return 1
374
374
 
375
375
 
376
- # manage goodbefore/onlyauthor
376
+ # manage goodbefore/onlycurator
377
377
  if goodbefore != None and goodbefore_reached:
378
- if onlyauthor == None:
378
+ if onlycurator == None:
379
379
  logger.warning(f"Skipping transport '{rid}' as requested with --goodbefore[2] '{goodbefore}'.")
380
380
  continue
381
381
 
382
382
 
383
- # parse author
384
- response = check_author(logger, rid, row, db, 'T')
383
+ # parse curator
384
+ response = check_curator(logger, rid, row, db, 'T')
385
385
  if type(response) == int: return 1
386
- else: authors = response
386
+ else: curators = response
387
387
 
388
388
 
389
- # manage goodbefore/onlyauthor
389
+ # manage goodbefore/onlycurator
390
390
  if goodbefore != None and goodbefore_reached:
391
- if onlyauthor != None and onlyauthor not in authors:
392
- authors_string = '; '.join(authors)
393
- logger.warning(f"Skipping transport '{rid}' (authors '{authors_string}') as requested with --goodbefore[2] '{goodbefore}' and --onlyauthor '{onlyauthor}'.")
391
+ if onlycurator != None and onlycurator not in curators:
392
+ curators_string = '; '.join(curators)
393
+ logger.warning(f"Skipping transport '{rid}' (curators '{curators_string}') as requested with --goodbefore[2] '{goodbefore}' and --onlycurator '{onlycurator}'.")
394
394
  continue
395
395
 
396
396
 
@@ -454,11 +454,11 @@ def introduce_transporters(logger, db, model, idcollection_dict, kegg_reaction_t
454
454
  eqbiggids.add(eqbiggid)
455
455
  if rid not in eqbiggids and eqbiggids != set():
456
456
  with open(f"{outdir}/logs/T.inbigg.txt", 'a') as f:
457
- print(f"Reactions '{'; '.join(kr_ids)}' already in BiGG as {eqbiggids} ({authors} gave '{rid}').", file=f)
457
+ print(f"Reactions '{'; '.join(kr_ids)}' already in BiGG as {eqbiggids} ({curators} gave '{rid}').", file=f)
458
458
 
459
459
 
460
460
  # add reaction to model
461
- response = add_reaction(logger, model, rid, authors, row, kr_ids, kegg_reaction_to_others, 'T', outdir)
461
+ response = add_reaction(logger, model, rid, curators, row, kr_ids, kegg_reaction_to_others, 'T', outdir)
462
462
  if response == 1: return 1
463
463
  rids_parsed.append(rid) # update list of rids in model
464
464
 
@@ -17,7 +17,7 @@ from ..commons import write_excel_model
17
17
  from ..commons import show_contributions
18
18
  from ..commons import adjust_biomass_precursors
19
19
  from ..commons import count_undrawn_rids_focus
20
-
20
+ from ..commons import parse_zipped_escher
21
21
  from ..commons import format_expansion
22
22
  from ..commons import check_taxon
23
23
  from ..commons import download_keggorg
@@ -50,6 +50,9 @@ def main(args, logger):
50
50
 
51
51
 
52
52
 
53
+
54
+
55
+
53
56
  ###### PRE-PARSING
54
57
 
55
58
  # adjust out folder path
@@ -72,9 +75,9 @@ def main(args, logger):
72
75
  return 1
73
76
 
74
77
 
75
- # check 'goodbefore' and 'onlyauthor' params
76
- if args.goodbefore == '-' and args.onlyauthor != '-':
77
- logger.error(f"--onlyauthor must be used in conjunction with --goodbefore.")
78
+ # check 'goodbefore' and 'onlycurator' params
79
+ if args.goodbefore == '-' and args.onlycurator != '-':
80
+ logger.error(f"--onlycurator must be used in conjunction with --goodbefore.")
78
81
  return 1
79
82
  if args.goodbefore == '-': args.goodbefore = [None, None, None]
80
83
  elif len(args.goodbefore.split('-')) != 3:
@@ -85,7 +88,7 @@ def main(args, logger):
85
88
  if args.goodbefore[0] == 'None': args.goodbefore[0] = None
86
89
  if args.goodbefore[1] == 'None': args.goodbefore[1] = None
87
90
  if args.goodbefore[2] == 'None': args.goodbefore[2] = None
88
- if args.onlyauthor == '-': args.onlyauthor = None
91
+ if args.onlycurator == '-': args.onlycurator = None
89
92
 
90
93
 
91
94
  # check and extract the required 'gsrap.maps' file
@@ -147,17 +150,17 @@ def main(args, logger):
147
150
 
148
151
 
149
152
  # introduce M
150
- universe = introduce_metabolites(logger, dbuni, universe, idcollection_dict, kegg_compound_to_others, args.outdir, args.goodbefore[0], args.onlyauthor)
153
+ universe = introduce_metabolites(logger, dbuni, universe, idcollection_dict, kegg_compound_to_others, args.outdir, args.goodbefore[0], args.onlycurator)
151
154
  if type(universe)==int: return 1
152
155
 
153
156
 
154
157
  # introduce R
155
- universe = introduce_reactions(logger, dbuni, universe, idcollection_dict, kegg_reaction_to_others, args.outdir, args.goodbefore[1], args.onlyauthor)
158
+ universe = introduce_reactions(logger, dbuni, universe, idcollection_dict, kegg_reaction_to_others, args.outdir, args.goodbefore[1], args.onlycurator)
156
159
  if type(universe)==int: return 1
157
160
 
158
161
 
159
162
  # introduce T
160
- universe = introduce_transporters(logger, dbuni, universe, idcollection_dict, kegg_reaction_to_others, args.outdir, args.goodbefore[2], args.onlyauthor)
163
+ universe = introduce_transporters(logger, dbuni, universe, idcollection_dict, kegg_reaction_to_others, args.outdir, args.goodbefore[2], args.onlycurator)
161
164
  if type(universe)==int: return 1
162
165
 
163
166
 
@@ -177,10 +180,16 @@ def main(args, logger):
177
180
 
178
181
 
179
182
  # introduce collections (groups of Rs as maps/modules)
180
- universe = set_up_groups(logger, universe, idcollection_dict)
183
+ universe = set_up_groups(logger, universe, idcollection_dict, args.goodbefore)
181
184
  if type(universe)==int: return 1
182
185
 
183
186
 
187
+ # introduce hand-drwn escher map annotation
188
+ if args.escherzip != '-':
189
+ universe = parse_zipped_escher(logger, universe, args.escherzip, args.outdir)
190
+ if type(universe) == int: return 1
191
+
192
+
184
193
 
185
194
  ###### POST-PARSING
186
195
 
@@ -199,7 +208,7 @@ def main(args, logger):
199
208
 
200
209
  # remove disconnected metabolites
201
210
  if args.keepdisconn == False:
202
- universe = remove_disconnected(logger, universe) # can be commented when using booster.py
211
+ universe = remove_disconnected(logger, universe) # keep disconnected metabolites when using booster.py
203
212
 
204
213
 
205
214
  # avoid time-consuming activities
@@ -1,7 +1,6 @@
1
1
  import pandas as pnd
2
2
  import cobra
3
3
 
4
-
5
4
  from .manual import get_deprecated_kos
6
5
  from .manual import get_rids_with_mancheck_gpr
7
6
  from .manual import get_rids_with_mancheck_balancing
@@ -90,7 +89,7 @@ def check_rstring_arrow(logger, rid, row, addtype='R'):
90
89
 
91
90
 
92
91
 
93
- def check_author(logger, mrid, row, db, addtype='R'):
92
+ def check_curator(logger, mrid, row, db, addtype='R'):
94
93
 
95
94
 
96
95
  # define itemtype:
@@ -101,23 +100,23 @@ def check_author(logger, mrid, row, db, addtype='R'):
101
100
  else: itemtype = 'Transporter'
102
101
 
103
102
 
104
- # check if author was indicated:
103
+ # check if curator was indicated:
105
104
  if pnd.isna(row['curator']):
106
105
  logger.error(f"{itemtype} '{mrid}' has no curator.")
107
106
  return 1
108
107
 
109
108
 
110
- # check if the are valid authors
111
- authors = set()
112
- for author in row['curator'].split(';'):
113
- author = author.strip()
114
- authors.add(author)
115
- if author not in db['curators']['username'].to_list():
116
- logger.error(f"{itemtype} '{mrid}' has invalid curator: '{author}'.")
109
+ # check if the are valid curators
110
+ curators = set()
111
+ for curator in row['curator'].split(';'):
112
+ curator = curator.strip()
113
+ curators.add(curator)
114
+ if curator not in db['curators']['username'].to_list():
115
+ logger.error(f"{itemtype} '{mrid}' has invalid curator: '{curator}'.")
117
116
  return 1
118
117
 
119
118
 
120
- return list(authors)
119
+ return list(curators)
121
120
 
122
121
 
123
122
 
@@ -137,7 +136,7 @@ def get_curator_notes(logger, row):
137
136
 
138
137
 
139
138
 
140
- def add_reaction(logger, model, rid, authors, row, kr_ids, kegg_reaction_to_others, addtype, outdir):
139
+ def add_reaction(logger, model, rid, curators, row, kr_ids, kegg_reaction_to_others, addtype, outdir):
141
140
 
142
141
 
143
142
  # define the itemtype:
@@ -180,7 +179,7 @@ def add_reaction(logger, model, rid, authors, row, kr_ids, kegg_reaction_to_othe
180
179
 
181
180
 
182
181
  # write curators as annotations
183
- r.annotation['curator_codes'] = authors
182
+ r.annotation['curator_codes'] = curators
184
183
 
185
184
 
186
185
  # add annotations to model (same order of Memote)
@@ -1,4 +1,5 @@
1
1
  import threading
2
+ import copy
2
3
 
3
4
  import cobra
4
5
 
@@ -106,7 +107,7 @@ def translate_annotate_genes(logger, model, idcollection_dict):
106
107
 
107
108
 
108
109
 
109
- def set_up_groups(logger, model, idcollection_dict):
110
+ def set_up_groups(logger, model, idcollection_dict, goodbefore):
110
111
 
111
112
 
112
113
  logger.debug("Introducing groups...")
@@ -160,18 +161,27 @@ def set_up_groups(logger, model, idcollection_dict):
160
161
  model.add_groups([actual_group])
161
162
 
162
163
 
163
-
164
- # insert custom groups:
165
- custom_groups = get_custom_groups()
166
- #
167
164
  # create a group for transporters on-the-fly
165
+ custom_groups = get_custom_groups()
168
166
  custom_groups['gr_transport'] = []
169
167
  for r in model.reactions:
170
168
  if len(r.metabolites) == 1 and list(r.metabolites)[0].id.rsplit('_',1)[-1] != 'c': # just exchanges (esclude sinks/demands)
171
169
  custom_groups['gr_transport'].append(r.id)
172
170
  if len(set([m.id.rsplit('_', 1)[-1] for m in r.metabolites])) > 1: # transport reactions
173
171
  custom_groups['gr_transport'].append(r.id)
174
- #
172
+
173
+
174
+ # handle eventual removed reactions as consequence of --goodbefore:
175
+ if type(goodbefore) == list:
176
+ modeled_rids = [r.id for r in model.reactions]
177
+ for group_id in custom_groups.keys():
178
+ for rid in copy.deepcopy(custom_groups[group_id]):
179
+ if rid not in modeled_rids:
180
+ logger.warning(f"Removing reaction '{rid}' from group '{group_id}' as consequence of --goodbefore.")
181
+ custom_groups[group_id].remove(rid)
182
+
183
+
184
+ # actually insert custom groups:
175
185
  for group_id in custom_groups.keys():
176
186
  actual_group = cobra.core.Group(
177
187
  group_id,
@@ -3,7 +3,7 @@ import sys
3
3
  import pandas as pnd
4
4
  import cobra
5
5
 
6
- from .repeating import check_author
6
+ from .repeating import check_curator
7
7
  from .repeating import check_rstring_arrow
8
8
  from .repeating import check_gpr
9
9
  from .repeating import add_reaction
@@ -14,7 +14,7 @@ from .manual import get_manual_demands
14
14
 
15
15
 
16
16
 
17
- def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to_others, outdir, goodbefore, onlyauthor):
17
+ def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to_others, outdir, goodbefore, onlycurator):
18
18
  goodbefore_reached = False
19
19
 
20
20
 
@@ -44,24 +44,24 @@ def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to
44
44
  goodbefore_reached = True
45
45
 
46
46
 
47
- # manage goodbefore/onlyauthor
47
+ # manage goodbefore/onlycurator
48
48
  if goodbefore != None and goodbefore_reached:
49
- if onlyauthor == None:
49
+ if onlycurator == None:
50
50
  logger.warning(f"Skipping metabolite '{pure_mid}' as requested with --goodbefore[0] '{goodbefore}'.")
51
51
  continue
52
52
 
53
53
 
54
54
  # parse and get curators
55
- response = check_author(logger, pure_mid, row, db, 'M')
55
+ response = check_curator(logger, pure_mid, row, db, 'M')
56
56
  if type(response) == int: return 1
57
- else: authors = response
57
+ else: curators = response
58
58
 
59
59
 
60
- # manage goodbefore/onlyauthor
60
+ # manage goodbefore/onlycurator
61
61
  if goodbefore != None and goodbefore_reached:
62
- if onlyauthor != None and onlyauthor not in authors:
63
- authors_string = '; '.join(authors)
64
- logger.warning(f"Skipping metabolite '{pure_mid}' (authors '{authors_string}') as requested with --goodbefore[0] '{goodbefore}' and --onlyauthor '{onlyauthor}'.")
62
+ if onlycurator != None and onlycurator not in curators:
63
+ curators_string = '; '.join(curators)
64
+ logger.warning(f"Skipping metabolite '{pure_mid}' (curators '{curators_string}') as requested with --goodbefore[0] '{goodbefore}' and --onlycurator '{onlycurator}'.")
65
65
  continue
66
66
 
67
67
 
@@ -122,7 +122,7 @@ def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to
122
122
  eqbiggids.add(eqbiggid)
123
123
  if pure_mid not in eqbiggids and eqbiggids != set():
124
124
  with open(f"{outdir}/logs/M.inbigg.txt", 'a') as f:
125
- print(f"Metabolites '{'; '.join(kc_ids)}' already in BiGG as {eqbiggids} ({authors} gave '{pure_mid}').", file=f)
125
+ print(f"Metabolites '{'; '.join(kc_ids)}' already in BiGG as {eqbiggids} ({curators} gave '{pure_mid}').", file=f)
126
126
 
127
127
 
128
128
  # add metabolite to model
@@ -136,7 +136,7 @@ def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to
136
136
 
137
137
 
138
138
  # write curators as annotations
139
- m.annotation['curator_codes'] = authors
139
+ m.annotation['curator_codes'] = curators
140
140
 
141
141
 
142
142
  # add annotations to model (same order of Memote)
@@ -197,7 +197,7 @@ def introduce_metabolites(logger, db, model, idcollection_dict, kegg_compound_to
197
197
 
198
198
 
199
199
 
200
- def introduce_reactions(logger, db, model, idcollection_dict, kegg_reaction_to_others, outdir, goodbefore, onlyauthor):
200
+ def introduce_reactions(logger, db, model, idcollection_dict, kegg_reaction_to_others, outdir, goodbefore, onlycurator):
201
201
  goodbefore_reached = False
202
202
 
203
203
 
@@ -226,24 +226,24 @@ def introduce_reactions(logger, db, model, idcollection_dict, kegg_reaction_to_o
226
226
  goodbefore_reached = True
227
227
 
228
228
 
229
- # manage goodbefore/onlyauthor
229
+ # manage goodbefore/onlycurator
230
230
  if goodbefore != None and goodbefore_reached:
231
- if onlyauthor == None:
231
+ if onlycurator == None:
232
232
  logger.warning(f"Skipping reaction '{rid}' as requested with --goodbefore[1] '{goodbefore}'.")
233
233
  continue
234
234
 
235
235
 
236
236
  # parse and get curators
237
- response = check_author(logger, rid, row, db, 'R')
237
+ response = check_curator(logger, rid, row, db, 'R')
238
238
  if type(response) == int: return 1
239
- else: authors = response
239
+ else: curators = response
240
240
 
241
241
 
242
- # manage goodbefore/onlyauthor
242
+ # manage goodbefore/onlycurator
243
243
  if goodbefore != None and goodbefore_reached:
244
- if onlyauthor != None and onlyauthor not in authors:
245
- authors_string = '; '.join(authors)
246
- logger.warning(f"Skipping reaction '{rid}' (authors '{authors_string}') as requested with --goodbefore[1] '{goodbefore}' and --onlyauthor '{onlyauthor}'.")
244
+ if onlycurator != None and onlycurator not in curators:
245
+ curators_string = '; '.join(curators)
246
+ logger.warning(f"Skipping reaction '{rid}' (curators '{curators_string}') as requested with --goodbefore[1] '{goodbefore}' and --onlycurator '{onlycurator}'.")
247
247
  continue
248
248
 
249
249
 
@@ -284,11 +284,11 @@ def introduce_reactions(logger, db, model, idcollection_dict, kegg_reaction_to_o
284
284
  eqbiggids.add(eqbiggid)
285
285
  if rid not in eqbiggids and eqbiggids != set():
286
286
  with open(f"{outdir}/logs/R.inbigg.txt", 'a') as f:
287
- print(f"Reactions '{'; '.join(kr_ids)}' already in BiGG as {eqbiggids} ({authors} gave '{rid}').", file=f)
287
+ print(f"Reactions '{'; '.join(kr_ids)}' already in BiGG as {eqbiggids} ({curators} gave '{rid}').", file=f)
288
288
 
289
289
 
290
290
  # add reaction to model
291
- response = add_reaction(logger, model, rid, authors, row, kr_ids, kegg_reaction_to_others, 'R', outdir)
291
+ response = add_reaction(logger, model, rid, curators, row, kr_ids, kegg_reaction_to_others, 'R', outdir)
292
292
  if response == 1: return 1
293
293
 
294
294
 
@@ -308,7 +308,7 @@ def introduce_reactions(logger, db, model, idcollection_dict, kegg_reaction_to_o
308
308
 
309
309
 
310
310
 
311
- def introduce_transporters(logger, db, model, idcollection_dict, kegg_reaction_to_others, outdir, goodbefore, onlyauthor):
311
+ def introduce_transporters(logger, db, model, idcollection_dict, kegg_reaction_to_others, outdir, goodbefore, onlycurator):
312
312
  goodbefore_reached = False
313
313
 
314
314
 
@@ -373,24 +373,24 @@ def introduce_transporters(logger, db, model, idcollection_dict, kegg_reaction_t
373
373
  return 1
374
374
 
375
375
 
376
- # manage goodbefore/onlyauthor
376
+ # manage goodbefore/onlycurator
377
377
  if goodbefore != None and goodbefore_reached:
378
- if onlyauthor == None:
378
+ if onlycurator == None:
379
379
  logger.warning(f"Skipping transport '{rid}' as requested with --goodbefore[2] '{goodbefore}'.")
380
380
  continue
381
381
 
382
382
 
383
- # parse author
384
- response = check_author(logger, rid, row, db, 'T')
383
+ # parse curator
384
+ response = check_curator(logger, rid, row, db, 'T')
385
385
  if type(response) == int: return 1
386
- else: authors = response
386
+ else: curators = response
387
387
 
388
388
 
389
- # manage goodbefore/onlyauthor
389
+ # manage goodbefore/onlycurator
390
390
  if goodbefore != None and goodbefore_reached:
391
- if onlyauthor != None and onlyauthor not in authors:
392
- authors_string = '; '.join(authors)
393
- logger.warning(f"Skipping transport '{rid}' (authors '{authors_string}') as requested with --goodbefore[2] '{goodbefore}' and --onlyauthor '{onlyauthor}'.")
391
+ if onlycurator != None and onlycurator not in curators:
392
+ curators_string = '; '.join(curators)
393
+ logger.warning(f"Skipping transport '{rid}' (curators '{curators_string}') as requested with --goodbefore[2] '{goodbefore}' and --onlycurator '{onlycurator}'.")
394
394
  continue
395
395
 
396
396
 
@@ -454,11 +454,11 @@ def introduce_transporters(logger, db, model, idcollection_dict, kegg_reaction_t
454
454
  eqbiggids.add(eqbiggid)
455
455
  if rid not in eqbiggids and eqbiggids != set():
456
456
  with open(f"{outdir}/logs/T.inbigg.txt", 'a') as f:
457
- print(f"Reactions '{'; '.join(kr_ids)}' already in BiGG as {eqbiggids} ({authors} gave '{rid}').", file=f)
457
+ print(f"Reactions '{'; '.join(kr_ids)}' already in BiGG as {eqbiggids} ({curators} gave '{rid}').", file=f)
458
458
 
459
459
 
460
460
  # add reaction to model
461
- response = add_reaction(logger, model, rid, authors, row, kr_ids, kegg_reaction_to_others, 'T', outdir)
461
+ response = add_reaction(logger, model, rid, curators, row, kr_ids, kegg_reaction_to_others, 'T', outdir)
462
462
  if response == 1: return 1
463
463
  rids_parsed.append(rid) # update list of rids in model
464
464