aertslab / pycisTopic

pycisTopic is a Python module to simultaneously identify cell states and cis-regulatory topics from single cell epigenomics data.
Other
56 stars 11 forks source link

get_consensus_peaks: 'PyRanges object has no attribute', 'Count' Bug report [BUG] #19

Closed IrinaMate closed 3 years ago

IrinaMate commented 3 years ago

Describe the bug

AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_20438/870027147.py in <module>
      4 path_to_blacklist='/staging/leuven/stg_00002/lcb/cbravo/Multiomics_pipeline/pycisTopic/blacklist/mm10-blacklist.v2.bed'
      5 # Get consensus peaks
----> 6 consensus_peaks=get_consensus_peaks(narrow_peaks_dict, peak_half_width, chromsizes=chromsizes, path_to_blacklist=path_to_blacklist)

/opt/venv/lib/python3.8/site-packages/pycisTopic/iterative_peak_calling.py in get_consensus_peaks(narrow_peaks_dict, peak_half_width, chromsizes, path_to_blacklist)
     60 
     61     log.info('Extending and merging peaks per class')
---> 62     center_extended_peaks = [
     63         iterative_peak_filtering(
     64             calculate_peaks_and_extend(

/opt/venv/lib/python3.8/site-packages/pycisTopic/iterative_peak_calling.py in <listcomp>(.0)
     61     log.info('Extending and merging peaks per class')
     62     center_extended_peaks = [
---> 63         iterative_peak_filtering(
     64             calculate_peaks_and_extend(
     65                 narrow_peaks_dict[x],

/opt/venv/lib/python3.8/site-packages/pycisTopic/iterative_peak_calling.py in iterative_peak_filtering(center_extended_peaks)
    188     # equal to 2
    189     center_extended_peaks_with_2_counts = center_extended_peaks_merged[
--> 190         center_extended_peaks_merged.Count == 2
    191     ]
    192     if len(center_extended_peaks_with_2_counts) > 0:

/opt/venv/lib/python3.8/site-packages/pyranges/pyranges.py in __getattr__(self, name)
    268         from pyranges.methods.attr import _getattr
    269 
--> 270         return _getattr(self, name)
    271 
    272     def __setattr__(self, column_name, column):

/opt/venv/lib/python3.8/site-packages/pyranges/methods/attr.py in _getattr(self, name)
     65         return pd.concat([df[name] for df in self.values()])
     66     else:
---> 67         raise AttributeError("PyRanges object has no attribute", name)

AttributeError: ('PyRanges object has no attribute', 'Count')

To Reproduce

from pycisTopic.iterative_peak_calling import *
# Other param
peak_half_width=250
path_to_blacklist='/staging/leuven/stg_00002/lcb/cbravo/Multiomics_pipeline/pycisTopic/blacklist/mm10-blacklist.v2.bed'
# Get consensus peaks
consensus_peaks=get_consensus_peaks(narrow_peaks_dict, peak_half_width, chromsizes=chromsizes, path_to_blacklist=path_to_blacklist)

Error output Paste the entire output of the command, including log information prior to the error.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem or show the format of the input data for the command/s.

Version (please complete the following information):

Additional context Add any other context about the problem here.

cbravo93 commented 3 years ago

Hi Irina!

The bug is solved in the last push. This happened if none of your summits overlap from the beginning, usually happens if you have a very small number of peaks per pseudobulk (if they come from small clusters).

Thanks for reporting!

C