cogent3-h5seqs 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ time: "19:00"
8
+ open-pull-requests-limit: 10
9
+ - package-ecosystem: "github-actions"
10
+ directory: "/"
11
+ schedule:
12
+ interval: "weekly"
13
+ time: "19:00"
14
+ open-pull-requests-limit: 10
@@ -0,0 +1,58 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ tests:
9
+ name: "Python ${{ matrix.python-version }} (${{ matrix.os }})"
10
+ runs-on: ${{ matrix.os }}
11
+
12
+ strategy:
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest, windows-latest]
15
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
16
+
17
+ steps:
18
+ - uses: "actions/checkout@v4"
19
+ with:
20
+ fetch-depth: 0
21
+
22
+ # Setup env
23
+ - uses: "actions/setup-python@v5"
24
+ with:
25
+ python-version: "${{ matrix.python-version }}"
26
+
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v6
29
+ with:
30
+ enable-cache: true
31
+ cache-dependency-glob: "pyproject.toml"
32
+
33
+ - name: "Installs for ${{ matrix.python-version }}"
34
+ run: |
35
+ uv venv venv -p python${{ matrix.python-version }}
36
+ uv tool install -p venv nox
37
+
38
+ - name: "Run nox for ${{ matrix.python-version }}"
39
+ run: "nox -db uv -s test-${{ matrix.python-version }} -- --cov-report lcov:lcov-${{matrix.os}}-${{matrix.python-version}}.lcov --cov-report term --cov-append --cov cogent3_h5seqs"
40
+
41
+ - name: Coveralls Parallel
42
+ uses: coverallsapp/github-action@v2
43
+ with:
44
+ parallel: true
45
+ github-token: ${{ secrets.github_token }}
46
+ flag-name: run-${{matrix.python-version}}-${{matrix.os}}
47
+ file: "lcov-${{matrix.os}}-${{matrix.python-version}}.lcov"
48
+
49
+ finish:
50
+ name: "Finish Coveralls"
51
+ needs: tests
52
+ runs-on: ubuntu-latest
53
+ steps:
54
+ - name: Coveralls Finished
55
+ uses: coverallsapp/github-action@v2
56
+ with:
57
+ github-token: ${{ secrets.github_token }}
58
+ parallel-finished: true
@@ -0,0 +1,75 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches-ignore:
17
+ - master
18
+ pull_request:
19
+ branches-ignore:
20
+ - master
21
+ schedule:
22
+ - cron: '39 20 * * 6'
23
+
24
+ jobs:
25
+ analyze:
26
+ name: Analyze
27
+ runs-on: ubuntu-latest
28
+ permissions:
29
+ actions: read
30
+ contents: read
31
+ security-events: write
32
+
33
+ strategy:
34
+ fail-fast: false
35
+ matrix:
36
+ language: [ 'python' ]
37
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
38
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
39
+
40
+ steps:
41
+ - name: Checkout repository
42
+ uses: actions/checkout@v4
43
+
44
+ # Initializes the CodeQL tools for scanning.
45
+ - name: Initialize CodeQL
46
+ uses: github/codeql-action/init@v3
47
+ with:
48
+ languages: ${{ matrix.language }}
49
+ # If you wish to specify custom queries, you can do so here or in a config file.
50
+ # By default, queries listed here will override any specified in a config file.
51
+ # Prefix the list here with "+" to use these queries and those in the config file.
52
+
53
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
54
+ # queries: security-extended,security-and-quality
55
+
56
+
57
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
58
+ # If this step fails, then you should remove it and run the build manually (see below)
59
+ - name: Autobuild
60
+ uses: github/codeql-action/autobuild@v3
61
+
62
+ # ℹ️ Command-line programs to run using the OS shell.
63
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
64
+
65
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
66
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
67
+
68
+ # - run: |
69
+ # echo "Run, Build Application using script"
70
+ # ./location_of_script_within_repo/buildscript.sh
71
+
72
+ - name: Perform CodeQL Analysis
73
+ uses: github/codeql-action/analyze@v3
74
+ with:
75
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,44 @@
1
+ name: Lint code using ruff
2
+ # modified from https://towardsdatascience.com/black-with-git-hub-actions-4ffc5c61b5fe
3
+ # caching https://stackoverflow.com/questions/59127258/how-can-i-use-pip-cache-in-github-actions
4
+ # black integration https://black.readthedocs.io/en/stable/integrations/github_actions.html
5
+ # isort integration https://pycqa.github.io/isort/docs/configuration/github_action.html
6
+
7
+ on:
8
+ push:
9
+ branches-ignore:
10
+ - master
11
+
12
+ jobs:
13
+ linters:
14
+ runs-on: ubuntu-latest
15
+ if: github.repository == 'cogent3/cogent3-h5seqs'
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: '3.13'
22
+
23
+ - name: Install uv
24
+ uses: astral-sh/setup-uv@v6
25
+ with:
26
+ enable-cache: true
27
+ cache-dependency-glob: "pyproject.toml"
28
+
29
+ - name: "Installs for ${{ matrix.python-version }}"
30
+ run: |
31
+ uv venv venv -p python${{ matrix.python-version }}
32
+ uv tool install -p venv nox
33
+ export ruff_version=$(python -c 'import tomllib; print([line for line in tomllib.load(open("pyproject.toml","rb"))["project"]["optional-dependencies"]["dev"] if "ruff" in line][0])')
34
+ echo "Click version: $ruff_version"
35
+ uv tool install -p venv $ruff_version
36
+ - name: Format code using ruff
37
+ run: ruff check --fix-only . && ruff format .
38
+ - name: Commit changes
39
+ uses: EndBug/add-and-commit@v9
40
+ with:
41
+ author_name: ${{ github.actor }}
42
+ author_email: ${{ github.actor }}@users.noreply.github.com
43
+ message: "STY: pre-commit linting with ruff"
44
+ add: "."
@@ -0,0 +1,95 @@
1
+ name: Release
2
+
3
+ on: [workflow_dispatch]
4
+
5
+ jobs:
6
+ test:
7
+ name: "Test on Python ${{ matrix.python-version }} (${{ matrix.os }})"
8
+ runs-on: ${{ matrix.os }}
9
+ strategy:
10
+ matrix:
11
+ os: [ubuntu-latest, macos-latest, windows-latest]
12
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
13
+ steps:
14
+ - uses: "actions/checkout@v4"
15
+ with:
16
+ fetch-depth: 0
17
+
18
+ - uses: "actions/setup-python@v5"
19
+ with:
20
+ python-version: "${{ matrix.python-version }}"
21
+
22
+ - name: "Installs for ${{ matrix.python-version }}"
23
+ run: |
24
+ pip install --upgrade pip nox
25
+
26
+ - name: "Run nox for Python ${{ matrix.python-version }}"
27
+ run: "nox -s test-${{ matrix.python-version }}"
28
+
29
+ build:
30
+ name: Build wheel and sdist
31
+ needs: test
32
+ runs-on: ubuntu-latest
33
+
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ with:
37
+ fetch-depth: 0
38
+
39
+ - uses: actions/setup-python@v5
40
+ with:
41
+ python-version: '3.13'
42
+
43
+ - name: Install build dependency
44
+ run: |
45
+ pip install build
46
+ pip install --upgrade pip
47
+
48
+ - name: Build sdist and wheel
49
+ run: python -m build --wheel --sdist
50
+
51
+ - name: Upload sdist and wheel
52
+ uses: actions/upload-artifact@v4
53
+ with:
54
+ name: c3h5-wheel-sdist
55
+ path: |
56
+ ./dist/*.whl
57
+ ./dist/*.tar.gz
58
+
59
+ release_test:
60
+ name: Release to Test PyPI
61
+ needs: [build]
62
+ environment: release_test
63
+ runs-on: ubuntu-latest
64
+ permissions:
65
+ id-token: write
66
+
67
+ steps:
68
+ - name: Download sdist and wheel
69
+ uses: actions/download-artifact@v4
70
+ with:
71
+ name: c3h5-wheel-sdist
72
+ path: ./dist
73
+
74
+ - name: Publish package distributions to Test PyPI
75
+ uses: pypa/gh-action-pypi-publish@release/v1
76
+ with:
77
+ repository-url: https://test.pypi.org/legacy/
78
+
79
+ release:
80
+ name: Release to PyPI
81
+ needs: release_test
82
+ environment: release
83
+ runs-on: ubuntu-latest
84
+ permissions:
85
+ id-token: write
86
+
87
+ steps:
88
+ - name: Download sdist and wheel
89
+ uses: actions/download-artifact@v4
90
+ with:
91
+ name: c3h5-wheel-sdist
92
+ path: ./dist
93
+
94
+ - name: Publish package distributions to PyPI
95
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,10 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
@@ -0,0 +1,39 @@
1
+ syntax:glob
2
+ .svn
3
+ *.pyc
4
+ *.pyo
5
+ *.so
6
+ *.o
7
+ *.DS_Store
8
+ *.tmproj
9
+ *.rej
10
+ *.orig
11
+ *.wpr
12
+ *.pdf
13
+ _build/*
14
+ build
15
+ *htmlcov*
16
+ *.idea
17
+ draw_results
18
+ *.coverage*
19
+ *egg-info*
20
+ *.wpu
21
+ .cache*
22
+ *taskpaper
23
+ *.ipynb_checkpoints*
24
+ *.sublime*
25
+ *.patch
26
+ *.pytest_cache
27
+ *.tox
28
+ *.nox
29
+ *.vscode
30
+ *.code-workspace
31
+ coverage.xml
32
+ __pycache__
33
+ junit-*.xml
34
+ doc/draw*
35
+ dist/*
36
+ working/*
37
+ .ruff_cache/*
38
+ jats/*
39
+ .venv/*
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, cogent3
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: cogent3-h5seqs
3
+ Version: 0.2.0
4
+ Summary: HDF5 storage driver for cogent3 sequence collections
5
+ Author-email: Gavin Huttley <Gavin.Huttley@anu.edu.au>
6
+ License: BSD 3-Clause License
7
+
8
+ Copyright (c) 2025, cogent3
9
+
10
+ Redistribution and use in source and binary forms, with or without
11
+ modification, are permitted provided that the following conditions are met:
12
+
13
+ 1. Redistributions of source code must retain the above copyright notice, this
14
+ list of conditions and the following disclaimer.
15
+
16
+ 2. Redistributions in binary form must reproduce the above copyright notice,
17
+ this list of conditions and the following disclaimer in the documentation
18
+ and/or other materials provided with the distribution.
19
+
20
+ 3. Neither the name of the copyright holder nor the names of its
21
+ contributors may be used to endorse or promote products derived from
22
+ this software without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ License-File: LICENSE
35
+ Requires-Python: >=3.10
36
+ Requires-Dist: blosc2
37
+ Requires-Dist: cogent3>=2025.5.8a2
38
+ Requires-Dist: h5py>=3.13.0
39
+ Requires-Dist: hdf5plugin>=5.1.0
40
+ Requires-Dist: numpy>=2.2.4
41
+ Requires-Dist: typing-extensions>=4.13.2
42
+ Provides-Extra: dev
43
+ Requires-Dist: nox>=2025.2.9; extra == 'dev'
44
+ Requires-Dist: pytest-cov>=6.1.1; extra == 'dev'
45
+ Requires-Dist: pytest>=8.3.5; extra == 'dev'
46
+ Requires-Dist: ruff>=0.11.5; extra == 'dev'
47
+ Description-Content-Type: text/markdown
48
+
49
+ [![CI](https://github.com/cogent3/cogent3-h5seqs/actions/workflows/ci.yml/badge.svg)](https://github.com/cogent3/cogent3-h5seqs/actions/workflows/ci.yml)
50
+ [![Coverage Status](https://coveralls.io/repos/github/cogent3/cogent3-h5seqs/badge.svg?branch=develop)](https://coveralls.io/github/cogent3/cogent3-h5seqs?branch=develop)
51
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
52
+
53
+ # cogent3-h5seqs: a HDF5 storage driver for cogent3 sequence collections
54
+
55
+ `cogent3-h5seqs` is a sequence storage plug-in for [cogent3](https://cogent3.org). It uses HDF5 as the storage format for biological sequences, supporting both unaligned sequence collections and alignments. Storage can be in memory or on disk and, at present, sequences are compressed using the BLOSC2 compression engine.
56
+
57
+ The advantage of HDF5 is that once primary sequence formats have been converted from text int numpy arrays, loading and manipulating sequence data is fast and very memory efficient.
58
+
59
+ > **Note**
60
+ > The storage only works with the new type `cogent3` `Alignment` and `SequenceCollection` types.
61
+
62
+ ## Installation
63
+
64
+ ```
65
+ pip install cogent3-h5seqs
66
+ ```
67
+
68
+ ## Usage
69
+
70
+ ### Making `cogent3-h5seqs` the default storage
71
+
72
+ Using `cogent3.set_storage_defaults()`, you can set `cogent3-h5seqs` as the default storage. This means whenever a sequence collection is loaded from disk or created in memory, it will use the storage within this package.
73
+
74
+ The following statement makes `cogent3-h5seqs` the default for both unaligned and aligned sequence collections.
75
+
76
+ ```python
77
+ import cogent3
78
+
79
+ cogent3.set_storage_defaults(unaligned_seqs="h5seqs_unaligned",
80
+ aligned_seqs="h5seqs_aligned")
81
+ ```
82
+
83
+ You can undo this setting by
84
+
85
+ ```python
86
+ cogent3.set_storage_defaults(unaligned_seqs=None, aligned_seqs=None)
87
+ ```
88
+
89
+ ### Using `cogent3-h5seqs` as storage per object
90
+
91
+ You don't have to specify the storage as the default for all instances, but can do it on a per object basis.
92
+
93
+ ```python
94
+ coll = cogent3.load_unaligned_seqs(some_path,
95
+ moltype="dna",
96
+ new_type=True,
97
+ storage_backend="h5seqs_unaligned")
98
+ ```
99
+
100
+ or, for alignments.
101
+
102
+ ```python
103
+ aln = cogent3.load_aligned_seqs(some_path,
104
+ moltype="dna",
105
+ new_type=True,
106
+ storage_backend="h5seqs_aligned")
107
+ ```
108
+
109
+ The same values can also be provided to the `make_unaligned_seqs()`, `make_aligned_seqs()` functions in `cogent3`.
110
+
111
+ ### Saving storage to disk
112
+
113
+ `cogent3-h5seqs` supports writing to disk, and employs the filename suffix `.c3h5u` for unaligned sequences and `.c3h5a` for aligned sequences. This will work whether your current object is using `cogent3-h5seqs` for storage or not. For example
114
+
115
+ ```python
116
+ import cogent3
117
+
118
+ sample_aln = cogent3.get_dataset("brca1") # using the cogent3 builtin storage
119
+ outpath = "~/Desktop/alignment_output.c3h5a"
120
+ sample_aln.write(outpath) # writes out as cogent3-h5seqs HDF5 storage
121
+ ```
122
+
123
+ For a sequence collection, do the following.
124
+
125
+ ```python
126
+ sample_coll = cogent3.get_dataset("brca1").degap()
127
+ # Note the different suffix
128
+ outpath = "~/Desktop/alignment_output.c3h5u"
129
+ sample_coll.write(outpath) # writes out as cogent3-h5seqs HDF5 storage
130
+ ```
131
+ ### Loading storage from disk
132
+
133
+ `cogent3` correctly directs to `cogent3-h5seqs` for loading based on the filename suffix.
134
+
135
+ ```python
136
+ inpath = "~/Desktop/alignment_output.c3h5u"
137
+ sample_coll = cogent3.load_unaligned_seqs(inpath, moltype="dna", new_type=True)
138
+ ```
139
+
140
+ > **Note**
141
+ > You cannot write an alignment instance to an unaligned storage type or vice versa. Nor can you read into the different types.
@@ -0,0 +1,93 @@
1
+ [![CI](https://github.com/cogent3/cogent3-h5seqs/actions/workflows/ci.yml/badge.svg)](https://github.com/cogent3/cogent3-h5seqs/actions/workflows/ci.yml)
2
+ [![Coverage Status](https://coveralls.io/repos/github/cogent3/cogent3-h5seqs/badge.svg?branch=develop)](https://coveralls.io/github/cogent3/cogent3-h5seqs?branch=develop)
3
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
4
+
5
+ # cogent3-h5seqs: a HDF5 storage driver for cogent3 sequence collections
6
+
7
+ `cogent3-h5seqs` is a sequence storage plug-in for [cogent3](https://cogent3.org). It uses HDF5 as the storage format for biological sequences, supporting both unaligned sequence collections and alignments. Storage can be in memory or on disk and, at present, sequences are compressed using the BLOSC2 compression engine.
8
+
9
+ The advantage of HDF5 is that once primary sequence formats have been converted from text int numpy arrays, loading and manipulating sequence data is fast and very memory efficient.
10
+
11
+ > **Note**
12
+ > The storage only works with the new type `cogent3` `Alignment` and `SequenceCollection` types.
13
+
14
+ ## Installation
15
+
16
+ ```
17
+ pip install cogent3-h5seqs
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ### Making `cogent3-h5seqs` the default storage
23
+
24
+ Using `cogent3.set_storage_defaults()`, you can set `cogent3-h5seqs` as the default storage. This means whenever a sequence collection is loaded from disk or created in memory, it will use the storage within this package.
25
+
26
+ The following statement makes `cogent3-h5seqs` the default for both unaligned and aligned sequence collections.
27
+
28
+ ```python
29
+ import cogent3
30
+
31
+ cogent3.set_storage_defaults(unaligned_seqs="h5seqs_unaligned",
32
+ aligned_seqs="h5seqs_aligned")
33
+ ```
34
+
35
+ You can undo this setting by
36
+
37
+ ```python
38
+ cogent3.set_storage_defaults(unaligned_seqs=None, aligned_seqs=None)
39
+ ```
40
+
41
+ ### Using `cogent3-h5seqs` as storage per object
42
+
43
+ You don't have to specify the storage as the default for all instances, but can do it on a per object basis.
44
+
45
+ ```python
46
+ coll = cogent3.load_unaligned_seqs(some_path,
47
+ moltype="dna",
48
+ new_type=True,
49
+ storage_backend="h5seqs_unaligned")
50
+ ```
51
+
52
+ or, for alignments.
53
+
54
+ ```python
55
+ aln = cogent3.load_aligned_seqs(some_path,
56
+ moltype="dna",
57
+ new_type=True,
58
+ storage_backend="h5seqs_aligned")
59
+ ```
60
+
61
+ The same values can also be provided to the `make_unaligned_seqs()`, `make_aligned_seqs()` functions in `cogent3`.
62
+
63
+ ### Saving storage to disk
64
+
65
+ `cogent3-h5seqs` supports writing to disk, and employs the filename suffix `.c3h5u` for unaligned sequences and `.c3h5a` for aligned sequences. This will work whether your current object is using `cogent3-h5seqs` for storage or not. For example
66
+
67
+ ```python
68
+ import cogent3
69
+
70
+ sample_aln = cogent3.get_dataset("brca1") # using the cogent3 builtin storage
71
+ outpath = "~/Desktop/alignment_output.c3h5a"
72
+ sample_aln.write(outpath) # writes out as cogent3-h5seqs HDF5 storage
73
+ ```
74
+
75
+ For a sequence collection, do the following.
76
+
77
+ ```python
78
+ sample_coll = cogent3.get_dataset("brca1").degap()
79
+ # Note the different suffix
80
+ outpath = "~/Desktop/alignment_output.c3h5u"
81
+ sample_coll.write(outpath) # writes out as cogent3-h5seqs HDF5 storage
82
+ ```
83
+ ### Loading storage from disk
84
+
85
+ `cogent3` correctly directs to `cogent3-h5seqs` for loading based on the filename suffix.
86
+
87
+ ```python
88
+ inpath = "~/Desktop/alignment_output.c3h5u"
89
+ sample_coll = cogent3.load_unaligned_seqs(inpath, moltype="dna", new_type=True)
90
+ ```
91
+
92
+ > **Note**
93
+ > You cannot write an alignment instance to an unaligned storage type or vice versa. Nor can you read into the different types.
@@ -0,0 +1,34 @@
1
+ import os
2
+
3
+ import nox
4
+
5
+ _py_versions = range(10, 14)
6
+ # on python >= 3.12 this will improve speed of test coverage a lot
7
+ os.environ["COVERAGE_CORE"] = "sysmon"
8
+
9
+
10
+ @nox.session(python=[f"3.{v}" for v in _py_versions])
11
+ def test(session):
12
+ session.install("-e.[dev]")
13
+ # doctest modules within cogent3/app
14
+ session.run(
15
+ "pytest",
16
+ "-s",
17
+ "-x",
18
+ ".",
19
+ *session.posargs,
20
+ )
21
+
22
+
23
+ @nox.session(python=[f"3.{v}" for v in _py_versions])
24
+ def test_cov(session):
25
+ session.install("-e.[dev]")
26
+ # doctest modules within cogent3/app
27
+ session.run(
28
+ "pytest",
29
+ "--cov-report",
30
+ "html",
31
+ "--cov",
32
+ "cogent3_h5seqs",
33
+ ".",
34
+ )