<p>You can use <code>IOBR</code> R package for this purpose. <code>IOBR</code> is an R package to perform comprehensive analysis of tumor microenvironment and signatures for immuno-oncology.</p>
<pre><code>if (!requireNamespace(&quot;remotes&quot;, quietly = TRUE))
install.packages(&quot;remotes&quot;)

if (!requireNamespace(&quot;IOBR&quot;, quietly = TRUE))
remotes::install_github(&quot;IOBR/IOBR&quot;)

library(IOBR)
library(tidyverse)

file = read.delim(file.choose(),row.names=1)        #bulk data from 4 samples
 
# estimating the average macrophages signatures using cibersort method
cibersort&lt;-deconvo_tme(eset = file, method = &quot;cibersort&quot;, arrays = TRUE, perm = 100 )

head(cibersort)


#barplot
res&lt;-cell_bar_plot(input = cibersort[,c(1,15:17)], title = &quot;CIBERSORT Cell Fraction&quot;)
</code></pre>

CC BY-SA 4.0
2023-09-10T12:48:05.947Z
2023-09-10T12:48:05.947Z
Nitesh Shriwash
<blockquote>
<p>CIBERSORTx Gene Expression Analysis Mode works best when the number of
samples to deconvolve is much larger than the number of cell types in
the signature matrix. A rule of thumb is to have at least four to five
times as many mixture samples as cell types</p>
</blockquote>
<p>From <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7695353/" rel="nofollow noreferrer">Profiling Cell Type Abundance and Expression in Bulk Tissues with CIBERSORTx</a></p>
<p>So even if technically you have more samples that cell types (and I cannot explain the error you got), practically you need more samples (especially for high-resolution mode )</p>

