Skip to content

Commit

Permalink
Fixed mclapply error on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Gierlinski authored and Marek Gierlinski committed Apr 10, 2019
1 parent 38643c4 commit de89051
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
^Meta$
^doc$
^.*\.Rproj$
^\.Rproj\.user$
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Meta
doc
.Rproj.user
.Rhistory
.RData
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: proteus
Type: Package
Title: Downstream analysis of the MaxQuant output
Version: 0.2.10
Version: 0.2.11
Depends: R (>= 3.4)
Authors@R: c(
person("Marek", "Gierlinski", email="[email protected]", role=c("aut", "cre")),
Expand Down
16 changes: 16 additions & 0 deletions R/func.R
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,11 @@ readColumnNames <- function(file) {
#' @return Data frame with selected columns from the evidence file.
#'
#' @examples
#' \dontrun{
#' library(proteusLabelFree)
#' evidenceFile <- system.file("extdata", "evidence.txt.gz", package="proteusLabelFree")
#' evi <- readEvidenceFile(evidenceFile)
#' }
#'
#' @export
readEvidenceFile <- function(file, measure.cols=measureColumns, data.cols=evidenceColumns, zeroes.are.missing=TRUE) {
Expand Down Expand Up @@ -446,9 +448,11 @@ parameterString <- function(...) {
#' metadata.
#'
#' @examples
#' \dontrun{
#' library(proteusLabelFree)
#' data(proteusLabelFree)
#' pepdat <- makePeptideTable(evi, meta, ncores=2)
#' }
#'
#' @export
makePeptideTable <- function(evi, meta, sequence.col=c("sequence", "modified_sequence"),
Expand All @@ -460,6 +464,12 @@ makePeptideTable <- function(evi, meta, sequence.col=c("sequence", "modified_seq
protein.col <- match.arg(protein.col)
experiment.type <- match.arg(experiment.type)

# mclapply doesn't work on Windows, so force 1 core
if(Sys.info()[['sysname']] == "Windows") {
ncores <- 1
warning("Multicore processing not available in Windows. Using ncores=1")
}

# check if measure.cols, sequence.col and protein.col are in the evidence file
measures <- names(measure.cols)
for(col in c(measures, sequence.col, protein.col)) {
Expand Down Expand Up @@ -605,6 +615,12 @@ makeProteinTable <- function(pepdat, aggregate.fun=aggregateHifly, ...,
min.peptides=2, ncores=4) {
if(!is(pepdat, "proteusData")) stop ("Input data must be of class proteusData.")

# mclapply doesn't work on Windows, so force 1 core
if(Sys.info()[['sysname']] == "Windows") {
ncores <- 1
warning("Multicore processing not available in Windows. Using ncores=1")
}

meta <- pepdat$metadata
tab <- pepdat$tab

Expand Down
2 changes: 2 additions & 0 deletions man/makePeptideTable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/readEvidenceFile.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vignettes/proteus.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ data(proteusLabelFree)
Here is a minimal example of data analysis in *Proteus*. You will need the evidence file from *MaxQuant* and a very simple text file with metadata (see below how to create it). Then, you can get from the evidence file to differential expression in just a few steps.

```{r quick_start, eval=FALSE}
library(proteus)
evidenceFile <- system.file("extdata", "evidence.txt.gz", package="proteusLabelFree")
metadataFile <- system.file("extdata", "metadata.txt", package="proteusLabelFree")

Expand Down

0 comments on commit de89051

Please sign in to comment.