-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
first attempts at writing the serializers for the new types PhylogeneticModel and GroupBasedPhylogeneticModel #4010
Draft
mariusneu
wants to merge
16
commits into
oscar-system:master
Choose a base branch
from
mariusneu:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bf3f0b2
first attempts at writing the serializers for the new types Phylogene…
mariusneu 7f08d36
include serialization functions from AlgebraicStatistics
antonydellavecchia d630180
Removed used_params for both types, save_object uses functions instea…
mariusneu 66a6681
Added functions to serialize edges of graphs
mariusneu 6e91a31
Changed indentation from 4 to 2
mariusneu 18bbc4d
Apply suggestions from code review: Save all polynomial rings as type…
mariusneu 637aad8
Changed tpye of root_distribution to Vector. Dirty workaround to allo…
mariusneu 458e28e
Resolved conflicts
mariusneu b3be37e
Changed serialization of Edges to a more efficient way
mariusneu b7ece5d
saving loading working
antonydellavecchia 715d3d0
Some more changes in the serialization file as well as in the seriali…
mariusneu 7ebdb16
jukes cantor model saving and loading
antonydellavecchia fdb6a0b
Changed documentation, removed unneccessary comments
mariusneu 4f6cfeb
Wrote first mini test
mariusneu 8723fc9
Wrote tests to verify serialization on object-identity level
mariusneu dd43585
Changed type of root_distribution entries to QQ in all models. Made t…
mariusneu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,42 @@ | ||||||
@register_serialization_type PhylogeneticModel | ||||||
@register_serialization_type GroupBasedPhylogeneticModel | ||||||
|
||||||
function save_object(s::SerializerState, pm::PhylogeneticModel) | ||||||
save_data_dict(s) do | ||||||
save_typed_object(s, graph(pm), :tree) # already implemented | ||||||
save_object(s, number_states(pm), :states) # already implemented | ||||||
save_typed_object(s, probability_ring(pm), :probability_ring) # already implemented | ||||||
save_object(s, root_distribution(pm), :root_distribution) # needs to be implemented, or we change the entry type to QQFieldElem | ||||||
save_typed_object(s, transition_matrices(pm), :transition_matrices) # needs to be implemented | ||||||
end | ||||||
end | ||||||
|
||||||
function save_object(s::SerializerState, pm::GroupBasedPhylogeneticModel) | ||||||
save_data_dict(s) do | ||||||
save_object(s, phylogenetic_model(pm), :phylomodel) # details see above | ||||||
save_typed_object(s, fourier_ring(pm), :fourier_ring) # already implemented | ||||||
save_typed_object(s, fourier_parameters(pm), :fourier_params) # needs to be implemented | ||||||
save_typed_object(s, group_of_model(pm), :group) # already implemented | ||||||
end | ||||||
end | ||||||
|
||||||
|
||||||
function load_object(s::DeserializerState, g::Type{PhylogeneticModel}) | ||||||
graph = load_object(s, Graph{Directed}, :tree) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here you would need to use
Suggested change
|
||||||
n_states = load_object(s, Int64, :states) | ||||||
prob_ring = load_typed_object(s, :probability_ring) | ||||||
root_distr = load_object(s, Vector, QQ, :root_distribution) | ||||||
params = load_type_params(s, Dict{Edge, MatElem{QQMPolyRingElem}}) | ||||||
trans_matrices = load_typed_object(s, :transition_matrices, params) | ||||||
|
||||||
return PhylogeneticModel(graph, n_states, prob_ring, root_distr, trans_matrices) | ||||||
end | ||||||
|
||||||
function load_object(s::DeserializerState, g::Type{GroupBasedPhylogeneticModel}) | ||||||
phylomodel = load_object(s, PhylogeneticModel, :phylomodel) | ||||||
fourier_ring = load_typed_object(s, :fourier_ring) | ||||||
fourier_params = load_typed_object(s, :fourier_params) | ||||||
group = load_typed_object(s, :group) | ||||||
|
||||||
return GroupBasedPhylogeneticModel(phylomodel, fourier_ring, fourier_params, group) | ||||||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can using save_typed_object here if the type isn't always know, or if your using a vector any because not all entries are the same type you'll need to use a tuple