CC BY-SA 4.0
2024-08-12T06:47:53.617Z
2024-08-12T06:47:53.617Z
Sam
<p>I have bulk data from 4 samples of triple negative breast cancer, which 2 of them are control and the other 2 are treated. The goal here is to estimate the average macrophages signatures, for M0,M1 and M2 in each of the 4 samples.</p>
<p>My bulk data:</p>
<pre><code>Gene    MCtrl1_TPM  MCtrl2_TPM  MTreat1_TPM MTreat2_TPM
KHDC1L  0.0 75.15   0.0 0.0
CD24    1.53    41.56   0.11    0.06
MAMLD1  5.2 11.94   0.0 0.0
SMIM31  4.1 10.24   0.0 0.06
C16orf95    7.9 13.24   0.0 0.08
OCLN    2.69    7.06    0.06    0.03
RBM14-RBM4  16.97   1.95    0.0 0.0
RPS10-NUDT3 0.0 0.0 31.91   12.06
NDUFC2-KCTD14   15.06   49.98   0.41    0.0
ATP9A   2.7 10.05   0.01    0.0
UST 0.38    10.63   0.0 0.01
LOC100996709    12.25   30.58   0.0 0.0
ADAM8   10.13   2.14    0.03    0.0
ADGRG2  0.05    21.49   0.0 0.0
MBNL2   4.61    5.04    0.0 0.0
PIGBOS1 56.73   51.33   0.6 0.09
</code></pre>
<p>To do that, I thought was to use the CIBERSORTx software more specifically, the option - Impute Gene Expression, High-Resolution Mode (tutorial 5) with my bulk data and signature matrix file, the LM22 signature matrix file of 22 immune cells provided by CIBERSORTx, but with the selected columns correspondent to the 3 types of macrophages.</p>
<p>Signature matrix file:</p>
<pre><code>Gene    M0  M1  M2
ABCB4   7.951360487 27.55771004 121.4322774
ABCB9   56.25188749 29.38087813 40.39026017
ACAP1   48.97221651 30.97425375 23.05515036
ACHE    13.6929629  1373.06962  48.58576071
ACP5    13644.1723  1062.475909 7633.960182
ADAM28  54.96648703 274.639997  360.6820442
ADAMDEC1    4464.262133 8524.022801 5004.969419
ADAMTS3 45.56049098 32.34016681 33.35142773
ADRB2   143.0178779 787.6239741 363.1850058
AIF1    1841.269508 1611.228571 11610.29035
AIM2    181.9571    2965.888162 148.2845223
ALOX15  6.621226619 5.412216318 430.3353048
ALOX5   788.5397751 83.30089783 248.3724724
AMPD1   76.54456664 62.39764428 59.95269372
ANGPT4  39.33257003 21.218127   11.8097012
ANKRD55 123.600429  96.20392388 48.55417359
APOBEC3A    85.2400852  4501.140479 148.7993403
APOBEC3G    278.7681406 1036.993881 258.3004281
APOL3   238.5980956 11009.29392 437.5272083
APOL6   13.10943681 967.6451456 7.784612131
AQP9    4583.500675 4309.341662 399.4746192
ARHGAP22    175.4574354 351.5922058 272.9890572
ARRB1   333.3962724 946.0138184 395.5562302
ASGR1   108.7218916 25.23626149 155.4913385
ASGR2   36.11978652 26.3738691  760.7257707
ATHL1   52.25820981 167.5032595 132.631945
</code></pre>
<p>But I encountered this error, trying to do that:</p>
<pre><code>## Formatted for easier reading
Error in runCIBERSORTxGEP(weights, mixture, classes, QN, maxsamples, label, : 
Abort! The number of mixture samples is not greater than the number of cell types. 
Calls: CIBERSORTxHiRes -&gt; CIBERSORTxGEP -&gt; runCIBERSORTxGEP Execution halted
</code></pre>
<p>How this error is possible, when I have 3 types of macrophages and 4 samples? There's another way to estimate the average of the 3 types of macrophages signatures? Specifically in a graphic like this?If yes, how?</p>
<p><a href="https://i.sstatic.net/yHiYJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yHiYJ.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2023-07-26T16:46:37.203Z
Welcome to the site. The raw data has 4 columns (2 controls) the processed data has 3 columns. Why is that? Specifically what do M1, M2 and M3 mean? Is this macrophage1, marcophage2, ... 3 . How does MCtrl1_TPM  MCtrl2_TPM  MTreat1_TPM MTreat2_TPM relate to M1, M2 and M3?
M__
CC BY-SA 4.0
2023-07-28T08:54:32.497Z
Thank you! This image presented is an example from another article that i read and wanted to do that type of graphic to my analysis. Yes M0,M1 and M2 are macrophage0, macrophage1, macrophage2. Given that i dont have single cell data of my data to exactly estimate average of each macrophage type in each sample, o do that i used a signature matrix from cibersortx software, LM22 signature matrix file of 22 immune cells, and from that matrix i selected only the columns correpondent to the macrophages types, that i'm interest to work, and i then tried the Impute Gene Expression, Group Mode.
Rita Soares
CC BY-SA 4.0
2023-07-28T11:57:28.523Z
Okay I see. This is bioinformatics but if you don't get a response, you could try Biology SE because it's formal package that for example an immunologist would know how to use. Just mentioned you've tried here first.
M__
CC BY-SA 4.0
2023-10-25T15:04:08.493Z
I have a question: CIBERSORT and CIBERSORTx give me same results? thnk
Adriana
<r><cibersortx>
How to do average macrophages signature boxplots, with Bulk RNA data from 2 control and 2 treatment samples and LM22 signature matrix from cibersort?
# How to do average macrophages signature boxplots, with Bulk RNA data from 2 control and 2 treatment samples and LM22 signature matrix from cibersort?

(Asked by: username_0 on 2023-07-26)

I have bulk data from 4 samples of triple negative breast cancer, which 2 of them are control and the other 2 are treated. The goal here is to estimate the average macrophages signatures, for M0,M1 and M2 in each of the 4 samples.
My bulk data:
Gene    MCtrl1_TPM  MCtrl2_TPM  MTreat1_TPM MTreat2_TPM
KHDC1L  0.0 75.15   0.0 0.0
CD24    1.53    41.56   0.11    0.06
MAMLD1  5.2 11.94   0.0 0.0
SMIM31  4.1 10.24   0.0 0.06
C16orf95    7.9 13.24   0.0 0.08
OCLN    2.69    7.06    0.06    0.03
RBM14-RBM4  16.97   1.95    0.0 0.0
RPS10-NUDT3 0.0 0.0 31.91   12.06
NDUFC2-KCTD14   15.06   49.98   0.41    0.0
ATP9A   2.7 10.05   0.01    0.0
UST 0.38    10.63   0.0 0.01
LOC100996709    12.25   30.58   0.0 0.0
ADAM8   10.13   2.14    0.03    0.0
ADGRG2  0.05    21.49   0.0 0.0
MBNL2   4.61    5.04    0.0 0.0
PIGBOS1 56.73   51.33   0.6 0.09

To do that, I thought was to use the CIBERSORTx software more specifically, the option - Impute Gene Expression, High-Resolution Mode (tutorial 5) with my bulk data and signature matrix file, the LM22 signature matrix file of 22 immune cells provided by CIBERSORTx, but with the selected columns correspondent to the 3 types of macrophages.
Signature matrix file:
Gene    M0  M1  M2
ABCB4   7.951360487 27.55771004 121.4322774
ABCB9   56.25188749 29.38087813 40.39026017
ACAP1   48.97221651 30.97425375 23.05515036
ACHE    13.6929629  1373.06962  48.58576071
ACP5    13644.1723  1062.475909 7633.960182
ADAM28  54.96648703 274.639997  360.6820442
ADAMDEC1    4464.262133 8524.022801 5004.969419
ADAMTS3 45.56049098 32.34016681 33.35142773
ADRB2   143.0178779 787.6239741 363.1850058
AIF1    1841.269508 1611.228571 11610.29035
AIM2    181.9571    2965.888162 148.2845223
ALOX15  6.621226619 5.412216318 430.3353048
ALOX5   788.5397751 83.30089783 248.3724724
AMPD1   76.54456664 62.39764428 59.95269372
ANGPT4  39.33257003 21.218127   11.8097012
ANKRD55 123.600429  96.20392388 48.55417359
APOBEC3A    85.2400852  4501.140479 148.7993403
APOBEC3G    278.7681406 1036.993881 258.3004281
APOL3   238.5980956 11009.29392 437.5272083
APOL6   13.10943681 967.6451456 7.784612131
AQP9    4583.500675 4309.341662 399.4746192
ARHGAP22    175.4574354 351.5922058 272.9890572
ARRB1   333.3962724 946.0138184 395.5562302
ASGR1   108.7218916 25.23626149 155.4913385
ASGR2   36.11978652 26.3738691  760.7257707
ATHL1   52.25820981 167.5032595 132.631945

But I encountered this error, trying to do that:
## Formatted for easier reading
Error in runCIBERSORTxGEP(weights, mixture, classes, QN, maxsamples, label, : 
Abort! The number of mixture samples is not greater than the number of cell types. 
Calls: CIBERSORTxHiRes -> CIBERSORTxGEP -> runCIBERSORTxGEP Execution halted

How this error is possible, when I have 3 types of macrophages and 4 samples? There's another way to estimate the average of the 3 types of macrophages signatures? Specifically in a graphic like this?If yes, how?

**Tags:** r, cibersortx
> **Comments:**
> **username_1**: Welcome to the site. The raw data has 4 columns (2 controls) the processed data has 3 columns. Why is that? Specifically what do M1, M2 and M3 mean? Is this macrophage1, marcophage2, ... 3 . How does MCtrl1_TPM  MCtrl2_TPM  MTreat1_TPM MTreat2_TPM relate to M1, M2 and M3?  
> **username_0**: Thank you! This image presented is an example from another article that i read and wanted to do that type of graphic to my analysis. Yes M0,M1 and M2 are macrophage0, macrophage1, macrophage2. Given that i dont have single cell data of my data to exactly estimate average of each macrophage type in each sample, o do that i used a signature matrix from cibersortx software, LM22 signature matrix file of 22 immune cells, and from that matrix i selected only the columns correpondent to the macrophages types, that i'm interest to work, and i then tried the Impute Gene Expression, Group Mode.  
> **username_1**: Okay I see. This is bioinformatics but if you don't get a response, you could try Biology SE because it's formal package that for example an immunologist would know how to use. Just mentioned you've tried here first.  
> **username_2**: I have a question: CIBERSORT and CIBERSORTx give me same results? thnk  

---

## 2 answers

### Answer by username_3 on 2023-09-10. Score: 2

You can use IOBR R package for this purpose. IOBR is an R package to perform comprehensive analysis of tumor microenvironment and signatures for immuno-oncology.
if (!requireNamespace("remotes", quietly = TRUE))
install.packages("remotes")

if (!requireNamespace("IOBR", quietly = TRUE))
remotes::install_github("IOBR/IOBR")

library(IOBR)
library(tidyverse)

file = read.delim(file.choose(),row.names=1)        #bulk data from 4 samples
 
# estimating the average macrophages signatures using cibersort method
cibersort<-deconvo_tme(eset = file, method = "cibersort", arrays = TRUE, perm = 100 )

head(cibersort)


#barplot
res<-cell_bar_plot(input = cibersort[,c(1,15:17)], title = "CIBERSORT Cell Fraction")


---

### Answer by username_4 on 2024-08-12. Score: 0

> CIBERSORTx Gene Expression Analysis Mode works best when the number of
> samples to deconvolve is much larger than the number of cell types in
> the signature matrix. A rule of thumb is to have at least four to five
> times as many mixture samples as cell types

From [Profiling Cell Type Abundance and Expression in Bulk Tissues with CIBERSORTx](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7695353/)

So even if technically you have more samples that cell types (and I cannot explain the error you got), practically you need more samples (especially for high-resolution mode )


---

