I have a large matrix of 4775 rows of genes and 37 columns (individual samples). The data in each cell is the logCPM value for each gene.
Is it possible to create a boxplot of just a single row (gene) that I am interested in? I have a corresponding metadata dataframe which has groupings for the individual samples.
I have been trying something like this which is not working:
boxplot(logcpm~pd_2$PEDIS, data=logcpm["K11040",], ylab="LogCPM", xlab="PEDIS Group")
If I do this code:
boxplot(logcpm["K11040",], ylab="LogCPM", xlab="PEDIS Group")
I get something like this:
However this obviously doesn't seperate the values based on patient group. How do I plot the logcpm values from a matrix while also including the groupings from a separate metadata dataframe?
Example data of what I mean:
I have a matrix similar to the below structure:
1 | 2 | 3 | 4 | 5 | |
---|---|---|---|---|---|
gene1 | 0.3 | 0.4 | 0.8 | 1.3 | 3.3 |
gene2 | 0.0 | 0.1 | 0.8 | 0.9 | 0.9 |
gene3 | 0.4 | 0.6 | 0.9 | 0.1 | 0.1 |
And metadata dataframe:
Sample | PEDIS |
---|---|
1 | PEDIS1 |
2 | PEDIS1 |
3 | PEDIS2 |
4 | PEDIS2 |
5 | PEDIS2 |
What I want to do is create a boxplot of only gene2 but group the values based on the pedis column in my metadata dataframe