nboley / idr

IDR
GNU General Public License v2.0
164 stars 45 forks source link

TypeError: unorderable types: NoneType() < int() #27

Open shawnzhangyx opened 7 years ago

shawnzhangyx commented 7 years ago

I ran IDR on the list of peaks where some of the summit values are -1, and I got the following error:

File "/mnt/silencer2/home/yanxiazh/.local/lib/python3.4/site-packages/idr-2.0.3-py3.4-linu x-x86_64.egg/idr/idr.py", line 222, in merge_peaks_in_contig all_intervals.sort() TypeError: unorderable types: NoneType() < int()

It looks like the error is because "-1" is converted to None when the files were loaded. And sorting values containing "None" will result in an error in Python3. Is there a way to fix this error?

-Yanxiao

hardigan commented 6 years ago

Hi, Yanxiao et al.

Did you every come across a solution for this problem? I am experiencing the same thing when running idr.py either as a standalone module or through the ENCODE ATAC-Seq pipeline (atac.bds):

Traceback (most recent call last):
  File "/gpfs/gpfs1/home/miniconda3/envs/bds_atac_py3/bin/idr", line 4, in <module>
    __import__('pkg_resources').run_script('idr==2.0.3', 'idr')
  File "/gpfs/gpfs1/home/miniconda3/envs/bds_atac_py3/lib/python3.5/site-packages/pkg_resources/__init__.py", line 748, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/gpfs/gpfs1/home/miniconda3/envs/bds_atac_py3/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1517, in run_script
    exec(code, namespace, namespace)
  File "/gpfs/gpfs1/home/miniconda3/envs/bds_atac_py3/lib/python3.5/site-packages/idr-2.0.3-py3.5-linux-x86_64.egg/EGG-INFO/scripts/idr", line 10, in <module>
    idr.idr.main()
  File "/gpfs/gpfs1/home/miniconda3/envs/bds_atac_py3/lib/python3.5/site-packages/idr-2.0.3-py3.5-linux-x86_64.egg/idr/idr.py", line 840, in main
    merged_peaks, signal_type = load_samples(args)
  File "/gpfs/gpfs1/home/miniconda3/envs/bds_atac_py3/lib/python3.5/site-packages/idr-2.0.3-py3.5-linux-x86_64.egg/idr/idr.py", line 760, in load_samples
    oracle_pks, args.use_nonoverlapping_peaks)
  File "/gpfs/gpfs1/home/miniconda3/envs/bds_atac_py3/lib/python3.5/site-packages/idr-2.0.3-py3.5-linux-x86_64.egg/idr/idr.py", line 281, in merge_peaks
    use_nonoverlapping_peaks=use_nonoverlapping_peaks)
  File "/gpfs/gpfs1/home/miniconda3/envs/bds_atac_py3/lib/python3.5/site-packages/idr-2.0.3-py3.5-linux-x86_64.egg/idr/idr.py", line 223, in merge_peaks_in_contig
    all_intervals.sort()
TypeError: unorderable types: int() < NoneType()

I tried printing out the all_intervals[] array and can find instances of lines that look like this:

(Peak(chrm='chr1', strand='.', start=176983596, stop=176983716, signal=2.66479, summit=None, signalValue=2.65491, pValue=2.66479, qValue=0.72361), 0),

I too have found that there are "-1" summit values called by MACS2 that are being converted to "None" when run through idr.py, which apparently is causing the all_intervals.sort() function to not work, (presumably its sorting based on windows around summit values?)

I suppose this may be a MACS2 callpeak error and not idr related, per se, but was wondering if you had a work around or identified a cause of these -1 summit values.

Considering just removing these peak rows as "Fails" before running Idr....

shawnzhangyx commented 6 years ago

@hardigan Sorry I don't...I did not get any response here and just gave up on it. I guess if you remove or convert the -1 summit values, it will bypass that problem, but I don't know how this might change the outcome.