diff --git a/Cargo.toml b/Cargo.toml index e949af6..9279a5a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,6 @@ chrono = "0.4" enum-map = "2.4" flate2 = "1.0" lazy_static = "1.4" -linked-hash-map = { version = "0.5", features = ["serde", "serde_impl"] } log = "0.4" md-5 = "0.10" nom = "7.1" @@ -29,18 +28,19 @@ quick_cache = "0.3" regex = "1.7" rustc-hash = "1.1" seqrepo = { version = "0.5" } -serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" +serde = { version = "1.0", features = ["derive"] } thiserror = "1.0" +indexmap = { version = "1.9.3", features = ["serde"] } [dev-dependencies] +anyhow = "1.0" +criterion = "0.5" csv = "1.2" env_logger = "0.10" pretty_assertions = "1.3" rstest = "0.17" test-log = "0.2" -criterion = "0.5" -anyhow = "1.0" [[bench]] name = "translate_cds" diff --git a/src/data/cdot/json.rs b/src/data/cdot/json.rs index eefd9d0..8264356 100644 --- a/src/data/cdot/json.rs +++ b/src/data/cdot/json.rs @@ -15,7 +15,7 @@ use crate::{ use bio::data_structures::interval_tree::ArrayBackedIntervalTree; use chrono::NaiveDateTime; -use linked_hash_map::LinkedHashMap; +use indexmap::IndexMap; use seqrepo::{Interface as SeqRepoInterface, SeqRepo}; /// Configurationf or the `data::cdot::Provider`. @@ -105,7 +105,7 @@ impl ProviderInterface for Provider { fn get_assembly_map( &self, assembly: crate::static_data::Assembly, - ) -> linked_hash_map::LinkedHashMap { + ) -> indexmap::IndexMap { self.inner.get_assembly_map(assembly) } @@ -187,16 +187,16 @@ impl ProviderInterface for Provider { /// Data structures used for deserializing from cdot. pub mod models { - use linked_hash_map::LinkedHashMap; + use indexmap::IndexMap; use serde::{Deserialize, Deserializer}; /// Container for a cDot data file. #[derive(Deserialize, Debug, Clone)] pub struct Container { - pub transcripts: LinkedHashMap, + pub transcripts: IndexMap, pub cdot_version: String, pub genome_builds: Vec, - pub genes: LinkedHashMap, + pub genes: IndexMap, } /// Enum for representing the tags for transcripts. @@ -221,7 +221,7 @@ pub mod models { /// `"ENSG00000012048"` for BRCA1. pub gene_version: String, /// Alignments to the different genome builds. - pub genome_builds: LinkedHashMap, + pub genome_builds: IndexMap, /// HGNC identifier, e.g. `"1100"` for BRCA1 which is `HGNC:1100`. #[serde(default)] pub hgnc: Option, @@ -709,8 +709,8 @@ impl TxProvider { REQUIRED_VERSION } - fn get_assembly_map(&self, assembly: Assembly) -> LinkedHashMap { - LinkedHashMap::from_iter( + fn get_assembly_map(&self, assembly: Assembly) -> IndexMap { + IndexMap::from_iter( ASSEMBLY_INFOS[assembly] .sequences .iter() diff --git a/src/data/interface.rs b/src/data/interface.rs index 068688b..1a4dda3 100644 --- a/src/data/interface.rs +++ b/src/data/interface.rs @@ -1,7 +1,7 @@ //! Definition of the interface for accessing the transcript database. use chrono::NaiveDateTime; -use linked_hash_map::LinkedHashMap; +use indexmap::IndexMap; use crate::data::error::Error; use crate::static_data::Assembly; @@ -193,7 +193,7 @@ pub trait Provider { /// # Arguments /// /// * `assembly` - The assembly to build the map for. - fn get_assembly_map(&self, assembly: Assembly) -> LinkedHashMap; + fn get_assembly_map(&self, assembly: Assembly) -> IndexMap; /// Returns the basic information about the gene. /// diff --git a/src/data/uta.rs b/src/data/uta.rs index 9128fd2..d40ae19 100644 --- a/src/data/uta.rs +++ b/src/data/uta.rs @@ -2,7 +2,7 @@ //! //! C.f. https://github.com/biocommons/uta -use linked_hash_map::LinkedHashMap; +use indexmap::IndexMap; use postgres::{Client, NoTls, Row}; use quick_cache::sync::Cache; use std::fmt::Debug; @@ -243,8 +243,8 @@ impl ProviderInterface for Provider { &self.schema_version } - fn get_assembly_map(&self, assembly: Assembly) -> LinkedHashMap { - LinkedHashMap::from_iter( + fn get_assembly_map(&self, assembly: Assembly) -> IndexMap { + IndexMap::from_iter( ASSEMBLY_INFOS[assembly] .sequences .iter() diff --git a/src/data/uta_sr.rs b/src/data/uta_sr.rs index 2d0bb59..b2787ba 100644 --- a/src/data/uta_sr.rs +++ b/src/data/uta_sr.rs @@ -93,7 +93,7 @@ impl ProviderInterface for Provider { fn get_assembly_map( &self, assembly: crate::static_data::Assembly, - ) -> linked_hash_map::LinkedHashMap { + ) -> indexmap::IndexMap { self.inner.get_assembly_map(assembly) } diff --git a/src/mapper/variant.rs b/src/mapper/variant.rs index f617f99..4128140 100644 --- a/src/mapper/variant.rs +++ b/src/mapper/variant.rs @@ -1134,7 +1134,7 @@ mod test { fn get_assembly_map( &self, _assembly: crate::static_data::Assembly, - ) -> linked_hash_map::LinkedHashMap { + ) -> indexmap::IndexMap { panic!("for test use only"); }