diff --git a/Cargo.lock b/Cargo.lock index c5233c9..a4c0f09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -401,9 +401,7 @@ dependencies = [ [[package]] name = "noodles" -version = "0.73.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e23ca72bd6a19e744f7f887434e2adc1d3eccdedbe619b4a45e8743656fd08c" +version = "0.74.0" dependencies = [ "noodles-bam", "noodles-bgzf", @@ -415,8 +413,6 @@ dependencies = [ [[package]] name = "noodles-bam" version = "0.63.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ede0b1e0b8e0e03f21c692ad38473dfe95c3650317650205c29c9a682c4a5a6" dependencies = [ "bit-vec", "bstr", @@ -432,8 +428,6 @@ dependencies = [ [[package]] name = "noodles-bgzf" version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13f54d4840fd26ed94103ded9524aa5fdd757255a556f24653d162c0a45c47e8" dependencies = [ "byteorder", "bytes", @@ -445,8 +439,6 @@ dependencies = [ [[package]] name = "noodles-core" version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a8c6b020d1205abef2b0fab4463a6c5ecc3c8f4d561ca8b0d1a42323376200" dependencies = [ "bstr", ] @@ -454,8 +446,6 @@ dependencies = [ [[package]] name = "noodles-csi" version = "0.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb1618ca2aa88662d387197a188686105d6b5e25f6959c52b766276cbfc4620" dependencies = [ "bit-vec", "byteorder", @@ -466,9 +456,7 @@ dependencies = [ [[package]] name = "noodles-gff" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44a4046d86db9371044d6581ae5293556bf236e564ae26f661998acc100a2d39" +version = "0.33.0" dependencies = [ "indexmap", "noodles-bgzf", @@ -480,8 +468,6 @@ dependencies = [ [[package]] name = "noodles-sam" version = "0.60.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec6452e8ed9f20ef043dce35e09ed58f1c34834cd941e987458a66e8fa66fa0" dependencies = [ "bitflags", "bstr", diff --git a/Cargo.toml b/Cargo.toml index 809e389..e576b22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,8 +20,8 @@ flate2 = "1.0.14" git-testament = "0.2.0" interval-tree = { git = "https://github.com/zaeleus/interval-tree.git", rev = "e303d7254d53de5c418d6079d4b66c30c10958d4" } mimalloc = { version = "0.1.26", default-features = false } -noodles = { version = "0.73.0", features = ["bam", "bgzf", "core", "gff", "sam"] } -noodles-bgzf = { version = "0.30.0", features = ["libdeflate"] } +noodles = { path = "../noodles/noodles", version = "0.74.0", features = ["bam", "bgzf", "core", "gff", "sam"] } +noodles-bgzf = { path = "../noodles/noodles-bgzf", version = "0.30.0", features = ["libdeflate"] } thiserror = "1.0.40" tracing = "0.1.25" tracing-subscriber = "0.3.3" diff --git a/src/lib.rs b/src/lib.rs index e6e4097..c48b871 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -70,14 +70,16 @@ pub fn read_features( where R: BufRead, { + use noodles::gff::lazy::{record::attributes::field::Value, Line}; + let mut features: HashMap> = HashMap::new(); info!("reading features"); - let mut line = noodles::gff::lazy::Line::default(); + let mut line = Line::default(); while reader.read_lazy_line(&mut line)? != 0 { - let noodles::gff::lazy::Line::Record(ref record) = line else { + let Line::Record(ref record) = line else { continue; }; @@ -86,9 +88,9 @@ where } let reference_sequence_name = record.reference_sequence_name(); - let start = record.start().try_into()?; - let end = record.end().try_into()?; - let strand = record.strand().try_into()?; + let start = record.start()?; + let end = record.end()?; + let strand = record.strand()?; let feature = Feature::new(reference_sequence_name.into(), start, end, strand); @@ -96,7 +98,11 @@ where let id = attributes .get(feature_id) .ok_or_else(|| ReadFeaturesError::MissingAttribute(feature_id.into()))? - .map_err(|_| ReadFeaturesError::InvalidAttribute(feature_id.into()))?; + .map_err(|_| ReadFeaturesError::InvalidAttribute(feature_id.into())) + .and_then(|value| match value { + Value::String(s) => Ok(s), + Value::Array(_) => Err(ReadFeaturesError::InvalidAttribute(feature_id.into())), + })?; let list = features.entry(id.into()).or_default();