Answers.Body: <p><strong>Convention</strong>
  The convention is it should be in ascending ordering, i.e. 0/1. The question is, why the convention broken?</p>
  <p><strong>Phasing</strong> I think, at a guess, the answer is it depends what reference genome you are using. I would suggest that this result would not occur if the reference genome is mum (or dad) and the alleles are occurring in the child. The output supports this idea because it is marked with '/', i.e. they are not phased, thus the reference genome is neither mum nor dad.</p>
  <p><strong>Example provided</strong> The thing I would like to point out is in the example given <code>117120306</code> and <code>117120317</code> are not randomly scattered across the genome but appear to be 11 bp apart. For a human genome those are very strongly linked.</p>
  <p><strong>Linkage hypothesis</strong> Thus I would suggest the answer is linkage in this example, given the reference genome isn't a parent. The mutations are occurring on different strands therefore better represented as 0/1 and then 1/0, i.e. one strand comprises 'A' allele and the opposite strand is the 'G' allele.</p>
  <p><strong>Why is unphased linkage important</strong> In this scenario the interpretation could be hugely important because it would be stating that each allele has come from different parents. This would be more important than maintaining convention. In an inherited disorder there is a risk the child has a dominant phenotype, when each parent could have been heterozygous. Clearly it depends whether the mutation is forcing an amino acid mutation, at 11bp it is certainly possible, i.e. mutation in the first codon upstream and mutation in the second codon downstream.</p>
  <p>More generally in any population analysis, linkage is an enormously important issue and central to any calculation. The point is simply that most analysis infers independent segregation of each allele and in this example that remains a good assumption because the allele (I am suggesting) are on opposite strands. If they were on the same strand it would create a bias away from panmixia.</p>
  <p>The hypothesis is formed on this example alone and if the alleles were 10 megabp apart it would be impossible to conclude they were linked, therefore the convention of 0/1 should hold. That's my guess, its not a bad guess.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-23T16:29:59.527Z
Answers.Text: This is an interesting suggestion. I just picked two random variants from the file, so I will have to investigate a bit to see if what you suggest is actually the case more generally. I'd love to see this backed up by a gatk source (post, or dev, or source file or whatever). Certainly plausible, anyway, thanks!
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-23T16:41:11.100Z
Answers.Text: Hope it helps @terdon. Its a hypothesis to work on. Geraldine@Broad will know of course.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-28T17:35:55.787Z
Answers.Text: I'm honored by your confidence in me, @M__ — But in this case I don't know for sure  I don't recall seeing something like this before. And if it was a phasing thing I would expect there to be phase related annotations. Are you seeing this in more than one record? And is this single or multi sample, have you done any subsetting, etc? 
  
  FWIW you might get a definitive answer faster on the GATK forum.
Answers.UserDisplayName: Geraldine_VdAuwera
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-29T19:57:27.960Z
Answers.Text: Alas, but regardless my confidence remains @Geraldine_VdAuwera  Thanks.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-30T11:55:59.793Z
Answers.Text: Thanks, @Geraldine_VdAuwera, I'll try there.
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-23T16:17:18.633Z
Answers.LastActivityDate: 2022-03-23T16:17:18.633Z
Answers.UserDisplayName: M__
Body: <p>I have always thought that <code>1/0</code> and <code>0/1</code> in VCF genotype fields are equivalent. And yet, GATK uses both. For example, these are two variants called in the same sample and the same run of GATK 4.1.4.0:</p>
  <pre><code>chr7    117120317   .   ATTCATTGTTTTGAAAGAAAGATGGAAGAATGAACTGAAG    A   748.97  .   AC=1;AF=0.5;AN=2;DP=64;ExcessHet=3.0103;FS=0;MLEAC=1;MLEAF=0.5;MQ=60;QD=11.89;SOR=7.223 GT:AD:DP:GQ:PL:SB   1/0:0,36:63:99:2294,1042,933:0,0,0,36
  chr7    117120306   .   GACGCGCT    G   516.6   .   AC=1;AF=0.5;AN=2;BaseQRankSum=0.826;DP=70;ExcessHet=3.0103;FS=0;MLEAC=1;MLEAF=0.5;MQ=60;MQRankSum=0;QD=8.2;ReadPosRankSum=-5.786;SOR=0.976  GT:AD:DP:GQ:PL:SB   0/1:37,26:63:99:524,0,1203:0,20,0,26
  </code></pre>
  <p>And here are the same lines redacted for clarity:</p>
  <pre><code>chr7    117120317   .   AT..AG  A   [...]   GT:AD:DP:GQ:PL:SB   1/0:0,36:63:99:2294,1042,933:0,0,0,36
  chr7    117120306   .   GA..CT  G   [...]   GT:AD:DP:GQ:PL:SB   0/1:37,26:63:99:524,0,1203:0,20,0,26
  </code></pre>
  <p>As you can see, one is genotyped as <code>1/0</code> and the other as <code>0/1</code>. <a href="https://samtools.github.io/hts-specs/VCFv4.3.pdf" rel="nofollow noreferrer">The VCF specs</a> say:</p>
  <blockquote>
  <p>GT (String): Genotype, encoded as allele values separated by either of / or |. The allele values are 0 for the
  reference allele (what is in the REF field), 1 for the first allele listed in ALT, 2 for the second allele list in
  ALT and so on. For diploid calls examples could be 0/1, 1 | 0, or 1/2, etc. Haploid calls, e.g. on Y, male
  non-pseudoautosomal X, or mitochondrion, are indicated by having only one allele value. A triploid call might
  look like 0/0/1. If a call cannot be made for a sample at a given locus, ‘.’ must be specified for each missing
  allele in the GT field (for example ‘./.’ for a diploid genotype and ‘.’ for haploid genotype). The meanings of
  the separators are as follows (see the PS field below for more details on incorporating phasing information into
  the genotypes):</p>
  <ul>
  <li>/ : genotype unphased</li>
  <li>| : genotype phased</li>
  </ul>
  </blockquote>
  <p>This suggests that although <code>1|0</code> is not the same as <code>0|1</code>, the <em>unphased</em> <code>0/1</code> and <code>1/0</code> genotypes are completely equivalent. Which makes perfect sense given that the <code>N/N</code> genotypes are unphased, so <code>n/N</code> must be equivalent to <code>N/n</code>.</p>
  <p>So, my questions are: why does gatk produce some lines with <code>0/1</code> and others with <code>1/0</code>? Is it a bug? Am I missing something? I can't imagine a developer writing code to pick either <code>0/1</code> or <code>1/0</code> randomly, so presumably they indicate some difference in what gatk sees about a variant. So are <code>0/1</code> and <code>1/0</code> not 100% equivalent somehow?</p>
  <hr />
  <p><sub> I have seen <a href="https://bioinformatics.stackexchange.com/q/14356/298">How is the GT field in a VCF file defined?</a> which suggests the two are equivalent, but this seems to be contradicted by GATK's own output which is why I am asking this again to get a clear and preferably referenced answer.</sub></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-10T16:20:59.933Z
