Back to index

python-biopython  1.60
Classes | Functions
Bio.Medline Namespace Reference

Classes

class  Record

Functions

def parse
def read

Class Documentation

class Bio::Medline::Record
A dictionary holding information from a Medline record.
All data are stored under the mnemonic appearing in the Medline
file. These mnemonics have the following interpretations:

Mnemonic  Description
AB        Abstract
CI        Copyright Information
AD        Affiliation
IRAD      Investigator Affiliation
AID       Article Identifier
AU        Author
FAU       Full Author
CN        Corporate Author
DCOM      Date Completed
DA        Date Created
LR        Date Last Revised
DEP       Date of Electronic Publication
DP        Date of Publication
EDAT      Entrez Date
GS        Gene Symbol
GN        General Note
GR        Grant Number
IR        Investigator Name
FIR       Full Investigator Name
IS        ISSN
IP        Issue
TA        Journal Title Abbreviation
JT        Journal Title
LA        Language
LID       Location Identifier
MID       Manuscript Identifier
MHDA      MeSH Date
MH        MeSH Terms
JID       NLM Unique ID
RF        Number of References
OAB       Other Abstract
OCI       Other Copyright Information
OID       Other ID
OT        Other Term
OTO       Other Term Owner
OWN       Owner
PG        Pagination
PS        Personal Name as Subject
FPS       Full Personal Name as Subject
PL        Place of Publication
PHST      Publication History Status
PST       Publication Status
PT        Publication Type
PUBM      Publishing Model
PMC       PubMed Central Identifier
PMID      PubMed Unique Identifier
RN        Registry Number/EC Number
NM        Substance Name
SI        Secondary Source ID
SO        Source
SFM       Space Flight Mission
STAT      Status
SB        Subset
TI        Title
TT        Transliterated Title
VI        Volume
CON       Comment on
CIN       Comment in
EIN       Erratum in
EFR       Erratum for
CRI       Corrected and Republished in
CRF       Corrected and Republished from
PRIN      Partial retraction in
PROF      Partial retraction of
RPI       Republished in
RPF       Republished from
RIN       Retraction in
ROF       Retraction of
UIN       Update in
UOF       Update of
SPIN      Summary for patients in
ORI       Original report in

Definition at line 17 of file __init__.py.


Function Documentation

def Bio.Medline.parse (   handle)
Read Medline records one by one from the handle.

The handle is either is a Medline file, a file-like object, or a list
of lines describing one or more Medline records.

Typical usage:

    from Bio import Medline
    handle = open("mymedlinefile")
    records = Medline.parse(handle)
    for record in record:
        print record['TI']

Definition at line 98 of file __init__.py.

00098 
00099 def parse(handle):
00100     """Read Medline records one by one from the handle.
00101 
00102     The handle is either is a Medline file, a file-like object, or a list
00103     of lines describing one or more Medline records.
00104 
00105     Typical usage:
00106 
00107         from Bio import Medline
00108         handle = open("mymedlinefile")
00109         records = Medline.parse(handle)
00110         for record in record:
00111             print record['TI']
00112 
00113     """
00114     # These keys point to string values
00115     textkeys = ("ID", "PMID", "SO", "RF", "NI", "JC", "TA", "IS", "CY", "TT",
00116                 "CA", "IP", "VI", "DP", "YR", "PG", "LID", "DA", "LR", "OWN",
00117                 "STAT", "DCOM", "PUBM", "DEP", "PL", "JID", "SB", "PMC",
00118                 "EDAT", "MHDA", "PST", "AB", "AD", "EA", "TI", "JT")
00119     handle = iter(handle)
00120     # First skip blank lines
00121     for line in handle:
00122         line = line.rstrip()
00123         if line:
00124             break
00125     else:
00126         return
00127     record = Record()
00128     finished = False
00129     while not finished:
00130         if line[:6]=="      ": # continuation line
00131             record[key].append(line[6:])
00132         elif line:
00133             key = line[:4].rstrip()
00134             if not key in record:
00135                 record[key] = []
00136             record[key].append(line[6:])
00137         try:
00138             line = handle.next()
00139         except StopIteration:
00140             finished = True
00141         else:
00142             line = line.rstrip()
00143             if line:
00144                 continue
00145         # Join each list of strings into one string.
00146         for key in textkeys:
00147             if key in record:
00148                 record[key] = " ".join(record[key])
00149         if record:
00150             yield record
00151         record = Record()

Here is the caller graph for this function:

def Bio.Medline.read (   handle)
Read a single Medline records from the handle.

The handle is either is a Medline file, a file-like object, or a list
of lines describing a Medline record.

Typical usage:

    from Bio import Medline
    handle = open("mymedlinefile")
    record = Medline.read(handle)
    print record['TI']

Definition at line 152 of file __init__.py.

00152 
00153 def read(handle):
00154     """Read a single Medline records from the handle.
00155 
00156     The handle is either is a Medline file, a file-like object, or a list
00157     of lines describing a Medline record.
00158 
00159     Typical usage:
00160 
00161         from Bio import Medline
00162         handle = open("mymedlinefile")
00163         record = Medline.read(handle)
00164         print record['TI']
00165 
00166     """
00167     records = parse(handle)
00168     return records.next()

Here is the call graph for this function: