本文整理汇总了Python中dipper.models.Reference.Reference.setShortCitation方法的典型用法代码示例。如果您正苦于以下问题:Python Reference.setShortCitation方法的具体用法?Python Reference.setShortCitation怎么用?Python Reference.setShortCitation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dipper.models.Reference.Reference
的用法示例。
在下文中一共展示了Reference.setShortCitation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_pubs
# 需要导入模块: from dipper.models.Reference import Reference [as 别名]
# 或者: from dipper.models.Reference.Reference import setShortCitation [as 别名]
def _get_pubs(self, entry, g):
"""
Extract mentioned publications from the reference list
:param entry:
:return:
"""
ref_to_pmid = {}
entry_num = entry['mimNumber']
model = Model(g)
if 'referenceList' in entry:
reflist = entry['referenceList']
for r in reflist:
if 'pubmedID' in r['reference']:
pub_id = 'PMID:' + str(r['reference']['pubmedID'])
ref = \
Reference(
g, pub_id,
Reference.ref_types['journal_article'])
else:
# make blank node for internal reference
pub_id = \
'_:OMIM' + str(entry_num) + 'ref' + \
str(r['reference']['referenceNumber'])
ref = Reference(g, pub_id)
title = author_list = source = citation = None
if 'title' in r['reference']:
title = r['reference']['title']
ref.setTitle(title)
if 'authors' in r['reference']:
author_list = r['reference']['authors']
ref.setAuthorList(author_list)
citation = re.split(r'\.\,', author_list)[0] + ' et al'
if 'source' in r['reference']:
source = r['reference']['source']
citation = '; '.join(
list(filter(None.__ne__, [citation, title, source])))
ref.setShortCitation(citation)
ref.addRefToGraph()
ref_to_pmid[r['reference']['referenceNumber']] = pub_id
# add is_about for the pub
omim_id = 'OMIM:'+str(entry_num)
g.addTriple(omim_id, model.object_properties['mentions'],
pub_id)
return ref_to_pmid
示例2: _get_pubs
# 需要导入模块: from dipper.models.Reference import Reference [as 别名]
# 或者: from dipper.models.Reference.Reference import setShortCitation [as 别名]
def _get_pubs(self, entry, g):
"""
Extract mentioned publications from the reference list
:param entry:
:return:
"""
ref_to_pmid = {}
du = DipperUtil()
entry_num = entry['mimNumber']
gu = GraphUtils(curie_map.get())
if 'referenceList' in entry:
reflist = entry['referenceList']
for r in reflist:
if 'pubmedID' in r['reference']:
pub_id = 'PMID:' + str(r['reference']['pubmedID'])
ref = Reference(pub_id, Reference.ref_types['journal_article'])
else:
# make blank node for internal reference
pub_id = '_OMIM' + str(entry_num) + 'ref' + str(r['reference']['referenceNumber'])
if self.nobnodes:
pub_id = ':' + pub_id
ref = Reference(pub_id)
title = author_list = source = citation = None
if 'title' in r['reference']:
title = r['reference']['title']
ref.setTitle(title)
if 'authors' in r['reference']:
author_list = r['reference']['authors']
ref.setAuthorList(author_list)
citation = re.split('\.\,', author_list)[0] + ' et al'
if 'source' in r['reference']:
source = r['reference']['source']
citation = '; '.join(du.flatten([citation, title, source]))
ref.setShortCitation(citation)
ref.addRefToGraph(g)
ref_to_pmid[r['reference']['referenceNumber']] = pub_id
# add is_about for the pub
omim_id = 'OMIM:'+str(entry_num)
gu.addTriple(g, omim_id, gu.object_properties['mentions'], pub_id)
return ref_to_pmid