Comments.Text: @M__ this was from a human sample. But you can't know dominant or recessive unless you also know what gene, if any, is affected by the variant and what that gene's mode of inheritance is with respect to a specific disease, so I don't think it can be about AD vs AR.
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-23T15:48:10.127Z
Comments.Text: Okay finally got it. The convention is it should be in ascending ordering, i.e. 0/1. The question is, why the convention broken?
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-23T21:23:29.177Z
Comments.Text: I just realized that's almost certainly on me. I just took a couple of variants from a file randomly, and I hadn't really noticed the positions. I'm pretty sure they were in the right (ascending) order in the original file. Which lends more credence to your suggestion, @M__.
Comments.UserDisplayName: terdon
Tags: <vcf><gatk><genotyping><phasing>
Title: Why does GATK produce both 0/1 and 1/0 genotypes in the same file? Are the two not equivalent?
ThreadText: # Why does GATK produce both 0/1 and 1/0 genotypes in the same file? Are the two not equivalent?
  
  (Asked by: username_0 on 2022-03-10)
  
  I have always thought that `1/0` and `0/1` in VCF genotype fields are equivalent. And yet, GATK uses both. For example, these are two variants called in the same sample and the same run of GATK 4.1.4.0:
  
  ```
  chr7    117120317   .   ATTCATTGTTTTGAAAGAAAGATGGAAGAATGAACTGAAG    A   748.97  .   AC=1;AF=0.5;AN=2;DP=64;ExcessHet=3.0103;FS=0;MLEAC=1;MLEAF=0.5;MQ=60;QD=11.89;SOR=7.223 GT:AD:DP:GQ:PL:SB   1/0:0,36:63:99:2294,1042,933:0,0,0,36
  chr7    117120306   .   GACGCGCT    G   516.6   .   AC=1;AF=0.5;AN=2;BaseQRankSum=0.826;DP=70;ExcessHet=3.0103;FS=0;MLEAC=1;MLEAF=0.5;MQ=60;MQRankSum=0;QD=8.2;ReadPosRankSum=-5.786;SOR=0.976  GT:AD:DP:GQ:PL:SB   0/1:37,26:63:99:524,0,1203:0,20,0,26
  
  ```
  
  And here are the same lines redacted for clarity:
  
  ```
  chr7    117120317   .   AT..AG  A   [...]   GT:AD:DP:GQ:PL:SB   1/0:0,36:63:99:2294,1042,933:0,0,0,36
  chr7    117120306   .   GA..CT  G   [...]   GT:AD:DP:GQ:PL:SB   0/1:37,26:63:99:524,0,1203:0,20,0,26
  
  ```
  
  As you can see, one is genotyped as `1/0` and the other as `0/1`. [The VCF specs](https://samtools.github.io/hts-specs/VCFv4.3.pdf) say:
  
  > GT (String): Genotype, encoded as allele values separated by either of / or |. The allele values are 0 for the
  > reference allele (what is in the REF field), 1 for the first allele listed in ALT, 2 for the second allele list in
  > ALT and so on. For diploid calls examples could be 0/1, 1 | 0, or 1/2, etc. Haploid calls, e.g. on Y, male
  > non-pseudoautosomal X, or mitochondrion, are indicated by having only one allele value. A triploid call might
  > look like 0/0/1. If a call cannot be made for a sample at a given locus, ‘.’ must be specified for each missing
  > allele in the GT field (for example ‘./.’ for a diploid genotype and ‘.’ for haploid genotype). The meanings of
  > the separators are as follows (see the PS field below for more details on incorporating phasing information into
  > the genotypes):
  >
  > * / : genotype unphased
  > * | : genotype phased
  
  This suggests that although `1|0` is not the same as `0|1`, the *unphased* `0/1` and `1/0` genotypes are completely equivalent. Which makes perfect sense given that the `N/N` genotypes are unphased, so `n/N` must be equivalent to `N/n`.
  
  So, my questions are: why does gatk produce some lines with `0/1` and others with `1/0`? Is it a bug? Am I missing something? I can't imagine a developer writing code to pick either `0/1` or `1/0` randomly, so presumably they indicate some difference in what gatk sees about a variant. So are `0/1` and `1/0` not 100% equivalent somehow?
  
  ---
  
  I have seen [How is the GT field in a VCF file defined?](https://bioinformatics.stackexchange.com/q/14356/298) which suggests the two are equivalent, but this seems to be contradicted by GATK's own output which is why I am asking this again to get a clear and preferably referenced answer.
  
  **Tags:** vcf, gatk, genotyping, phasing
  
  > **Comments:**
  > **username_0**: @username_1 this was from a human sample. But you can't know dominant or recessive unless you also know what gene, if any, is affected by the variant and what that gene's mode of inheritance is with respect to a specific disease, so I don't think it can be about AD vs AR.  
  > **username_1**: Okay finally got it. The convention is it should be in ascending ordering, i.e. 0/1. The question is, why the convention broken?  
  > **username_0**: I just realized that's almost certainly on me. I just took a couple of variants from a file randomly, and I hadn't really noticed the positions. I'm pretty sure they were in the right (ascending) order in the original file. Which lends more credence to your suggestion, @username_1.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-03-23. Score: 2
  
  **Convention**
  The convention is it should be in ascending ordering, i.e. 0/1. The question is, why the convention broken?
  
  **Phasing** I think, at a guess, the answer is it depends what reference genome you are using. I would suggest that this result would not occur if the reference genome is mum (or dad) and the alleles are occurring in the child. The output supports this idea because it is marked with '/', i.e. they are not phased, thus the reference genome is neither mum nor dad.
  
  **Example provided** The thing I would like to point out is in the example given `117120306` and `117120317` are not randomly scattered across the genome but appear to be 11 bp apart. For a human genome those are very strongly linked.
  
  **Linkage hypothesis** Thus I would suggest the answer is linkage in this example, given the reference genome isn't a parent. The mutations are occurring on different strands therefore better represented as 0/1 and then 1/0, i.e. one strand comprises 'A' allele and the opposite strand is the 'G' allele.
  
  **Why is unphased linkage important** In this scenario the interpretation could be hugely important because it would be stating that each allele has come from different parents. This would be more important than maintaining convention. In an inherited disorder there is a risk the child has a dominant phenotype, when each parent could have been heterozygous. Clearly it depends whether the mutation is forcing an amino acid mutation, at 11bp it is certainly possible, i.e. mutation in the first codon upstream and mutation in the second codon downstream.
  
  More generally in any population analysis, linkage is an enormously important issue and central to any calculation. The point is simply that most analysis infers independent segregation of each allele and in this example that remains a good assumption because the allele (I am suggesting) are on opposite strands. If they were on the same strand it would create a bias away from panmixia.
  
  The hypothesis is formed on this example alone and if the alleles were 10 megabp apart it would be impossible to conclude they were linked, therefore the convention of 0/1 should hold. That's my guess, its not a bad guess.
  
  > **Comments:**
  > **username_0**: This is an interesting suggestion. I just picked two random variants from the file, so I will have to investigate a bit to see if what you suggest is actually the case more generally. I'd love to see this backed up by a gatk source (post, or dev, or source file or whatever). Certainly plausible, anyway, thanks!  
  > **username_1**: Hope it helps @username_0. Its a hypothesis to work on. Geraldine@Broad will know of course.  
  > **username_2**: I'm honored by your confidence in me, @username_1 — But in this case I don't know for sure  I don't recall seeing something like this before. And if it was a phasing thing I would expect there to be phase related annotations. Are you seeing this in more than one record? And is this single or multi sample, have you done any subsetting, etc?   FWIW you might get a definitive answer faster on the GATK forum.  
  > **username_1**: Alas, but regardless my confidence remains @username_2  Thanks.  
  > **username_0**: Thanks, @username_2, I'll try there.  
  
  ---
  
  