text: user174: In VCF 4.2, a structural variant (SV) can be described with the BND keyword in SVTYPE. For example, the following example is an insertion (from https://samtools.github.io/hts-specs/VCFv4.2.pdf):
  #CHROM    POS ID REF ALT                      QUAL FILTER INFO
  2 321682  bnd V  T   ]13 : 123456]AGTNNNNNCAT 6    PASS   SVTYPE=BND;MATEID=bnd U
  13 123456 bnd U  C   CAGTNNNNNCA[2 : 321682[  6    PASS   SVTYPE=BND;MATEID=bnd V
  
  The keyword can be used to describe any SV event.
  I would like to work out how to find out if an event is an insertion, deletion, duplication, inversion, etc. The algorithm/program will tell me the example above is an insertion.
  I'm not able to find a tool that can do the conversion for me.
  PS: The program I'm using is GRIDSS. This program would only generate BND in the SVTYPE field. It's not strictly a bug (BND can be used for any SV arrangement), but it's annoying in analysis.
  
  user174: GRIDSS's author had posted his own solution on Github. The code is:
  simpleEventType <- function(gr) {
      return(ifelse(seqnames(gr) != seqnames(partner(gr)), "ITX", # inter-chromosomosal
             ifelse(gr$insLen >= abs(gr$svLen) * 0.7, "INS",
             ifelse(strand(gr) == strand(partner(gr)), "INV",
             ifelse(xor(start(gr) < start(partner(gr)), strand(gr) == "-"), "DEL", "DUP")))))
  }
  
  
original_text: 174: <p>In VCF 4.2, a structural variant (SV) can be described with the <code>BND</code> keyword in <code>SVTYPE</code>. For example, the following example is an insertion (from <a href="https://samtools.github.io/hts-specs/VCFv4.2.pdf" rel="nofollow noreferrer">https://samtools.github.io/hts-specs/VCFv4.2.pdf</a>):</p>
  
  <pre><code>#CHROM    POS ID REF ALT                      QUAL FILTER INFO
  2 321682  bnd V  T   ]13 : 123456]AGTNNNNNCAT 6    PASS   SVTYPE=BND;MATEID=bnd U
  13 123456 bnd U  C   CAGTNNNNNCA[2 : 321682[  6    PASS   SVTYPE=BND;MATEID=bnd V
  </code></pre>
  
  <p>The keyword can be used to describe any SV event.</p>
  
  <p>I would like to work out how to find out if an event is an insertion, deletion, duplication, inversion, etc. The algorithm/program will tell me the example above is an insertion.</p>
  
  <p>I'm not able to find a tool that can do the conversion for me.</p>
  
  <p><strong>PS:</strong> The program I'm using is GRIDSS. This program would only generate <code>BND</code> in the SVTYPE field. It's not strictly a bug (BND can be used for any SV arrangement), but it's annoying in analysis.</p>
   174: <p>GRIDSS's author had posted <a href="https://github.com/PapenfussLab/gridss/blob/7b1fedfed32af9e03ed5c6863d368a821a4c699f/example/simple-event-annotation.R#L9" rel="nofollow noreferrer">his own solution on Github</a>. The code is:</p>
  
  <pre><code>simpleEventType &lt;- function(gr) {
      return(ifelse(seqnames(gr) != seqnames(partner(gr)), "ITX", # inter-chromosomosal
             ifelse(gr<span class="math-container">$insLen &gt;= abs(gr$</span>svLen) * 0.7, "INS",
             ifelse(strand(gr) == strand(partner(gr)), "INV",
             ifelse(xor(start(gr) &lt; start(partner(gr)), strand(gr) == "-"), "DEL", "DUP")))))
  }
  </code></pre>
  