Skip to content
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

v2.0.0: compatibility with PhyloNetworks v0.17; output named tuple (breaking, #21 fix) #26

Merged
merged 19 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ on:
types:
- created
workflow_dispatch:
inputs:
lookback:
default: "3"
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PhyloPlots"
uuid = "c0d5b6db-e3fc-52bc-a87d-1d050989ed3b"
license = "MIT"
version = "1.0.1"
version = "1.1.0"
Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with 1.1.0, but out of curiosity, what made you change your mind and not go to 2.0.0 ?
(As it is a non backward compatible change, see #20 (comment))

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, indeed, it should be 2.0.0. When starting this PR, I merely wanted a version compatible with the new PhyloNetworks v0.17.0. Later I noticed the open issue #21 and thought that it was a good time to act on it, introducing a breaking change.

I also agree with removing "phylogram", but it would be nice to keep the term "rightwards" to be explicit that these plots won't convey the "semidirected" nature of networks like "circular" trees can do.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you, looks good to me !


[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand All @@ -12,9 +12,9 @@ RCall = "6f49c342-dc21-5d91-9882-a32aef131414"

[compat]
DataFrames = "0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 1.0"
PhyloNetworks = "0.16, 0.17.0, 1.0.0" # extras to let PN build its documentation of new releases
PhyloNetworks = "0.17"
RCall = "0.11, 0.12, 0.13, 0.14"
julia = "0.7, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7"
julia = "1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ via [RCall](https://github.com/JuliaInterop/RCall.jl).

## examples

in PhyloPlots' documentation [manual](https://juliaphylo.github.io/PhyloPlots.jl/stable/man/getting_started/), and
in [PhyloNetworks](http://juliaphylo.github.io/PhyloNetworks.jl/latest/)'s documentation, see
- basic examples
[here](http://juliaphylo.github.io/PhyloNetworks.jl/latest/man/snaq_plot/#Network-Visualization-1)
- examples to annotate edges
[here](http://juliaphylo.github.io/PhyloNetworks.jl/latest/man/bootstrap/#support-for-tree-edges)
- in PhyloPlots' documentation [manual](https://juliaphylo.github.io/PhyloPlots.jl/stable/man/getting_started/)
- in [PhyloNetworks](http://juliaphylo.github.io/PhyloNetworks.jl/latest/)'s documentation, see
* basic examples
[here](https://juliaphylo.github.io/PhyloNetworks.jl/dev/man/net_plot/#Network-Visualization)
* examples to annotate edges
[here](https://juliaphylo.github.io/PhyloNetworks.jl/dev/man/network_support/#support-for-tree-edges)
- visualization with data in this
[tutorial](https://cecileane.github.io/networkPCM-workshop/topic6-visualization.html)
29 changes: 0 additions & 29 deletions appveyor.yml

This file was deleted.

1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
PhyloNetworks = "33ad39ac-ed31-50eb-9b15-43d0656eaa72"
PhyloPlots = "c0d5b6db-e3fc-52bc-a87d-1d050989ed3b"
RCall = "6f49c342-dc21-5d91-9882-a32aef131414"
Expand Down
9 changes: 8 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ using Documenter
using Pkg
Pkg.add(PackageSpec(name="PhyloNetworks", rev="master"))

using DocumenterInterLinks
links = InterLinks(
"PhyloNetworks" => "https://juliaphylo.github.io/PhyloNetworks.jl/stable/objects.inv"
)
using PhyloNetworks
using PhyloPlots
DocMeta.setdocmeta!(PhyloPlots, :DocTestSetup, :(using PhyloPlots); recursive=true)
# default loading of interlinked packages in all docstring examples
DocMeta.setdocmeta!(PhyloPlots, :DocTestSetup,
:(using PhyloNetworks, PhyloPlots);
recursive=true)

makedocs(
sitename = "PhyloPlots.jl",
Expand Down
34 changes: 24 additions & 10 deletions docs/src/man/adding_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To add labels on edges (or nodes), we need to know their numbers. We can use the
```@example adding_data
R"svg"(figname("adding_data1.svg"), width=6, height=3) # hide
R"par"(mar=[.1,.1,.1,.1]); R"layout"([1 2]); # hide
net = readTopology("(A,((B,#H1),((C)#H1, D)));") # hide
net = readnewick("(A,((B,#H1),((C)#H1, D)));") # hide
plot(net, showedgenumber=true);
plot(net, showedgenumber=true, edgenumbercolor="red4");
R"dev.off()" # hide
Expand All @@ -40,7 +40,7 @@ node), and the label that goes on it, like this:
| 2 | "edge # 2" |

After including the DataFrames package, we can define it as so:
```@repl
```@repl adding_data
using DataFrames
DataFrame(number=[1,2], label=["edge number 1","edge # 2"])
```
Expand All @@ -49,7 +49,7 @@ puts the text on the correct edges:
```@example adding_data
R"svg"(figname("edge_labels_example.svg"), width=4, height=3) # hide
R"par"(mar=[.1,.1,.1,.1]) # hide
net = readTopology("(A,((B,#H1),(C,(D)#H1)));") # hide
net = readnewick("(A,((B,#H1),(C,(D)#H1)));") # hide
plot(net, edgelabel=DataFrame(number = [1,2],
label = ["edge number 1", "edge # 2"]),
edgelabelcolor="orangered", edgecex=[0.9,1.1]);
Expand All @@ -63,12 +63,12 @@ nothing # hide
We can use the return values of [`plot`](@ref) to get information on the coordinates of
different elements of the plot. Using this, we can add any other information we want.

The [`plot`](@ref) function returns the following tuple:
The [`plot`](@ref) function returns the following named tuple:
```
(xmin, xmax, ymin, ymax,
node_x, node_y, node_yB, node_yE,
edge_xB, edge_xE, edge_yB, edge_yE,
nodedataframe, edgedataframe)
(:xmin, :xmax, :ymin, :ymax,
:node_x, :node_y, :node_y_lo, :node_y_hi,
:edge_x_lo, :edge_x_hi, :edge_y_lo, :edge_y_hi,
:node_data, :edge_data)
```
See the documentation for descriptions of these elements: [`plot`](@ref)

Expand All @@ -79,7 +79,7 @@ Here's example code that adds bars to denote clades in the margin:
```@example adding_data
R"svg"(figname("side_bars.svg"), width=4, height=4) # hide
R"par"(mar=[.1,.1,.1,.1]) # hide
net = readTopology("(((((((1,2),3),4),5),(6,7)),(8,9)),10);");
net = readnewick("(((((((t1,t2),t3),t4),t5),(t6,t7)),(t8,t9)),t10);");
plot(net, xlim=(1,10))
using RCall # to send any R command, to make further plot modifications
R"segments"([9, 9, 9], [0.8, 7.8, 9.8], [9, 9, 9], [7.2, 9.2, 10.2])
Expand All @@ -97,7 +97,7 @@ because they contain the default range of the x axis; `xmin` and `xmax`.

```@example adding_data
res = plot(net);
res[1:2]
res[[:xmin,:xmax]]
```

Looking at `xmin` and `xmax` returned by default, we can see that the x
Expand All @@ -120,3 +120,17 @@ using RCall # add (install) the RCall package prior to 'using' it
R"segments"([9, 9, 9], [0.8, 7.8, 9.8], [9, 9, 9], [7.2, 9.2, 10.2])
R"text"([9.5, 9.5, 9.5], [4, 8.5, 10], ["C", "B", "A"])
```

# Beyond

To go beyond, we can access data on the node & edges to use them as we wish.
We can access the coordinates of points & segments and more data like this:

```@repl adding_data
res[:node_x] # x coordinate. similarly try res[:node_y]
hcat(res[:node_y_lo], res[:node_y_hi])
DataFrame(edge_x_lo=res[:edge_x_lo], edge_x_hi=res[:edge_x_hi],
edge_y_lo=res[:edge_y_lo], edge_y_hi=res[:edge_y_hi])
res[:node_data]
res[:edge_data]
```
8 changes: 4 additions & 4 deletions docs/src/man/better_edges.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ but by switching it to `:majortree`, we can draw minor hybrid edges as diagonal
```@example better_edges
R"svg"(figname("style_example.svg"), width=3, height=3) # hide
R"par"(mar=[.1,.1,.1,.1]) # hide
net = readTopology("(A,((B,#H1),(C,(D)#H1)));") # hide
net = readnewick("(A,((B,#H1),(C,(D)#H1)));") # hide
plot(net, style=:majortree);
R"dev.off()" # hide
nothing # hide
Expand All @@ -31,7 +31,7 @@ lines. For this, we'll use a network that has branch lengths:
R"svg"(figname("edge_len_example.svg"), width=6, height=3) # hide
R"par"(mar=[.1,.1,.1,.1]) # hide
R"layout"([1 2]) # hide
net = readTopology("(A:3.3,((B:1.5,#H1:0.5):1.5,((C:1)#H1:1.8,D:1.1):.2):0.3);")
net = readnewick("(A:3.3,((B:1.5,#H1:0.5):1.5,((C:1)#H1:1.8,D:1.1):.2):0.3);")
df = DataFrame(number=[-3,3], label=["N","H1"]); # hide
plot(net, useedgelength=true, ylim = [-1, 5.5], nodelabel = df); # hide
R"text"([3], [0], ["useedgelength=true"]) # hide
Expand Down Expand Up @@ -73,8 +73,8 @@ Time-inconsistent networks like these ones below might cause confusion:
R"svg"(figname("edge_len_example2.svg"), width=6, height=3) # hide
R"par"(mar=[.1,.1,.1,.1]) # hide
R"layout"([1 2]) # hide
net1 = readTopology("(A:3.3,((B:1.5,#H1:1.2):1.5,((C:1.8)#H1:1,D:1.1):.2):0.3);");
net2 = readTopology("(A:3.3,((B:1.5,#H1:0.2):1.5,((C:1)#H1:1.8,D:1.1):.2):0.3);");
net1 = readnewick("(A:3.3,((B:1.5,#H1:1.2):1.5,((C:1.8)#H1:1,D:1.1):.2):0.3);");
net2 = readnewick("(A:3.3,((B:1.5,#H1:0.2):1.5,((C:1)#H1:1.8,D:1.1):.2):0.3);");
plot(net1, useedgelength=true); # hide
plot(net2, useedgelength=true); # hide
R"dev.off()" # hide
Expand Down
4 changes: 2 additions & 2 deletions docs/src/man/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ using PhyloPlots
```
Then read the topology
```@repl getting_started
net = readTopology("(A,((B,#H1),(C,(D)#H1)));")
net = readnewick("(A,((B,#H1),(C,(D)#H1)));")
```
and call `plot`, as shown below.

```@example getting_started
R"svg"(figname("gettingstarted.svg"), width=3, height=3) # hide
R"par"(mar=[.1,.1,.1,.1]) # hide
net = readTopology("(A,((B,#H1),(C,(D)#H1)));") # hide
net = readnewick("(A,((B,#H1),(C,(D)#H1)));") # hide
plot(net);
R"dev.off()" # hide
nothing # hide
Expand Down
4 changes: 2 additions & 2 deletions docs/src/man/untangling_edges.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ whose child edges we should rotate.
```@example untangling
R"svg"(figname("untangling1.svg"), width=3, height=3) # hide
R"par"(mar=[.1,.1,.1,.1]) # hide
net = readTopology("(A,((B,#H1),(C,(D)#H1)));") # hide
net = readnewick("(A,((B,#H1),(C,(D)#H1)));") # hide
plot(net, shownodenumber=true);
R"dev.off()" # hide
nothing # hide
Expand All @@ -32,7 +32,7 @@ As we can see, rotating edges around node `-5` will make for a prettier network.
```@example untangling
R"svg"(figname("untangling2.svg"), width=3, height=3) # hide
R"par"(mar=[.1,.1,.1,.1]) # hide
net = readTopology("(A,((B,#H1),(C,(D)#H1)));") # hide
net = readnewick("(A,((B,#H1),(C,(D)#H1)));") # hide
rotate!(net, -5)
plot(net)
R"dev.off()" # hide
Expand Down
1 change: 0 additions & 1 deletion src/PhyloPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export sexp

include("phylonetworksPlots.jl")
include("plotRCall.jl")
include("substitutionmodels.jl")
include("rexport.jl")

end # of module
Loading
Loading