metaGmetapop / metapop

A pipeline for the macro- and micro-diversity analyses and visualization of metagenomic-derived populations
MIT License
38 stars 10 forks source link

error in breadth_and_depth_output function from metapop_filter.py #26

Open beacamara opened 1 year ago

beacamara commented 1 year ago

Hi everyone,

I have run metapop y I obtained this error:

####################################################### Getting breadth and depth of coverage for: TS_sept_cat.fa starting at: 01/06/2023 10:02:16 Filtering by genome for: TS_sept_cat.fa starting at: 01/06/2023 10:02:16 Completed preprocessing for: TS_sept_cat.fa at: 01/06/2023 10:02:16 multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/emm4/anaconda3/envs/metapop/lib/python3.7/multiprocessing/pool.py", line 121, in worker result = (True, func(*args, *kwds)) File "/home/emm4/anaconda3/envs/metapop/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar return list(map(args)) File "/home/emm4/anaconda3/envs/metapop/lib/python3.7/site-packages/metapop/metapop_filter.py", line 292, in parse_reads breadth_and_depth_output(current_depths, contig_length_dict[contig], contig, truncation, breadth_and_depth_fh) UnboundLocalError: local variable 'contig' referenced before assignment """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/emm4/anaconda3/envs/metapop/bin/metapop", line 8, in sys.exit(main()) File "/home/emm4/anaconda3/envs/metapop/lib/python3.7/site-packages/metapop/metapop_main.py", line 297, in main metapop.metapop_filter.filt(original_bams, filter_command_base, bdb, threads, mag_contig_dict, mag_length_dict, joined_fastas) File "/home/emm4/anaconda3/envs/metapop/lib/python3.7/site-packages/metapop/metapop_filter.py", line 167, in filt p.map(parse_reads, commands) File "/home/emm4/anaconda3/envs/metapop/lib/python3.7/multiprocessing/pool.py", line 268, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/home/emm4/anaconda3/envs/metapop/lib/python3.7/multiprocessing/pool.py", line 657, in get raise self._value UnboundLocalError: local variable 'contig' referenced before assignment

#############################################

I have realized that the function breadth_and_depth_output in metapop_filter.py script (line 292) is calling for the "contig" argument outside the for loop where this parameter is defined. Enclosed you will find a screenshot Captura de pantalla de 2023-06-01 11-45-41

Maybe removing line 292

bayknight commented 1 year ago

HI @beacamara , Im getting the same issue with the test data. Were you able to resolve this?