scenicplus icon indicating copy to clipboard operation
scenicplus copied to clipboard

pycisTopic.iterative_peak_calling: IndexError: list index out of range

Open hshcao opened this issue 9 months ago • 0 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce

from pycisTopic.iterative_peak_calling import get_consensus_peaks

Other param

peak_half_width=250 path_to_blacklist="pycisTopic/blacklist/hg38-blacklist.v2.bed"

Get consensus peaks

consensus_peaks = get_consensus_peaks( narrow_peaks_dict = narrow_peak_dict, peak_half_width = peak_half_width, chromsizes = chromsizes, path_to_blacklist = path_to_blacklist)

Error output

2024-05-06 23:30:20,024 cisTopic INFO Extending and merging peaks per class { "name": "IndexError", "message": "list index out of range", "stack": "--------------------------------------------------------------------------- IndexError Traceback (most recent call last) Cell In[29], line 6 4 path_to_blacklist='data/hg38-blacklist.v2.bed' 5 # Get consensus peaks ----> 6 consensus_peaks = get_consensus_peaks( 7 narrow_peaks_dict = narrow_peak_dict, 8 peak_half_width = peak_half_width, 9 chromsizes = chromsizes, 10 path_to_blacklist = path_to_blacklist)

File ~/anaconda3/envs/scenicplus/lib/python3.11/site-packages/pycisTopic/iterative_peak_calling.py:66, in get_consensus_peaks(narrow_peaks_dict, peak_half_width, chromsizes, path_to_blacklist) 63 chromsizes = pr.PyRanges(chromsizes) 65 log.info("Extending and merging peaks per class") ---> 66 center_extended_peaks = [ 67 iterative_peak_filtering( 68 calculate_peaks_and_extend( 69 narrow_peaks_dict[x], peak_half_width, chromsizes, path_to_blacklist 70 ) 71 ).df 72 for x in list(narrow_peaks_dict.keys()) 73 ] 74 log.info("Normalizing peak scores") 75 center_extended_peaks_norm = [cpm(x, "Score") for x in center_extended_peaks]

File ~/anaconda3/envs/scenicplus/lib/python3.11/site-packages/pycisTopic/iterative_peak_calling.py:68, in (.0) 63 chromsizes = pr.PyRanges(chromsizes) 65 log.info("Extending and merging peaks per class") 66 center_extended_peaks = [ 67 iterative_peak_filtering( ---> 68 calculate_peaks_and_extend( 69 narrow_peaks_dict[x], peak_half_width, chromsizes, path_to_blacklist 70 ) 71 ).df 72 for x in list(narrow_peaks_dict.keys()) 73 ] 74 log.info("Normalizing peak scores") 75 center_extended_peaks_norm = [cpm(x, "Score") for x in center_extended_peaks]

File ~/anaconda3/envs/scenicplus/lib/python3.11/site-packages/pycisTopic/iterative_peak_calling.py:144, in calculate_peaks_and_extend(narrow_peaks, peak_half_width, chromsizes, path_to_blacklist) 140 center_extended_peaks = center_extended_peaks.intersect( 141 chromsizes, how="containment" 142 ) 143 if isinstance(path_to_blacklist, str): --> 144 blacklist = pr.read_bed(path_to_blacklist) 145 center_extended_peaks = center_extended_peaks.overlap(blacklist, invert=True) 146 return center_extended_peaks

File ~/anaconda3/envs/scenicplus/lib/python3.11/site-packages/pyranges/readers.py:79, in read_bed(f, as_df, nrows) 77 first_start = gzip.open(f).readline().split()[1] 78 else: ---> 79 first_start = open(f).readline().split()[1] 81 header = None 83 try:

IndexError: list index out of range" }

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):

  • Python: [e.g. Python 3.11]
  • SCENIC+: [e.g. 0.1.dev40+g4ff5053.d20210520] Screenshot 2024-05-06 at 11 34 02 PM

Additional context Add any other context about the problem here.

hshcao avatar May 06 '24 15:05 hshcao