Ejemplo n.º 1
0
def sample_5():
    """EPost - ELink - ESummary/EFetch

    Downloads gene records linked to a set of proteins corresponding
    to a list of protein GI numbers.
    """
    # Input: List of Entrez UIDs in database protein (protein GIs).
    id_list = '194680922,50978626,28558982,9507199,6678417'

    elems_prot = ez.eselect(tool='post', db='protein', id=id_list)

    elems_gene = ez.eselect(tool='link',
                            dbfrom='protein',
                            db='gene',
                            elems=elems_prot,
                            linkname='protein_gene',
                            cmd='neighbor_history')

    for line in ez.eapply(tool='summary', db='gene', elems=elems_gene):
        print(line)

    for line in ez.eapply(tool='fetch',
                          db='gene',
                          elems=elems_gene,
                          rettype='xml',
                          retmode='xml'):
        print(line)
Ejemplo n.º 2
0
def sample_4():
    """ESearch - ELink - ESummary/EFetch

    Download protein FASTA records linked to abstracts published
    in 2009 that are indexed in MeSH for both asthma and leukotrienes.
    """
    # Input: Entrez text query in database pubmed.
    query = 'asthma[mesh] AND leukotrienes[mesh] AND 2009[pdat]'

    elems_pubmed = ez.eselect(tool='search', db='pubmed', term=query)

    elems_prot = ez.eselect(tool='link',
                            dbfrom='pubmed',
                            db='protein',
                            elems=elems_pubmed,
                            linkname='pubmed_protein',
                            cmd='neighbor_history')

    # Linked XML Document Summaries from database protein.
    for line in ez.eapply(tool='summary', db='protein', elems=elems_prot):
        print(line)

    # Formatted data records of selected proteins (FASTA in this case).
    for line in ez.eapply(tool='fetch',
                          db='protein',
                          elems=elems_prot,
                          rettype='fasta'):
        print(line)
Ejemplo n.º 3
0
def sample_3():
    """ELink - ESummary/Efetch

    Download gene records linked to a set of proteins corresponding to
    a list of GI numbers.
    """
    # Input UIDs (protein GIs).
    id_list = '194680922,50978626,28558982,9507199,6678417'

    # Select elements, linking dbs protein and gene with the name protein_gene.
    elems = ez.eselect(tool='link',
                       dbfrom='protein',
                       db='gene',
                       id=id_list,
                       linkname='protein_gene',
                       cmd='neighbor_history')

    # XML document summaries of selected genes.
    for line in ez.eapply(tool='summary', db='gene', elems=elems):
        print(line)

    # Formatted data records of selected genes (FASTA in this case).
    for line in ez.eapply(tool='fetch',
                          db='gene',
                          elems=elems,
                          rettype='fasta'):
        print(line)
Ejemplo n.º 4
0
def sample_4():
    """ESearch - ELink - ESummary/EFetch

    Download protein FASTA records linked to abstracts published
    in 2009 that are indexed in MeSH for both asthma and leukotrienes.
    """
    # Input: Entrez text query in database pubmed.
    query = 'asthma[mesh] AND leukotrienes[mesh] AND 2009[pdat]'

    elems_pubmed = entrez.eselect(tool='search', db='pubmed', term=query)

    elems_prot = entrez.eselect(tool='link', dbfrom='pubmed', db='protein',
                                elems=elems_pubmed, linkname='pubmed_protein',
                                cmd='neighbor_history')

    # Linked XML Document Summaries from database protein.
    for line in entrez.eapply(tool='summary', db='protein', elems=elems_prot):
        print(line)

    # Formatted data records of selected proteins (FASTA in this case).
    for line in entrez.eapply(tool='fetch', db='protein', elems=elems_prot,
                              rettype='fasta'):
        print(line)
Ejemplo n.º 5
0
def sample_6():
    """EPost - ESearch

    Given an input set of protein GI numbers, create a history set containing
    the members of the input set that correspond to human proteins.
    (Which of these proteins are from human?)
    """
    id_list = '194680922,50978626,28558982,9507199,6678417'

    elems = ez.eselect(tool='post', db='protein', id=id_list)

    for line in ez.eapply(tool='search',
                          db='protein',
                          term='human[orgn]',
                          elems=elems):
        print(line)
