semvec/pypi-packages huggingface dataset:
acanthophis 1.1.0
A comprehensive, opinionated plant variant calling pipeline in Snakemake

# Acanthophis


[![DOI](https://joss.theoj.org/papers/10.21105/joss.06062/status.svg)](https://doi.org/10.21105/joss.06062)

A reusable, comprehensive, opinionated Snakemake pipeline for plant-microbe genomics and plant variant calling.

<img src=".github/logo.jpg" width="320">

# Documentation

For documentation, see [./documentation.md](documentation.md). In summary:

```bash
# create conda env, activate it
mamba create -n someproject python snakemake pip natsort
mamba activate someproject

# Install acanthophis itself
pip install acanthophis

# Generate a workspace. This copies all files the workflow will need to your
# workspace directory.
acanthophis-init /path/to/someproject/

# Edit config.yml to suit your project. Hopefully this config file documents
# all options available in an understandable fashion. If not, please raise an
# issue on github.
vim config.yml

# Run snakemake
snakemake -j 16 -p --use-conda --conda-frontend mamba --ri

# Or on a cluster, see acanthophis-init --list-available-profiles
snakemake --profile ./ebio-cluster/
```

### Compatibility

While snakemake and Acanthophis are cross-platform, most of the underlying tools are only packaged for and/or only operate on  Linux `x68_64`. Therefore, I only support users on Linux systems. In theory, everything *should* run on OSX or WSL, but the vast majority of users will want to utilise a high performance linux workstation (at least, probably more likely a cluster).

### Running tests

For running tests, see [./tests/README.md](tests/README.md).

# Contribution & Assistance

If you have anything (advice, docs, code) you'd like to contribute, pull requests are more than welcome. Please discuss any major contribution in a new issue before implementing it, to avoid wasted effort.

If you need any assistance, or have other questions or comments, please make an issue on github, or open a discussion. Unfortunately both need an account on github, so alternatively you can email me (`foss  <usual email symbol> kdmurray.id.au`).

## About & Authors

This is an amalgamation of several pipelines developed between the [Weigel
Group, MPI DB, Tübingen, DE](https://weigelworld.org), the [Warthmann Group,
IAEA/FAO PBGL, Seibersdorf, AT](http://warthmann.com) and the [Borevitz Group,
ANU, Canberra, AU](https://borevitzlab.anu.edu.au). This amalgamation authored
by Dr. K. D. Murray, original code primary by K. D. Murray, Norman Warthmann,
with contributions from others at the aforementioned institutes.
pytree2safetensors 0.1.4
A simple package to save and load JAX PyTrees to and from Safetensors
Requires Python: >=3.10

# Pytree2Safetensors
Pytree2Safetensors is a simple package to save and load JAX PyTrees to and from
Safetensors, a popular file format for saving neural network weights.

To install, run

```
pip install --upgrade pytree2safetensors
```

Pytree2Safetensors depends on `jax`, `safetensors`, and `jaxtyping`. You also need
to have at least Python 3.10

## Specification
### Serialising/Deserialising

#### `keypath2string(path: KeyPath) -> str`
Serializes a JAX key path (i.e., a path to a leaf in a pytree) to a string by joining together a string representation of each key in the path. Prefixes of these representation tell what type of key it is. A GetAttryKey is prefixed with ".", a DictKey is prefixed with "@", and a SequenceKey is prefixed with "#". If the initial key is a
GetAttryKey, the initial "." is left off.

Examples:
```python
keypath2string((GetAttrKey("layers"), SequenceKey(10), DictKey("query"),))
# => "layers#10@query
keypath2string((SequenceKey(2), GetAttrKey("layers"), SequenceKey(10), DictKey("query"),))
# => "#2.layers#10@query
```

#### `string2keypath(string: str) -> KeyPath`
Inverse of `keypath2string`

#### `pytree2dict(tree: PyTree) -> dict`
Returns a dictionary of serialized key paths mapping to leaves of the tree.

#### `dict2pytree(dictionary: dict) -> tree`
Inverse of `pytree2dict`, except that it wraps attributes in `PyTreeContainer`s instead of using the original object. This is because there is no way for the deserialiser to know what the original object was. You can use `load_into_pytree` to load weights into an initialized
pytree.

#### `PyTreeContainer`
A class which implements the bare minimum to be a node in a pytree according to JAX.

### Saving
#### `save_pytree(tree: PyTree, path: str) -> None`
Saves the pytree as a safetensors at the given path. Equivalent to
```python
safetensors.flax.save_file(pytree2dict(tree), path)
```

### Loading
#### ```load_file```
Alias of `safetensors.flax.load_file`

#### ```load_pytree(path: str) -> PyTree```
Loads a file and uses `dict2pytree` to convert the safetensors dict to a pytree.

#### ```set_weights(module: PyTree, dictionary: dict) -> PyTree```
Given a pytree module and a safetensors dict, load the weights in the safetensors dict into the module using string2keypath to determine their paths. Returns a new pytree.

#### ```load_into_pytree(module: PyTree, path: str) -> PyTree```
Equivalent to `set_weights(module, load_file(path))`.