The goal of the rpx package is to provide programmatic access to proteomics data from R, in particular to the ProteomeXchange (PX) central repository (see http://www.proteomexchange.org/ and http://central.proteomexchange.org/).
Vizcaino J.A. et al. ProteomeXchange: globally co-ordinated proteomics data submission and dissemination, Nature Biotechnology 2014, 32, 223 – 226, doi:10.1038/nbt.2839.
Additional repositories are likely to be added in the future.
PXDataset
objectsThe central object that handles data access is the PXDataset
class. Such an instance can be generated by passing a valid PX
experiment identifier to the PXDataset
constructor.
library("rpx")
id <- "PXD000001"
px <- PXDataset(id)
px
## Object of class "PXDataset"
## Id: PXD000001 with 12 files
## [1] 'F063721.dat' ... [12] 'generated'
## Use 'pxfiles(.)' to see all files.
Several attributes can be extracted from an PXDataset
instance, as
described below.
The experiment identifier, that was originally used to create the \Robject{PXDataset} instance can be extracted with the \Rfunction{pxid} method:
pxid(px)
## [1] "PXD000001"
The file transfer url where the data files can be accessed can be
queried with the pxurl
method:
pxurl(px)
## [1] "ftp://ftp.pride.ebi.ac.uk/pride/data/archive/2012/03/PXD000001"
The species the data has been generated the data can be obtain calling
the pxtax
function:
pxtax(px)
## [1] "Erwinia carotovora"
Relevant bibliographic references can be queried with the
pxref
method:
strwrap(pxref(px))
## [1] "Gatto L, Christoforou A. Using R and Bioconductor for proteomics"
## [2] "data analysis. Biochim Biophys Acta. 2013 May 18. doi:pii:"
## [3] "S1570-9639(13)00186-6. 10.1016/j.bbapap.2013.04.032"
All files available for the PX experiment can be obtained with the
pxfiles
method:
pxfiles(px)
## [1] "F063721.dat"
## [2] "F063721.dat-mztab.txt"
## [3] "PRIDE_Exp_Complete_Ac_22134.xml.gz"
## [4] "PRIDE_Exp_mzData_Ac_22134.xml.gz"
## [5] "PXD000001_mztab.txt"
## [6] "README.txt"
## [7] "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01-20141210.mzML"
## [8] "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01-20141210.mzXML"
## [9] "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzXML"
## [10] "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.raw"
## [11] "erwinia_carotovora.fasta"
## [12] "generated"
The complete or partial data set can be downloaded with the pxget
function. The function takes an instance of class PXDataset
as first
mandatory argument.
The next argument, list
, specifies what files to download. If
missing, a menu is printed and the user can select a file. If set to
"all"
, all files of the experiment are downloaded in the working
directory. Alternatively, numerics or logicals can also be used to
subset the relevant files to be downloaded based on the pxfiles(.)
output.
The last argument, force
, can be set to TRUE
to force the download
of files that already exists in the working directory.
pxget(px, "erwinia_carotovora.fasta")
## Downloading 1 file
dir(pattern = "fasta")
## [1] "erwinia_carotovora.fasta"
By default, pxget
will not download and overwrite a file if already
available. The last argument of pxget
, force
, can be set to TRUE
to force the download of files that already exists in the working
directory.
(i <- grep("fasta", pxfiles(px)))
## [1] 11
pxget(px, i) ## same as above
## Downloading 1 file
## /tmp/RtmpsLb7jY/Rbuild23346e29c90e/rpx/vignettes/erwinia_carotovora.fasta already present.
Finally, a list of recent PX additions and updates can be obtained
using the pxannounced()
function:
pxannounced()
## 15 new ProteomeXchange annoucements
## Data.Set Publication.Data Message
## 1 PXD013256 2019-10-02 15:13:13 New
## 2 PXD014533 2019-10-02 11:10:37 New
## 3 PXD014530 2019-10-02 11:07:16 New
## 4 PXD015233 2019-10-02 10:51:15 New
## 5 PXD015272 2019-10-02 10:50:08 New
## 6 PXD013191 2019-10-02 09:09:53 New
## 7 PXD015194 2019-10-02 08:32:53 New
## 8 PXD012592 2019-10-02 08:23:44 New
## 9 PXD007988 2019-10-02 07:59:03 New
## 10 PXD009726 2019-10-02 07:52:04 New
## 11 PXD009727 2019-10-02 07:46:05 New
## 12 PXD013729 2019-10-02 07:42:21 New
## 13 PXD009729 2019-10-02 07:32:51 New
## 14 PXD009728 2019-10-02 07:24:26 New
## 15 PXD011335 2019-10-01 15:39:34 New
Below, we show how to automate the extraction of files of interest
(fasta and mzTab files), download them and read them using appropriate
Bioconductor infrastructure. (Note that we read version 0.9 of the
MzTab format below. For recent data, the version
argument would be
omitted.)
(mzt <- grep("F0.+mztab", pxfiles(px), value = TRUE))
## [1] "F063721.dat-mztab.txt"
(fas <- grep("fasta", pxfiles(px), value = TRUE))
## [1] "erwinia_carotovora.fasta"
pxget(px, c(mzt, fas))
## Downloading 2 files
## /tmp/RtmpsLb7jY/Rbuild23346e29c90e/rpx/vignettes/erwinia_carotovora.fasta already present.
library("Biostrings")
readAAStringSet(fas)
## A AAStringSet instance of length 4499
## width seq names
## [1] 147 MADITLISGSTLGSAEYVA...QIPEDPAEEWLGSWVNLLK ECA0001 putative ...
## [2] 153 VAEIYQIDNLDRGILSALM...QSTETLISLQNPIMRTIAP ECA0002 AsnC-fami...
## [3] 330 MKKQYIEKQQQISFVKSFF...QVQCGVWPQPLRESVSGLL ECA0003 putative ...
## [4] 492 MITLESLEMLLSIDENELL...FDTGLKSRLMRRWQHGKAY ECA0004 conserved...
## [5] 499 MRQTAALAERISRLSHALE...IEASLQQVAEQIQQSEQQD ECA0005 conserved...
## ... ... ...
## [4495] 634 MSDKIIHLTDDSFDTDVLK...KVDPLRVFASDMARRLELL trx-rv3790 trx-rv...
## [4496] 93 MTKMNNKARRTARELKHLG...LRDEFPMGYLGDYKDDDDK TimBlower TimBlower
## [4497] 309 MFSNLSKRWAQRTLSKSFY...KWAGIKTRKFVFNPPKPRK sp|P07143|CY1_YEA...
## [4498] 231 FPTDDDDKIVGGYTCAANS...VYTKVCNYVNWIQQTIAAN sp|P00761|TRYP_PI...
## [4499] 269 GVSGSCNIDVVCPEGNGHR...AGTGAQFIDGLDSTGTPPV sp|Q7M135|LYSC_LY...
library("MSnbase")
(x <- readMzTabData(mzt, "PEP", version = "0.9"))
## MSnSet (storageMode: lockedEnvironment)
## assayData: 1528 features, 6 samples
## element names: exprs
## protocolData: none
## phenoData
## sampleNames: sub[1] sub[2] ... sub[6] (6 total)
## varLabels: abundance
## varMetadata: labelDescription
## featureData
## featureNames: 1 2 ... 1528 (1528 total)
## fvarLabels: sequence accession ... uri (14 total)
## fvarMetadata: labelDescription
## experimentData: use 'experimentData(object)'
## Annotation:
## - - - Processing information - - -
## mzTab read: Wed Oct 2 20:43:23 2019
## MSnbase version: 2.10.1
head(exprs(x))
## sub[1] sub[2] sub[3] sub[4] sub[5] sub[6]
## 1 10630132 11238708 12424917 10997763 9928972 10398534
## 2 11105690 12403253 13160903 12229367 11061660 10131218
## 3 1183431 1322371 1599088 1243715 1306602 1159064
## 4 5384958 5508454 6883086 6136023 5626680 5213771
## 5 18033537 17926487 21052620 19810368 17381162 17268329
## 6 9873585 10299931 11142071 10258214 9664315 9518271
head(fData(x)[, 1:2])
## sequence accession
## 1 DGVSVAR ECA0625
## 2 NVVLDK ECA0625
## 3 VEDALHATR ECA0625
## 4 LAGGVAVIK ECA0625
## 5 LIAEAMEK ECA0625
## 6 SFGAPTITK ECA0625
Eithe post questions on the Bioconductor support forum or open a GitHub issue.
sessionInfo()
## R version 3.6.1 (2019-07-05)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.3 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.9-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.9-bioc/R/lib/libRlapack.so
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats4 parallel stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] rpx_1.20.2 MSnbase_2.10.1 ProtGenerics_1.16.0
## [4] mzR_2.18.1 Rcpp_1.0.2 Biobase_2.44.0
## [7] Biostrings_2.52.0 XVector_0.24.0 IRanges_2.18.3
## [10] S4Vectors_0.22.1 BiocGenerics_0.30.0 BiocStyle_2.12.0
##
## loaded via a namespace (and not attached):
## [1] tidyselect_0.2.5 xfun_0.10 purrr_0.3.2
## [4] lattice_0.20-38 colorspace_1.4-1 htmltools_0.3.6
## [7] yaml_2.2.0 vsn_3.52.0 XML_3.98-1.20
## [10] rlang_0.4.0 pillar_1.4.2 glue_1.3.1
## [13] BiocParallel_1.18.1 affy_1.62.0 affyio_1.54.0
## [16] foreach_1.4.7 plyr_1.8.4 mzID_1.22.0
## [19] stringr_1.4.0 zlibbioc_1.30.0 munsell_0.5.0
## [22] pcaMethods_1.76.0 gtable_0.3.0 codetools_0.2-16
## [25] evaluate_0.14 knitr_1.25 doParallel_1.0.15
## [28] curl_4.2 preprocessCore_1.46.0 scales_1.0.0
## [31] BiocManager_1.30.4 limma_3.40.6 impute_1.58.0
## [34] ggplot2_3.2.1 digest_0.6.21 stringi_1.4.3
## [37] dplyr_0.8.3 ncdf4_1.16.1 grid_3.6.1
## [40] bitops_1.0-6 tools_3.6.1 magrittr_1.5
## [43] RCurl_1.95-4.12 lazyeval_0.2.2 tibble_2.1.3
## [46] crayon_1.3.4 pkgconfig_2.0.3 MASS_7.3-51.4
## [49] xml2_1.2.2 assertthat_0.2.1 rmarkdown_1.16
## [52] iterators_1.0.12 R6_2.4.0 MALDIquant_1.19.3
## [55] compiler_3.6.1