ggpubr violin plot for comparing number of fragments

one step code

  1. go to your data dir

  2. module load python/2.7.12

  3. prepare sample.list

sample.list (tab-seperated) will have the format showing below:

test1.bed

1631310_RFA005.bam

test1

test2.bed

1631310_RFA005.bam

test2

  1. cp /research/dept/hem/common/sequencing/chenggrp/pipelines/misc/data_vis/Li_violin_plot/ggpubR_violin.py .

  2. python ggpubR_violin.py

When job finished, the violin plot will be sent to you

you can then adjust the figure yourself, the program will generate a data file called for_ggpubr.csv

[1]:
df = read.csv("for_ggpubr.csv",header=F)
df[sample(dim(df)[1],5),]
V1V2
16117 test1.out
446 9 test2.out
4714 test1.out
435 2 test2.out
316 6 test1.out
[4]:
library(ggpubr)
comp = list(c('test1.out',"test2.out"))
a=ggviolin(df,x="V2",y="V1",color="black",fill="V2",add = "boxplot", add.params = list(fill = "white"))
a=a+stat_compare_means(comparisons = comp)+
xlab("")+
ylab("Number of fragments")+
guides(fill=FALSE)
print (a)
ggsave("violin_bed_reads.png",dpi=200,width=3,height=5)

../_images/jupyter_notebooks_ggplot_violin_8_0.png