aertslab / scenicplus

SCENIC+ is a python package to build gene regulatory networks (GRNs) using combined or separate single-cell gene expression (scRNA-seq) and single-cell chromatin accessibility (scATAC-seq) data.
Other
162 stars 27 forks source link

run_pycistarget is not defined #412

Open DmitriiSeverinov opened 3 weeks ago

DmitriiSeverinov commented 3 weeks ago

Hi all, I would like to run the run_pycistarget function, however, I am getting the following error:

from scenicplus.wrappers.run_pycistarget import *
import pycistarget
run_pycistarget(
    region_sets = bed_dict,
    species = 'custom',
    custom_annot = custom_annot,
    save_path = 'test_multiome/scATAC_1000_INs_annotated',
    path_to_motif_annotations = '/projects/p_scads_spinal_cord/motifs_no_cb.tbl',
    dem_log2fc_thr = 1.5,
    ctx_db_path = 'results/test_multiome/scATAC_1000_INs_annotated/scATAC_1000_INs_annotated.regions_vs_motifs.rankings.feather',
    dem_db_path = 'results/test_multiome/scATAC_1000_INs_annotated/scATAC_1000_INs_annotated.regions_vs_motifs.scores.feather',
    _temp_dir = '/tmp/',
    n_cpu=16
)

2024-06-04 11:02:37,917 pycisTarget_wrapper INFO     Loading cisTarget database for Topic48.bed
2024-06-04 11:02:37,917 cisTarget    INFO     Reading cisTarget database
2024-06-04 11:02:49,903 pycisTarget_wrapper INFO     Running cisTarget for Topic48.bed
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dmse952c/.local/lib/python3.11/site-packages/scenicplus/wrappers/run_pycistarget.py", line 191, in run_pycistarget
    menr['CTX_'+key+'_All'] = run_cistarget(ctx_db = ctx_db,
                              ^^^^^^^^^^^^^
NameError: name 'run_cistarget' is not defined. Did you mean: 'run_pycistarget'?

It works perfectly on the older version of SCENIC+. Is there a difference between older and newer version of SCENIC+ wrapper function run_pycistarget?

New version:

Older version:

from scenicplus.wrappers.run_pycistarget import *
import pycistarget
run_pycistarget(
    region_sets = bed_dict,
    species = 'custom',
    custom_annot = custom_annot,
    save_path = 'test_multiome/scATAC_1000_INs_annotated',
    path_to_motif_annotations = '/projects/p_scads_spinal_cord/motifs_no_cb.tbl',
    dem_log2fc_thr = 1.5,
    ctx_db_path = 'results/test_multiome/scATAC_1000_INs_annotated/scATAC_1000_INs_annotated.regions_vs_motifs.rankings.feather',
    dem_db_path = 'results/test_multiome/scATAC_1000_INs_annotated/scATAC_1000_INs_annotated.regions_vs_motifs.scores.feather',
    _temp_dir = '/tmp/',
    n_cpu=16
)

2024-06-04 11:11:02,288 pycisTarget_wrapper INFO     Loading cisTarget database for Topic48.bed
2024-06-04 11:11:02,288 cisTarget    INFO     Reading cisTarget database
2024-06-04 11:11:08,609 pycisTarget_wrapper INFO     Running cisTarget for Topic48.bed
2024-06-04 11:11:12,834 INFO worker.py:1715 -- Started a local Ray instance. View the dashboard at http://127.0.0.1:8265 
(ctx_internal_ray pid=3215885) 2024-06-04 11:11:15,246 cisTarget    INFO     Running cisTarget for chr1 which has 133 regions
2024-06-04 11:11:49,038 cisTarget    INFO     Done!
2024-06-04 11:11:49,041 pycisTarget_wrapper INFO     Created folder : /data/horse/ws/dmse952c-zebrafish_multiome/results/test_multiome/scATAC_1000_INs_annotated/CTX_Topic48.bed_All
2024-06-04 11:11:49,607 pycisTarget_wrapper INFO     Running DEM for Topic48.bed
2024-06-04 11:11:49,607 DEM          INFO     Reading DEM database
2024-06-04 11:12:59,626 DEM          INFO     Creating contrast groups
2024-06-04 11:13:12,260 INFO worker.py:1715 -- Started a local Ray instance. View the dashboard at http://127.0.0.1:8265 
(DEM_internal_ray pid=3218540) 2024-06-04 11:13:14,803 DEM          INFO     Computing DEM for chr3
(DEM_internal_ray pid=3218541) 2024-06-04 11:13:21,024 DEM          INFO     Computing DEM for chr17 [repeated 16x across cluster] (Ray deduplicates logs by default. Set RAY_DEDUP_LOGS=0 to disable log deduplication, or see https://docs.ray.io/en/master/ray-observability/ray-logging.html#log-deduplication for more options.)
(DEM_internal_ray pid=3218543) 2024-06-04 11:13:21,551 DEM          INFO     Computing DEM for chr24 [repeated 8x across cluster]
2024-06-04 11:13:31,378 DEM          INFO     Forming cistromes
2024-06-04 11:13:31,392 DEM          INFO     Done!
2024-06-04 11:13:31,398 pycisTarget_wrapper INFO     Created folder : /data/horse/ws/dmse952c-zebrafish_multiome/results/test_multiome/scATAC_1000_INs_annotated/DEM_Topic48.bed_All
2024-06-04 11:13:31,487 pycisTarget_wrapper INFO     Loading cisTarget database for Topic59.bed
2024-06-04 11:13:31,487 cisTarget    INFO     Reading cisTarget database

So, it seems working well!

Best, Dmitrii

SeppeDeWinter commented 2 weeks ago

Hi @DmitriiSeverinov

Yes, this function is removed in the newest version of pycistarget / SCENIC+. Now, pycistarget should be run via the command line.

See


pycistarget --help

For more info.

Let me know if you need further help.

Best,

Seppe