-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from databio/dev
0.2.0 Release - Gibson Les Paul
- Loading branch information
Showing
51 changed files
with
1,379 additions
and
516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ bin/ | |
|
||
.DS_Store | ||
.Rhistory | ||
/gtars/tests/data/out/region_scoring_count.csv.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Copyright 2024 gtars authors | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Copyright 2024 gtars authors | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
# gtars | ||
This is a python wrapper around the `gtars` crate. It provides an easy interface for using `gtars` in python. It is currently in early development, and as such, it does not have a lot of functionality yet, but new tools are being worked on right now. | ||
|
||
## Installation | ||
You can get `gtars` from PyPI: | ||
```bash | ||
pip install gtars | ||
``` | ||
This is a Python package that wraps the `gtars` crate so you can call gtars code from Python. | ||
|
||
Documentation for Python bindings is hosted at: https://docs.bedbase.org/gtars/ | ||
|
||
## Brief instructions | ||
|
||
## Usage | ||
Import the package, and use the tools: | ||
```python | ||
import gtars as gt | ||
To install the development version, you'll have to build it locally. Build Python bindings like this: | ||
|
||
gt.prune_universe(...) | ||
```console | ||
cd bindings/python | ||
maturin build --interpreter 3.11 --release | ||
``` | ||
## Developer docs | ||
Write the develop docs here... | ||
|
||
Then install the local wheel that was just built: | ||
|
||
```console | ||
gtars_version=`grep '^version =' Cargo.toml | cut -d '"' -f 2` | ||
python_version=$(python --version | awk '{print $2}' | cut -d '.' -f1-2 | tr -d '.') | ||
wheel_path=$(find target/wheels/gtars-${gtars_version}-cp${python_version}-cp${python_version}-*.whl) | ||
pip install --force-reinstall ${wheel_path} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .gtars.digests import * # noqa: F403 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// This is intended to provide minimal Python bindings to functions in the `digests` module of the `gtars` crate. | ||
|
||
use pyo3::prelude::*; | ||
use gtars::digests::{sha512t24u, md5, DigestResult}; | ||
|
||
#[pyfunction] | ||
pub fn sha512t24u_digest(readable: &str) -> String { | ||
return sha512t24u(readable); | ||
} | ||
|
||
#[pyfunction] | ||
pub fn md5_digest(readable: &str) -> String { | ||
return md5(readable); | ||
} | ||
|
||
#[pyfunction] | ||
pub fn digest_fasta(fasta: &str) -> PyResult<Vec<PyDigestResult>> { | ||
match gtars::digests::digest_fasta(fasta) { | ||
Ok(digest_results) => { | ||
let py_digest_results: Vec<PyDigestResult> = digest_results.into_iter().map(PyDigestResult::from).collect(); | ||
Ok(py_digest_results) | ||
}, | ||
Err(e) => Err(PyErr::new::<pyo3::exceptions::PyIOError, _>(format!("Error processing FASTA file: {}", e))), | ||
} | ||
} | ||
|
||
#[pyclass] | ||
#[pyo3(name="DigestResult")] | ||
pub struct PyDigestResult { | ||
#[pyo3(get,set)] | ||
pub id: String, | ||
#[pyo3(get,set)] | ||
pub length: usize, | ||
#[pyo3(get,set)] | ||
pub sha512t24u: String, | ||
#[pyo3(get,set)] | ||
pub md5: String | ||
} | ||
|
||
#[pymethods] | ||
impl PyDigestResult { | ||
fn __repr__(&self) -> String { | ||
format!("<DigestResult for {}>", self.id) | ||
} | ||
|
||
fn __str__(&self) -> PyResult<String> { | ||
Ok(format!("DigestResult for sequence {}\n length: {}\n sha512t24u: {}\n md5: {}", self.id, self.length, self.sha512t24u, self.md5)) | ||
} | ||
} | ||
|
||
impl From<DigestResult> for PyDigestResult { | ||
fn from(value: DigestResult) -> Self { | ||
PyDigestResult { | ||
id: value.id, | ||
length: value.length, | ||
sha512t24u: value.sha512t24u, | ||
md5: value.md5 | ||
} | ||
} | ||
} | ||
|
||
// This represents the Python module to be created | ||
#[pymodule] | ||
pub fn digests(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { | ||
m.add_function(wrap_pyfunction!(sha512t24u_digest, m)?)?; | ||
m.add_function(wrap_pyfunction!(md5_digest, m)?)?; | ||
m.add_function(wrap_pyfunction!(digest_fasta, m)?)?; | ||
m.add_class::<PyDigestResult>()?; | ||
Ok(()) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# gtars | ||
|
||
This is an R package that wraps the `gtars` Rust crate so you can call gtars code from R. | ||
|
||
## Brief instructions | ||
|
||
To install the development version, you'll have to build it locally. Build R bindings like this: | ||
|
||
```console | ||
cd bindings | ||
R CMD build r | ||
``` | ||
|
||
Then install the package that was just built: | ||
|
||
```console | ||
R CMD INSTALL gtars_0.0.1.tar.gz | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = 'gtars-r' | ||
version = '0.1.0' | ||
version = '0.2.0' | ||
edition = '2021' | ||
|
||
[lib] | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.