stratiphy 0.1.5

Phenotype-driven identification of disease subgroups
Documentation
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClusteringWorkflowResult {
    #[prost(double, repeated, tag = "1")]
    pub affinity_matrix: ::prost::alloc::vec::Vec<f64>,
    #[prost(message, repeated, tag = "2")]
    pub cluster_labels: ::prost::alloc::vec::Vec<clustering_workflow_result::ClusterLabels>,
    #[prost(uint32, repeated, tag = "3")]
    pub sort_order: ::prost::alloc::vec::Vec<u32>,
    #[prost(message, optional, tag = "4")]
    pub gap_values: ::core::option::Option<GapValues>,
    #[prost(message, optional, tag = "5")]
    pub split_check: ::core::option::Option<SplitCheck>,
    #[prost(message, repeated, tag = "6")]
    pub term_associations: ::prost::alloc::vec::Vec<clustering_workflow_result::TermAssociations>,
}
/// Nested message and enum types in `ClusteringWorkflowResult`.
pub mod clustering_workflow_result {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct ClusterLabels {
        #[prost(uint32, tag = "1")]
        pub k: u32,
        #[prost(uint32, repeated, tag = "2")]
        pub labels: ::prost::alloc::vec::Vec<u32>,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct TermAssociations {
        #[prost(uint32, tag = "1")]
        pub k: u32,
        #[prost(message, repeated, tag = "2")]
        pub associations: ::prost::alloc::vec::Vec<super::TermAssociation>,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GapValues {
    #[prost(map = "uint32, double", tag = "1")]
    pub log_wk_data: ::std::collections::HashMap<u32, f64>,
    #[prost(message, repeated, tag = "2")]
    pub log_wk_rand: ::prost::alloc::vec::Vec<gap_values::LogWkRand>,
}
/// Nested message and enum types in `GapValues`.
pub mod gap_values {
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct LogWkRand {
        #[prost(uint32, tag = "1")]
        pub k: u32,
        #[prost(double, repeated, tag = "2")]
        pub values: ::prost::alloc::vec::Vec<f64>,
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SplitCheck {
    #[prost(bool, tag = "1")]
    pub should_split: bool,
    #[prost(double, tag = "2")]
    pub split_proba: f64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TermAssociation {
    /// CURIE of the tested ontology term (e.g. `HP:0001250` for Seizure).
    #[prost(string, tag = "1")]
    pub term_id: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "2")]
    pub counts: ::prost::alloc::vec::Vec<term_association::TermCounts>,
    /// Results of the association test.
    ///
    /// Should be unset if no testing was performed.
    #[prost(message, optional, tag = "3")]
    pub nominal_test: ::core::option::Option<term_association::NominalTestResult>,
    /// p value after multiple testing correction (MTC).
    ///
    /// Unset if no MTC procedure was performed.
    #[prost(message, optional, tag = "4")]
    pub corrected_test: ::core::option::Option<term_association::CorrectedTestResult>,
    /// The minimal effect detectable from the current sample size
    /// given \alpha and \beta.
    ///
    /// The value should be in \[0, 1\], where 0. and 1. correspond
    /// to the highest and lowest sensitivity, respectively.
    #[prost(double, optional, tag = "5")]
    pub sensitivity: ::core::option::Option<f64>,
    /// The strength of the association between the observation state
    /// and the clusters.
    ///
    /// The value should be in \[0, 1\] where 0. and 1. correspond
    /// to the lowest and highest effect, respectively.
    ///
    /// The value is `NaN` if it is impossible to quantify the association,
    /// e.g. due to zero counts in at least one row/column margin cell.
    #[prost(double, optional, tag = "6")]
    pub effect: ::core::option::Option<f64>,
}
/// Nested message and enum types in `TermAssociation`.
pub mod term_association {
    /// cluster_id to term count.
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct TermCounts {
        #[prost(uint32, tag = "1")]
        pub cluster_id: u32,
        #[prost(message, repeated, tag = "2")]
        pub counts: ::prost::alloc::vec::Vec<term_counts::TermCount>,
    }
    /// Nested message and enum types in `TermCounts`.
    pub mod term_counts {
        /// The count of individuals with given observation state.
        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
        pub struct TermCount {
            #[prost(enumeration = "super::super::ObservationState", tag = "1")]
            pub state: i32,
            #[prost(uint32, tag = "2")]
            pub count: u32,
        }
    }
    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
    pub struct NominalTestResult {
        /// The nominal p value.
        /// Should be set if the test was performed.
        #[prost(double, tag = "1")]
        pub pval: f64,
        /// The type of the performed test.
        #[prost(oneof = "nominal_test_result::Kind", tags = "11, 12, 13")]
        pub kind: ::core::option::Option<nominal_test_result::Kind>,
    }
    /// Nested message and enum types in `NominalTestResult`.
    pub mod nominal_test_result {
        /// The Fisher exact test.
        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
        pub struct FisherExactTest {}
        /// Fisher exact test with Monte Carlo sampling.
        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
        pub struct FisherExactMcTest {
            /// The number of Monte Carlo resampling iterations.
            #[prost(uint64, tag = "1")]
            pub n_iter: u64,
        }
        /// Chi square test
        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
        pub struct ChiSquareTest {
            /// The degrees of freedom.
            #[prost(uint32, tag = "1")]
            pub df: u32,
        }
        /// The type of the performed test.
        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
        pub enum Kind {
            #[prost(message, tag = "11")]
            Fet(FisherExactTest),
            #[prost(message, tag = "12")]
            FetMc(FisherExactMcTest),
            #[prost(message, tag = "13")]
            Chi2(ChiSquareTest),
        }
    }
    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
    pub struct CorrectedTestResult {
        #[prost(double, tag = "1")]
        pub pval: f64,
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TermAssociationMetadata {
    /// Alpha - the type 1 error parameter.
    #[prost(double, optional, tag = "1")]
    pub alpha: ::core::option::Option<f64>,
    /// Beta - the type 2 error parameter.
    #[prost(double, optional, tag = "2")]
    pub beta: ::core::option::Option<f64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClusteringWorkflowMetadata {
    /// Semantic versioning identifier, e.g. `0.3.0`.
    #[prost(string, tag = "1")]
    pub stratiphy_version: ::prost::alloc::string::String,
    /// HPO release identifier, e.g. `v2026-02-16`.
    /// Should always be present.
    #[prost(string, tag = "2")]
    pub hpo_version: ::prost::alloc::string::String,
    /// Metadata of the term-cluster association tests.
    #[prost(message, optional, tag = "3")]
    pub association_metadata: ::core::option::Option<TermAssociationMetadata>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StratiphyResult {
    #[prost(message, optional, tag = "1")]
    pub clustering_result: ::core::option::Option<ClusteringWorkflowResult>,
    #[prost(message, optional, tag = "2")]
    pub cohort: ::core::option::Option<super::stratiphy_model::Cohort>,
    #[prost(message, optional, tag = "3")]
    pub meta_data: ::core::option::Option<ClusteringWorkflowMetadata>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ObservationState {
    Unspecified = 0,
    Present = 1,
    Excluded = 2,
}
impl ObservationState {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "OBSERVATION_STATE_UNSPECIFIED",
            Self::Present => "OBSERVATION_STATE_PRESENT",
            Self::Excluded => "OBSERVATION_STATE_EXCLUDED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "OBSERVATION_STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "OBSERVATION_STATE_PRESENT" => Some(Self::Present),
            "OBSERVATION_STATE_EXCLUDED" => Some(Self::Excluded),
            _ => None,
        }
    }
}