From c153f2edac461eb455f26e1a8a2e7450c45de9fb Mon Sep 17 00:00:00 2001 From: Mark Chernyshev Date: Fri, 15 Nov 2024 09:58:31 +0100 Subject: [PATCH] small docs changes --- src/CHMMera.jl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/CHMMera.jl b/src/CHMMera.jl index 2997554..b74f199 100644 --- a/src/CHMMera.jl +++ b/src/CHMMera.jl @@ -40,7 +40,7 @@ If the argument `detailed` is false, only `recombinations` is computed. - `mutation_probabilities::Vector{Float64} = [0.0047, 0.01, 0.05, 0.1, 0.15, 0.2]`: A vector of mutation probabilities. - `base_mutation_probability::Float64 = 0.05`: The base mutation probability. Used as starting point for Baum-Welch. - `prior_probability::Float64 = 0.02`: The prior probability of a sequence being chimeric. -- `detailed::Bool = false`: A boolean indicating whether to calculate `startingpoint`, `pathevaluation`, and `logsiteprobabilities`. +- `detailed::Bool = false`: A boolean indicating whether to calculate `pathevaluation` and `logsiteprobabilities`. """ get_recombination_events(queries::Vector{String}, references::Vector{String}; bw::Bool = true, mutation_probabilities::Vector{Float64} = [0.0047, 0.01, 0.05, 0.1, 0.15, 0.2], base_mutation_probability::Float64 = 0.05, prior_probability::Float64 = 0.02, detailed::Bool = false) = get_recombination_events(as_ints.(queries), as_ints.(references), bw, mutation_probabilities, base_mutation_probability, prior_probability, detailed) @@ -48,8 +48,8 @@ get_recombination_events(queries::Vector{String}, references::Vector{String}; bw function get_chimera_probabilities(queries::Vector{Vector{UInt8}}, references::Vector{Vector{UInt8}}, bw::Bool = true, mutation_probabilities::Vector{Float64} = [0.0047, 0.01, 0.05, 0.1, 0.15, 0.2], base_mutation_probability::Float64 = 0.05, prior_probability::Float64 = 0.02) hmm = bw ? ApproximateHMM(vovtomatrix(references), prior_probability) : FullHMM(vovtomatrix(references), mutation_probabilities, prior_probability) mutation_probabilities = bw ? [base_mutation_probability for i in 1:length(references)] : mutation_probabilities - # split query iteration among threads chimera_probabiltiies = zeros(length(queries)) + # split query iteration among threads Threads.@threads for i in eachindex(queries) chimera_probabiltiies[i] = chimeraprobability(queries[i], hmm, copy(mutation_probabilities)) end @@ -61,18 +61,16 @@ function get_recombination_events(queries::Vector{Vector{UInt8}}, references::Ve hmm = bw ? ApproximateHMM(vovtomatrix(references), prior_probability) : FullHMM(vovtomatrix(references), mutation_probabilities, prior_probability) mutation_probabilities = bw ? [base_mutation_probability for i in eachindex(references)] : mutation_probabilities - # split query iteration among threads recomb_type = detailed ? DetailedRecombinationEvents : RecombinationEvents recombination_events = Vector{recomb_type}(undef, length(queries)) - + # split query iteration among threads Threads.@threads for i in eachindex(queries) recombination_events[i] = get_recombination_events(queries[i], hmm, copy(mutation_probabilities), Val(detailed)) end return recombination_events end -# multiple dispatch to figure out if we want starting point or pathevaluation -# no starting point or path evaluation +# no path evaluation or logsiteprobabilities function get_recombination_events(query::Vector{UInt8}, hmm::HMM, mutation_probabilities::Vector{Float64}, ::Val{false}) findrecombinations(query, hmm, mutation_probabilities) end