This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Contig length distribution plotting with R

Hi all,

I would like to plot the contig length distribution of my assembly using R software. I tried the ggplot2 package, but sounds that it's not correct for this purpose, however, I'm not sure about it. Could you please help me out on this issue? which R package is suitable for this task?

Thank you in advance

contig length plotting r

hist() in R would not do that ?

1 answer

Assuming you have a data frame with contig lengths:

contigs <- data.frame( row.names = c( "contig1", "contig2", "contig3", 
                                      "contig4", "contig5", "contig6", 
                                      "contig7"),
                       length = c(10000, 10001, 540, 320, 600, 640, 1000) )
#base graphics
hist( contigs$length )

#both are ggplot
qplot( contigs$length, geom="histogram" )
ggplot(data=contigs, aes(length)) + geom_histogram()

edit: see ?hist and ?qplot for options and parameters.

How to make the same as a scatter plot? Is it possible?

Log in to answer this question.