Skip to content

Commit

Permalink
chore: bump dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Nov 20, 2024
1 parent f7b07f6 commit d10d344
Show file tree
Hide file tree
Showing 13 changed files with 799 additions and 1,196 deletions.
1,846 changes: 725 additions & 1,121 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ clap-verbosity-flag = "2.2"
clap = { version = "4.5", features = ["derive", "help", "env"] }
console = "0.15"
csv = "1.3"
derive_more = "0.99"
env_logger = "0.10"
derive_more = { version = "1.0", features = ["full"] }
env_logger = "0.11"
fastobo = "0.15.2"
fastrand = "2.1"
flate2 = "1.0"
hpo = "0.8"
hpo = "0.11"
indexmap = { version = "2.6", features = ["serde"] }
indicatif = { version = "0.17", features = ["rayon"] }
itertools = "0.13"
Expand All @@ -36,13 +36,13 @@ serde_with = { version = "3.9", features=["alloc", "macros", "indexmap_2"], defa
shellexpand = "3.0"
strum_macros = "0.26"
strum = { version = "0.26", features = ["strum_macros", "derive"] }
tantivy = "0.21.1"
tempdir = "0.3.7"
tantivy = "0.22"
tempdir = "0.3"
thiserror = "2.0"
tracing = "0.1"
tracing-subscriber = "0.3"
utoipa-swagger-ui = { version = "7.1.0", features = ["actix-web"] }
utoipa = { version = "4.2", features = ["actix_extras", "chrono", "indexmap", "preserve_order", "yaml"] }
utoipa-swagger-ui = { version = "8.0", features = ["actix-web"] }
utoipa = { version = "5.2", features = ["actix_extras", "chrono", "indexmap", "preserve_order", "yaml"] }

[build-dependencies]
anyhow = "1.0"
Expand Down
8 changes: 6 additions & 2 deletions src/algos/phenomizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ fn score_dir(qs: &HpoGroup, ds: &HpoGroup, o: &Ontology, s: &impl Similarity) ->
#[cfg(test)]
mod test {
use super::*;
use hpo::{annotations::OmimDiseaseId, term::HpoGroup, HpoTermId, Ontology};
use hpo::{
annotations::{Disease as _, OmimDiseaseId},
term::HpoGroup,
HpoTermId, Ontology,
};

fn load_hpo() -> Result<Ontology, anyhow::Error> {
Ok(Ontology::from_standard("tests/data/hpo")?)
Expand Down Expand Up @@ -84,7 +88,7 @@ mod test {

let score = score(&prepare(query), &hpo_marfan, &hpo);

assert!((score - 1.757_194).abs() < 0.00001, "score = {score}");
assert!((score - 1.756_347).abs() < 0.00001, "score = {score}");

Ok(())
}
Expand Down
28 changes: 14 additions & 14 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ pub fn load_hpo<P: AsRef<std::path::Path>>(path: P) -> Result<hpo::Ontology, any
pub enum IcBasedOn {
/// Compute information content based on gene.
#[default]
#[display(fmt = "gene")]
#[display("gene")]
Gene,
/// Compute information content based on OMIM disease.
#[display(fmt = "omim")]
#[display("omim")]
Omim,
}

Expand Down Expand Up @@ -105,29 +105,29 @@ impl FromStr for IcBasedOn {
#[serde(rename_all = "kebab-case")]
pub enum SimilarityMethod {
/// "Distance" similarity.
#[display(fmt = "distance")]
#[display("distance")]
DistanceGene,
/// Graph IC similarity.
#[display(fmt = "graph-ic")]
#[display("graph-ic")]
GraphIc,
/// Information coefficient similarity..
#[display(fmt = "information-coefficient")]
#[display("information-coefficient")]
InformationCoefficient,
/// Jiang & Conrath similarity.
#[display(fmt = "jc")]
#[display("jc")]
Jc,
/// Lin similarity..
#[display(fmt = "lin")]
#[display("lin")]
Lin,
/// "Mutation" similarity.
#[display(fmt = "mutation")]
#[display("mutation")]
Mutation,
/// "Relevance" similarity.
#[display(fmt = "relevance")]
#[display("relevance")]
Relevance,
/// Resnik similarity..
#[default]
#[display(fmt = "resnik")]
#[display("resnik")]
Resnik,
}

Expand Down Expand Up @@ -182,13 +182,13 @@ impl FromStr for SimilarityMethod {
pub enum ScoreCombiner {
/// funSimAvg algborithm.
#[default]
#[display(fmt = "fun-sim-avg")]
#[display("fun-sim-avg")]
FunSimAvg,
/// funSimMax algorithm.
#[display(fmt = "fun-sim-max")]
#[display("fun-sim-max")]
FunSimMax,
/// BMA algorithm.
#[display(fmt = "bma")]
#[display("bma")]
Bma,
}

Expand All @@ -197,7 +197,7 @@ impl From<ScoreCombiner> for StandardCombiner {
match val {
ScoreCombiner::FunSimAvg => StandardCombiner::FunSimAvg,
ScoreCombiner::FunSimMax => StandardCombiner::FunSimMax,
ScoreCombiner::Bma => StandardCombiner::Bwa,
ScoreCombiner::Bma => StandardCombiner::Bma,

Check warning on line 200 in src/common.rs

View check run for this annotation

Codecov / codecov/patch

src/common.rs#L200

Added line #L200 was not covered by tests
}
}
}
Expand Down
11 changes: 3 additions & 8 deletions src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,9 @@ pub fn run(args_common: &crate::common::Args, args: &Args) -> Result<(), anyhow:
tracing::info!("args_common = {:?}", &args_common);
tracing::info!("args = {:?}", &args);

if let Some(level) = args_common.verbose.log_level() {
match level {
log::Level::Trace | log::Level::Debug => {
std::env::set_var("RUST_LOG", "debug");
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
}
_ => (),
}
if let Some(log::Level::Trace | log::Level::Debug) = args_common.verbose.log_level() {
std::env::set_var("RUST_LOG", "debug");
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));

Check warning on line 34 in src/convert/mod.rs

View check run for this annotation

Codecov / codecov/patch

src/convert/mod.rs#L32-L34

Added lines #L32 - L34 were not covered by tests
}

tracing::info!("Loading HPO...");
Expand Down
2 changes: 1 addition & 1 deletion src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl Index {
.iter()
.filter_map(fastobo::ast::EntityFrame::as_term)
{
let mut doc = tantivy::Document::default();
let mut doc = tantivy::TantivyDocument::default();

doc.add_field_value(
schema.get_field("term_id")?,
Expand Down
29 changes: 16 additions & 13 deletions src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ pub mod query_result {

/// Struct for storing gene information in the result.
#[derive(
serde::Serialize, serde::Deserialize, PartialEq, Eq, PartialOrd, Ord, Debug, Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Debug,
Clone,
serde::Serialize,
serde::Deserialize,
utoipa::ToSchema,
)]
#[serde_with::skip_serializing_none]
pub struct Gene {
Expand All @@ -65,7 +73,7 @@ pub mod query_result {
}

/// The performed query.
#[derive(serde::Serialize, serde::Deserialize, utoipa::ToSchema, Debug, Clone)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, utoipa::ToSchema)]
#[schema(title = "HpoSimTermGeneQuery")]
pub struct Query {
/// The query HPO terms.
Expand All @@ -75,7 +83,7 @@ pub mod query_result {
}

/// Result container data structure.
#[derive(serde::Serialize, serde::Deserialize, utoipa::ToSchema, Debug, Clone)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, utoipa::ToSchema)]
#[schema(title = "HpoSimTermGeneResult")]
pub struct Result {
/// Version information.
Expand All @@ -87,7 +95,7 @@ pub mod query_result {
}

/// Store score for a record with information on individual terms.
#[derive(serde::Serialize, serde::Deserialize, utoipa::ToSchema, Debug, Clone)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, utoipa::ToSchema)]
#[schema(title = "HpoSimTermGeneResultEntry")]
pub struct ResultEntry {
/// The gene symbol.
Expand All @@ -100,7 +108,7 @@ pub mod query_result {
}

/// Detailed term scores.
#[derive(serde::Serialize, serde::Deserialize, utoipa::ToSchema, Debug, Clone)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, utoipa::ToSchema)]
#[schema(title = "HpoSimTermGeneTermDetails")]
pub struct TermDetails {
/// The query HPO term.
Expand Down Expand Up @@ -258,14 +266,9 @@ pub fn run(args_common: &crate::common::Args, args: &Args) -> Result<(), anyhow:
tracing::info!("args_common = {:?}", &args_common);
tracing::info!("args = {:?}", &args);

if let Some(level) = args_common.verbose.log_level() {
match level {
log::Level::Trace | log::Level::Debug => {
std::env::set_var("RUST_LOG", "debug");
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
}
_ => (),
}
if let Some(log::Level::Trace | log::Level::Debug) = args_common.verbose.log_level() {
std::env::set_var("RUST_LOG", "debug");
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));

Check warning on line 271 in src/query/mod.rs

View check run for this annotation

Codecov / codecov/patch

src/query/mod.rs#L269-L271

Added lines #L269 - L271 were not covered by tests
}

tracing::info!("Loading HPO...");
Expand Down
3 changes: 1 addition & 2 deletions src/server/run/hpo_genes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::{collections::HashMap, sync::Arc};
use actix_web::{
get,
web::{self, Data, Json, Path},
Responder,
};
use hpo::{
annotations::{AnnotationId, Gene, GeneId},
Expand Down Expand Up @@ -143,7 +142,7 @@ async fn handle(
data: Data<Arc<WebServerData>>,
_path: Path<()>,
query: web::Query<Query>,
) -> actix_web::Result<impl Responder, CustomError> {
) -> actix_web::Result<Json<Result>, CustomError> {
let ontology = &data.ontology;
let match_ = query.match_.unwrap_or_default();
let mut result: Vec<ResultEntry> = Vec::new();
Expand Down
5 changes: 2 additions & 3 deletions src/server/run/hpo_omims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ use std::sync::Arc;
use actix_web::{
get,
web::{self, Data, Json, Path},
Responder,
};
use hpo::{
annotations::{OmimDisease, OmimDiseaseId},
annotations::{Disease as _, OmimDisease, OmimDiseaseId},
term::HpoGroup,
Ontology,
};
Expand Down Expand Up @@ -178,7 +177,7 @@ async fn handle(
data: Data<Arc<WebServerData>>,
_path: Path<()>,
query: web::Query<Query>,
) -> actix_web::Result<impl Responder, CustomError> {
) -> actix_web::Result<Json<Result>, CustomError> {
let ontology = &data.ontology;
let match_ = query.match_.unwrap_or_default();
let mut result: Vec<ResultEntry> = Vec::new();
Expand Down
10 changes: 6 additions & 4 deletions src/server/run/hpo_sim/term_gene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ use std::sync::Arc;
use actix_web::{
get,
web::{self, Data, Json, Path},
Responder,
};

use hpo::{annotations::GeneId, term::HpoGroup, HpoTermId, Ontology};

use super::super::CustomError;
use crate::{query, server::run::WebServerData};
use crate::{
query::{self, query_result},
server::run::WebServerData,
};

/// Parameters for `handle`.
///
Expand Down Expand Up @@ -52,15 +54,15 @@ pub struct Query {
operation_id = "hpo_sim_term_gene",
params(Query),
responses(
(status = 200, description = "The query was successful.", body = Result),
(status = 200, description = "The query was successful.", body = query_result::Result),

Check warning on line 57 in src/server/run/hpo_sim/term_gene.rs

View check run for this annotation

Codecov / codecov/patch

src/server/run/hpo_sim/term_gene.rs#L57

Added line #L57 was not covered by tests
)
)]
#[get("/hpo/sim/term-gene")]
async fn handle(
data: Data<Arc<WebServerData>>,
_path: Path<()>,
query: web::Query<Query>,
) -> actix_web::Result<impl Responder, CustomError> {
) -> actix_web::Result<Json<query_result::Result>, CustomError> {
let hpo: &Ontology = &data.ontology;

// Translate strings from the query into an `HpoGroup`.
Expand Down
3 changes: 1 addition & 2 deletions src/server/run/hpo_sim/term_term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::sync::Arc;
use actix_web::{
get,
web::{self, Data, Json, Path},
Responder,
};
use hpo::{
similarity::{Builtins, Similarity},
Expand Down Expand Up @@ -116,7 +115,7 @@ async fn handle(
data: Data<Arc<WebServerData>>,
_path: Path<()>,
query: web::Query<RequestQuery>,
) -> actix_web::Result<impl Responder, CustomError> {
) -> actix_web::Result<Json<Result>, CustomError> {
let ontology: &Ontology = &data.ontology;
let mut result = Vec::new();

Expand Down
Loading

0 comments on commit d10d344

Please sign in to comment.