Answers.Body: <p>Reviewing the source code, I observe the following <a href="https://github.com/similab/FSTest/blob/main/FSTest1.3.py#L37-L45" rel="nofollow noreferrer">at and before line 45</a> where your error occurs:</p>
  <pre><code>pop1 = allel.read_vcf(args.pop1)
  pop2 = allel.read_vcf(args.pop2)
  
  gt1 = allel.GenotypeArray(pop1['calldata/GT'])
  gt2 = allel.GenotypeArray(pop2['calldata/GT'])
  
  ac1 = gt1.count_alleles()
  ac1 = pd.DataFrame(ac1)
  ac1.columns=[&quot;np1&quot;,&quot;nq1&quot;]
  </code></pre>
  <p>Based on a naive reading, the issue seems to be that the allele counts indicate more than 2 alleles based on its dependency on <code>scikit-allel</code>'s <a href="https://scikit-allel.readthedocs.io/en/stable/model/ndarray.html#genotypearray" rel="nofollow noreferrer">GenotypeArray</a>. I believe that this means that your VCF is treating your data as triploid (?), but the <code>FSTest1.py</code> script strictly assumes diploidy. It would be nice if it could make that explicit.</p>
  <p>But I am not absolutely sure as I am not an expert on these packages. I invite someone with more understanding to comment.</p>
  <p>Can you show a snippet of your VCF or comment on the ploidy issue? What's the form of your data?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-11T05:01:44.267Z
Answers.Text: SNP data in the VCF file is diploid
Answers.UserDisplayName: DJI
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-11T17:47:39.480Z
Answers.Text: @DJI can you show a sample of your VCF files?
Answers.UserDisplayName: Maximilian Press
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-11T04:27:52.430Z
Answers.LastActivityDate: 2024-06-11T04:27:52.430Z
Answers.UserDisplayName: Maximilian Press
Body: <p>I used the Python script FSTest (<a href="https://github.com/similab/FSTest" rel="nofollow noreferrer">https://github.com/similab/FSTest</a>) for the calculation of the fixation index from the extracted SNPs. I used the following command:</p>
  <pre><code>python FSTest1.3.py --pop1 snps_chr1.vcf --pop2 snps_chr2.vcf --m 3 --zt 1 --o chr1_chr2_fst
  </code></pre>
  <p>I received the following error: Could you please help me to solve the error?</p>
  <pre><code> **************************************************************
  *                 FSTest software v 1.3                      *
  *       Seyed Milad Vahedi, Siavash Salek Ardestani          *
  *         smvahedi@dal.ca, siasia6650@gmail.com              *
  **************************************************************
  
      Traceback (most recent call last):
        File &quot;/home/user/Desktop/fst/FSTest1.3.py&quot;, line 45, in &lt;module&gt;
          ac1.columns=[&quot;np1&quot;,&quot;nq1&quot;]
          ^^^^^^^^^^^
  
    
  
      File &quot;/home/user/miniconda3/lib/python3.11/site-packages/pandas/core/generic.py&quot;, line 6313, in __setattr__
          return object.__setattr__(self, name, value)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File &quot;properties.pyx&quot;, line 69, in pandas._libs.properties.AxisProperty.__set__
    File &quot;/home/user/miniconda3/lib/python3.11/site-packages/pandas/core/generic.py&quot;, line 814, in _set_axis
      self._mgr.set_axis(axis, labels)
    File &quot;/home/user/miniconda3/lib/python3.11/site-packages/pandas/core/internals/managers.py&quot;, line 238, in set_axis
      self._validate_set_axis(axis, new_labels)
    File &quot;/home/user/miniconda3/lib/python3.11/site-packages/pandas/core/internals/base.py&quot;, line 98, in _validate_set_axis
      raise ValueError(
  ValueError: Length mismatch: Expected axis has 3 elements, new values have 2 elements
  </code></pre>
  
Tags: <python><vcf><snp><fst>
Title: Fixation index calculation from the vcf files
ThreadText: # Fixation index calculation from the vcf files
  
  (Asked by: username_0 on 2024-06-11)
  
  I used the Python script FSTest (<https://github.com/similab/FSTest>) for the calculation of the fixation index from the extracted SNPs. I used the following command:
  
  ```
  python FSTest1.3.py --pop1 snps_chr1.vcf --pop2 snps_chr2.vcf --m 3 --zt 1 --o chr1_chr2_fst
  
  ```
  
  I received the following error: Could you please help me to solve the error?
  
  ```
   **************************************************************
  *                 FSTest software v 1.3                      *
  *       Seyed Milad Vahedi, Siavash Salek Ardestani          *
  *         smvahedi@dal.ca, siasia6650@gmail.com              *
  **************************************************************
  
      Traceback (most recent call last):
        File "/home/user/Desktop/fst/FSTest1.3.py", line 45, in <module>
          ac1.columns=["np1","nq1"]
          ^^^^^^^^^^^
  
    
  
      File "/home/user/miniconda3/lib/python3.11/site-packages/pandas/core/generic.py", line 6313, in __setattr__
          return object.__setattr__(self, name, value)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "properties.pyx", line 69, in pandas._libs.properties.AxisProperty.__set__
    File "/home/user/miniconda3/lib/python3.11/site-packages/pandas/core/generic.py", line 814, in _set_axis
      self._mgr.set_axis(axis, labels)
    File "/home/user/miniconda3/lib/python3.11/site-packages/pandas/core/internals/managers.py", line 238, in set_axis
      self._validate_set_axis(axis, new_labels)
    File "/home/user/miniconda3/lib/python3.11/site-packages/pandas/core/internals/base.py", line 98, in _validate_set_axis
      raise ValueError(
  ValueError: Length mismatch: Expected axis has 3 elements, new values have 2 elements
  
  ```
  
  **Tags:** python, vcf, snp, fst
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-06-11. Score: 1
  
  Reviewing the source code, I observe the following [at and before line 45](https://github.com/similab/FSTest/blob/main/FSTest1.3.py#L37-L45) where your error occurs:
  
  ```
  pop1 = allel.read_vcf(args.pop1)
  pop2 = allel.read_vcf(args.pop2)
  
  gt1 = allel.GenotypeArray(pop1['calldata/GT'])
  gt2 = allel.GenotypeArray(pop2['calldata/GT'])
  
  ac1 = gt1.count_alleles()
  ac1 = pd.DataFrame(ac1)
  ac1.columns=["np1","nq1"]
  
  ```
  
  Based on a naive reading, the issue seems to be that the allele counts indicate more than 2 alleles based on its dependency on `scikit-allel`'s [GenotypeArray](https://scikit-allel.readthedocs.io/en/stable/model/ndarray.html#genotypearray). I believe that this means that your VCF is treating your data as triploid (?), but the `FSTest1.py` script strictly assumes diploidy. It would be nice if it could make that explicit.
  
  But I am not absolutely sure as I am not an expert on these packages. I invite someone with more understanding to comment.
  
  Can you show a snippet of your VCF or comment on the ploidy issue? What's the form of your data?
  
  > **Comments:**
  > **username_0**: SNP data in the VCF file is diploid  
  > **username_1**: @username_0 can you show a sample of your VCF files?  
  
  ---
  
  