phylophlan icon indicating copy to clipboard operation
phylophlan copied to clipboard

AttributeError: 'NoneType' object has no attribute 'replace'

Open TonyMane opened this issue 3 years ago • 1 comments

greetings, i am running phylophan on an SGE-type server. i believe i have performed the installation correctly, as the below command works:

phylophlan -v
PhyloPhlAn version 3.0.60 (27 November 2020)

i have the below command via qsub.

#First Blast job of MILOCO samples
#PBS -N phylophlan
#PBS -l nodes=1:ppn=20
#PBS -l mem=20gb
#PBS -l walltime=90:00:00
#PBS -q inferno
#PBS -A GT-fstewart7  
#PBS -j oe
#PBS -o /storage/home/hcoda1/7/abertagnolli3/phylophlan.log
#PBS -m abe
#PBS -M [email protected]
phylophlan \
    -i input_isolates \
    -o output_isolates \
    -d s__Staphylococcus_aureus \
    --trim greedy \
    --not_variant_threshold 0.99 \
    --remove_fragmentary_entries \
    --fragmentary_threshold 0.67 \
    --min_num_entries 135 \
    -t a \
    -f isolates_config.cfg \
    --diversity low \
    --force_nucleotides \
    --nproc 4 \
    --verbose 2>&1 | tee logs/phylophlan__output_isolates.log

But the program's log give me this output.

cat logs/phylophlan_setup_database.log 
phylophlan_setup_database.py version 3.0.23 (27 November 2020)

Command line: /storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/rich_project_pb1/miniconda3/bin/phylophlan_setup_database -g s__Staphylococcus_aureus -o /storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/phylophlan/phylophlan/examples/01_saureus/ --verbose

Setting output folder "/storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/phylophlan/phylophlan/examples/01_saureus/s__Staphylococcus_aureus"
Setting db_name to "s__Staphylococcus_aureus"
Arguments: {'input': '/storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/phylophlan/phylophlan/examples/01_saureus/s__Staphylococcus_aureus', 'get_core_proteins': 's__Staphylococcus_aureus', 'database_update': False, 'output': '/storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/phylophlan/phylophlan/examples/01_saureus/s__Staphylococcus_aureus', 'db_name': 's__Staphylococcus_aureus', 'input_extension': '.faa', 'db_type': None, 'output_extension': '.faa', 'overwrite': False, 'verbose': True}
Output "/storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/phylophlan/phylophlan/examples/01_saureus/s__Staphylococcus_aureus" folder present
File "taxa2core.txt" present
Traceback (most recent call last):
  File "/storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/rich_project_pb1/miniconda3/bin/phylophlan_setup_database", line 33, in <module>
    sys.exit(load_entry_point('PhyloPhlAn==3.0.2', 'console_scripts', 'phylophlan_setup_database')())
  File "/storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/rich_project_pb1/miniconda3/lib/python3.8/site-packages/phylophlan/phylophlan_setup_database.py", line 406, in phylophlan_setup_database
    taxa2core_file_latest = database_update(update=args.database_update, verbose=args.verbose)
  File "/storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/rich_project_pb1/miniconda3/lib/python3.8/site-packages/phylophlan/phylophlan_setup_database.py", line 190, in database_update
    taxa2core_file_latest = taxa2core_file_latest.replace('?dl=1', '')
AttributeError: 'NoneType' object has no attribute 'replace'

Either way, kind of stuck, and suggestions are welcome. thanks!

TonyMane avatar Jul 14 '21 07:07 TonyMane

Hi, thanks for reporting this.

So, the first command you posted is not helpful in this case, as that is a phylophlan command, but the error is from the phylophlan_setup_database script. So, I believe the log you have from the phylophlan command should be quite different from the one you posted. From the error log, it seems that the command generating the error is:

/storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/rich_project_pb1/miniconda3/bin/phylophlan_setup_database \
    -g s__Staphylococcus_aureus \
    -o /storage/home/hcoda1/7/abertagnolli3/d-bios-fstewart7/phylophlan/phylophlan/examples/01_saureus/ \
    --verbose

The command seems ok and I tested it to double-check in my system and it is working fine. One thing I can think of is that the taxa2core.txt file was maybe not correctly downloaded. Can you remove it and re-run the phylophlan_setup_database command (so that the file will be downloaded again)?

Many thanks, Francesco

fasnicar avatar Jul 19 '21 11:07 fasnicar