diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..7637bb7 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,20 @@ +name: docs +on: + push: + branches: + - master + - main +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + python-version: 3.9 + - run: pip install mkdocs mkdocs-material mkdocs-markdownextradata-plugin mkdocs-git-revision-date-localized-plugin "mkdocstrings[python]" + - run: mkdocs gh-deploy --force diff --git a/docs/examples.md b/docs/examples.md new file mode 100644 index 0000000..61efa56 --- /dev/null +++ b/docs/examples.md @@ -0,0 +1,44 @@ +## Needleman-Wunsch + +```python +seq_a = ["G", "A", "T", "T", "A", "C", "A"] +seq_b = ["G", "C", "A", "T", "G", "C", "G"] + +aligned_seq_a, aligned_seq_b = needleman_wunsch( + seq_a, + seq_b, + match_score=1.0, + mismatch_score=-1.0, + indel_score=-1.0, + gap="_", +) + +# Expects ["G", "_", "A", "T", "T", "A", "C", "A"] +print(aligned_seq_a) + +# Expects ["G", "C", "A", "_", "T", "G", "C", "G"] +print(aligned_seq_b) +``` + + +## Hirschberg + +```python +seq_a = ["A", "G", "T", "A", "C", "G", "C", "A"] +seq_b = ["T", "A", "T", "G", "C"] + +aligned_seq_a, aligned_seq_b = hirschberg( + seq_a, + seq_b, + match_score=2.0, + mismatch_score=-1.0, + indel_score=-2.0, + gap="_", +) + +# Expects ["A", "G", "T", "A", "C", "G", "C", "A"] +print(aligned_seq_a) + +# Expects ["_", "_", "T", "A", "T", "G", "C", "_"] +print(aligned_seq_b) +``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..48300c2 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,25 @@ +## Introduction + +Efficient implementations of Needleman-Wunsch and other sequence alignment algorithms written in Rust with Python bindings via PyO3. + +## Installation + +```bash +pip install sequence_align +``` + +## Quickstart + +```python +seq_a = ["G", "A", "T", "T", "A", "C", "A"] +seq_b = ["G", "C", "A", "T", "G", "C", "G"] + +aligned_seq_a, aligned_seq_b = needleman_wunsch( + seq_a, + seq_b, + match_score=1.0, + mismatch_score=-1.0, + indel_score=-1.0, + gap="_", +) +``` diff --git a/docs/methodology.md b/docs/methodology.md new file mode 100644 index 0000000..e69de29 diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..4fa9b2f --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,69 @@ +site_name: sequence_align + +theme: + name: "material" + features: + # - navigation.indexes + - navigation.sections + - navigation.tabs + - navigation.expand + - navigation.top + palette: + # Palette toggle for light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: blue-grey + toggle: + icon: material/brightness-7 + name: Switch to dark mode + + # Palette toggle for dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: blue-grey + toggle: + icon: material/brightness-4 + name: Switch to light mode + +repo_name: PPPModels +repo_url: https://github.com/kensho-technologies/sequence_align +edit_uri: blob/main/docs/ +site_url: https://kensho-technologies.github.io/sequence_align/ + +extra: + homepage: https://kensho-technologies.github.io/ + social: + - icon: fontawesome/brands/github + link: https://github.com/kensho-technologies/sequence_align + +nav: + - Overview: index.md + - Methodology: methodology.md + - Examples: examples.md + +plugins: + - search + - mkdocstrings: + handlers: + python: + options: + docstring_style: google + + +markdown_extensions: + - pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true + - pymdownx.inlinehilite + - pymdownx.snippets + - pymdownx.superfences + - pymdownx.arithmatex: + generic: true + - pymdownx.details + - admonition + +extra_javascript: + - https://polyfill.io/v3/polyfill.min.js?features=es6 + - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js + diff --git a/pyproject.toml b/pyproject.toml index 4a15e72..3df76e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,9 @@ dev = [ "pyyaml", "types-psutil", "types-pyyaml", + "mkdocs", + "mkdocs-material", + "mkdocstrings", ] [tool.black]