labgem / PPanGGOLiN

Build a partitioned pangenome graph from microbial genomes
https://ppanggolin.readthedocs.io
Other
242 stars 29 forks source link

Error from Pyton 3.12 #268

Closed Nilad closed 2 weeks ago

Nilad commented 2 months ago

Same as #253,

....
2024-08-21 11:48:38 makeGraph.py:l88 INFO   Computing the neighbors graph...
Processing O77D5.gff3: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1199/1199 [00:23<00:00, 50.39genome/s]
2024-08-21 11:49:01 makeGraph.py:l109 INFO  Done making the neighbors graph.
2024-08-21 11:49:01 partition.py:l494 INFO  Estimating the optimal number of partitions...
Traceback (most recent call last):
  File "/usr/local/bin/ppanggolin", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/main.py", line 222, in main
    ppanggolin.workflow.all.launch(args)
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/workflow/all.py", line 295, in launch
    launch_workflow(args, panrgp=True, panmodule=True)
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/workflow/all.py", line 125, in launch_workflow
    partition(pangenome,
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/nem/partition.py", line 495, in partition
    kval = evaluate_nb_partitions(organisms, output, sm_degree, free_dispersion, chunk_size, kmm,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/nem/partition.py", line 337, in evaluate_nb_partitions
    select_organisms = set(random.sample(set(organisms), chunk_size))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/random.py", line 413, in sample
    raise TypeError("Population must be a sequence.  "
TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).

Version PPanGGOLiN - 2.1.0

JeanMainguy commented 2 months ago

Hi, Thanks for reporting that. We are going to release a patch version supporting python3.12

JeanMainguy commented 2 months ago

Hi, Support for Python 3.12 is now included in version 2.1.1. Best regards,

Nilad commented 2 months ago

Seem not fixed : @JeanMainguy

...
2024-08-22 15:38:31 writeBinaries.py:l762 INFO  Done writing the pangenome. It is in file : output_ppanggolin/pangenome.h5
2024-08-22 15:38:31 makeGraph.py:l87 INFO   Computing the neighbors graph...
Processing O77D5.gff3: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1199/1199 [00:24<00:00, 48.93genome/s]
2024-08-22 15:38:55 makeGraph.py:l108 INFO  Done making the neighbors graph.
2024-08-22 15:38:55 partition.py:l488 INFO  Estimating the optimal number of partitions...
Traceback (most recent call last):
  File "/usr/local/bin/ppanggolin", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/main.py", line 221, in main
    ppanggolin.workflow.all.launch(args)
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/workflow/all.py", line 294, in launch
    launch_workflow(args, panrgp=True, panmodule=True)
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/workflow/all.py", line 124, in launch_workflow
    partition(pangenome,
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/nem/partition.py", line 489, in partition
    kval = evaluate_nb_partitions(organisms, output, sm_degree, free_dispersion, chunk_size, kmm,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/nem/partition.py", line 324, in evaluate_nb_partitions
    select_organisms = set(random.sample(set(organisms), chunk_size))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/random.py", line 413, in sample
    raise TypeError("Population must be a sequence.  "
TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).
2024-08-22 15:39:38 utils.py:l168 INFO  Command: /usr/local/bin/ppanggolin msa -p output_ppanggolin/pangenome.h5 --phylo --source dna --partition persistent --output output_ppanggolin/msa_persistent
2024-08-22 15:39:38 utils.py:l169 INFO  PPanGGOLiN version: 2.1.1
2024-08-22 15:39:38 utils.py:l770 INFO  4 parameters have a non-default value.
2024-08-22 15:39:38 readBinaries.py:l99 INFO    Getting the current pangenome status
Traceback (most recent call last):
  File "/usr/local/bin/ppanggolin", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/main.py", line 199, in main
    ppanggolin.formats.writeMSA.launch(args)
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/formats/writeMSA.py", line 350, in launch
    write_msa_files(pangenome, args.output, cpu=args.cpu, partition=args.partition, tmpdir=args.tmpdir,
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/formats/writeMSA.py", line 314, in write_msa_files
    check_pangenome_info(pangenome, need_annotations=True, need_families=True, need_partitions=need_partitions,
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/formats/readBinaries.py", line 981, in check_pangenome_info
    need_info = get_need_info(pangenome, need_annotations, need_families, need_graph, need_partitions,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/ppanggolin/formats/readBinaries.py", line 888, in get_need_info
    raise Exception("Your pangenome has not been partitioned. See the 'partition' subcommand")
Exception: Your pangenome has not been partitioned. See the 'partition' subcommand
2024-08-22 15:39:42 utils.py:l168 INFO  Command: /usr/local/bin/ppanggolin msa -p output_ppanggolin/pangenome.h5 --phylo --source dna --partition all --output output_ppanggolin/msa_all
2024-08-22 15:39:42 utils.py:l169 INFO  PPanGGOLiN version: 2.1.1
2024-08-22 15:39:42 utils.py:l770 INFO  4 parameters have a non-default value.

...
JeanMainguy commented 2 months ago

Hi, In deed it is not fixed. I'll work on a fix Thanks for pointing that out

JeanMainguy commented 2 months ago

In the meantime, using a Python version between 3.8 and 3.10 should prevent this error.

JeanMainguy commented 1 month ago

Hi, The fix has been released in version 2.1.2. PPanGGOLIN should now work fine with Python 3.12.