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

Issues using parameters in CLI #102

Open
jamesoccean1 opened this issue Sep 27, 2024 · 3 comments
Open

Issues using parameters in CLI #102

jamesoccean1 opened this issue Sep 27, 2024 · 3 comments

Comments

@jamesoccean1
Copy link

Thank you for creating this great tool!

I am having trouble using parameters that are available in the API version of coolbox in the CLI version.
For example, in API mode, one can use cmap, depth_ratio, and resolution as parameters:

dhic = DotHiC(test_hic, cmap="RdYlBu_r", depth_ratio=.5, resolution=10000)
frame = XAxis() + dhic
frame.plot("chr9:4000000-6000000")

However, the parameters do not work in CLI mode. I tried a couple of ways, one example with "resolution" below, using add. But I have also tried --resolution. But it is not recognized.

coolbox add XAxis -
add HiCMat "/YM1_inter_30_0.mcool" -
add resolution=10000 -
add Title "young hic" -
set_genome mm10 -
goto "chr1:4770000-6230000" -
plot /Users/jamesoccean/Desktop/sen_lab/hic_analysis/chr1_4770000-6230000_output_cool_adj.pdf

@Nanguage
Copy link
Collaborator

Hi, thanks for feedback! Did you tried to specify the parameter like this: add HiCMat "/YM1_inter_30_0.mcool" resolution=10000 ?

@jamesoccean1
Copy link
Author

Hi, thanks for the response! I just tried:

coolbox add XAxis - \
add HiCMat "/YM1_inter_30_0.mcool" resolution=10000 - \
add Title "young hic" - \
set_genome mm10 - \
goto "chr1:4770000-6230000" - \
plot /hic_analysis/chr1_4770000-6230000_output_cool_adj.pdf

But received the following error:

exception ignored in: <function Track.__del__ at 0x142e68280>
Traceback (most recent call last):
  File "/Users/jamesoccean/miniforge3/envs/coolbox_env_3.9/lib/python3.9/site-packages/coolbox/core/track/base.py", line 97, in __del__
    name = self.properties['name']
AttributeError: 'Cool' object has no attribute 'properties'
[ERROR:cli.py:334 -                 plot()] Error when execute the generated source code:

------------------------
from coolbox.api import *
def fetch_top_frame():
    frame = Frame()
    frame += XAxis()
    frame += HiCMat('/YM1_inter_30_0.mcool', 'resolution=10000')
    frame += Title('young hic')
    return frame
    
top_frame = fetch_top_frame()
frame = top_frame

fig = frame.plot('chr1:4770000-6230000')
fig.savefig('/hic_analysis/chr1_4770000-6230000_output_cool_adj.pdf')

------------------------


Traceback (most recent call last):
  File "/Users/jamesoccean/miniforge3/envs/coolbox_env_3.9/bin/coolbox", line 6, in <module>
    fire.Fire(CLI)
  File "/Users/jamesoccean/miniforge3/envs/coolbox_env_3.9/lib/python3.9/site-packages/fire/core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/Users/jamesoccean/miniforge3/envs/coolbox_env_3.9/lib/python3.9/site-packages/fire/core.py", line 477, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/Users/jamesoccean/miniforge3/envs/coolbox_env_3.9/lib/python3.9/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/Users/jamesoccean/miniforge3/envs/coolbox_env_3.9/lib/python3.9/site-packages/coolbox/cli.py", line 345, in plot
    raise e
  File "/Users/jamesoccean/miniforge3/envs/coolbox_env_3.9/lib/python3.9/site-packages/coolbox/cli.py", line 332, in plot
    eval(code)
  File "coolbox_cli_source", line 9, in <module>
  File "coolbox_cli_source", line 5, in fetch_top_frame
    import runpy
  File "/Users/jamesoccean/miniforge3/envs/coolbox_env_3.9/lib/python3.9/site-packages/coolbox/core/track/hicmat/hicmat.py", line 22, in HiCMat
    return Cool(file_or_hicmat, *args, **kwargs)
TypeError: __init__() takes 2 positional arguments but 3 were given

@zhqu1148980644
Copy link
Collaborator

have you tried this:

HiCMat "/YM1_inter_30_0.mcool" --resolution 10000 -\

or

HiCMat "/YM1_inter_30_0.mcool" - \
add Feature --resolution 10000 - \

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