# \[e\] gene\_markers\_selection crashed (SOLUTION)

**URL:** <https://forum.biobakery.org/t/e-gene-markers-selection-crashed-solution/7481>\
**Category:** PhyloPhlAn\
**Created:** [October 7, 2024, 7:11pm UTC](https://forum.biobakery.org/t/e-gene-markers-selection-crashed-solution/7481 "2024-10-07T19:11:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![baldeguer-riquelme](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/baldeguer-riquelme/32/3032_2.png) [@baldeguer-riquelme](https://forum.biobakery.org/u/baldeguer-riquelme)\
**Post date:** [October 7, 2024, 7:11pm UTC](https://forum.biobakery.org/t/e-gene-markers-selection-crashed-solution/7481/1 "2024-10-07T19:11:54Z")

</div>

Hi,

Thank you for developing this great tool!

I was running PhyloPhlAn version 3.1.68 to create a phylogenomic tree using the command:

```auto
phylophlan -i Protein_files/ -o Phylogenomic_tree/ -f supermatrix_aa.cfg --diversity high --fast --nproc 8 -d phylophlan --proteome_extension .faa --verbose

```

However, I got the following error:

```auto
Selecting "phylophlan_test/tmp/map_aa/0BWT1.b6o.bkp"

[e] expected str, bytes or os.PathLike object, not NoneType

[e] gene_markers_selection crashed

```

After rerunning the command above using 1 thread I was able to identify the specific \*.b6o.bkp files that originated the error. I realized that these files were corrupted, the last line of the diamond output table was incomplete. Rows in these files are supposed to be 12 columns wide but in these files, the last row had a smaller number (e.g, 1,2,3 or 9 columns). Apparently, when aligning the genome protein files to the markers, the process stopped before writing to the whole output. Such files cannot be processed by the “best\_hit” function (line 1337 of the phylophlan.py script) since it relies on column position to identify each variable, causing the error.

I removed only those corrupted files and reran the phylophlan command and the alignment was done correctly this time. So, it seems a random, non reproducible error (may be a problem of the multiprocessing module?). However, it seems to be a recurring problem that several users have reported before:

> <https://github.com/biobakery/phylophlan/issues/27#issue-635933181>
>
> \`\[e\] expected str, bytes or os.PathLike object, not NoneType\`
> 
> \`\[e\] gene\_marke…rs\_selection crashed\`
> \`output\_tree/tmp/map\_dna/JIAJIAN16\_Bin\_002.LargeContigs.b6o.bz2" generated in 1s\`
> 
> What does the following error mean? I used the following command.
> 
> \`phylophlan -i input\_genomes -d phylophlan -f /mnt/home/gunturus/phylophlan/supermatrix\_aa.cfg --diversity high --fast -o output\_tree --nproc 20 --verbose\`

> <https://github.com/biobakery/phylophlan/issues/61#issue-877379286>
>
> Hi, 
> I have downloaded Phylophlan version 3.0.60 via conda and following exampl…e 1 (S.aureus) tutorial on github. 
> 
> This is the command I am using: 
> \` phylophlan -i input\_genomes -d phylophlan --diversity medium -f isolates\_config.cfg --verbose\`
> 
> This is the error message I am getting: 
> \`\`\`
> PhyloPhlAn version 3.0.60 (27 November 2020)
> 
> Command line: /opt/miniconda3/bin/phylophlan -i input\_genomes -d phylophlan --diversity medium -f isolates\_config.cfg --verbose
> 
> Automatically setting "input=input\_genomes" and "input\_folder=/home/ubuntu"
> "medium-accurate" preset
> Setting "sort=True" because "database=phylophlan"
> Setting "min\_num\_markers=100" since no value has been specified and the "database=phylophlan"
> Arguments: {'input': 'input\_genomes', 'clean': None, 'output': 'input\_genomes\_phylophlan', 'database': 'phylophlan', 'db\_type': None, 'config\_file': 'isolates\_config.cfg', 'diversity': 'medium', 'accurate': True, 'fast': False, 'clean\_all': False, 'database\_list': False, 'submat': 'pfasum60', 'submat\_list': False, 'submod\_list': False, 'nproc': 1, 'min\_num\_proteins': 1, 'min\_len\_protein': 50, 'min\_num\_markers': 100, 'trim': 'gap\_trim', 'gap\_perc\_threshold': 0.67, 'not\_variant\_threshold': 0.99, 'subsample': \<function onehundred at 0x7f03d9380680\>, 'unknown\_fraction': 0.3, 'scoring\_function': \<function trident at 0x7f03d93809e0\>, 'sort': True, 'remove\_fragmentary\_entries': False, 'fragmentary\_threshold': 0.85, 'min\_num\_entries': 4, 'maas': None, 'remove\_only\_gaps\_entries': False, 'mutation\_rates': False, 'force\_nucleotides': False, 'input\_folder': '/home/ubuntu/input\_genomes', 'data\_folder': 'input\_genomes\_phylophlan/tmp', 'databases\_folder': 'phylophlan\_databases/', 'submat\_folder': '/opt/miniconda3/lib/python3.7/site-packages/phylophlan/phylophlan\_substitution\_matrices/', 'submod\_folder': '/opt/miniconda3/lib/python3.7/site-packages/phylophlan/phylophlan\_substitution\_models/', 'configs\_folder': '/opt/miniconda3/lib/python3.7/site-packages/phylophlan/phylophlan\_configs/', 'output\_folder': '', 'genome\_extension': '.fna', 'proteome\_extension': '.faa', 'update': False, 'verbose': True}
> Loading configuration file "isolates\_config.cfg"
> Checking configuration file
> Checking "/opt/miniconda3/bin/diamond"
> Checking "/opt/miniconda3/bin/mafft"
> Checking "/opt/miniconda3/bin/trimal"
> Checking "/opt/miniconda3/bin/FastTreeMP"
> Checking "/opt/miniconda3/bin/raxmlHPC-PTHREADS-SSE3"
> "db\_aa" database "phylophlan\_databases/phylophlan/phylophlan.dmnd" present
> Loading files from "/home/ubuntu/input\_genomes"
> Inputs already cleaned
> Loading files from "input\_genomes\_phylophlan/tmp/clean\_dna"
> "phylophlan" markers already mapped (key: "map\_dna")
> Selecting 84 markers from "input\_genomes\_phylophlan/tmp/map\_dna"
> Selecting "input\_genomes\_phylophlan/tmp/map\_dna/1007-1-F#8.b6o.bkp"
> 
> \[e\] expected str, bytes or os.PathLike object, not NoneType
> 
> \[e\] gene\_markers\_selection crashed
> \`\`\`
> Any help would be appreciated.

> <https://github.com/biobakery/phylophlan/issues/115#issue-1903690692>
>
> I just had my phylophlan run crash after 5 days and would appreciate any help.
> …
> I'm running version 3.0.2 installed via conda. I am trying to run phylophlan on a collection of bacterial isolate genomes. It looks like it successfully mapped most of the input genomes, but failed with a few of them and then marker gene identification failed.
> 
> 
> Here are my output and error files from slurm and my phylophlan config file:
> \[phylophlan.515596.err.txt\](https://github.com/biobakery/phylophlan/files/12666092/phylophlan.515596.err.txt)
> \[phylophlan.515596.out.txt\](https://github.com/biobakery/phylophlan/files/12666093/phylophlan.515596.out.txt)
> \[alaskan\_config.txt\](https://github.com/biobakery/phylophlan/files/12666184/alaskan\_config.txt)
> 
> If there's any help you can offer, I'd greatly appreciate it.

It would be very useful if you could add a few lines of code to check file integrity before proceeding to marker selection and, in the case that the last row of the file does not have 12 columns, rerun the alignment. I think it would fit in the “gene\_markers\_identification\_rec” function (line 1246 of the phylophlan.py script).

As a temporary workaround I would suggest users facing the same error use this line of code to identify corrupted \*.b6o.bkp:

```auto
out=Phylogenomic_tree/ # Set the phylophlan output folder
for i in $(ls $out/tmp/map_aa/*.bkp); do ncol=$(tail -n 1 $i | awk '{print NF}'); if (( $ncol < 12 )) ; then echo $i $ncol; fi; done

```

It will print to screen the files with less than 12 columns in the last row that should be removed before rerunning phylophlan.

Hope it helps!

Borja
