ctlab / parallel-rearrangements

parallel rearrangements caller
MIT License
4 stars 2 forks source link

error after install with bioconda #7

Open fwhelan opened 3 months ago

fwhelan commented 3 months ago

Hi oxygen311,

I've installed parebricks with conda install -c conda-forge -c bioconda PaReBrick. When I try to run the provided example code, I get the following error; any thoughts (e.g. is there a required version of bg)?

$ parebrick -t tree.nwk -b maf2synteny-output -l labels.csv                                                                                                                                                          

[2024-07-29 14:35:36,071] INFO - <Running module: Preprocess Data>                                                                                                    
--------------------------------------------------------------------------------                                                                                      
[2024-07-29 14:35:36,135] INFO - Converting block coords to infercars format                                                                                          
--------------------------------------------------------------------------------                                                                                      
[2024-07-29 14:35:36,885] INFO - <Module finished: Preprocess Data>, elapsed 0.8142709732055664 seconds                                                               

[2024-07-29 14:35:36,885] INFO - <Running module: Parsers and check strains>                                                                                          
--------------------------------------------------------------------------------                                                                                      
[2024-07-29 14:35:37,644] INFO - Blocks count: 217                                                                                                                    
[2024-07-29 14:35:37,645] INFO - Unique one-copy blocks count: 125                                                                                                    
[2024-07-29 14:35:37,660] INFO - Mean block coverage: 77.40723362525112 %                                                                                             
[2024-07-29 14:35:37,674] INFO - Mean common one-copy blocks coverage: 68.25079478567572 %                                                                            
[2024-07-29 14:35:37,688] INFO - Mean 80 % rate one-copy blocks coverage: 71.16868232101604 %                                                                         
[2024-07-29 14:35:37,742] INFO - Strains in blocks file count: 219                                                                                                    
[2024-07-29 14:35:37,742] INFO - Strains in tree leafs count: 219                                                                                                     
[2024-07-29 14:35:37,742] INFO - Intersected strains count: 219                                                                                                       
--------------------------------------------------------------------------------                                                                                      
[2024-07-29 14:35:37,742] INFO - <Module finished: Parsers and check strains>, elapsed 0.8569958209991455 seconds                                                     

[2024-07-29 14:35:37,742] INFO - <Running module: Balanced rearrangements characters>                                                                                 
--------------------------------------------------------------------------------                                                                                      
Traceback (most recent call last):                                                                                                                                    
  File "/opt/miniconda3/envs/intel_env/bin/parebrick", line 10, in <module>                                                                                           
    sys.exit(main())                                                                                                                                                  
             ^^^^^^                                                                                                                                                   
  File "/opt/miniconda3/envs/intel_env/lib/python3.12/site-packages/parebrick/main.py", line 428, in main                                                             
    balanced_rearrangements_characters()                                                                                                                              
  File "/opt/miniconda3/envs/intel_env/lib/python3.12/site-packages/parebrick/utils/decorators.py", line 13, in wrapper                                               
    return_value = func(*args, **kwargs)                                                                                                                              
                   ^^^^^^^^^^^^^^^^^^^^^                                                                                                                              
  File "/opt/miniconda3/envs/intel_env/lib/python3.12/site-packages/parebrick/main.py", line 209, in balanced_rearrangements_characters                               
    b_characters = get_characters_balanced(preprocessed_data_folder + UNIQUE_GRIMM_FILENAME, genomes, logger)                                                         
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/intel_env/lib/python3.12/site-packages/parebrick/characters/balanced.py", line 73, in get_characters_balanced
    bg = GRIMMReader.get_breakpoint_graph(open(grimm_file))
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/intel_env/lib/python3.12/site-packages/bg/grimm.py", line 310, in get_breakpoint_graph
    edge.update_data(source=edge_specific_data)
  File "/opt/miniconda3/envs/intel_env/lib/python3.12/site-packages/bg/edge.py", line 190, in update_data
    recursive_dict_update(self.data, source)
  File "/opt/miniconda3/envs/intel_env/lib/python3.12/site-packages/bg/utils.py", line 20, in recursive_dict_update
    if isinstance(value, collections.Mapping) and isinstance(dict1_entry, collections.Mapping):
                         ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Mapping'
oxygen311 commented 3 months ago

Hi @fwhelan!

Sorry for the late response.

One of PaReBrick dependencies (bg) works only with python <= 3.8. I don't see a quick fix to support a newer version and can only suggest using it with a separate conda python 3.8 environment.

You can try:

Step 1: Create the Conda Environment

First, you'll need to create a new Conda environment with Python 3.8.

conda create -n parebrick_env python=3.8

This command creates a new environment named parebrick_env with Python 3.8 installed.

Step 2: Activate the Environment

Activate the newly created environment.

conda activate parebrick_env

Step 3: Install PaReBrick

Now that your environment is active, install the PaReBrick package using conda or pip.

pip install PaReBrick

or

conda install -c conda-forge -c bioconda PaReBrick

Step 4: Deactivate the Environment (Optional)

When you're done working, you can deactivate the environment by running:

conda deactivate