GithubHelp home page GithubHelp logo

entrez_utils's Introduction

entrez_utils

This library allows you to access information in remote Entrez databases from Python.

Examples

Creating an EntrezManager

An EntrezManager controls communication with the Entrez databases via HTTP requests. The class is aware of the methods supported by the Entrez API and ensures that the rate limits are not exceeded.

NCBI requests that the email address of the user be sent with requests, so an email is required to construct an EntrezManager.

from entrez_utils import EntrezManager

man = EntrezManager("[email protected]")

Accessing a record

Most objects can be constructed with either an accession or an Entrez ID.

from entrez_utils import BioProject, BioSample, SRAExperiment, SRARun

project = BioProject(man, accession="PRJNA293777")
sample = BioSample(man, entrez_id="4009779")
experiment = SRAExperiment(man, accession="SRX4958339")
run = SRARun(man, accession="SRR8137396	")

Getting linked records

Properties of a record can be used to get other linked records. For example, this code gets the samples associated with a project.

samples = project.samples

Accessing raw XML

The Python objects representing Entrez records do not expose all possible data from the XML through their properties. The xml attribute give access to a parsed version of the raw XML associated with the record.

xml = project.xml

Batch fetching objects

The XML for a record is ordinarily retrieved lazily, but separately fetching XML for many records can be time consuming. To speed up the process, you can use fetch_all to fetch many records' XML at once.

samples = project.samples
fetch_all(samples)

The fetched function runs fetch_all on its argument and returns the argument, so it can be used to make the code above more concise.

samples = fetched(project.sample)

entrez_utils's People

Contributors

actapia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.