Answers.Body: <p>According to the VCF specification, haplotype blocks are defined by the "Phase Set" [PS] tag:</p>
  
  <blockquote>
    <p>PS : phase set. A phase set is defined as a set of phased genotypes to which this genotype belongs. Phased genotypes for an individual that are on the same chromosome and have the same PS value are in the same phased set. A phase set specifies multi-marker haplotypes for the phased genotypes in the set. All phased genotypes that do not contain a PS subfield are assumed to belong to the same phased set. If the genotype in the GT field is unphased, the corresponding PS field is ignored. The recommended convention is to use the position of the first variant in the set as the PS identifier (although this is not required). (Non-negative 32-bit Integer)</p>
  </blockquote>
  
  <p>A good example of this can be found on a <a href="https://support.10xgenomics.com/genome-exome/software/pipelines/latest/output/vcf" rel="nofollow noreferrer">10X Genomics support page</a> about phasing:</p>
  
  <pre><code>CHROM   Pos REF ALT GT  PS
  chr1    1000    A   C   0|1 1000
  chr1    1010    T   G   1|0 1000
  chr1    2000    C   T   0|1 2000
  chr1    2005    T   G   0/1 2000
  chr1    2008    G   C   0|1 2000
  </code></pre>
  
  <blockquote>
    <p>In this example we have two phase blocks, denoted by PS=1000 and PS=2000. PS=1000 spans position 1000-1010, and PS=2000 spans position 2000-2008. In PS=1000, haplotype 1 contains the REF A allele at position 1000, and the ALT G allele as position 1010, while haplotype 2 contains the ALT C allele at position 1000 and the REF T allele at position 1010.</p>
  </blockquote>
  
  <p>Note that this phase set identifier needs to be a single numeric value, which means that sub-blocks and overlapping blocks cannot be defined by this field.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-19T18:24:29.280Z
Answers.LastActivityDate: 2017-12-22T03:36:47.963Z
Answers.LastEditDate: 2017-12-22T03:36:47.963Z
Answers.UserDisplayName: gringer
Answers.Body: <p>Two options that immediately come to mind, depending on what you hope to accomplish down the pipeline: you might simply mark the unphased sites with a "/" instead of "|" to indicate they are not phased; or, if you have multiple haplotype blocks that are all independent of each other, you could use the chromosome field to identify each unique haplotype (e.g. chr1h1, chr1h2, chr2h1, chr2h2, etc).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-19T14:05:33.133Z
Answers.LastActivityDate: 2017-12-19T14:05:33.133Z
Answers.UserDisplayName: caw5cv
Answers.Body: <p>There is a new idea of reporting the "phased haplotype/genotype block" with unique block ID.</p>
  
  <p><a href="https://github.com/secastel/phaser/tree/master/phaser" rel="nofollow noreferrer">phaser</a> uses "PI" (unique phase-index) and "PG" (phased-genotype). </p>
  
  <p>GATK is also using this idea of "unique-block" and "phased-genotype"; See <a href="https://software.broadinstitute.org/gatk/documentation/tooldocs/3.8-0/org_broadinstitute_gatk_tools_walkers_phasing_ReadBackedPhasing.php" rel="nofollow noreferrer">the "HP" tag</a>.</p>
  
  <p>Personally, I feel the representation of "phaser" is way better and comprehensive.</p>
  
  <p>I would represent your data as:</p>
  
  <pre><code>chr1 100 . A T . . . GT:PI:PG    1/0:3:1|0
  chr1 200 . A T . . . GT:PI:PG    0/1:3:0|1
  chr1 300 . A T . . . GT:PI:PG    1/0:4:1|0
  chr1 400 . A T . . . GT:PI:PG    0/1:4:1|0
  </code></pre>
  
  <p>where first two lines have same "PI" (i.e 3) stating they are phased with each other. Same with the later two lines which have another "PI" (i.e 4).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-07T21:56:35.440Z
Answers.LastActivityDate: 2018-03-08T11:52:31.273Z
Answers.LastEditDate: 2018-03-08T11:52:31.273Z
Answers.UserDisplayName: everestial
Body: <p>In VCF I know how to indicate that two genotypes are in the same phase by using consecutive "0|1" and "1|0" genotype fields, for example. However, how do I deal with the case that the first two genotypes are in phase and the second 2 are in phase, but there is no phase between the 2nd and 3rd?</p>
  
  <p>According to the format I think I need to write:</p>
  
  <pre><code>chr1 100 . A T . . . GT 1|0
  chr1 200 . A T . . . GT 0|1
  chr1 300 . A T . . . GT 1|0
  chr1 400 . A T . . . GT 0|1
  </code></pre>
  
  <p>but that implies that the SNP at 200 and the SNP at 300 are in phase, when in fact they are not.</p>
  
  <p>How to indicate the END of a haplotype block in VCF?</p>
  
Tags: <file-formats><vcf><haplotypes>
Title: How to indicate the END of a haplotype block in VCF?
ThreadText: # How to indicate the END of a haplotype block in VCF?
  
  (Asked by: username_0 on 2017-12-19)
  
  In VCF I know how to indicate that two genotypes are in the same phase by using consecutive "0|1" and "1|0" genotype fields, for example. However, how do I deal with the case that the first two genotypes are in phase and the second 2 are in phase, but there is no phase between the 2nd and 3rd?
  
  According to the format I think I need to write:
  
  ```
  chr1 100 . A T . . . GT 1|0
  chr1 200 . A T . . . GT 0|1
  chr1 300 . A T . . . GT 1|0
  chr1 400 . A T . . . GT 0|1
  
  ```
  
  but that implies that the SNP at 200 and the SNP at 300 are in phase, when in fact they are not.
  
  How to indicate the END of a haplotype block in VCF?
  
  **Tags:** file-formats, vcf, haplotypes
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2017-12-19. Score: 3
  
  According to the VCF specification, haplotype blocks are defined by the "Phase Set" [PS] tag:
  
  > PS : phase set. A phase set is defined as a set of phased genotypes to which this genotype belongs. Phased genotypes for an individual that are on the same chromosome and have the same PS value are in the same phased set. A phase set specifies multi-marker haplotypes for the phased genotypes in the set. All phased genotypes that do not contain a PS subfield are assumed to belong to the same phased set. If the genotype in the GT field is unphased, the corresponding PS field is ignored. The recommended convention is to use the position of the first variant in the set as the PS identifier (although this is not required). (Non-negative 32-bit Integer)
  
  A good example of this can be found on a [10X Genomics support page](https://support.10xgenomics.com/genome-exome/software/pipelines/latest/output/vcf) about phasing:
  
  ```
  CHROM   Pos REF ALT GT  PS
  chr1    1000    A   C   0|1 1000
  chr1    1010    T   G   1|0 1000
  chr1    2000    C   T   0|1 2000
  chr1    2005    T   G   0/1 2000
  chr1    2008    G   C   0|1 2000
  
  ```
  
  > In this example we have two phase blocks, denoted by PS=1000 and PS=2000. PS=1000 spans position 1000-1010, and PS=2000 spans position 2000-2008. In PS=1000, haplotype 1 contains the REF A allele at position 1000, and the ALT G allele as position 1010, while haplotype 2 contains the ALT C allele at position 1000 and the REF T allele at position 1010.
  
  Note that this phase set identifier needs to be a single numeric value, which means that sub-blocks and overlapping blocks cannot be defined by this field.
  
  
  ---
  
  ### Answer by username_2 on 2017-12-19. Score: 1
  
  Two options that immediately come to mind, depending on what you hope to accomplish down the pipeline: you might simply mark the unphased sites with a "/" instead of "|" to indicate they are not phased; or, if you have multiple haplotype blocks that are all independent of each other, you could use the chromosome field to identify each unique haplotype (e.g. chr1h1, chr1h2, chr2h1, chr2h2, etc).
  
  
  ---
  
  ### Answer by username_3 on 2018-03-07. Score: 1
  
  There is a new idea of reporting the "phased haplotype/genotype block" with unique block ID.
  
  [phaser](https://github.com/secastel/phaser/tree/master/phaser) uses "PI" (unique phase-index) and "PG" (phased-genotype).
  
  GATK is also using this idea of "unique-block" and "phased-genotype"; See [the "HP" tag](https://software.broadinstitute.org/gatk/documentation/tooldocs/3.8-0/org_broadinstitute_gatk_tools_walkers_phasing_ReadBackedPhasing.php).
  
  Personally, I feel the representation of "phaser" is way better and comprehensive.
  
  I would represent your data as:
  
  ```
  chr1 100 . A T . . . GT:PI:PG    1/0:3:1|0
  chr1 200 . A T . . . GT:PI:PG    0/1:3:0|1
  chr1 300 . A T . . . GT:PI:PG    1/0:4:1|0
  chr1 400 . A T . . . GT:PI:PG    0/1:4:1|0
  
  ```
  
  where first two lines have same "PI" (i.e 3) stating they are phased with each other. Same with the later two lines which have another "PI" (i.e 4).
  
  
  ---
  
  