Clinical-Genomics / genmod

Annotate models of genetic inheritance patterns in variant files (vcf files)
http://moonso.github.io/genmod/
MIT License
74 stars 18 forks source link

python3.10: import error #119

Closed jemten closed 9 months ago

jemten commented 9 months ago

It looks like Iterable was removed from the Collections package in python 3.9 and onwards. It would be a good idea to either look down the python version to max 3.8 or update the import statements to import collections.abc as collections.

[2023-11-22 04:52:40,007] INFO    : genmod.commands.annotate_models: Running GENMOD annotate models version 3.8.1
[2023-11-22 04:52:40,007] INFO    : genmod.commands.annotate_models: Found file with genes that have reduced penetrance
[2023-11-22 04:52:40,007] INFO    : genmod.commands.annotate_models: Found 9 genes with reduced penetrance
[2023-11-22 04:52:40,007] INFO    : genmod.commands.annotate_models: Setting up a family parser
[2023-11-22 04:52:40,007] INFO    : genmod.commands.annotate_models: Check if the familys have any affected
[2023-11-22 04:52:40,007] INFO    : genmod.commands.annotate_models: Families used in analysis: justhusky
[2023-11-22 04:52:40,007] INFO    : genmod.commands.annotate_models: Individuals included in analysis: earlycasualcaiman,hugelymodelbat,slowlycivilbuck
[2023-11-22 04:52:41,029] INFO    : genmod.commands.annotate_models: Using Annotation annotation
[2023-11-22 04:52:41,030] INFO    : genmod.commands.annotate_models: Adding genmod version to vcf header
[2023-11-22 04:52:41,030] INFO    : genmod.commands.annotate_models: Adding genetic models to vcf header
[2023-11-22 04:52:41,030] INFO    : genmod.vcf_tools.header_parser: Adding info line to vcf: ##INFO=<ID=GeneticModels,Number=.,Type=String,Description="':'-separated list of genetic models for this variant.">
[2023-11-22 04:52:41,030] INFO    : genmod.commands.annotate_models: Adding model score to vcf header
[2023-11-22 04:52:41,030] INFO    : genmod.vcf_tools.header_parser: Adding info line to vcf: ##INFO=<ID=ModelScore,Number=.,Type=String,Description="PHRED score for genotype models.">
[2023-11-22 04:52:41,030] INFO    : genmod.commands.annotate_models: Adding Compounds to vcf header
[2023-11-22 04:52:41,030] INFO    : genmod.vcf_tools.header_parser: Adding info line to vcf: ##INFO=<ID=Compounds,Number=.,Type=String,Description="List of compound pairs for this variant.The list is splitted on ',' family id is separated with compoundswith ':'. Compounds are separated with '|'.">
[2023-11-22 04:52:41,031] INFO    : genmod.commands.annotate_models: Individuals used in analysis: earlycasualcaiman, hugelymodelbat, slowlycivilbuck
[2023-11-22 04:52:41,195] INFO    : genmod.commands.annotate_models: Number of CPU:s 36
[2023-11-22 04:52:41,195] INFO    : genmod.commands.annotate_models: Number of model checkers: 4
[2023-11-22 04:52:41,195] INFO    : genmod.commands.annotate_models: Seting up the workers
[2023-11-22 04:52:41,196] INFO    : genmod.annotate_models.variant_annotator: Setting up variant_annotator: VariantAnnotator-2
[2023-11-22 04:52:41,196] INFO    : genmod.annotate_models.variant_annotator: Setting up variant_annotator: VariantAnnotator-3
[2023-11-22 04:52:41,196] INFO    : genmod.annotate_models.variant_annotator: Setting up variant_annotator: VariantAnnotator-4
[2023-11-22 04:52:41,196] INFO    : genmod.annotate_models.variant_annotator: Setting up variant_annotator: VariantAnnotator-5
[2023-11-22 04:52:41,196] INFO    : genmod.commands.annotate_models: Starting the workers
[2023-11-22 04:52:41,202] INFO    : genmod.annotate_models.variant_annotator: VariantAnnotator-2: Starting!
[2023-11-22 04:52:41,203] INFO    : genmod.commands.annotate_models: Seting up the variant printer
[2023-11-22 04:52:41,204] INFO    : genmod.annotate_models.variant_annotator: VariantAnnotator-3: Starting!
[2023-11-22 04:52:41,205] INFO    : genmod.commands.annotate_models: Starting the variant printer process
[2023-11-22 04:52:41,206] INFO    : genmod.annotate_models.variant_annotator: VariantAnnotator-5: Starting!
[2023-11-22 04:52:41,206] INFO    : genmod.annotate_models.variant_annotator: VariantAnnotator-4: Starting!
[2023-11-22 04:52:41,207] INFO    : genmod.commands.annotate_models: Start parsing the variants
[2023-11-22 04:52:41,208] INFO    : genmod.utils.get_batches : Start parsing the variants
[2023-11-22 04:52:41,211] INFO    : genmod.utils.variant_printer: VariantPrinter-6: starting
Process VariantAnnotator-4:
Process VariantAnnotator-2:
Traceback (most recent call last):
Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/conda/lib/python3.10/site-packages/genmod/annotate_models/variant_annotator.py", line 133, in run
    check_genetic_models(
  File "/opt/conda/lib/python3.10/site-packages/genmod/annotate_models/genetic_models.py", line 206, in check_genetic_models
    for pair in generate_pairs(compound_candidates):
  File "/opt/conda/lib/python3.10/site-packages/genmod/utils/pair_generator.py", line 25, in generate_pairs
    if not isinstance(objects, collections.Iterable):
  File "/opt/conda/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/conda/lib/python3.10/site-packages/genmod/annotate_models/variant_annotator.py", line 133, in run
    check_genetic_models(
AttributeError: module 'collections' has no attribute 'Iterable'
  File "/opt/conda/lib/python3.10/site-packages/genmod/annotate_models/genetic_models.py", line 206, in check_genetic_models
    for pair in generate_pairs(compound_candidates):
  File "/opt/conda/lib/python3.10/site-packages/genmod/utils/pair_generator.py", line 25, in generate_pairs
    if not isinstance(objects, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'
Process VariantAnnotator-3:
Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/conda/lib/python3.10/site-packages/genmod/annotate_models/variant_annotator.py", line 133, in run
    check_genetic_models(
  File "/opt/conda/lib/python3.10/site-packages/genmod/annotate_models/genetic_models.py", line 206, in check_genetic_models
    for pair in generate_pairs(compound_candidates):
  File "/opt/conda/lib/python3.10/site-packages/genmod/utils/pair_generator.py", line 25, in generate_pairs
    if not isinstance(objects, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'
Process VariantAnnotator-5:
Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/conda/lib/python3.10/site-packages/genmod/annotate_models/variant_annotator.py", line 133, in run
    check_genetic_models(
  File "/opt/conda/lib/python3.10/site-packages/genmod/annotate_models/genetic_models.py", line 206, in check_genetic_models
    for pair in generate_pairs(compound_candidates):
  File "/opt/conda/lib/python3.10/site-packages/genmod/utils/pair_generator.py", line 25, in generate_pairs
    if not isinstance(objects, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'
jemten commented 9 months ago

I can confirm that the issue disappears if the python version is pinned to 3.8