Skip to content

Commit

Permalink
Merge pull request #34 from aertslab/update_docs
Browse files Browse the repository at this point in the history
Update docs, add checks for formatting/docs building, and refactor modisco and utils modules
  • Loading branch information
LukasMahieu authored Oct 9, 2024
2 parents 07e4a25 + ec31d34 commit 8fd7f3c
Show file tree
Hide file tree
Showing 51 changed files with 1,586 additions and 2,976 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Check Sphinx Docs

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
docs:
name: Build Sphinx Documentation
runs-on: ubuntu-latest
defaults:
run:
shell: bash -eo pipefail {0} # Fail on error and enable pipefail

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: "pip"
cache-dependency-path: "**/pyproject.toml"

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install ".[doc]"
- name: Build Documentation and Check for Issues
working-directory: docs
run: |
make clean
# Build the docs and capture output, treat warnings as errors (-W)
sphinx-build -b html -W . _build/html 2>&1 | tee sphinx-output.log
- name: Upload Documentation Artifacts (HTML Pages)
if: always()
uses: actions/upload-artifact@v3
with:
name: sphinx-docs
path: docs/_build/html

- name: Upload Log if Build Failed
if: failure()
uses: actions/upload-artifact@v3
with:
name: sphinx-output-log
path: docs/sphinx-output.log
16 changes: 16 additions & 0 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Ruff

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 5 1,15 * *"

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pip install torch
pip install crested
```

3. If you plan on doing motif analysis using the tf-modisco (lite) and tangermeme functionality inside CREsted, you will need to run the following additional install:
3. If you plan on doing motif analysis using the tf-modisco (lite) and tangermeme's tomtom functionality inside CREsted, you will need to run the following additional install:

```bash
pip install crested[tfmodisco]
Expand Down
Binary file added docs/_static/img/examples/hist_locus_scoring.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/img/examples/pattern_clustermap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ io
preprocessing
tools/index.md
plotting/index.md
logging
utils
```
14 changes: 0 additions & 14 deletions docs/api/logging.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/api/plotting/hist.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ Plots for inspecting distributions of ground truth and predictions?
:toctree: _autosummary
distribution
locus_scoring
```
6 changes: 6 additions & 0 deletions docs/api/plotting/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ Plot contribution scores and analyze them using tfmodisco.
contribution_scores
modisco_results
selected_instances
class_instances
clustermap
clustermap_tf_motif
tf_expression_per_cell_type
similarity_heatmap
```
25 changes: 22 additions & 3 deletions docs/api/tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
Crested
TaskConfig
tfmodisco
default_configs
```


```{toctree}
:maxdepth: 2
:hidden:
Expand All @@ -23,6 +21,7 @@ data
zoo
losses
metrics
modisco
```

## Data
Expand Down Expand Up @@ -59,4 +58,24 @@ metrics
metrics.PearsonCorrelation
metrics.PearsonCorrelationLog
metrics.ZeroPenaltyMetric
```
```

## Modisco

```{eval-rst}
.. autosummary::
modisco.tfmodisco
modisco.match_h5_files_to_classes
modisco.process_patterns
modisco.create_pattern_matrix
modisco.generate_nucleotide_sequences
modisco.pattern_similarity
modisco.find_pattern
modisco.find_pattern_matches
modisco.calculate_similarity_matrix
modisco.calculate_mean_expression_per_cell_type
modisco.generate_html_paths
modisco.read_motif_to_tf_file
modisco.create_pattern_tf_dict
modisco.create_tf_ct_matrix
```
27 changes: 27 additions & 0 deletions docs/api/tools/modisco.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Modisco `tl.modisco`

Tfmodisco (utility) functions. Requires the `modisco-lite` package to be installed.

```{eval-rst}
.. currentmodule:: crested.tl.modisco
```

```{eval-rst}
.. autosummary::
:toctree: _autosummary
tfmodisco
match_h5_files_to_classes
process_patterns
create_pattern_matrix
generate_nucleotide_sequences
pattern_similarity
find_pattern
find_pattern_matches
calculate_similarity_matrix
calculate_mean_expression_per_cell_type
generate_html_paths
read_motif_to_tf_file
create_pattern_tf_dict
create_tf_ct_matrix
```
18 changes: 18 additions & 0 deletions docs/api/utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Utils

CREsted provides a few utility function to help with sequence encoding, function optimization, ...

```{eval-rst}
.. currentmodule:: crested.utils
```

```{eval-rst}
.. autosummary::
:toctree: _autosummary
EnhancerOptimizer
extract_bigwig_values_per_bp
hot_encoding_to_sequence
one_hot_encode_sequence
setup_logging
```
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
"anndata": ("https://anndata.readthedocs.io/en/stable/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"pandas": ("http://pandas.pydata.org/pandas-docs/stable/", None),
"seaborn": ("https://seaborn.pydata.org/", None),
}

# List of patterns, relative to source directory, that match files and
Expand Down Expand Up @@ -137,7 +139,9 @@
("py:class", "keras.metrics.Metric"),
("py:class", "keras.src.losses.loss.Loss"),
("py:class", "keras.src.metrics.metric.Metric"),
("py:class", "seaborn.matrix.ClusterGrid"),
]

suppress_warnings = [
"autosummary.import_cycle",
]
Loading

0 comments on commit 8fd7f3c

Please sign in to comment.