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
178 stars 28 forks source link

Tutorial 10x multiome - AssertionError: Database "{fname}" doesn't exist. #69

Closed Tomoya89 closed 1 year ago

Tomoya89 commented 1 year ago

Describe the bug Thank you for developing such a wonderful package! First, I tried to follow the tutorial for 10x multiome, but I get the below error at the Motif enrichment analysis using pycistarget part. I'm not sure if this is a problem with my environment, but could you please tell me how to solve this problem? Thank you.

To Reproduce from scenicplus.wrappers.run_pycistarget import run_pycistarget run_pycistarget( region_sets = region_sets, species = 'homo_sapiens', save_path = os.path.join(work_dir, 'motifs'), ctx_db_path = rankings_db, dem_db_path = scores_db, path_to_motif_annotations = motif_annotation, run_without_promoters = True, n_cpu = 4,

_temp_dir = os.path.join(tmp_dir, 'ray_spill'),

annotation_version = 'v10nr_clust',
)

Error output

AssertionError Traceback (most recent call last) Cell In [60], line 2 1 from scenicplus.wrappers.run_pycistarget import run_pycistarget ----> 2 run_pycistarget( 3 region_sets = region_sets, 4 species = 'homo_sapiens', 5 save_path = os.path.join(work_dir, 'motifs'), 6 ctx_db_path = rankings_db, 7 dem_db_path = scores_db, 8 path_to_motif_annotations = motif_annotation, 9 run_without_promoters = True, 10 n_cpu = 4, 11 #_temp_dir = os.path.join(tmp_dir, 'ray_spill'), 12 annotation_version = 'v10nr_clust', 13 )

File ~/scenicplus/src/scenicplus/wrappers/run_pycistarget.py:182, in run_pycistarget(region_sets, species, save_path, custom_annot, save_partial, ctx_db_path, dem_db_path, run_without_promoters, biomart_host, promoter_space, ctx_auc_threshold, ctx_nes_threshold, ctx_rank_threshold, dem_log2fc_thr, dem_motif_hit_thr, dem_max_bg_regions, annotation, motif_similarity_fdr, path_to_motif_annotations, annotation_version, n_cpu, _temp_dir, exclude_motifs, exclude_collection, **kwargs) 180 ## CISTARGET 181 regions = region_sets[key] --> 182 ctx_db = cisTargetDatabase(ctx_db_path, regions)
183 if exclude_motifs is not None: 184 out = pd.read_csv(exclude_motifs, header=None).iloc[:,0].tolist()

File ~/opt/anaconda3/envs/scenicplus/lib/python3.8/site-packages/pycistarget/motif_enrichment_cistarget.py:67, in cisTargetDatabase.init(self, fname, region_sets, name, fraction_overlap) 48 def init(self, 49 fname: str, 50 region_sets: Union[Dict[str, pr.PyRanges], pr.PyRanges] = None, 51 name: str = None, 52 fraction_overlap: float = 0.4): 53 """ 54 Initialize cisTargetDatabase 55
(...) 65 Minimal overlap between query and regions in the database for the mapping.
66 """ ---> 67 self.regions_to_db, self.db_rankings, self.total_regions = self.load_db(fname, 68 region_sets, 69 name, 70 fraction_overlap)

File ~/opt/anaconda3/envs/scenicplus/lib/python3.8/site-packages/pycistarget/motif_enrichment_cistarget.py:110, in cisTargetDatabase.load_db(self, fname, region_sets, name, fraction_overlap) 108 if name is None: 109 name = os.path.basename(fname) --> 110 db = FeatherRankingDatabase(fname, name=name) 111 total_regions = db.total_genes 112 db_regions = db.genes

File ~/opt/anaconda3/envs/scenicplus/lib/python3.8/site-packages/ctxcore/rnkdb.py:106, in FeatherRankingDatabase.init(self, fname, name) 98 """ 99 Create a new feather database. 100 101 :param fname: The filename of the database. 102 :param name: The name of the database. 103 """ 104 super().init(name=name) --> 106 assert os.path.isfile(fname), """Database "{fname}" doesn't exist.""" 108 self._fname = fname 109 self.ct_db = CisTargetDatabase.init_ct_db( 110 ct_db_filename=self._fname, engine="pyarrow" 111 )

AssertionError: Database "{fname}" doesn't exist.

Version (please complete the following information):

re-rosales commented 1 year ago

Hi, I got the same error. I would really appreciate any suggestions.

The versions I'm using: Python: 3.9.12 scenicplus: 0.1.dev452+g22735ca

tu4n-p commented 1 year ago

I'd check if I had the ranking and score files for motifs or not.

Tomoya89 commented 1 year ago

Thank you for your reply. Yes, it seems I miss these files. rankings_db = os.path.join(db_fpath, 'cluster_SCREEN.regions_vs_motifs.rankings.v2.feather') scores_db = os.path.join(db_fpath, 'cluster_SCREEN.regions_vs_motifs.scores.v2.feather') motif_annotation = os.path.join(motif_annot_fpath, 'motifs-v10-nr.hgnc-m0.00001-o0.0.tbl')

Could you please teach me how to prepare these files to proceed the tutorial? I don't have the staging folder yet and maybe I might not have been able to successfully create the singularity image.

tu4n-p commented 1 year ago

You can download files here or you can create your database from scratch

SeppeDeWinter commented 1 year ago

@tu4n-p

Thanks for replying to the issue 😄

ramadatta commented 1 year ago

Hi,

Thank you for the wonderful tool. I have the same issue as above while running PBMC tutorial.

As you stated in the above replies, I checked here, and found motifs-v10-nr.hgnc-m0.00001-o0.0.tbl file, but could not find the

1) cluster_SCREEN.regions_vs_motifs.scores.v2.feather 2) cluster_SCREEN.regions_vs_motifs.rankings.v2.feather

to download.

Could I know from where I can download these files?

ramadatta commented 1 year ago

Hi, thanks, I think my question is already answered here.