Package: ppx
A Python interface to proteomics data repositoriesOverviewppx provides a simple, programmatic means to access proteomics data that are
publicly available inProteomeXchangepartner
repositories. ppx allows users to easily find and download files associated
with projects inPRIDEandMassIVE. In doing so,
ppx promotes the reproducible analysis of proteomics data.For full documentation and examples, visit:https://ppx.readthedocs.ioInstallationppx requires Python 3.6+ and depends upon therequestsandtqdmPython packages. ppx and any missing
dependencies are easily installed withpipor withcondathrough thebiocondachannel.Install withconda:condainstall-cbiocondappxOr install withpip:pip3installppxConfigurationBy default, ppx will download project files in the.ppxdirectory under the
current user's home directory (~/.ppxon Linux and MacOS). There are several
ways to specify different data directories:Change the ppx data directory for all future Python sessions by setting thePPX_DATA_DIRenvironment variable to your preferred directory.Change the ppx data directory for a Python session using theppx.set_data_dir()function.Specify a data directory for a project using thelocalargument:>>>importppx>>>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.As of ppx v1.3.0, cloud paths can also be used as the data directory. This
allows you to stream downloaded files to AWS S3, Google Cloud Storage, or Azure
Blob Storage. To use a cloud storage provider, simply set the data directory to
a cloud URI, such as :code:s3://my-data-bucket/ppxusing any of the methods
above. Please note that you'll also need to setup credentials for your cloud
provider---see theCloudPathLib documentation <https://cloudpathlib.drivendata.org/v0.6/authentication/>_for details.ExamplesFirst, find a project using its ProteomeXchange or MassIVE identifier:>>>importppx>>>proj=ppx.find_project("PXD000001")We can then view the files associated with the project in the repository
(PRIDE in this case):>>>proj.remote_files()#['F063721.dat',# 'F063721.dat-mztab.txt',# 'PRIDE_Exp_Complete_Ac_22134.xml.gz',# 'PRIDE_Exp_mzData_Ac_22134.xml.gz',# 'PXD000001_mztab.txt',# 'README.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',# 'generated/PRIDE_Exp_Complete_Ac_22134.pride.mgf.gz',# 'generated/PRIDE_Exp_Complete_Ac_22134.pride.mztab.gz']We can alsoglobfor
specific types of files:>>>proj.remote_files("*.mzML")# ['TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01-20141210.mzML']Then we can download one or more files to the projects local data directory:>>>proj.download("README.txt")# [PosixPath('/Users/wfondrie/.ppx/PXD000001/README.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:>>>importppx>>>proj=ppx.find_project("PXD000001",repo="PRIDE")>>>proj.local_files()# [PosixPath('/Users/wfondrie/.ppx/PXD000001/README.txt')]Downloading to cloud storage backendWe useCloudPathlibto power
support for AWS S3, Google Cloud Storage, and Azure Blob Storage. To use a
cloud storage provider, create the bucket for ppx to use and set it as the ppx data
directory.For example using AWS S3, we can save the files of a project to an S3 bucket:>>>proj=ppx.find_project("PXD000001",local="s3://my-bucket/PXD000001")>>>proj.download("README.txt")# [S3Path('s3://my-bucket/PXD000001/README.txt')]CloudPathLib then provides methods to download files from S3 when you need them:>>>readme_on_s3=proj.local_files("README.txt")[0]>>>readme_on_s3.download_to("README.txt")# [PosixPath(README.txt)]If you are an R user...ppx was inspired the rpx R package by Laurent Gatto. Check it out onBioconductorandGitHub.