2
$\begingroup$

I'd like to run dotPlotly from RStudio but I can't find any description/help for this. Is it at all possible? Another side to this question: does anyone know any tool for dot plots for genome comparison apart from pafr (doesn't provide colour legend) and d-genies (we have problems with installation)? Is there a way to make dot plots for a minimap2 output with ggplot2?

To specify:

  1. I need help in running dotPlotly (preferably from Rstudio)
  2. I'd like to build dot plots for genome comparisons showing % of identity

Thanks

$\endgroup$
1
  • $\begingroup$ Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. $\endgroup$
    – Community Bot
    Commented Dec 5, 2022 at 19:48

1 Answer 1

1
$\begingroup$

For the issue of just making a dotplot in ggplot2 from a PAF file, it is pretty trivial to do a simple one, though it is necessarily not the most beautiful.

I grabbed 2 random E. coli genomes and mapped them:

% minimap2 ~/Downloads/GCF_000157115.2_Escherichia_sp_3_2_53FAA_V2_genomic.fna.gz ~/Downloads/GCF_000308975.1_ASM30897v2_genomic.fna.gz > 2_ecolis.paf

Then I opened Rstudio and ran the following (which is only slightly modified from what I was first shown by an old colleague, Zev Kronenberg):

ecoli_paf = read.table("~/2_ecolis.paf", sep="\t", fill=T)
ggplot() + 
geom_segment(
  data=ecoli_paf, mapping=aes(
    x=ecoli_paf$V3, y=ecoli_paf$V8, xend=ecoli_paf$V4, yend=ecoli_paf$V9, color=ecoli_paf$V6
  )
)

I am far from a ggplot2 expert as you can tell, and there are a few issues here (reverse complement is shown opposite to what you'd expect, linear interpolation of mappings from mapped endpoints), but it makes a somewhat informative dotplot:

enter image description here

I am confident that with minimal fiddling you can make this look a lot better. I will try to revisit and beautify.

$\endgroup$
4
  • 1
    $\begingroup$ Thanks a lot, this is useful! My problem is that I'd also need some reflection of similarity, like the % of identity. Specific tools provide it. Is there a way to show it in this simple ggplot approach? $\endgroup$
    – SKay
    Commented Dec 6, 2022 at 10:54
  • $\begingroup$ Thank you @SKay. $\endgroup$
    – M__
    Commented Dec 6, 2022 at 15:15
  • $\begingroup$ @SKay yes there should be, you would have to use another layer like perhaps line thickness or transparency, or mapping colors to that instead and tracking scaffold id differently. PAF output from minimap2 captures similarity so everything is there. If i get a moment to improve my answer I will try a few approaches and see what seems best. $\endgroup$ Commented Dec 7, 2022 at 5:37
  • $\begingroup$ Thank you very much! $\endgroup$
    – SKay
    Commented Dec 7, 2022 at 17:00

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.