Skip to content

Commit

Permalink
Merge pull request #13 from aertslab/example_datasets
Browse files Browse the repository at this point in the history
Add motifs db downloading function
  • Loading branch information
LukasMahieu authored Aug 13, 2024
2 parents 0eea7fc + 14a9534 commit 4a29d67
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/crested/_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get_dataset(dataset: str):
"mouse_cortex_bigwig": (
"data/mouse_biccn/bigwigs.tar.gz",
"data/mouse_biccn/consensus_peaks_biccn.bed",
),
)
}
assert (
dataset in dataset_mapping
Expand All @@ -101,3 +101,26 @@ def get_dataset(dataset: str):
cregions_path = _get_dataset_index().fetch(cregions_url, progressbar=True)
targets_dir = os.path.dirname(targets_paths[0])
return targets_dir, cregions_path

def get_motif_db():
"""
Fetch the motif database. This function retrieves the Aerts lab motif database for use in motif analysis, downloading if not already cached, and returns the paths to the dataset.
These two paths can be passed to :func:`crested.import_bigwigs()` / :func:`crested.import_beds()`.
Note
----
The cache location can be changed by setting environment variable $CRESTED_DATA_DIR.
Returns
-------
A tuple consisting of the motif db .meme file path and the transcription factor info .tsv file path.
Example
-------
>>> motif_db_path, motif_tf_collection_path = crested.get_motif_db()
"""
motif_db_path = _get_dataset_index().fetch("motif_db/motif_db.meme", progressbar=True)
motif_collection_path = _get_dataset_index().fetch( "motif_db/motif_tf_collection.tsv", progressbar=True)
return motif_db_path, motif_collection_path

0 comments on commit 4a29d67

Please sign in to comment.