aertslab / pycisTopic

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

peak_calling: if there are no peaks, there is simply an error [BUG] #56

Open alexlenail opened 1 year ago

alexlenail commented 1 year ago
Traceback (most recent call last):
  File "/var/spool/slurmd/job21252148/slurm_script", line 97, in call_peaks_f
    narrow_peaks_dict = peak_calling(macs_path,
  File "pycisTopic/pseudobulk_peak_calling.py", line 434, in peak_calling
    narrow_peaks = [macs_call_peak(
  File "pycisTopic/pseudobulk_peak_calling.py", line 434, in <listcomp>
    narrow_peaks = [macs_call_peak(
  File "pycisTopic/pseudobulk_peak_calling.py", line 511, in macs_call_peak
    MACS_peak_calling = MACSCallPeak(
  File "pycisTopic/pseudobulk_peak_calling.py", line 657, in __init__
    self.call_peak()
  File "pycisTopic/pseudobulk_peak_calling.py", line 703, in call_peak
    self.narrow_peak = self.load_narrow_peak()
  File "pycisTopic/pseudobulk_peak_calling.py", line 709, in load_narrow_peak
    narrow_peak = pd.read_csv(
  File "/home/gridsan/lenail/.conda/envs/py39/lib/python3.9/site-packages/pandas/util/_decorators.py", line 211, in wrapper
    return func(*args, **kwargs)
  File "/home/gridsan/lenail/.conda/envs/py39/lib/python3.9/site-packages/pandas/util/_decorators.py", line 331, in wrapper
    return func(*args, **kwargs)
  File "/home/gridsan/lenail/.conda/envs/py39/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 950, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/home/gridsan/lenail/.conda/envs/py39/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 605, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "/home/gridsan/lenail/.conda/envs/py39/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1442, in __init__
    self._engine = self._make_engine(f, self.engine)
  File "/home/gridsan/lenail/.conda/envs/py39/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1753, in _make_engine
    return mapping[engine](f, **self.options)
  File "/home/gridsan/lenail/.conda/envs/py39/lib/python3.9/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 79, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas/_libs/parsers.pyx", line 554, in pandas._libs.parsers.TextReader.__cinit__
pandas.errors.EmptyDataError: No columns to parse from file

I'm guessing this is because I have cell types with only a handful of cells. Ideally this function should still return something like an empty list of peaks, rather than causing an error.

cbravo93 commented 1 year ago

Hi @alexlenail !

Can you post the head of the bed.gz file that gives the error and the number of lines?

Thanks!

C

alexlenail commented 1 year ago

My solution was to delete them from the input directory, since there were only a handful of cells annotated with those identities. 😳