Answers.Body: <p>As described in the <a href="https://lh3.github.io/minimap2/minimap2.html" rel="nofollow noreferrer">minimap2 manual</a>, <code>-x STR</code> is used to specify a preset option like <code>-x map-pb</code> for <code>PacBio/Oxford Nanopore read to reference mapping (-Hk19)</code>.</p>
  <p>In general, I use the <code>-a</code> flag to output alignments in sam format that can then be  sorted and converted to bam format, and viewed in any genome browser. The support for PAF format when it comes to visualization appears to be limited. A few options that I have found, but not tested are:</p>
  <ul>
  <li><a href="https://github.com/thackl/minidot" rel="nofollow noreferrer">minidot</a></li>
  <li><a href="https://github.com/dwinter/pafr" rel="nofollow noreferrer">pafr</a></li>
  <li><a href="https://github.com/mbhall88/pafpy" rel="nofollow noreferrer">pafpy</a> -- this one may not have the plotting capabilities though</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-22T01:42:50.470Z
Answers.LastActivityDate: 2020-11-22T19:11:36.577Z
Answers.LastEditDate: 2020-11-22T19:11:36.577Z
Answers.UserDisplayName: vkkodali
Answers.Body: <p>Depending on what level of information you need, it is not difficult to just homebrew a plot in your plotting package of choice, as PAF has relevant coordinate information. Unless you are interested in some more complex features of a plotter such as IGV, I think that this is a good flexible solution.</p>
  <p>For example, this R code makes a dot plot of the synteny between the reference and the query:</p>
  <pre><code>library(ggplot2)
  paf = read.table(&quot;out.paf&quot;, sep=&quot;\t&quot;)
  ggplot(data=paf, aes(x=V3, xend=V4, y=V8, yend=V9, color=factor(V1))) + geom_segment() + labs(x=&quot;Reference coordinate&quot;, y=&quot;Query coordinate&quot;)
  </code></pre>
  <p>The plot looks like this:</p>
  <p><a href="https://i.sstatic.net/2nDg1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2nDg1.png" alt="enter image description here" /></a></p>
  <p>It is effectively a rather minimalist version of what <a href="https://github.com/dwinter/pafr" rel="nofollow noreferrer">pafr</a> (as suggested by vkkodali) or minidot is doing.</p>
  <p>(h/t Zev K.)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-27T21:39:40.327Z
Answers.LastActivityDate: 2020-11-27T21:39:40.327Z
Answers.UserDisplayName: Maximilian Press
Body: <p>As described by the <a href="https://github.com/lh3/miniasm/blob/master/PAF.md" rel="nofollow noreferrer">developer</a> of <a href="https://github.com/lh3/minimap2/blob/master/cookbook.md" rel="nofollow noreferrer">minimap2</a>:</p>
  <blockquote>
  <p>PAF is a text format describing the approximate mapping positions between two set of sequences.</p>
  </blockquote>
  <p>He also suggest to use either <a href="https://genomeribbon.com/" rel="nofollow noreferrer">Ribbon</a> to visualize PAF files, or to use <code>minidot</code> from <code>miniasm</code>:</p>
  <blockquote>
  <pre class="lang-bash prettyprint-override"><code>minimap2 -c -x??? asm1.fa asm2.fa &gt; out.paf
  minidot out.paf &gt; out.eps &amp;&amp; epstopdf out.eps
  </code></pre>
  </blockquote>
  <p>What does <code>-x???</code> stand for? And how do you visualize PAF files? Could you think of a way to use <a href="https://software.broadinstitute.org/software/igv/" rel="nofollow noreferrer">IGV</a> to visualize PAF files?</p>
  
Tags: <minimap2>
Title: How do you visualize minimap2's PAF output format?
ThreadText: # How do you visualize minimap2's PAF output format?
  
  (Asked by: username_0 on 2020-11-22)
  
  As described by the [developer](https://github.com/lh3/miniasm/blob/master/PAF.md) of [minimap2](https://github.com/lh3/minimap2/blob/master/cookbook.md):
  
  > PAF is a text format describing the approximate mapping positions between two set of sequences.
  
  He also suggest to use either [Ribbon](https://genomeribbon.com/) to visualize PAF files, or to use `minidot` from `miniasm`:
  
  > ```bash
  > minimap2 -c -x??? asm1.fa asm2.fa > out.paf
  > minidot out.paf > out.eps && epstopdf out.eps
  >
  > ```
  
  What does `-x???` stand for? And how do you visualize PAF files? Could you think of a way to use [IGV](https://software.broadinstitute.org/software/igv/) to visualize PAF files?
  
  **Tags:** minimap2
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-11-22. Score: 5
  
  As described in the [minimap2 manual](https://lh3.github.io/minimap2/minimap2.html), `-x STR` is used to specify a preset option like `-x map-pb` for `PacBio/Oxford Nanopore read to reference mapping (-Hk19)`.
  
  In general, I use the `-a` flag to output alignments in sam format that can then be sorted and converted to bam format, and viewed in any genome browser. The support for PAF format when it comes to visualization appears to be limited. A few options that I have found, but not tested are:
  
  * [minidot](https://github.com/thackl/minidot)
  * [pafr](https://github.com/dwinter/pafr)
  * [pafpy](https://github.com/mbhall88/pafpy) -- this one may not have the plotting capabilities though
  
  
  ---
  
  ### Answer by username_2 on 2020-11-27. Score: 4
  
  Depending on what level of information you need, it is not difficult to just homebrew a plot in your plotting package of choice, as PAF has relevant coordinate information. Unless you are interested in some more complex features of a plotter such as IGV, I think that this is a good flexible solution.
  
  For example, this R code makes a dot plot of the synteny between the reference and the query:
  
  ```
  library(ggplot2)
  paf = read.table("out.paf", sep="\t")
  ggplot(data=paf, aes(x=V3, xend=V4, y=V8, yend=V9, color=factor(V1))) + geom_segment() + labs(x="Reference coordinate", y="Query coordinate")
  
  ```
  
  The plot looks like this:
  
  [![enter image description here](https://i.sstatic.net/2nDg1.png)](https://i.sstatic.net/2nDg1.png)
  
  It is effectively a rather minimalist version of what [pafr](https://github.com/dwinter/pafr) (as suggested by username_1) or minidot is doing.
  
  (h/t Zev K.)
  
  
  ---
  
  