MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / combine

Function combine

bmtools/tools/meta_analysis/api.py:256–290  ·  view source on GitHub ↗
(tables, tables1=None, crit=None)

Source from the content-addressed store, hash-verified

254 return dic
255
256def combine(tables, tables1=None, crit=None):
257 extra_query = []
258 if tables1 is not None:
259 if len(tables)!=len(tables1):
260 print('error')
261 else:
262 for idx in range(len(tables)):
263 if tables1[idx] is not None:
264 tables[idx].update(tables1[idx])
265 bigtab = {}
266 kys = []
267 for tab in tables:
268 kys+=list(tab.keys())
269 kys = set(kys)
270 if crit is not None:
271 for jdx,tab in enumerate(tables):
272 prp = ''
273 for ky in kys:
274 if ky not in tab:
275 prp+=ky+', '
276 if prp=='':
277 extra_query.append('')
278 else:
279 ask = 'We want to explore '+crit+'. Read the following article and list the '+prp[:-2]+' of the trial into a concise markdown table. Article: '
280 extra_query.append(ask)
281 for ky in kys:
282 line = ' | '
283 for tab in tables:
284 if ky not in tab:
285 line+='N/A'
286 else:
287 line+=tab[ky]
288 line+=' | '
289 bigtab[ky] = line
290 return bigtab, extra_query
291
292def get_table(pth, crit):
293 lines = open(pth).readlines()[1:]

Callers 2

get_tableFunction · 0.85
final_tableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected