Answers.Body: <p>I am the developer of FlowSorted.Blood.EPIC, I will try to provide you with some guidance.
  First, the FlowSorted.Blood.EPIC is located on ExperimentHub, which means that you need to ask the program to download the database first before running estimateCellCounts (minfi) or estimateCellCounts2 (FlowSorted.Blood.EPIC).</p>
  <p>For estimateCellCounts2, I explain this here if you are using a 450K array <a href="https://github.com/immunomethylomics/FlowSorted.Blood.EPIC/issues/10" rel="nofollow noreferrer">GitHub FlowSorted.Blood.EPIC</a>. If you are using EPIC you can read the help file of <a href="https://www.bioconductor.org/packages/release/data/experiment/vignettes/FlowSorted.Blood.EPIC/inst/doc/FlowSorted.Blood.EPIC.html" rel="nofollow noreferrer">estimateCellCounts2</a>. Although we believe our method improves the cell estimates, you can load the library and use minfi's &quot;auto&quot; selection or the same option on estimateCellCounts2 (that is your decision as a user of the library).</p>
  <pre><code>library(FlowSorted.Blood.EPIC)
  FlowSorted.Blood.EPIC &lt;-
      libraryDataGet(&quot;FlowSorted.Blood.EPIC&quot;)
  FlowSorted.Blood.EPIC
  </code></pre>
  <p>Then you can run estimateCellCounts according to minfi's help.</p>
  <p>Good luck.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-18T13:38:20.727Z
Answers.Text: Welcome to the site @LucasSalas and thank you for your comprehensive response, much appreciated.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-18T21:17:27.937Z
Answers.Text: Thank you so much @Lucas Salas
Answers.UserDisplayName: Indira
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-18T13:15:42.527Z
Answers.LastActivityDate: 2023-08-18T13:15:42.527Z
Answers.UserDisplayName: Lucas Salas
Body: <p>I would like to plot using estimateCellCounts as I do not know my cell counts for the blood samples I am using however, it seem that I cannot get estimateCellCounts to work with EPIC arrays.</p>
  <p>Detailing Attempts:</p>
  <p><strong>Attempt 1</strong>:</p>
  <ul>
  <li>I first attempted it with EPIC arrays but it wouldn't take it.</li>
  </ul>
  <pre class="lang-r prettyprint-override"><code>estimateCellCounts(RGset, 
                     compositeCellType = &quot;Blood&quot;,
                     processMethod = &quot;auto&quot;, 
                     probeSelect = &quot;auto&quot;,
                     cellTypes = c(&quot;Bcell&quot;, 
                                   &quot;CD4T&quot;, 
                                   &quot;CD8T&quot;, 
                                   &quot;Eos&quot;, 
                                   &quot;Gran&quot;, 
                                   &quot;Mono&quot;, 
                                   &quot;Neu&quot;, 
                                   &quot;NK&quot;
                                  ),
                     referencePlatform = &quot;IlluminaHumanMethylationEPIC&quot;,
                     returnAll = TRUE,
                     meanPlot = TRUE,
                     verbose = TRUE)
  </code></pre>
  <p>And the associated error:</p>
  <pre class="lang-r prettyprint-override"><code>Loading required package: FlowSorted.Blood.EPIC
  Loading required package: ExperimentHub
  Loading required package: AnnotationHub
  Loading required package: BiocFileCache
  Loading required package: dbplyr
  
  Attaching package: 'AnnotationHub'
  
  The following object is masked from 'package:Biobase':
      cache
  
  Warning message in data(list = referencePkg):
  &quot;data set 'FlowSorted.Blood.EPIC' not found&quot;
  Error in get(referencePkg): object 'FlowSorted.Blood.EPIC' not found
  Traceback:
  1. estimateCellCounts(RGset, compositeCellType = &quot;Blood&quot;, processMethod = &quot;auto&quot;, 
   .     probeSelect = &quot;auto&quot;, cellTypes = c(&quot;Bcell&quot;, &quot;CD4T&quot;, &quot;CD8T&quot;, 
   .         &quot;Eos&quot;, &quot;Gran&quot;, &quot;Mono&quot;, &quot;Neu&quot;, &quot;NK&quot;), referencePlatform = &quot;IlluminaHumanMethylationEPIC&quot;, 
   .     returnAll = TRUE, meanPlot = TRUE, verbose = TRUE)
  2. get(referencePkg)
  3. get(referencePkg)
  </code></pre>
  <p>Adding the <code>library(&quot;FlowSorted.Blood.EPIC&quot;)</code> did not stop the error <code>&quot;data set 'FlowSorted.Blood.EPIC' not found&quot;</code>.</p>
  <p><strong>Attempt 2</strong>:</p>
  <ol>
  <li>Then, I looked up the error I got first on <a href="https://github.com/hansenlab/minfi/issues/185" rel="nofollow noreferrer">Github</a> and found that converting to 450k was recommended. So I used the <code>convertArray</code>.</li>
  <li>Then it threw up an error saying  <code>&quot;FlowSorted.Blood.450k&quot;</code> was not installed.</li>
  </ol>
  <p><strong>Attempt 3</strong>:</p>
  <p>So I installed and loaded the library and re-ran to get the code below and the error below. However, this does not change the issue that it does not seem to run. The code I used and the error is below - any suggestions are appreciated:</p>
  <pre class="lang-r prettyprint-override"><code>library(&quot;FlowSorted.Blood.450k&quot;)
  
  RGset_450k = convertArray(RGset, 
                            outType = c(&quot;IlluminaHumanMethylation450k&quot;),
                            verbose = TRUE
                           ) 
  
  estimateCellCounts(RGset_450k, 
                     compositeCellType = &quot;Blood&quot;,
                     processMethod = &quot;auto&quot;, 
                     probeSelect = &quot;auto&quot;,
                     cellTypes = c(&quot;Bcell&quot;, 
                                   &quot;CD4T&quot;, 
                                   &quot;CD8T&quot;, 
                                   &quot;Eos&quot;, 
                                   &quot;Gran&quot;, 
                                   &quot;Mono&quot;, 
                                   &quot;Neu&quot;, 
                                   &quot;NK&quot;
                                  ),
                     referencePlatform = &quot;IlluminaHumanMethylation450k&quot;,
                     returnAll = TRUE,
                     meanPlot = TRUE,
                     verbose = TRUE)
  </code></pre>
  <p><strong>Error</strong>:</p>
  <pre class="lang-r prettyprint-override"><code>Error in p[trainingProbes, ]: subscript out of bounds
  Traceback:
  
  1. estimateCellCounts(RGset_450k, compositeCellType = &quot;Blood&quot;, processMethod = &quot;auto&quot;, 
   .     probeSelect = &quot;auto&quot;, cellTypes = c(&quot;Bcell&quot;, &quot;CD4T&quot;, &quot;CD8T&quot;, 
   .         &quot;Eos&quot;, &quot;Gran&quot;, &quot;Mono&quot;, &quot;Neu&quot;, &quot;NK&quot;), referencePlatform = &quot;IlluminaHumanMethylation450k&quot;, 
   .     returnAll = TRUE, meanPlot = TRUE, verbose = TRUE)
  </code></pre>
  <p>How would I make it get around this error as it does not output any results? Any suggestions/solutions are appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-18T17:25:27.390Z
Comments.Text: Seems that one person found that there was an issue with NAs ( https://support.bioconductor.org/p/9148370/ ) I am not sure if this is the case for me but adding this here as a comment just in case someone else has this issue with the NAs. The pull request seems to not have been approved yet.
Comments.UserDisplayName: Indira
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-18T18:40:22.573Z
Comments.Text: I added `source("/path/to/Forked_Minfi/R/estimateCellCounts.R")` before the `estimateCellCounts` but I get the following error  after running the command ```Error in .isMatrixBackedOrStop(rgSet, "estimateCellCounts"): could not find function ".isMatrixBackedOrStop"
  Traceback:
  1. estimateCellCounts(RGset_450k, compositeCellType = "Blood", processMethod = "auto", 
   .     probeSelect = "auto", cellTypes = c("Bcell", "CD4T", "CD8T", 
   .         "Eos", "Gran", "Mono", "Neu", "NK"), referencePlatform = "IlluminaHumanMethylation450k", 
   .     returnAll = TRUE, meanPlot = TRUE, verbose = TRUE)```
Comments.UserDisplayName: Indira
Tags: <r>
Title: Minfi and estimateCellCounts Error: in p[trainingProbes, ]: subscript out of bounds
ThreadText: # Minfi and estimateCellCounts Error: in p[trainingProbes, ]: subscript out of bounds
  
  (Asked by: username_0 on 2023-07-18)
  
  I would like to plot using estimateCellCounts as I do not know my cell counts for the blood samples I am using however, it seem that I cannot get estimateCellCounts to work with EPIC arrays.
  
  Detailing Attempts:
  
  **Attempt 1**:
  
  * I first attempted it with EPIC arrays but it wouldn't take it.
  
  ```r
  estimateCellCounts(RGset, 
                     compositeCellType = "Blood",
                     processMethod = "auto", 
                     probeSelect = "auto",
                     cellTypes = c("Bcell", 
                                   "CD4T", 
                                   "CD8T", 
                                   "Eos", 
                                   "Gran", 
                                   "Mono", 
                                   "Neu", 
                                   "NK"
                                  ),
                     referencePlatform = "IlluminaHumanMethylationEPIC",
                     returnAll = TRUE,
                     meanPlot = TRUE,
                     verbose = TRUE)
  
  ```
  
  And the associated error:
  
  ```r
  Loading required package: FlowSorted.Blood.EPIC
  Loading required package: ExperimentHub
  Loading required package: AnnotationHub
  Loading required package: BiocFileCache
  Loading required package: dbplyr
  
  Attaching package: 'AnnotationHub'
  
  The following object is masked from 'package:Biobase':
      cache
  
  Warning message in data(list = referencePkg):
  "data set 'FlowSorted.Blood.EPIC' not found"
  Error in get(referencePkg): object 'FlowSorted.Blood.EPIC' not found
  Traceback:
  1. estimateCellCounts(RGset, compositeCellType = "Blood", processMethod = "auto", 
   .     probeSelect = "auto", cellTypes = c("Bcell", "CD4T", "CD8T", 
   .         "Eos", "Gran", "Mono", "Neu", "NK"), referencePlatform = "IlluminaHumanMethylationEPIC", 
   .     returnAll = TRUE, meanPlot = TRUE, verbose = TRUE)
  2. get(referencePkg)
  3. get(referencePkg)
  
  ```
  
  Adding the `library("FlowSorted.Blood.EPIC")` did not stop the error `"data set 'FlowSorted.Blood.EPIC' not found"`.
  
  **Attempt 2**:
  
  1. Then, I looked up the error I got first on [Github](https://github.com/hansenlab/minfi/issues/185) and found that converting to 450k was recommended. So I used the `convertArray`.
  2. Then it threw up an error saying `"FlowSorted.Blood.450k"` was not installed.
  
  **Attempt 3**:
  
  So I installed and loaded the library and re-ran to get the code below and the error below. However, this does not change the issue that it does not seem to run. The code I used and the error is below - any suggestions are appreciated:
  
  ```r
  library("FlowSorted.Blood.450k")
  
  RGset_450k = convertArray(RGset, 
                            outType = c("IlluminaHumanMethylation450k"),
                            verbose = TRUE
                           ) 
  
  estimateCellCounts(RGset_450k, 
                     compositeCellType = "Blood",
                     processMethod = "auto", 
                     probeSelect = "auto",
                     cellTypes = c("Bcell", 
                                   "CD4T", 
                                   "CD8T", 
                                   "Eos", 
                                   "Gran", 
                                   "Mono", 
                                   "Neu", 
                                   "NK"
                                  ),
                     referencePlatform = "IlluminaHumanMethylation450k",
                     returnAll = TRUE,
                     meanPlot = TRUE,
                     verbose = TRUE)
  
  ```
  
  **Error**:
  
  ```r
  Error in p[trainingProbes, ]: subscript out of bounds
  Traceback:
  
  1. estimateCellCounts(RGset_450k, compositeCellType = "Blood", processMethod = "auto", 
   .     probeSelect = "auto", cellTypes = c("Bcell", "CD4T", "CD8T", 
   .         "Eos", "Gran", "Mono", "Neu", "NK"), referencePlatform = "IlluminaHumanMethylation450k", 
   .     returnAll = TRUE, meanPlot = TRUE, verbose = TRUE)
  
  ```
  
  How would I make it get around this error as it does not output any results? Any suggestions/solutions are appreciated.
  
  **Tags:** r
  
  > **Comments:**
  > **username_0**: Seems that one person found that there was an issue with NAs ( https://support.bioconductor.org/p/9148370/ ) I am not sure if this is the case for me but adding this here as a comment just in case someone else has this issue with the NAs. The pull request seems to not have been approved yet.  
  > **username_0**: I added `source("/path/to/Forked_Minfi/R/estimateCellCounts.R")` before the `estimateCellCounts` but I get the following error  after running the command ```Error in .isMatrixBackedOrStop(rgSet, "estimateCellCounts"): could not find function ".isMatrixBackedOrStop" Traceback: 1. estimateCellCounts(RGset_450k, compositeCellType = "Blood", processMethod = "auto",   .     probeSelect = "auto", cellTypes = c("Bcell", "CD4T", "CD8T",   .         "Eos", "Gran", "Mono", "Neu", "NK"), referencePlatform = "IlluminaHumanMethylation450k",   .     returnAll = TRUE, meanPlot = TRUE, verbose = TRUE)```  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-08-18. Score: 2 | Accepted answer
  
  I am the developer of FlowSorted.Blood.EPIC, I will try to provide you with some guidance.
  First, the FlowSorted.Blood.EPIC is located on ExperimentHub, which means that you need to ask the program to download the database first before running estimateCellCounts (minfi) or estimateCellCounts2 (FlowSorted.Blood.EPIC).
  
  For estimateCellCounts2, I explain this here if you are using a 450K array [GitHub FlowSorted.Blood.EPIC](https://github.com/immunomethylomics/FlowSorted.Blood.EPIC/issues/10). If you are using EPIC you can read the help file of [estimateCellCounts2](https://www.bioconductor.org/packages/release/data/experiment/vignettes/FlowSorted.Blood.EPIC/inst/doc/FlowSorted.Blood.EPIC.html). Although we believe our method improves the cell estimates, you can load the library and use minfi's "auto" selection or the same option on estimateCellCounts2 (that is your decision as a user of the library).
  
  ```
  library(FlowSorted.Blood.EPIC)
  FlowSorted.Blood.EPIC <-
      libraryDataGet("FlowSorted.Blood.EPIC")
  FlowSorted.Blood.EPIC
  
  ```
  
  Then you can run estimateCellCounts according to minfi's help.
  
  Good luck.
  
  > **Comments:**
  > **username_2**: Welcome to the site @username_1 and thank you for your comprehensive response, much appreciated.  
  > **username_0**: Thank you so much @username_1  
  
  ---
  
  