Ejemplo n.º 6
0
def sample_2():
    """EPost - ESummary/EFetch

    Download protein records corresponding to a list of GI numbers.
    """
    # Input: List of Entrez UIDs (integer identifiers, e.g. PMID, GI, Gene ID).
    id_list = '194680922,50978626,28558982,9507199,6678417'

    elems = entrez.eselect(tool='post', db='protein', id=id_list)

    # XML document summaries.
    for line in entrez.eapply(tool='summary', db='protein', elems=elems):
        print(line)

    # Formatted data records (FASTA in this case).
    for line in entrez.eapply(tool='fetch', db='protein', elems=elems,
                              rettype='fasta'):
        print(line)
Ejemplo n.º 7
0
def sample_1():
    """ESearch - ESummary/EFetch

    Download PubMed records that are indexed in MeSH for both asthma
    and leukotrienes and were also published in 2009.
    """
    # Input query.
    query = 'asthma[mesh] AND leukotrienes[mesh] AND 2009[pdat]'

    # Select the elements: query pubmed and keep the reference.
    elems = entrez.eselect(tool='search', db='pubmed', term=query)

    # XML document summaries.
    for line in entrez.eapply(tool='summary', db='pubmed', elems=elems):
        print(line)

    # Formatted data records (abstracts in this case).
    for line in entrez.eapply(tool='fetch', db='pubmed', elems=elems,
                              rettype='abstract'):
        print(line)
Ejemplo n.º 8
0
def sample_2():
    """EPost - ESummary/EFetch

    Download protein records corresponding to a list of GI numbers.
    """
    # Input: List of Entrez UIDs (integer identifiers, e.g. PMID, GI, Gene ID).
    id_list = '194680922,50978626,28558982,9507199,6678417'

    elems = ez.eselect(tool='post', db='protein', id=id_list)

    # XML document summaries.
    for line in ez.eapply(tool='summary', db='protein', elems=elems):
        print(line)

    # Formatted data records (FASTA in this case).
    for line in ez.eapply(tool='fetch',
                          db='protein',
                          elems=elems,
                          rettype='fasta'):
        print(line)
Ejemplo n.º 9
0
def sample_3():
    """ELink - ESummary/Efetch

    Download gene records linked to a set of proteins corresponding to
    a list of GI numbers.
    """
    # Input UIDs (protein GIs)
    id_list = '194680922,50978626,28558982,9507199,6678417'

    # Select elements, linking dbs protein and gene with the name protein_gene
    elems = entrez.eselect(tool='link', dbfrom='protein', db='gene', id=id_list,
                           linkname='protein_gene', cmd='neighbor_history')

    # XML document summaries of selected genes.
    for line in entrez.eapply(tool='summary', db='gene', elems=elems):
        print(line)

    # Formatted data records of selected genes (FASTA in this case).
    for line in entrez.eapply(tool='fetch', db='gene', elems=elems,
                              rettype='fasta'):
        print(line)
Ejemplo n.º 10
0
def sample_7():
    """ELink - ESearch

    Given an input set of protein GI numbers, create a history set containing
    the gene IDs linked to members of the input set that also are on human
    chromosome X.
    (Which of the input proteins are encoded by a gene on human chromosome X?)
    """
    # Input: UIDs in database protein (protein GIs).
    id_list = '148596974,42544182,187937179,4557377,6678417'

    elems = ez.eselect(tool='link',
                       dbfrom='protein',
                       db='gene',
                       id=id_list,
                       linkname='protein_gene',
                       cmd='neighbor_history')

    query = 'human[orgn] AND x[chr]'
    for line in ez.eapply(tool='search', db='gene', term=query, elems=elems):
        print(line)
Ejemplo n.º 11
0
def sample_1():
    """ESearch - ESummary/EFetch

    Download PubMed records that are indexed in MeSH for both asthma
    and leukotrienes and were also published in 2009.
    """
    # Input query.
    query = 'asthma[mesh] AND leukotrienes[mesh] AND 2009[pdat]'

    # Select the elements: query pubmed and keep the reference.
    elems = ez.eselect(tool='search', db='pubmed', term=query)

    # XML document summaries.
    for line in ez.eapply(tool='summary', db='pubmed', elems=elems):
        print(line)

    # Formatted data records (abstracts in this case).
    for line in ez.eapply(tool='fetch',
                          db='pubmed',
                          elems=elems,
                          rettype='abstract'):
        print(line)