jangevaare / PhyloTrees.jl

Phylogenetic trees in Julia
Other
22 stars 8 forks source link

Parametric nodes #11

Closed claireh93 closed 7 years ago

claireh93 commented 7 years ago

@jangevaare We're interested in using your package, but need to be able to attach a state to nodes (and branches?), which could include simple labels #9, but we're thinking more about phylogenetic state. Is this something you are currently working on, and if not, would it be okay for me to submit a pull request with some code? Thanks.

jangevaare commented 7 years ago

Hi @claireh93. I'm intending on adding labels to the node type in the very near future - perhaps this week. Will this be sufficient for your work?

claireh93 commented 7 years ago

Hi @jangevaare, labels would be helpful but we are aiming on evolving traits along our trees, so need something more general. Essentially we're thinking about turning Node into a parametric type- something like this:

type Node{A}
  in::Vector{Int64}
  out::Vector{Int64}
  state::A
...
end

And then having the default to be a string (i.e. label) or something like that?

jangevaare commented 7 years ago

So the state will not necessarily be a string - correct? I do have some work in progress on labels, which are just Nullable{String}s.

The goal has been to keep Node and Branch objects as basic as possible, and anything extra (sequence data for example), is kept separate. I'm not sure if states here are best handled like labels, or like sequence data. Do you know what is done in other software?

Would love to hear more of your thoughts on this.

edit: I've pushed 0bb00d70002689d672a2c1a713177bf8e2a2a88d for you to check out. It doesn't really do anything yet except add some utilities for reading and writing labels.

richardreeve commented 7 years ago

Hi @jangevaare, I'm involved in this a bit too, but @claireh93 noticed that BioJulia/Bio.jl's Phylogeny type has parameterised Node and Branch types, which seems very handy, but the code is otherwise much less well developed. Given the traits evolve along the tree (as does the sequence, obviously), it seemed to make sense to work that way. Standard flat file tree formats also seem to maintain the association between node/branch parameters and the nodes/branches themselves - probably to avoid errors.

Why have you decided to keep them lightweight? What advantages do you gain?

jangevaare commented 7 years ago

@richardreeve @claireh93 I'm happy to add in parametric branches and nodes. I don't think it would require too much effort, and I do see the benefit in avoiding errors when it comes to likelihood calculations and any other future uses.

To understand some of the initial design decisions here, you could check out my main project here. I started developing PhyloTrees.jl out of some requirements for this main project.

The ultimate goal here is having this package serve as a full suite of tools for phylogenetic tree simulation and inference in Julia... so I'm happy to take these suggestions while I work towards that!

richardreeve commented 7 years ago

That looks very cool. I obviously don't understand the full idea after a quick glance, but I work a lot with the World Reference Lab for FMDV, and I have wondered whether there was an easy was of simulating the evolution of the virus for the 2001 outbreak. It looks like I have the answer!

Anyway, @claireh93 is going to be working on analysing the biodiversity of a simulated ecosystem, with phylogenetically evolved traits of families of species, and we're looking for something to make that easier to start work on. This looks like an excellent kick off point. If you're happy to add in parametric nodes, please go ahead, otherwise (or in any event) I'm confident @claireh93 can be persuaded to help ;)

jangevaare commented 7 years ago

Nodes and branches are now parametric. In the near future I hope to have both parametric, and non-parametric nodes and branches... allowing trees to be built with say, parametric nodes and non-parametric branches.

I will also likely pull some of my phylogenetic inference and simulation stuff into a separate package, leaving PhyloTrees as just the basics for working with phylogenetic trees. I noticed it's looking a little cluttered!

richardreeve commented 7 years ago

Great! I was going to say "don't move things around on our account" but I see you already have... hopefully @claireh93 will be able to have a play with this early next week and see how well it works, but it seems like the right idea to me. Thanks.

Ajax323 commented 4 years ago

@jangevaare Hello!

I am sorry for coming back to this topic in 2020. I am quite new in Julia and don't understand everything you are talking about in this thread. Anyway, I have managed to create a Tree with this package. Now, I don't understand how I can add a label to each tree (to mark different populations and populations lines) and change the size of the leafs (f.e. to show the size of daughter population to its ancestors). Is that possible with this package? If yes, an example would probably be enough to help me.

I would be very grateful for your help! Thanks!

jangevaare commented 4 years ago

These two features are not currently implemented in the plotting functionality - which is quite basic. You may want to check out @richardreeve's Phylo.jl package. Or if you want to get involved with this package, PRs are welcome.

Ajax323 commented 4 years ago

Thanks a lot for the fast answer! I've checked the Phylo.jl package. I like PhyloTrees.jl more than Phylo.jl because for me it seems much easier and clearer to create an extend my own Trees. Maybe I can figure out how to create a more complex plot function.