本文整理汇总了Python中Bio.Medline.read方法的典型用法代码示例。如果您正苦于以下问题:Python Medline.read方法的具体用法?Python Medline.read怎么用?Python Medline.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.Medline
的用法示例。
在下文中一共展示了Medline.read方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_medline_from_url
# 需要导入模块: from Bio import Medline [as 别名]
# 或者: from Bio.Medline import read [as 别名]
def test_medline_from_url(self):
"""Test Entrez into Medline.read from URL"""
efetch = Entrez.efetch(db="pubmed", id="19304878", rettype="medline", retmode="text")
record = Medline.read(efetch)
self.assertTrue(isinstance(record, dict))
self.assertEqual("19304878", record["PMID"])
self.assertEqual("10.1093/bioinformatics/btp163 [doi]", record["LID"])
示例2: test_read
# 需要导入模块: from Bio import Medline [as 别名]
# 或者: from Bio.Medline import read [as 别名]
def test_read(self):
with open("Medline/pubmed_result1.txt") as handle:
record = Medline.read(handle)
self.assertEqual(record["PMID"], "12230038")
self.assertEqual(record["OWN"], "NLM")
self.assertEqual(record["STAT"], "MEDLINE")
self.assertEqual(record["DA"], "20020916")
self.assertEqual(record["DCOM"], "20030606")
self.assertEqual(record["LR"], "20041117")
self.assertEqual(record["PUBM"], "Print")
self.assertEqual(record["IS"], "1467-5463 (Print)")
self.assertEqual(record["VI"], "3")
self.assertEqual(record["IP"], "3")
self.assertEqual(record["DP"], "2002 Sep")
self.assertEqual(record["TI"], "The Bio* toolkits--a brief overview.")
self.assertEqual(record["PG"], "296-302")
self.assertEqual(record["AB"], "Bioinformatics research is often difficult to do with commercial software. The Open Source BioPerl, BioPython and Biojava projects provide toolkits with multiple functionality that make it easier to create customised pipelines or analysis. This review briefly compares the quirks of the underlying languages and the functionality, documentation, utility and relative advantages of the Bio counterparts, particularly from the point of view of the beginning biologist programmer.")
self.assertEqual(record["AD"], "tacg Informatics, Irvine, CA 92612, USA. [email protected]")
self.assertEqual(record["FAU"], ["Mangalam, Harry"])
self.assertEqual(record["AU"], ["Mangalam H"])
self.assertEqual(record["LA"], ["eng"])
self.assertEqual(record["PT"], ["Journal Article"])
self.assertEqual(record["PL"], "England")
self.assertEqual(record["TA"], "Brief Bioinform")
self.assertEqual(record["JT"], "Briefings in bioinformatics")
self.assertEqual(record["JID"], "100912837")
self.assertEqual(record["SB"], "IM")
self.assertEqual(record["MH"], ["*Computational Biology", "Computer Systems", "Humans", "Internet", "*Programming Languages", "*Software", "User-Computer Interface"])
self.assertEqual(record["EDAT"], "2002/09/17 10:00")
self.assertEqual(record["MHDA"], "2003/06/07 05:00")
self.assertEqual(record["PST"], "ppublish")
self.assertEqual(record["SO"], "Brief Bioinform. 2002 Sep;3(3):296-302.")
示例3: processInput
# 需要导入模块: from Bio import Medline [as 别名]
# 或者: from Bio.Medline import read [as 别名]
def processInput(k):
print "Querying PMID: "+str(k)+"."
getall = Medline.read(Entrez.efetch(db="pubmed", id=k, rettype="medline", retmode="text"))
singlemesh = getall.get("MH")
singledate = getall.get("EDAT")
for j1 in range(len(singlemesh)):
cur.execute("INSERT INTO MeSH002(PMID, MeSH, Dates) VALUES("+str(k)+",'" + getall.get("MH")[j1][0:24].translate(None, "'*&")+"','" + str(singledate[0:10]) +"')" )
示例4: parse_medline
# 需要导入模块: from Bio import Medline [as 别名]
# 或者: from Bio.Medline import read [as 别名]
def parse_medline(self, text):
self.medline = Medline.read(text.split('\n'))
self.title = self.medline['TI']
self.journal = self.medline['JT']
self.citation = self.medline['SO']
self.date_pub = self.medline['DP']
try:
self.authors = self.medline['AU']
except KeyError:
self.authors = self.medline['IR']
示例5: test_pubmed_16381885
# 需要导入模块: from Bio import Medline [as 别名]
# 或者: from Bio.Medline import read [as 别名]
def test_pubmed_16381885(self):
"""Bio.TogoWS.entry("pubmed", "16381885")"""
# Gives Medline plain text
handle = TogoWS.entry("pubmed", "16381885")
data = Medline.read(handle)
handle.close()
self.assertEqual(data["TI"],
'From genomics to chemical genomics: new developments in KEGG.')
self.assertEqual(data["AU"], ['Kanehisa M', 'Goto S', 'Hattori M',
'Aoki-Kinoshita KF', 'Itoh M',
'Kawashima S', 'Katayama T', 'Araki M',
'Hirakawa M'])
示例6: test_multiline_mesh
# 需要导入模块: from Bio import Medline [as 别名]
# 或者: from Bio.Medline import read [as 别名]
def test_multiline_mesh(self):
with open("Medline/pubmed_result3.txt") as handle:
record = Medline.read(handle)
self.assertEqual(record["PMID"], "23039619")
self.assertEqual(record["MH"], ["Blood Circulation",
"High-Intensity Focused Ultrasound Ablation/adverse effects/instrumentation/*methods",
"Humans",
"Models, Biological",
"Sonication",
"Temperature",
"Time Factors",
"Transducers"])
示例7: test_medline_from_url
# 需要导入模块: from Bio import Medline [as 别名]
# 或者: from Bio.Medline import read [as 别名]
def test_medline_from_url(self):
"""Test Entrez into Medline.read from URL"""
handle = Entrez.efetch(db="pubmed", id="19304878", rettype="medline", retmode="text")
self.assertTrue(handle.url.startswith(URL_HEAD + "efetch.fcgi?"), handle.url)
self.assertTrue(URL_TOOL in handle.url)
self.assertTrue(URL_EMAIL in handle.url)
self.assertTrue("id=19304878" in handle.url)
record = Medline.read(handle)
handle.close()
self.assertTrue(isinstance(record, dict))
self.assertEqual("19304878", record["PMID"])
self.assertEqual("10.1093/bioinformatics/btp163 [doi]", record["LID"])
示例8: test_pubmed_16381885
# 需要导入模块: from Bio import Medline [as 别名]
# 或者: from Bio.Medline import read [as 别名]
def test_pubmed_16381885(self):
"""Bio.TogoWS.entry("pubmed", "16381885")"""
# Gives Medline plain text
handle = TogoWS.entry("pubmed", "16381885")
data = Medline.read(handle)
handle.close()
self.assertEqual(data["TI"], "From genomics to chemical genomics: new developments in KEGG.")
self.assertEqual(
data["AU"],
[
"Kanehisa M",
"Goto S",
"Hattori M",
"Aoki-Kinoshita KF",
"Itoh M",
"Kawashima S",
"Katayama T",
"Araki M",
"Hirakawa M",
],
)
示例9: fetch_from_entrez
# 需要导入模块: from Bio import Medline [as 别名]
# 或者: from Bio.Medline import read [as 别名]
def fetch_from_entrez(index, cache_dir=False):
logger = logging.getLogger('build')
# slugify the index for the cache filename (some indices have symbols not allowed in file names (e.g. /))
index_slug= slugify(index)
cache_file_path = '{}/{}'.format('/'.join(cache_dir), index_slug)
# try fetching from cache
if cache_dir:
d = fetch_from_cache(cache_dir, index_slug)
if d:
logger.info('Fetched {} from cache'.format(cache_file_path))
return d
# if nothing is found in the cache, use the web API
logger.info('Fetching {} from Entrez'.format(index))
tries = 0
max_tries = 5
while tries < max_tries:
if tries > 0:
logger.warning('Failed fetching {}, retrying'.format(full_url))
try:
Entrez.email = '[email protected]'
handle = Entrez.efetch(
db="pubmed",
id=str(index),
rettype="medline",
retmode="text"
)
except:
tries += 1
time.sleep(2)
else:
d = Medline.read(handle)
# save to cache
save_to_cache(cache_dir, index_slug, d)
logger.info('Saved entry for {} in cache'.format(cache_file_path))
return d
示例10: fetcher
# 需要导入模块: from Bio import Medline [as 别名]
# 或者: from Bio.Medline import read [as 别名]
def fetcher(self):
handle = Entrez.efetch(db='pubmed', id=self.name, retmode='text', rettype='medline')
return Medline.read(handle)