Skip to content

A bug and a runtime error. #43

@Yichen-HNU

Description

@Yichen-HNU

Thank you for providing the tool!

However, I encountered the following issues during execution:

In command_line.py, there is an undefined output_file, and I suspect that the author intended to provide an output path but did not add it to args.

profile_path = os.path.join(os.path.dirname(args.output_file), args.profile_name)
Therefore, I added the following:

ADD

parser.add_argument('-o', '--output-file', dest='output_file', metavar='OUTPUT',
help='Output Hi-C reads file (either interleaved or R1/R2)', required=True)
I hope this modification will not cause errors later.

However, when I run the command:

sim3C --dist uniform -n 100000 -l 150 -m hic -e NlaIII ref.split_50000_0.1_hap1.fa hic_reads_hap1_R1.fastq hic_reads_hap2_R2.fastq -o test
I get the following error:

ERROR | 2024-11-08 07:29:13,390 | main | OrderedDict mutated during iteration
Traceback (most recent call last):
File "/home/lyc/.local/lib/python3.11/site-packages/sim3C/command_line.py", line 256, in main
strategy = SequencingStrategy(args.profile_in, args.genome_seq, args.enzyme,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lyc/.local/lib/python3.11/site-packages/sim3C/simulator.py", line 345, in init
self.community = Community.from_profile(seq_index, profile_filename, self.enzymes,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lyc/.local/lib/python3.11/site-packages/sim3C/community.py", line 796, in from_profile
community._init_community()
File "/home/lyc/.local/lib/python3.11/site-packages/sim3C/community.py", line 804, in _init_community
for cell in self.cell_registry.values():
RuntimeError: OrderedDict mutated during iteration
What is the cause of this error?

The error is related to modifying an OrderedDict while it is being iterated over. During the iteration, an attempt is made to change the dictionary, which leads to the RuntimeError. This can happen if there are operations like adding, removing, or modifying dictionary entries while iterating over it.

To resolve this, you should avoid modifying the OrderedDict during the iteration process, or iterate over a copy of the dictionary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions