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)

Karyotype with 2 annotations

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)

Karyotype with 3 annotations

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?

  • 1
    $\begingroup$ 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 $\endgroup$
    – llrs
    Jun 25, 2018 at 8:56
  • $\begingroup$ good idea, but then the green bar is half masked by the yellow bar and this gives the wrong impression of size. $\endgroup$ Jun 25, 2018 at 10:23
  • $\begingroup$ 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 $\endgroup$
    – llrs
    Jun 25, 2018 at 11:08
  • $\begingroup$ p. 28 of the manual seems to make it work: bioconductor.org/packages/devel/bioc/vignettes/chromPlot/inst/… $\endgroup$ Jun 25, 2018 at 12:48
  • $\begingroup$ 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) $\endgroup$
    – llrs
    Jun 25, 2018 at 12:51

1 Answer 1

chromPlot(gaps = cel_gap, figCols = 2, annot1 = annot1, annot2 = annot3, annot3 = annot2,
          chrSide=c(1, 1, -1, 1, -1, 1, -1, 1))

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.

Thanks to Llopis for the guidance.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.