Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
YingziZhang-github opened this issue Apr 18, 2023 · 2 comments

Comments

@YingziZhang-github
Copy link

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
Copy link

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 added a commit that referenced this issue Jul 3, 2023
Properly continuing if there is no data for a requested chromosome in a MetH5 file
@snajder-r
Copy link
Contributor

snajder-r commented Jul 3, 2023

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:

  • Make sure the reference fasta file is the same one as you used when producing the methylation data (chromosomes are spelled the same)
  • If possible, it's recommended you provide a bed file with regions you want to check differential methylation for (use the -aparameter). If you don't, MethComp will perform windowed testing on all chromosomes.
  • If you really want to do the windowed testing, as a workaround you could remove all chromosomes from the fasta file which you don't have methylation data for.

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

snajder-r added a commit that referenced this issue Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants