Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 37 additions & 133 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ name = "maptide"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.17.3", features = ["extension-module", "abi3-py37"] }
pyo3 = { version = "0.24.2", features = ["extension-module", "abi3-py39"] }
noodles = { version = "0.31.1", features = ["core", "bam", "sam", "bgzf"] }
16 changes: 5 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@ use std::fs::File;
mod error;
use error::MapTideError;

#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
#[derive(IntoPyObject, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
struct Coordinate(usize, usize);

impl IntoPy<PyObject> for Coordinate {
fn into_py(self, py: Python<'_>) -> PyObject {
(self.0, self.1).into_py(py)
}
}

impl From<MapTideError> for PyErr {
fn from(e: MapTideError) -> Self {
match e {
Expand Down Expand Up @@ -379,7 +373,7 @@ fn merge_into_base_map(
Ok(ins_maps)
}

#[pyfunction]
#[pyfunction(signature = (bam_path, mapping_quality, base_quality))]
fn all(bam_path: String, mapping_quality: usize, base_quality: usize) -> PyResult<MapTide> {
// Create initial maps
let (mut ref_arrs, mut ins_maps, mut ref_lengths) = init_maps();
Expand Down Expand Up @@ -450,7 +444,7 @@ fn all(bam_path: String, mapping_quality: usize, base_quality: usize) -> PyResul
Ok(base_map)
}

#[pyfunction]
#[pyfunction(signature = (bam_path, bai_path, region, mapping_quality, base_quality))]
fn query(
bam_path: String,
bai_path: Option<String>,
Expand Down Expand Up @@ -571,7 +565,7 @@ fn query(
Ok(base_map)
}

#[pyfunction]
#[pyfunction(signature = (region))]
fn parse_region(region: String) -> PyResult<(String, Option<usize>, Option<usize>)> {
let region: Region = region
.parse()
Expand All @@ -591,7 +585,7 @@ fn parse_region(region: String) -> PyResult<(String, Option<usize>, Option<usize

/// A Python module implemented in Rust.
#[pymodule]
fn maptide(_py: Python, m: &PyModule) -> PyResult<()> {
fn maptide(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(all, m)?)?;
m.add_function(wrap_pyfunction!(query, m)?)?;
m.add_function(wrap_pyfunction!(parse_region, m)?)?;
Expand Down