open2c / pairtools

Extract 3D contacts (.pairs) from sequencing alignments
MIT License
100 stars 32 forks source link

Extracting contact matrices from pairs file #243

Open arodel21 opened 3 months ago

arodel21 commented 3 months ago

Hello, I am trying to extract the contact matrices from a 5000 bp resolution pairs file following the command

cooler cload pairs \
    -c1 2 -p1 3 -c2 4 -p2 5\
    $CHRSIZES:5000 \
    $AUX.test.nodups.pairs.gz \
    $AUX.test.grcz11.5000.cool

But I get this error

Traceback (most recent call last):
  File "/package/python-cbrg/current/3.11/bin/cooler", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/package/python-cbrg/current/3.11/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/package/python-cbrg/current/3.11/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/package/python-cbrg/current/3.11/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/package/python-cbrg/current/3.11/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/package/python-cbrg/current/3.11/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/package/python-cbrg/current/3.11/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/package/python-cbrg/current/3.11/lib/python3.11/site-packages/cooler/cli/cload.py", line 551, in pairs
    f_in = get_handle(pairs_path, mode='r', compression='infer')[0]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'IOHandles' object is not subscriptable

I think it happens because the pairs file is too big (248MB) because I have managed to get the cool files from smaller files successfully.

Could you please tell me if there is an alternative way of doing this?

Thanks in advance.

nvictus commented 3 months ago

I think you're version of cooler is old and out of sync with pandas. Try pip install -U cooler.

arodel21 commented 3 months ago

@nvictus This worked! Thank you!