def yield_nanopub(assertions, annotations, line_num):
if not assertions:<EOL><INDENT>return {}<EOL><DEDENT>anno = copy.deepcopy(annotations)<EOL>evidence = anno.pop("<STR_LIT>", None)<EOL>stmt_group = anno.pop("<STR_LIT>", None)<EOL>citation = anno.pop("<STR_LIT>", None)<EOL>anno_list = []<EOL>for anno_type in anno:<EOL><INDENT>if isinstance(anno[anno_type], (list, tuple)):<EOL><INDENT>for val in anno[anno_type]:<EOL><INDENT>anno_list.append({"<STR_LIT:type>": anno_type, "<STR_LIT:label>": val})<EOL><DEDENT><DEDENT>else:<EOL><INDENT>anno_list.append({"<STR_LIT:type>": anno_type, "<STR_LIT:label>": anno[anno_type]})<EOL><DEDENT><DEDENT>assertions_list = []<EOL>for assertion in assertions:<EOL><INDENT>(subj, rel, obj) = split_bel_stmt(assertion, line_num)<EOL>assertions_list.append({"<STR_LIT>": subj, "<STR_LIT>": rel, "<STR_LIT:object>": obj})<EOL><DEDENT>nanopub = {<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT:type>": copy.deepcopy(nanopub_type),<EOL>"<STR_LIT>": copy.deepcopy(anno_list),<EOL>"<STR_LIT>": copy.deepcopy(citation),<EOL>"<STR_LIT>": copy.deepcopy(assertions_list),<EOL>"<STR_LIT>": evidence,<EOL>"<STR_LIT>": {"<STR_LIT>": stmt_group},<EOL>}<EOL>return {"<STR_LIT>": copy.deepcopy(nanopub)}<EOL>
Yield nanopub object