本文整理汇总了Python中dipper.models.Reference.Reference.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Python Reference.setTitle方法的具体用法?Python Reference.setTitle怎么用?Python Reference.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dipper.models.Reference.Reference
的用法示例。
在下文中一共展示了Reference.setTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _process_article_row
# 需要导入模块: from dipper.models.Reference import Reference [as 别名]
# 或者: from dipper.models.Reference.Reference import setTitle [as 别名]
def _process_article_row(self, row):
# don't bother in test mode
if self.testMode:
return
iarticle_id = self._make_internal_id('article', row['article_id'])
self.id_hash['article'][row['article_id']] = iarticle_id
rtype = None
if row['journal'] != '':
rtype = Reference.ref_types['journal_article']
r = Reference(iarticle_id, rtype)
if row['title'] is not None:
r.setTitle(row['title'].strip())
if row['year'] is not None:
r.setYear(row['year'])
r.addRefToGraph(self.g)
if row['pubmed_id'] is not None:
pmid = 'PMID:'+str(row['pubmed_id'])
self.id_hash['article'][row['article_id']] = pmid
self.gu.addSameIndividual(self.g, iarticle_id, pmid)
self.gu.addComment(self.g, pmid, iarticle_id)
return
示例2: _get_pubs
# 需要导入模块: from dipper.models.Reference import Reference [as 别名]
# 或者: from dipper.models.Reference.Reference import setTitle [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
示例3: _get_pubs
# 需要导入模块: from dipper.models.Reference import Reference [as 别名]
# 或者: from dipper.models.Reference.Reference import setTitle [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