nboley / idr

IDR
GNU General Public License v2.0
168 stars 46 forks source link

--use-nonoverlapping-peaks argument never used #36

Open haoyangz opened 6 years ago

haoyangz commented 6 years ago

It seems that the argument --use-nonoverlapping-peaks is never used. Instead, the code checks for an argument "--use_nonoverlapping_peaks". When I corrected this and ran it on two replicates where there are non-overlapping peaks, I got the following error:

Traceback (most recent call last):
  File "/cluster/zeng/code/research/software/miniconda/envs/idr/bin/idr", line 4, in <module>
    __import__('pkg_resources').run_script('idr==2.0.3', 'idr')
  File "/cluster/zeng/code/research/software/miniconda/envs/idr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 750, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/cluster/zeng/code/research/software/miniconda/envs/idr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1527, in run_script
    exec(code, namespace, namespace)
  File "/cluster/zeng/code/research/software/miniconda/envs/idr/lib/python3.6/site-packages/idr-2.0.3-py3.6-linux-x86_64.egg/EGG-INFO/scripts/idr", line 10, in <module>
    idr.idr.main()
  File "/cluster/zeng/code/research/software/miniconda/envs/idr/lib/python3.6/site-packages/idr-2.0.3-py3.6-linux-x86_64.egg/idr/idr.py", line 876, in main
    useBackwardsCompatibleOutput=args.use_old_output_format)
  File "/cluster/zeng/code/research/software/miniconda/envs/idr/lib/python3.6/site-packages/idr-2.0.3-py3.6-linux-x86_64.egg/idr/idr.py", line 482, in write_results_to_file
    merged_peak, IDR, localIDR, output_file_type, signal_type)
  File "/cluster/zeng/code/research/software/miniconda/envs/idr/lib/python3.6/site-packages/idr-2.0.3-py3.6-linux-x86_64.egg/idr/idr.py", line 343, in build_idr_output_line_with_bed6
    rv.append( "%i" % min(x.start for x in m_pk.pks[key]))
ValueError: min() arg is an empty sequence

Maybe this functionality hasn't been tested thoroughly due to the mismatched naming? Could you advise?

yingzhang121 commented 1 year ago

I got the same error. So I checked the code, and it turns out the error is caused by an empty list. However, empty list in python doesn't mean "None", so this condition is always false. To fix the problem, I manually modified the code at line 336 to be if m_pk.pks[key] is None or not m_pk.pks[key].