Skip to content

Commit

Permalink
small docs changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mchernys committed Nov 15, 2024
1 parent ace74cc commit c153f2e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/CHMMera.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ 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)

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
Expand All @@ -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
Expand Down

4 comments on commit c153f2e

@mchernys
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@mchernys
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@AntonOresten
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/119495

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" c153f2edac461eb455f26e1a8a2e7450c45de9fb
git push origin v0.1.0

Please sign in to comment.