<p>Apparently the format of the <code>phenotype_to_genes.txt</code> File changed, while at the time when this pipeline was published the file consisted of 7 columns, it only has 5 now. That's what the error message tells you. It's best to file an issue at the github repository to get in touch with the authors. 1) so that other potential users are also aware of this issue and 2) the authors might be willing to fix this issue/help you get an updated version of the pipeline or an older version of the phenotype-file.</p>

CC BY-SA 4.0
2023-06-09T13:57:01.990Z
I was wondering what the original has as I might be able to publish the changes but I doubt I can get in touch with the author again. I think from what I can tell the original ```is 1. HPO-id:
2. HPO label: 
3. gene-id:
4. gene-symbol: 
5. gene-name: 
6. gene-source: 
7. disease-source: ```
Indira
CC BY-SA 4.0
2023-06-09T22:32:47.123Z
Thank you @Patrick.
Indira
CC BY-SA 4.0
2023-06-09T11:14:28.047Z
2023-06-09T11:14:28.047Z
Patrick
<p>I am using the following <a href="https://github.com/anthonyozerov/variant-filtering/tree/main" rel="nofollow noreferrer">Github repository</a> that I cloned. One apparent issue is that it is using an old/defunct link for the phenotype_to_genes.txt that is no longer active and after several tries I found what seems to be the <a href="http://purl.obolibrary.org/obo/hp/hpoa/phenotype_to_genes.txt" rel="nofollow noreferrer">correct link</a>. However, I cannot seem to get it to work as it seems to be throwing up an error that makes no sense to me when I try and run it via a bash script:</p>
<p><strong>Variable I defined in advance:</strong></p>
<ul>
<li><code>pedigree_file</code> has the path to the pedigree file with 4 columns (Family ID, individual_ID,Status [Child,Father,Mother,Sibling], Sex [Male or Female] and Phenotype [Affected or Unaffected]</li>
<li><code>Mendelian</code> a path to a file created via Mendelian filtering</li>
<li><code>output_dir</code> path to the output directory</li>
<li><code>phenotype_path</code> a path to a file with 2 columns group/family and then HPO</li>
<li><code>VC_Python_directory</code> path to the variant filtering directory</li>
<li><code>Map_File</code> path to the phenotype_to_genes.txt</li>
<li><code>family_names</code> a list of family/group names</li>
</ul>
<p><strong>The bash script:</strong></p>
<pre class="lang-bash prettyprint-override"><code>cd &quot;$VC_Python_directory&quot;

IFS=',' read -ra family_array &lt;&lt;&lt; &quot;<span class="math-container">$family_names"
for family_name in "$</span>{family_array[@]}&quot;; do

    # Concatenate the file path
    file_path=&quot;<span class="math-container">$output_dir/$</span>family_name.txt&quot;
    
    # Echo the family name and file path
    echo &quot;Family Name: <span class="math-container">${family_name}"
echo "File Path: $</span>{file_path}&quot;
    
    # Run the Python script with the correct arguments
    python main.py -p &quot;<span class="math-container">$pedigree_file" --data "$</span>Mendelian&quot; --output &quot;<span class="math-container">$file_path" --family "$</span>family_name&quot; -ph &quot;<span class="math-container">$phenotype_path" --mapfile "$</span>Map_File&quot;
done

</code></pre>
<p><strong>The error:</strong></p>
<pre><code>Family Name: Sample_1
File Path: /path/to/output_directory/Sample_1.txt
Path/to/variant-filtering/utils.py:77: DtypeWarning: Columns (2) have mixed types. Specify dtype option on import or set low_memory=False.
  phen_to_genes = pd.read_csv(mapfile, sep = '\t', header = None, comment = '#')
Getting relevant genes for family phenotypes...
Traceback (most recent call last):
  File “path/to/variant-filtering/main.py&quot;, line 26, in &lt;module&gt;
    load_phen(families, args.phenfile, args.mapfile)
  File “path/to/variant-filtering/utils.py&quot;, line 80, in load_phen
    phen_to_genes.columns = [&quot;HPO-id&quot;, &quot;HPO label&quot;, &quot;gene-id&quot;,
  File “path/to/python3.10/site-packages/pandas/core/generic.py&quot;, line 6002, in __setattr__
    return object.__setattr__(self, name, value)
  File &quot;pandas/_libs/properties.pyx&quot;, line 69, in pandas._libs.properties.AxisProperty.__set__
  File “/path/to/generic.py&quot;, line 730, in _set_axis
    self._mgr.set_axis(axis, labels)
  File “/path/to/managers.py&quot;, line 225, in set_axis
    self._validate_set_axis(axis, new_labels)
  File “/path/to/base.py&quot;, line 70, in _validate_set_axis
    raise ValueError(
ValueError: Length mismatch: Expected axis has 5 elements, new values have 7 elements
</code></pre>
<p>I have checked over the pedigree file and map file and phenotype path files but I am really unsure of how to go about this pipeline as I have never seen this kind of error before. I am not sure I can ask this here but does anyone perchance have an inkling as to what is causing the rather peculiar error?</p>

<python><bash><github>
Variant Filtering Using AnthonyOzerov/variant-filtering Github Repository And Python Errors
# Variant Filtering Using AnthonyOzerov/variant-filtering Github Repository And Python Errors

(Asked by: username_0 on 2023-06-09)

I am using the following Github repository that I cloned. One apparent issue is that it is using an old/defunct link for the phenotype_to_genes.txt that is no longer active and after several tries I found what seems to be the correct link. However, I cannot seem to get it to work as it seems to be throwing up an error that makes no sense to me when I try and run it via a bash script:
Variable I defined in advance:

pedigree_file has the path to the pedigree file with 4 columns (Family ID, individual_ID,Status [Child,Father,Mother,Sibling], Sex [Male or Female] and Phenotype [Affected or Unaffected]
Mendelian a path to a file created via Mendelian filtering
output_dir path to the output directory
phenotype_path a path to a file with 2 columns group/family and then HPO
VC_Python_directory path to the variant filtering directory
Map_File path to the phenotype_to_genes.txt
family_names a list of family/group names

The bash script:
cd "$VC_Python_directory"

IFS=',' read -ra family_array <<< "$family_names"
for family_name in "${family_array[@]}"; do

    # Concatenate the file path
    file_path="$output_dir/$family_name.txt"
    
    # Echo the family name and file path
    echo "Family Name: ${family_name}"
echo "File Path: ${file_path}"
    
    # Run the Python script with the correct arguments
    python main.py -p "$pedigree_file" --data "$Mendelian" --output "$file_path" --family "$family_name" -ph "$phenotype_path" --mapfile "$Map_File"
done


The error:
Family Name: Sample_1
File Path: /path/to/output_directory/Sample_1.txt
Path/to/variant-filtering/utils.py:77: DtypeWarning: Columns (2) have mixed types. Specify dtype option on import or set low_memory=False.
  phen_to_genes = pd.read_csv(mapfile, sep = '\t', header = None, comment = '#')
Getting relevant genes for family phenotypes...
Traceback (most recent call last):
  File “path/to/variant-filtering/main.py", line 26, in 
    load_phen(families, args.phenfile, args.mapfile)
  File “path/to/variant-filtering/utils.py", line 80, in load_phen
    phen_to_genes.columns = ["HPO-id", "HPO label", "gene-id",
  File “path/to/python3.10/site-packages/pandas/core/generic.py", line 6002, in __setattr__
    return object.__setattr__(self, name, value)
  File "pandas/_libs/properties.pyx", line 69, in pandas._libs.properties.AxisProperty.__set__
  File “/path/to/generic.py", line 730, in _set_axis
    self._mgr.set_axis(axis, labels)
  File “/path/to/managers.py", line 225, in set_axis
    self._validate_set_axis(axis, new_labels)
  File “/path/to/base.py", line 70, in _validate_set_axis
    raise ValueError(
ValueError: Length mismatch: Expected axis has 5 elements, new values have 7 elements

I have checked over the pedigree file and map file and phenotype path files but I am really unsure of how to go about this pipeline as I have never seen this kind of error before. I am not sure I can ask this here but does anyone perchance have an inkling as to what is causing the rather peculiar error?

**Tags:** python, bash, github

---

## 1 answers

### Answer by username_1 on 2023-06-09. Score: 1 | Accepted answer

Apparently the format of the `phenotype_to_genes.txt` File changed, while at the time when this pipeline was published the file consisted of 7 columns, it only has 5 now. That's what the error message tells you. It's best to file an issue at the github repository to get in touch with the authors. 1) so that other potential users are also aware of this issue and 2) the authors might be willing to fix this issue/help you get an updated version of the pipeline or an older version of the phenotype-file.

> **Comments:**
> **username_0**: I was wondering what the original has as I might be able to publish the changes but I doubt I can get in touch with the author again. I think from what I can tell the original ```is 1. HPO-id: 2. HPO label:  3. gene-id: 4. gene-symbol:  5. gene-name:  6. gene-source:  7. disease-source: ```  
> **username_0**: Thank you @Patrick.  

---

