Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-27T15:46:37.340Z
Answers.Text: Can you please elaborate on this answer? What's gr? Looks like R, which library should I use for this?
Answers.UserDisplayName: Wouter De Coster
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-19T05:01:35.280Z
Answers.LastActivityDate: 2019-03-28T05:43:55.263Z
Answers.LastEditDate: 2019-03-28T05:43:55.263Z
Answers.UserDisplayName: SmallChess
Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-16T12:58:45.520Z
Comments.Text: how about 'just' using the `INFO/SVTYPE`attribute ?
Comments.UserDisplayName: Pierre
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-16T12:59:03.823Z
Comments.Text: @Pierre SVTYPE is BND.
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-16T12:59:49.523Z
Comments.Text: @Pierre Some SV programs such as GRIDSS only output BND to the SVTYPE. Otherwise, I would not be here asking.
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-16T13:01:36.420Z
Comments.Text: from the VCF spec: `INFO=<ID=SVTYPE,Number=1,Type=String,Description="Type of structural variant">
  Value should be one of DEL, INS, DUP, INV, CNV, BND.`. So BND (break end) is NOT an INDEL, and NOT an insertion.
Comments.UserDisplayName: Pierre
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-16T13:02:19.723Z
Comments.Text: @Pierre My above example took from the specification.
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-16T13:02:20.937Z
Comments.Text: "Some SV programs such as GRIDSS only output BND to the SVTYPE" oh, I see
Comments.UserDisplayName: Pierre
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-16T13:56:53.763Z
Comments.Text: May I suggest you simply not use GRIDSS and instead use a tool that produces valid output?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-16T13:57:32.447Z
Comments.Text: @terdon What do you mean? GRIDSS is a published SV program. BND is a valid VCF output?
Comments.UserDisplayName: SmallChess
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-16T13:58:40.870Z
Comments.Text: If it uses `BND` to indicate an insertion, then it is not following the VCF specs since the `SVTYPE` for insertions should be `INS` and `BND` should only be used for break ends.
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-10-14T02:31:40.200Z
Comments.Text: https://github.com/PapenfussLab/gridss/pull/618 Just use the commands and scripts provided
Comments.UserDisplayName: Sunny wy
Tags: <vcf><genome><variation><structural-variation>
Title: Simplest way to work out structural variant type?
ThreadText: # Simplest way to work out structural variant type?
  
  (Asked by: username_0 on 2018-07-16)
  
  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.
  
  **Tags:** vcf, genome, variation, structural-variation
  
  > **Comments:**
  > **username_1**: how about 'just' using the `INFO/SVTYPE`attribute ?  
  > **username_0**: @username_1 SVTYPE is BND.  
  > **username_0**: @username_1 Some SV programs such as GRIDSS only output BND to the SVTYPE. Otherwise, I would not be here asking.  
  > **username_1**: from the VCF spec: `INFO=<ID=SVTYPE,Number=1,Type=String,Description="Type of structural variant"> Value should be one of DEL, INS, DUP, INV, CNV, BND.`. So BND (break end) is NOT an INDEL, and NOT an insertion.  
  > **username_0**: @username_1 My above example took from the specification.  
  > **username_1**: "Some SV programs such as GRIDSS only output BND to the SVTYPE" oh, I see  
  > **username_2**: May I suggest you simply not use GRIDSS and instead use a tool that produces valid output?  
  > **username_0**: @username_2 What do you mean? GRIDSS is a published SV program. BND is a valid VCF output?  
  > **username_2**: If it uses `BND` to indicate an insertion, then it is not following the VCF specs since the `SVTYPE` for insertions should be `INS` and `BND` should only be used for break ends.  
  > **username_3**: https://github.com/PapenfussLab/gridss/pull/618 Just use the commands and scripts provided  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-07-19. Score: 3 | Accepted answer
  
  GRIDSS's author had posted [his own solution on Github](https://github.com/PapenfussLab/gridss/blob/7b1fedfed32af9e03ed5c6863d368a821a4c699f/example/simple-event-annotation.R#L9). 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")))))
  }
  
  ```
  
  > **Comments:**
  > **username_4**: Can you please elaborate on this answer? What's gr? Looks like R, which library should I use for this?  
  
  ---
  
  