# How to superimpose barplots in karyotype graphic using the chromPlot Bioconductor package?

I have a data frame containing 4 columns:

• Chrom: chromosome name of the feature
• Start: starting base of the feature
• End: end base of the feature
• Name: name of the feature, e.g. 5S ribosomal RNA

The head of the data frame is shown below:

      Chrom    Start      End                        Name
1     1 15390242 15390720 16S ribosomal RNA (partial)
2     1 15390900 15391794 16S ribosomal RNA (partial)
3     1 15392798 15396046           23S ribosomal RNA
4     1 15397439 15397917 16S ribosomal RNA (partial)
5     1 15398097 15398991 16S ribosomal RNA (partial)
6     1 15399995 15403243           23S ribosomal RNA


I want to plot these features on the karyotype of C. elegans. I am using the chromPlot package from Bioconductor.

I am using the following code:

• Subsetting the original data frame to get a data frame for each feature type: 5S, 16S and 23S rRNAs

annot1 <- dplyr::filter(cel, Name == '5S ribosomal RNA')
annot2 <- dplyr::filter(cel, Name == '23S ribosomal RNA')
annot3 <- dplyr::filter(cel, Name == '16S ribosomal RNA (partial)')


and then plot:

chromPlot(gaps = cel, figCols = 2, annot1 = annot1, annot2 = annot2)

This is OK because the two features are far away in the genome. However, if I try:

chromPlot(gaps = cel_gap, figCols = 2, annot1 = annot1, annot2 = annot2,
annot3 = annot3)


one of the features masks the other because they are close to each other in the genome. How can I make the green bar stack on top of the yellow one instead of covering it?

• Did you tried changing the order ? annot1 = annot1, annot2 = annot3, annot3 = annot2) If the annot_n are plotted in that order, simply changing the size will change the results as desired
– llrs
Jun 25, 2018 at 8:56
• good idea, but then the green bar is half masked by the yellow bar and this gives the wrong impression of size. Jun 25, 2018 at 10:23
• I'm not sure if this is possible at all with chromPlot. Are you sure there is the possibility to make this work as you wish? (have you seen it elsewhere?). Maybe this is a question for the developers themselves
– llrs
Jun 25, 2018 at 11:08
• p. 28 of the manual seems to make it work: bioconductor.org/packages/devel/bioc/vignettes/chromPlot/inst/… Jun 25, 2018 at 12:48
• Then you might need to check what "chrSide" parameter does, because is the only difference I see. (And I am not sure that each bar is just added at the top of the other bar, but that could be the effect of chrSide)
– llrs
Jun 25, 2018 at 12:51

chromPlot(gaps = cel_gap, figCols = 2, annot1 = annot1, annot2 = annot3, annot3 = annot2,

The chrSide argument decides on which side the histogram goes, so it can be used to solve my problem. The bars are not stacked but the result is the same: more accurate visualisation.