Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #14

Merged
merged 1 commit into from
Feb 14, 2024
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
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
Loading