Skip to content

Commit

Permalink
update accessors getchild etc. deprecated in PN v0.16
Browse files Browse the repository at this point in the history
also CI update: r-lib install etc
  • Loading branch information
cecileane committed Apr 16, 2023
1 parent 30cc688 commit 8efc7b7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ on:
- master
tags: '*'

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
Expand All @@ -26,7 +32,7 @@ jobs:
- x64
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
- name: set R lib path to be found by julia RCall
if: matrix.os == 'ubuntu-latest'
run: echo "LD_LIBRARY_PATH=$(R RHOME)/lib" >> $GITHUB_ENV
Expand All @@ -47,20 +53,20 @@ jobs:
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v2
with:
file: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
- run: echo "LD_LIBRARY_PATH=$(R RHOME)/lib" >> $GITHUB_ENV
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- name: install dependencie
- name: install dependencies
run: |
julia --project=docs -e '
using Pkg
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 1" # extras to let PN build its documentation of new releases
PhyloNetworks = "0.16, 0.17.0, 1.0.0" # extras to let PN build its documentation of new releases
RCall = "0.11, 0.12, 0.13"
julia = "0.7, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7"

Expand Down
1 change: 0 additions & 1 deletion src/PhyloPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module PhyloPlots

# standard libraries
using DataFrames: _broadcast_unalias_helper, LatexTableFormat
using PhyloNetworks: getMinorParent, getParent, getChildren, getMajorParentEdge, getChild, Edge, getMinorParentEdge
using Markdown
using Printf: @printf, @sprintf

Expand Down
23 changes: 12 additions & 11 deletions src/phylonetworksPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ function edgenode_coordinates(net::HybridNetwork, useedgelength::Bool, useSimple
while !isempty(cladewise_queue)
cur_edge = pop!(cladewise_queue); # deliberate choice over shift! for cladewise order
# increment spacing and add to node_y if leaf
if getChild(cur_edge).leaf
ni = findfirst(x->x===getChild(cur_edge), net.node)
cur_child = getchild(cur_edge)
if cur_child.leaf
ni = findfirst(x->x===cur_child, net.node)
node_y[ni] = nexty
node_yB[ni] = nexty
node_yE[ni] = nexty
Expand All @@ -92,8 +93,8 @@ function edgenode_coordinates(net::HybridNetwork, useedgelength::Bool, useSimple

# push children edges if this is a major edge:
if cur_edge.isMajor
for e in getChild(cur_edge).edge
if getParent(e) === getChild(cur_edge)# don't go backwards
for e in cur_child.edge
if getparent(e) === cur_child # don't go backwards
push!(cladewise_queue, e)
end
end
Expand All @@ -109,11 +110,11 @@ function edgenode_coordinates(net::HybridNetwork, useedgelength::Bool, useSimple
minor_yB = ymax; minor_yE = ymin;
nomajorchild=useSimpleHybridLines # only use this var if using simple hybrid lines
for e in nn.edge
if nn == PhyloNetworks.getParent(e) # if e = child of node
if nn == getparent(e) # if e = child of node
if useSimpleHybridLines
# old simple hybrid lines
if e.isMajor || nomajorchild
cc = PhyloNetworks.getChild(e)
cc = getchild(e)
yy = node_y[findfirst(x -> x===cc, net.node)]
yy!==nothing || error("oops, child $(cc.number) has not been visited before node $(nn.number).")
end
Expand All @@ -128,7 +129,7 @@ function edgenode_coordinates(net::HybridNetwork, useedgelength::Bool, useSimple
else
# new pretty hybrid lines
if e.isMajor
cc = PhyloNetworks.getChild(e)
cc = getchild(e)
child_y = node_y[findfirst(x -> x===cc, net.node)]
child_y!==nothing || error("oops, child $(cc.number) has not been visited before node $(nn.number).")
else
Expand Down Expand Up @@ -183,7 +184,7 @@ function edgenode_coordinates(net::HybridNetwork, useedgelength::Bool, useSimple
for e in net.nodes_changed[i].edge # loop over children only
if net.nodes_changed[i] == (e.isChild1 ? e.node[2] : e.node[1])
node_age[ni] = max(node_age[ni], 1 +
node_age[findfirst(x -> x=== PhyloNetworks.getChild(e), net.node)])
node_age[findfirst(x -> x=== getchild(e), net.node)])
end
end
end
Expand Down Expand Up @@ -211,7 +212,7 @@ function edgenode_coordinates(net::HybridNetwork, useedgelength::Bool, useSimple
end
ei !== nothing || error("oops, could not find major parent edge of node number $ni.")
edge_yB[ei] = node_y[ni]
pni = findfirst(x -> x===PhyloNetworks.getParent(net.edge[ei]), net.node) # parent node index
pni = findfirst(x -> x===getparent(net.edge[ei]), net.node) # parent node index
edge_xB[ei] = node_x[pni]
if elenCalculate
elen[ei] = node_age[pni] - node_age[ni]
Expand All @@ -230,8 +231,8 @@ function edgenode_coordinates(net::HybridNetwork, useedgelength::Bool, useSimple
for i=1:net.numEdges
if !net.edge[i].isMajor # minor hybrid edges
# indices of child and parent nodes
cni = findfirst(x -> x===PhyloNetworks.getChild( net.edge[i]), net.node)
pni = findfirst(x -> x===PhyloNetworks.getParent(net.edge[i]), net.node)
cni = findfirst(x -> x===getchild( net.edge[i]), net.node)
pni = findfirst(x -> x===getparent(net.edge[i]), net.node)

edge_xB[i] = node_x[pni]
edge_xE[i] = useSimpleHybridLines ? edge_xB[i] : (useedgelength ? edge_xB[i] + elen[i] : node_x[cni])
Expand Down

0 comments on commit 8efc7b7

Please sign in to comment.