PMBio / pycoMeth

DNA methylation analysis downstream to Nanopolish for Oxford Nanopore DNA sequencing datasets
https://pmbio.github.io/pycoMeth/
GNU General Public License v3.0
27 stars 3 forks source link

AttributeError: 'NoneType' object has no attribute 'get_values_in_range' #4

Open YingziZhang-github opened 1 year ago

YingziZhang-github commented 1 year ago

Dear pycoMeth developer(s),

I am trying using pycometh Meth_Comp to do methylation differential analysis. My command was pycometh Meth_Comp -i 1.m5 2.m5 3.m5 4.m5 5.m5 -f reference.fa -b output.bed.

It reported error as the following:

Cannot import dependencies required for static image export
## Checking options and input files ##
## Opening H5 files ##
    Starting asynchronous file parsing
    Launching 4 worker processes
Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

CRITICAL: Error in worker thread
Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'
Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

CRITICAL: Error in worker thread
Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'
CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'
Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

CRITICAL: Error in worker thread
Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'
CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'

Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

CRITICAL: Error in worker thread
CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'
CRITICAL: Error in worker thread
CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'
CRITICAL: Error in worker thread
CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'
CRITICAL: Error in worker thread
    No valid p-Value could be computed
CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'
    Results summary
CRITICAL: Error in worker thread
CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'
CRITICAL: Error in worker thread
Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/Meth_Comp.py", line 289, in __call__
    label_list, raw_llr_list, raw_pos_list, raw_read_list = self.loader.read_raw_llrs(interval)
  File "/home/zhany0s/miniconda3/lib/python3.8/site-packages/pycoMeth/loader.py", line 52, in read_raw_llrs
    interval_container = chrom_container.get_values_in_range(interval.start, interval.end)
AttributeError: 'NoneType' object has no attribute 'get_values_in_range'

CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'
CRITICAL: Error in worker thread
CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'
CRITICAL: Error in worker thread
CRITICAL: 'NoneType' object has no attribute 'get_values_in_range'
Exception ignored in: <function Pool.__del__ at 0x2b1a490240d0>
Traceback (most recent call last):
  File "/home/zhany0s/miniconda3/lib/python3.8/multiprocessing/pool.py", line 268, in __del__
    self._change_notifier.put(None)
  File "/home/zhany0s/miniconda3/lib/python3.8/multiprocessing/queues.py", line 368, in put
    self._writer.send_bytes(obj)
  File "/home/zhany0s/miniconda3/lib/python3.8/multiprocessing/connection.py", line 200, in send_bytes
    self._send_bytes(m[offset:offset + size])
  File "/home/zhany0s/miniconda3/lib/python3.8/multiprocessing/connection.py", line 411, in _send_bytes
    self._send(header + buf)
  File "/home/zhany0s/miniconda3/lib/python3.8/multiprocessing/connection.py", line 368, in _send
    n = write(self._handle, buf)
OSError: [Errno 9] Bad file descriptor

I thought it was because of no valid p-values can be used, so I adjusted --pvalue_threshold but it seemed not help. Would you please let me know what should I do to get it work?

Thank you very much in advance.

Yingzi

ZabalaAitor commented 1 year ago

Hi,

I have the same issue also, and I think I can not do the html report because of that. Did you succeed in solving the problem?

Aitor Zabala

snajder-r commented 1 year ago

Apologies for the late response. I hadn't noticed that GitHub wasn't set up to send me notifications for issues, so this issue remained unseen for far too long.

This is appears to be a bug with pycoMeth handling requests to compare on chromosomes for which there is no data in any one of the MetH5 files. I have just pushed a fix into the dev branch.

Until a new release can be published, a workaround would be to make sure you only run MethComp for chromosomes for which your M5 files actually have methylation data. Use meth5 list_chunks -i INPUT_FILE.m5 to check what chromosomes are actually in your MetH5 files. Then:

Hope this helps. I'll keep this open until the fix is in a release.