-
Notifications
You must be signed in to change notification settings - Fork 2
/
lib.rs
35 lines (33 loc) · 1.29 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use clap::Parser;
use kmertools::args::{cli, Cli};
use pybindings::{
cgr::CgrComputer, kmer::KmerGenerator, min::MinimiserGenerator, oligo::OligoComputer,
};
use pyo3::prelude::*;
#[pyfunction]
// TODO: remove after https://github.com/PyO3/maturin/issues/368 is resolved
fn run_cli(_py: Python) -> PyResult<()> {
let args: Vec<_> = std::env::args_os().skip(1).collect();
let parsed_args = Cli::parse_from(&args);
cli(parsed_args);
Ok(())
}
/// Pykmertools: kmertools python wrapper
/// Modules:
/// OligoComputer - computing oligonucleotide frequency vectors
/// from DNA sequences
/// CgrComputer - computing chaos game representations
/// for DNA sequences
/// KmerGenerator - an iterator object to generate k-mers
/// as (forward, reverse) numeric kmer tuples
/// MinimiserGenerator - an iterator object to iterate minimisers
/// as (kmer, start, end) numeric minimiser tuples
#[pymodule]
fn pykmertools(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<OligoComputer>()?;
m.add_class::<CgrComputer>()?;
m.add_class::<KmerGenerator>()?;
m.add_class::<MinimiserGenerator>()?;
m.add_function(wrap_pyfunction!(run_cli, m)?)?;
Ok(())
}