Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A Python interface to proteomics data repositories

Project description

A Python interface to proteomics data repositories

testsDocumentation Status

Overview

ppx provides a simple, programmatic means to access proteomics data that are publicly available in ProteomeXchange partner repositories. ppx allows users to easily find and download files associated with projects in PRIDE and MassIVE. In doing so, ppx promotes the reproducible analysis of proteomics data.

For full documentation and examples, visit: https://ppx.readthedocs.io

Installation

ppx requires Python 3.6+ and depends upon the requests and tqdm Python packages. ppx and any missing dependencies are easily installed with pip:

pip3 install ppx

Configuration

By default, ppx will download project files in the .ppx directory under the current user's home directory (~/.ppx on Linux and MacOS). There are several ways to specify different data directories:

  1. Change the ppx data directory for all future Python sessions by setting the PPX_DATA_DIR environment variable to your preferred directory.

  2. Change the ppx data directory for a Python session using the ppx.set_data_dir() function.

  3. Specify a data directory for a project using the local argument:

>>> import ppx

>>> proj = ppx.find_project("PXD000001", local="my/data/dir")

Why does ppx set a default data directory? We found that this makes it easier to reuse the same proteomics data files in multiple tasks that we're working on.

Examples

First, find a project using its ProteomeXchange or MassIVE identifier:

>>> import ppx

>>> proj = ppx.find_project("PXD000001")

We can then view the files associated with the project in the repository (PRIDE in this case):

>>> remote_files = proj.remote_files()
>>> print(remote_files)
# ['F063721.dat', 'F063721.dat-mztab.txt', 'PXD000001_mztab.txt',
# 'TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01-20141210.mzML',
# 'TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01-20141210.mzXML',
# 'TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzXML',
# 'TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.raw',
# 'erwinia_carotovora.fasta']

We can also glob for specific types of files:

>>> mzml_files = proj.remote_files("*.mzML")
>>> print(mzml_files)
# ['TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01-20141210.mzML']

Then we can download one or more files to the projects local data directory:

>>> downloaded = proj.download("F063721.dat-mztab.txt")
>>> print(downloaded)
# [PosixPath('/Users/wfondrie/.ppx/PXD000001/F063721.dat-mztab.txt')]

Once we've downloaded files, ppx no longer needs an internet connection to retrieve a project's local data. However, you will need to specify the repository in which the project data resides. If we start a new Python session, we can find our previous file easily:

>>> import ppx

>>> proj = ppx.find_project("PXD000001", repo="PRIDE")
>>> local_files = proj.local_files()
>>> print(local_files)
# [PosixPath('/Users/wfondrie/.ppx/PXD000001/F063721.dat-mztab.txt')]

If you are an R user...

ppx was inpsired the rpx R package by Laurent Gatto. Check it out on Bioconductor and GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ppx, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size ppx-1.0.0-py3-none-any.whl (21.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ppx-1.0.0.tar.gz (71.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page