Answers.Body: <p>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.</p>
  <p>I grabbed 2 random E. coli genomes and mapped them:</p>
  <pre><code>% minimap2 ~/Downloads/GCF_000157115.2_Escherichia_sp_3_2_53FAA_V2_genomic.fna.gz ~/Downloads/GCF_000308975.1_ASM30897v2_genomic.fna.gz &gt; 2_ecolis.paf
  </code></pre>
  <p>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):</p>
  <pre><code>ecoli_paf = read.table(&quot;~/2_ecolis.paf&quot;, sep=&quot;\t&quot;, 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
    )
  )
  </code></pre>
  <p>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:</p>
  <p><a href="https://i.sstatic.net/h7WCR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/h7WCR.png" alt="enter image description here" /></a></p>
  <p>I am confident that with minimal fiddling you can make this look a lot better. I will try to revisit and beautify.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-06T10:54:41.950Z
Answers.Text: 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?
Answers.UserDisplayName: SKay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-06T15:15:02.460Z
Answers.Text: Thank you @SKay.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-07T05:37:37.457Z
Answers.Text: @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.
Answers.UserDisplayName: Maximilian Press
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-07T17:00:47.603Z
Answers.Text: Thank you very much!
Answers.UserDisplayName: SKay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-05T21:57:01.223Z
Answers.LastActivityDate: 2022-12-05T21:57:01.223Z
Answers.UserDisplayName: Maximilian Press
Body: <p>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?</p>
  <p>To specify:</p>
  <ol>
  <li>I need help in running dotPlotly (preferably from Rstudio)</li>
  <li>I'd like to build dot plots for genome comparisons showing % of identity</li>
  </ol>
  <p>Thanks</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-05T19:48:27.807Z
Comments.Text: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
Comments.UserDisplayName: Community
Tags: <r><ggplot2>
Title: Can I run dotPlotly from Rstudio?
ThreadText: # Can I run dotPlotly from Rstudio?
  
  (Asked by: username_0 on 2022-12-05)
  
  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
  
  **Tags:** r, ggplot2
  
  > **Comments:**
  > **username_1**: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-12-05. Score: 1 | Accepted answer
  
  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](https://i.sstatic.net/h7WCR.png)](https://i.sstatic.net/h7WCR.png)
  
  I am confident that with minimal fiddling you can make this look a lot better. I will try to revisit and beautify.
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_3**: Thank you @username_0.  
  > **username_2**: @username_0 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.  
  > **username_0**: Thank you very much!  
  
  ---
  
  