Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Update all dependencies to latest versions. This might be necessary to support
Windows.
  • Loading branch information
jakobnissen committed Feb 14, 2024
1 parent 376776b commit f48ff62
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
13 changes: 5 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ name = "pycoverm"
crate-type = ["cdylib"]

[dependencies]
coverm = "0.6.0"
ndarray = "0.13.1"
numpy = "0.12.1"
pyo3 = { version = "0.12.4", features = ["extension-module"] }
rust-htslib = "0.36.0"

[package.metadata.maturin]
requires-dist = ["numpy"]
coverm = "0.7.0"
ndarray = "0.15.6"
numpy = "0.20.0"
pyo3 = { version = "0.20", features = ["extension-module"] }
rust-htslib = "0.45.0"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["maturin>=0.10,<0.11"]
requires = ["maturin>=1.4.0,<2.0", "numpy==0.20.0"]
build-backend = "maturin"
33 changes: 17 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use coverm::{
FlagFilter,
};
use ndarray::Array;
use numpy::convert::ToPyArray;
use numpy::pyo3::IntoPy;
use numpy::ToPyArray;
use pyo3::{prelude::*, wrap_pyfunction};
use rust_htslib::{bam, bam::Read};
use std::collections::HashSet;
Expand Down Expand Up @@ -83,14 +84,16 @@ fn is_bam_sorted(bam_file: &str) -> PyResult<bool> {
/// tuple
/// A tuple whose fist element is a list of the contig names and the second
/// one is a numpy matrix of contig coverages in the input BAM files.
#[pyfunction(
contig_end_exclusion = "75",
min_identity = "0.97",
trim_lower = "0.",
trim_upper = "0.",
contig_set = "None",
threads = "1"
)]
#[pyfunction]
#[pyo3(signature = (
bam_list,
contig_end_exclusion = 75,
min_identity = 0.97,
trim_lower = 0.,
trim_upper = 0.,
contig_set = None,
threads = 1
))]
fn get_coverages_from_bam(
py: Python,
bam_list: Vec<&str>,
Expand All @@ -99,7 +102,7 @@ fn get_coverages_from_bam(
trim_lower: f32,
trim_upper: f32,
contig_set: Option<HashSet<&str>>,
threads: usize,
threads: u16,
) -> (PyObject, PyObject) {
let trim_upper = 1. - trim_upper;
let min_fraction_covered_bases = 0.;
Expand Down Expand Up @@ -166,7 +169,7 @@ fn get_coverages_from_bam(
&mut estimators_and_taker.taker,
&mut estimators_and_taker.estimators,
true,
filter_params.flag_filters,
&filter_params.flag_filters,
threads,
);

Expand Down Expand Up @@ -200,18 +203,16 @@ fn get_coverages_from_bam(
}
(
headers.into_py(py),
matrix
.to_pyarray(Python::acquire_gil().python())
.into_py(py),
matrix.to_pyarray(py).into()
)
}

fn default_return_value(py: Python, n_files: usize) -> (Py<PyAny>, Py<PyAny>) {
(
Vec::<String>::new().into_py(py),
Array::from_elem((0, n_files), 0f32)
.to_pyarray(Python::acquire_gil().python())
.into_py(py),
.to_pyarray(py)
.into(),
)
}

Expand Down

0 comments on commit f48ff62

Please sign in to comment.