How to plot a table with multiple columns as a box plot
I am trying to plot a box plot with the Trinucleotide as the x axis (so 64 trinucleotides on the x axis) and the frequency of each trinucleotide in each of 6 samples then color code the plot according to the sample. This is a snippet of the table and the code I have so far as well as the type of graph I want.
``` ibrary(tidyverse) library(readxl)
<PERSON> <- read_xlsx("TrinucleotideFrequency06182021.xlsx") <PERSON> <- gather (<PERSON>, "xzl.mmu.C57.testis.wt.adult.40S_crosslink.rep1+rept1.RPF.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.40S.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6", "xzl.mmu.C57.testis.wt.adult.40S_crosslink.rep2+rept2.RPF.R1.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.40S.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6", "xzl.mmu.C57.testis.wt.adult.40S_crosslink.rep3+rept3.RPF.R1.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.40S.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6", "xzl.mmu.C57.testis.wt.adult.80S_crosslink.rep1+rept1.RPF.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.RPF.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6", "xzl.mmu.C57.testis.wt.adult.80S_crosslink.rep2+rept2.RPF.R1.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.RPF.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6", "xzl.mmu.C57.testis.wt.adult.80S_crosslink.rep3+rept3.RPF.R1.trimmed.gz.x_rRNA.x_hairpin.mm10v1.unique.+jxn.bed13.RPF.sense.hybrid.utr3.1up.5end.PNLDC1.rep1.bed6",key="gene", value="value") marte$gene <- as.factor(marte$Trinucleotide)
marte$group <- as.factor(marte$gene)
ggplot(marte, aes(x = gene, y = value, color = group)) + geom_boxplot() ```
head (marte) produces the output below and underneath is a part of the table I am using to generate the plot with the first column as the trinucleotide and the other 6 as each gene respectively.
Trinucleotide gene value group <chr> <fct> <dbl> <fct> 1 AAA AAA 0.0214 AAA 2 TAG TAG 0.0199 TAG 3 AGC AGC 0.0132 AGC 4 TGT TGT 0.0338 TGT 5 GAT GAT 0.0130 GAT 6 CAC CAC 0.0112 CAC
AAA 0.<PHONE_NUMBER>.016654469 0.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER> TAG 0.019927531 0.018790672 0.015649845 0.<PHONE_NUMBER>.019363723 0.<PHONE_NUMBER> AGC 0.013209711 0.<PHONE_NUMBER>.014520044 0. 60