diff --git a/Cargo.toml b/Cargo.toml index bb40831..9892087 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,8 @@ name = "biobear" [dependencies] arrow = { version = "52.1.0", features = ["pyarrow"] } -datafusion = "40" -exon = { version = "0.30.0", features = ["default"] } +datafusion = "41" +exon = { version = "0.31.0", features = ["default"] } pyo3 = "0.21.2" tokio = { version = "1", features = ["rt"] } noodles = { version = "0.79", features = ["core"] } diff --git a/src/bam_reader.rs b/src/bam_reader.rs index fcd6d2e..90c2087 100644 --- a/src/bam_reader.rs +++ b/src/bam_reader.rs @@ -71,7 +71,7 @@ impl BamIndexedReader { config = config.with_batch_size(batch_size); } - let ctx = ExonSession::with_config_exon(config); + let ctx = ExonSession::with_config_exon(config).map_err(BioBearError::from)?; let df = self._runtime.block_on(async { ctx.sql(&format!( diff --git a/src/bcf_reader.rs b/src/bcf_reader.rs index 5f5d3f0..f9287dc 100644 --- a/src/bcf_reader.rs +++ b/src/bcf_reader.rs @@ -68,7 +68,7 @@ impl BCFIndexedReader { config = config.with_batch_size(batch_size); } - let ctx = ExonSession::with_config_exon(config); + let ctx = ExonSession::with_config_exon(config).map_err(BioBearError::from)?; let region = Region::from_str(region).map_err(|e| { io::Error::new(io::ErrorKind::Other, format!("Error parsing region: {e}")) diff --git a/src/exon_reader.rs b/src/exon_reader.rs index fb0b1e1..e31480e 100644 --- a/src/exon_reader.rs +++ b/src/exon_reader.rs @@ -48,7 +48,7 @@ impl ExonReader { config = config.with_batch_size(batch_size); } - let ctx = ExonSession::with_config_exon(config); + let ctx = ExonSession::with_config_exon(config).map_err(BioBearError::from)?; let df = rt.block_on(async { ctx.session diff --git a/src/session_context.rs b/src/session_context.rs index 443cb7a..0c64ba0 100644 --- a/src/session_context.rs +++ b/src/session_context.rs @@ -34,19 +34,13 @@ pub struct BioBearSessionContext { ctx: ExonSession, } -impl Default for BioBearSessionContext { - fn default() -> Self { - Self { - ctx: ExonSession::new_exon(), - } - } -} - #[pymethods] impl BioBearSessionContext { #[new] - fn new() -> PyResult { - Ok(Self::default()) + fn try_new() -> PyResult { + let ctx = ExonSession::new_exon().unwrap(); + + Ok(Self { ctx }) } /// Read one or more VCF files from the given path. @@ -346,10 +340,10 @@ impl BioBearSessionContext { #[pyfunction] pub fn connect() -> PyResult { - Ok(BioBearSessionContext::default()) + BioBearSessionContext::try_new() } #[pyfunction] pub fn new_session() -> PyResult { - Ok(BioBearSessionContext::default()) + BioBearSessionContext::try_new() } diff --git a/src/vcf_reader.rs b/src/vcf_reader.rs index 61b4898..f41f7a1 100644 --- a/src/vcf_reader.rs +++ b/src/vcf_reader.rs @@ -69,7 +69,7 @@ impl VCFIndexedReader { config = config.with_batch_size(batch_size); } - let ctx = ExonSession::with_config_exon(config); + let ctx = ExonSession::with_config_exon(config).map_err(BioBearError::from)?; let region = Region::from_str(region).map_err(|e| { io::Error::new(