Skip to content

AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'? #371

@mooreld

Description

@mooreld

Hello,

I am using a Linux OS on a University cluster and I am running phyluce/1.7.3-foss-2023a

I am trying to find UCE loci in a single genome using the following code:

#!/bin/bash
#SBATCH --job-name=2bit_scan
#SBATCH --partition=batch
#SBATCH --ntasks=1
#SBATCH --mem=100gb
#SBATCH --time=72:00:00

phyluce_probe_run_multiple_lastzs_sqlite --db CampRap.sqlite --output CampRap-genome-lastz --scaffoldlist CampRap --genome-base-path ./ --probefile hymenoptera-v2-PRINCIPAL-bait.fasta --cores 12

but I keep getting the same error at the end:

AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?

I then followed the tutorial Tutorial III: Harvesting UCE Loci From Genomes using the following code:

#!/bin/bash
#SBATCH --job-name=2bit_scan
#SBATCH --partition=batch
#SBATCH --ntasks=1
#SBATCH --mem=100gb
#SBATCH --time=72:00:00

phyluce_probe_run_multiple_lastzs_sqlite --db tutorial3.sqlite --output tutorial3-genome-lastz --scaffoldlist galGal4 allMis1 --genome-base-path ./ --probefile uce-5k-probes.fasta --cores 12

# I use allMis1 because I downloaded an Alligator mississippiensis genome directly from 'UCSC Genome Browser' rather than NCBI like you do in the tutorial and I believe that should be the only difference between my run and your tutorial.

and I still get the same error.

Here is the full report for the tutorial run:

2025-04-01 13:35:44,506 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - ======= Starting phyluce_probe_run_multiple_lastzs_sqlite =======
2025-04-01 13:35:44,506 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Version: 1.7.3
2025-04-01 13:35:44,506 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Commit: None
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --append: False
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --base_path: ./
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --chromolist: []
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --cores: 12
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --coverage: 83.0
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --db: /scratch/ldm95149/phyluce/uce-genome-tutorial/tutorial3.sqlite
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --identity: 92.5
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --log_path: None
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --no_dir: False
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --output: /scratch/ldm95149/phyluce/uce-genome-tutorial/tutorial3-genome-lastz
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --probefile: /scratch/ldm95149/phyluce/uce-genome-tutorial/uce-5k-probes.fasta
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --scaffoldlist: ['galGal4', 'allMis1']
2025-04-01 13:35:44,507 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Argument --verbosity: INFO
2025-04-01 13:35:44,510 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Checking to ensure all genome sequences exist as 2bit files
2025-04-01 13:35:44,512 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Created species table
2025-04-01 13:35:44,669 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Aligning against galGal4 scaffolds
2025-04-01 13:35:44,704 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Running against galGal4.2bit
2025-04-01 13:35:44,704 - phyluce_probe_run_multiple_lastzs_sqlite - INFO - Running with the --huge option. Chunking files into 10000000 bp...
Traceback (most recent call last):
File "/apps/eb/phyluce/1.7.3-foss-2023a/bin/phyluce_probe_run_multiple_lastzs_sqlite", line 297, in
main()
File "/apps/eb/phyluce/1.7.3-foss-2023a/bin/phyluce_probe_run_multiple_lastzs_sqlite", line 286, in main
align_against_scaffolds(log, cur, args, path)
File "/apps/eb/phyluce/1.7.3-foss-2023a/bin/phyluce_probe_run_multiple_lastzs_sqlite", line 211, in align_against_scaffolds
multi_lastz_runner(
File "/apps/eb/phyluce/1.7.3-foss-2023a/lib/python3.11/site-packages/phyluce/many_lastz.py", line 135, in multi_lastz_runner
chromos = chunk_scaffolds(log, target, size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/apps/eb/phyluce/1.7.3-foss-2023a/lib/python3.11/site-packages/phyluce/many_lastz.py", line 94, in chunk_scaffolds
">{0}\n{1}\n".format(seq.decode("utf-8"), sequence)
^^^^^^^^^^
AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?

In the Traceback, the carets were originally pointing to "chunk_scaffolds(log, target, size)" and "seq.decode".

Is this perhaps an issue with how Phyluce was installed?

I appreciate any help you can offer!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions