Answers.Body: <p>This is an option for the function documented in its help page. Just run <code>?bamDataRanges</code> and you will see:</p>
  
  <pre><code>Usage:
  
       getReadCountsFromBAM(BAMFiles, sampleNames, refSeqNames, WL = 25000,
         parallel = 0, ...)
  
  [...]
  
  parallel: The number of parallel processes to be used for this
            function. Default=0.
  </code></pre>
  
  <p>So all you need to run with 10 cores is:</p>
  
  <pre><code>bamDataRanges &lt;- getReadCountsFromBAM(BAMFiles, parallel=10)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-05T11:55:14.933Z
Answers.LastActivityDate: 2019-02-05T11:55:14.933Z
Answers.UserDisplayName: terdon
Body: <p>I am trying to run cn.MOPS to detect CNVs in multiple bam files. Following <a href="https://www.bioconductor.org/packages/release/bioc/vignettes/cn.mops/inst/doc/cn.mops.R" rel="nofollow noreferrer">the example code</a>, I have run:</p>
  
  <pre><code>source("https://bioconductor.org/biocLite.R")
  biocLite("cn.mops")
  options(width=75)
  set.seed(0)
  library(cn.mops)
  library(Biobase)
  library(GenomicRanges)
  library(GenomeInfoDb)
  cn.mopsVersion &lt;- packageDescription("cn.mops")$Version
  library(cn.mops)
  BAMFiles &lt;- c('bam1.bam', 'bam2.bam', ..., 'bamN.bam')
  bamDataRanges &lt;- getReadCountsFromBAM(BAMFiles)
  
  PLEASE BE PATIENT... this might take a while. Consider using the parallel version of this function
  </code></pre>
  
  <p>Since this is indeed taking a while, I'd like to follow the tool's suggestion and use "the parallel version of this function". But how do I do that? I don't see any mention of "parallel" in <a href="https://www.bioconductor.org/packages/release/bioc/vignettes/cn.mops/inst/doc/cn.mops.pdf" rel="nofollow noreferrer">the manual</a>. Is there some standard Bioconductor/R trick to make a function parallel? Am I missing something in the manual? </p>
  
  <p>How can I run <code>bamDataRanges</code> parallelized? </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-04T16:59:03.693Z
Comments.Text: It looks like `parallel` is an argument you set and feed to the function? https://rdrr.io/github/Bioconductor-mirror/cn.mops/man/getReadCountsFromBAM.html
Comments.UserDisplayName: Chris_Rands
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-04T17:20:58.040Z
Comments.Text: @Chris_Rands duh! Thanks, I should have found that myself. Could you post it as an answer?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-05T11:55:44.007Z
Comments.Text: @Chris_Rands I posted an answer just so the question can be counted as answered. Please feel very free to post your own (even just copying mine) and I'll delete and accept yours.
Comments.UserDisplayName: terdon
Tags: <cnv>
Title: Parallel version of cn.mops' bamDataRanges
ThreadText: # Parallel version of cn.mops' bamDataRanges
  
  (Asked by: username_0 on 2019-02-04)
  
  I am trying to run cn.MOPS to detect CNVs in multiple bam files. Following [the example code](https://www.bioconductor.org/packages/release/bioc/vignettes/cn.mops/inst/doc/cn.mops.R), I have run:
  
  ```
  source("https://bioconductor.org/biocLite.R")
  biocLite("cn.mops")
  options(width=75)
  set.seed(0)
  library(cn.mops)
  library(Biobase)
  library(GenomicRanges)
  library(GenomeInfoDb)
  cn.mopsVersion <- packageDescription("cn.mops")$Version
  library(cn.mops)
  BAMFiles <- c('bam1.bam', 'bam2.bam', ..., 'bamN.bam')
  bamDataRanges <- getReadCountsFromBAM(BAMFiles)
  
  PLEASE BE PATIENT... this might take a while. Consider using the parallel version of this function
  
  ```
  
  Since this is indeed taking a while, I'd like to follow the tool's suggestion and use "the parallel version of this function". But how do I do that? I don't see any mention of "parallel" in [the manual](https://www.bioconductor.org/packages/release/bioc/vignettes/cn.mops/inst/doc/cn.mops.pdf). Is there some standard Bioconductor/R trick to make a function parallel? Am I missing something in the manual?
  
  How can I run `bamDataRanges` parallelized?
  
  **Tags:** cnv
  
  > **Comments:**
  > **username_1**: It looks like `parallel` is an argument you set and feed to the function? https://rdrr.io/github/Bioconductor-mirror/cn.mops/man/getReadCountsFromBAM.html  
  > **username_0**: @username_1 duh! Thanks, I should have found that myself. Could you post it as an answer?  
  > **username_0**: @username_1 I posted an answer just so the question can be counted as answered. Please feel very free to post your own (even just copying mine) and I'll delete and accept yours.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-02-05. Score: 0 | Accepted answer
  
  This is an option for the function documented in its help page. Just run `?bamDataRanges` and you will see:
  
  ```
  Usage:
  
       getReadCountsFromBAM(BAMFiles, sampleNames, refSeqNames, WL = 25000,
         parallel = 0, ...)
  
  [...]
  
  parallel: The number of parallel processes to be used for this
            function. Default=0.
  
  ```
  
  So all you need to run with 10 cores is:
  
  ```
  bamDataRanges <- getReadCountsFromBAM(BAMFiles, parallel=10)
  
  ```
  
  
  ---
  
  