Skip to content

Commit

Permalink
chore: Add pre-commit config and perform style fixes (#48)
Browse files Browse the repository at this point in the history
* feat: Add pre-commit configuration file

* chore: Add codespell words whitelists

* chore: Add pre-commit deps and bump down jupyterlab

* refactor: Skip prettier for yaml

* style: Perform style fixes with pre-commit

* chore: Remove R-CMD-check action for now

* ci: Change cargo-fmt to have language of rust
  • Loading branch information
lsetiawan authored Dec 11, 2024
1 parent d13eeab commit 7fcb403
Show file tree
Hide file tree
Showing 17 changed files with 964 additions and 67 deletions.
1 change: 1 addition & 0 deletions .codespell-whitelist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
crate
2 changes: 1 addition & 1 deletion .github/workflows/ci-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- dev
pull_request:

env:
env:
CARGO_TERM_COLOR: always

jobs:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,7 @@ trees/# pixi environments
.DS_Store

# Web
*.html
*.html

# Experimental notebooks folder
notebooks/
53 changes: 53 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
exclude: (^.pixi/|.snap)

ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.6.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
hooks:
- id: prettier
types_or: [markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]

- repo: https://github.com/codespell-project/codespell
rev: "v2.3.0"
hooks:
- id: codespell
args: ["--write-changes", "--ignore-words", ".codespell-whitelist"]

- repo: local
hooks:
- id: disallow-caps
name: Disallow improper capitalization
language: pygrep
entry: Github
exclude: .pre-commit-config.yaml
- id: cargo-fmt
name: fmt
language: rust
stages: [pre-commit, pre-push, manual]
types: [file, rust]
entry: cargo fmt
pass_filenames: false

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.28.4"
hooks:
- id: check-dependabot
- id: check-github-workflows
45 changes: 26 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Phylo2Vec

This repository contains an implementation of Phylo2Vec. It is distributed under the GNU Lesser General Public License v3.0 (LGPL).
This repository contains an implementation of Phylo2Vec. It is distributed under
the GNU Lesser General Public License v3.0 (LGPL).

[![PyPI version](https://badge.fury.io/py/phylo2vec.svg)](https://pypi.org/project/phylo2vec/)

Expand All @@ -10,12 +11,12 @@ Link to the paper: <https://doi.org/10.1093/sysbio/syae030>

### Dependencies

* python>=3.9
* numba==0.56.4
* numpy==1.23.5
* biopython==1.80.0
* joblib>=1.2.0
* ete3==3.1.3
- python>=3.9
- numba==0.56.4
- numpy==1.23.5
- biopython==1.80.0
- joblib>=1.2.0
- ete3==3.1.3

### User installation

Expand All @@ -27,8 +28,9 @@ pip install phylo2vec

#### Manual installation

* We recommend to setup an isolated enviroment, using conda, mamba or virtualenv.
* Clone the repository and install using ```pip```:
- We recommend to setup an isolated environment, using conda, mamba or
virtualenv.
- Clone the repository and install using `pip`:

```bash
git clone https://github.com/Neclow/phylo2vec_dev.git
Expand All @@ -39,18 +41,19 @@ pip install -e .

### Additional test dependencies

* pytest==7.4.2
* six==1.16.0
- pytest==7.4.2
- six==1.16.0

### Testing

After installation, you can launch the test suite from outside the source directory:
After installation, you can launch the test suite from outside the source
directory:

```bash
pytest phylo2vec
```

Warning! You might need to clear your ```__pycache__``` folders beforehand:
Warning! You might need to clear your `__pycache__` folders beforehand:

```bash
rm -rf phylo2vec/__pycache__/
Expand All @@ -61,7 +64,8 @@ rm -rf phylo2vec/base/__pycache__/

### Conversions

* The ```base``` module contains elements to convert a Newick string (```to_vector```) to a Phylo2Vec vector and vice versa (```to_newick```)
- The `base` module contains elements to convert a Newick string (`to_vector`)
to a Phylo2Vec vector and vice versa (`to_newick`)

Example:

Expand All @@ -78,8 +82,9 @@ v_converted = to_vector(newick) # array([0, 1, 2, 3, 4], dtype=int16)

### Optimization

* The ```opt``` module contains methods to perform phylogenetic inference using Phylo2Vec vectors
* TODO: include GradME from <https://github.com/Neclow/GradME>
- The `opt` module contains methods to perform phylogenetic inference using
Phylo2Vec vectors
- TODO: include GradME from <https://github.com/Neclow/GradME>

Example:

Expand All @@ -101,6 +106,8 @@ v_opt, taxa_dict, losses = hc.fit("/path/to/your_fasta_file.fa")
}
```

* Preprint repository (core functions are deprecated): <https://github.com/Neclow/phylo2vec_preprint>
* C++ version (deprecated): <https://github.com/Neclow/phylo2vec_cpp>
* GradME: <https://github.com/Neclow/GradME> = phylo2vec + minimum evolution + gradient descent
- Preprint repository (core functions are deprecated):
<https://github.com/Neclow/phylo2vec_preprint>
- C++ version (deprecated): <https://github.com/Neclow/phylo2vec_cpp>
- GradME: <https://github.com/Neclow/GradME> = phylo2vec + minimum evolution +
gradient descent
Loading

0 comments on commit 7fcb403

Please sign in to comment.