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

Standardising formatting #92

Merged
merged 7 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
26 changes: 12 additions & 14 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@ using Documenter
using Phylo

makedocs(modules = [Phylo, Phylo.API],
sitename = "Phylo.jl",
sitename = "Phylo.jl",
pages = ["Home" => "index.md",
"Tutorial / Quick start" => "tutorial.md",
"Manual" => Any[
"Phylogeny data types" => "man/treetypes.md",
"Creating and writing phylogenies" => "man/io.md",
"Manipulating and building phylogenies" => "man/manipulating.md",
"Traversal and iterators" => "man/traversal.md",
"Getting phylogeny attributes" => "man/attributes.md",
"Modelling traits" => "man/modelling.md",
"Plotting" => "man/plotting.md"
],
"List of functions" => "functionlist.md",
"API" => "api.md"];
"Tutorial / Quick start" => "tutorial.md",
"Manual" => Any["Phylogeny data types" => "man/treetypes.md",
"Creating and writing phylogenies" => "man/io.md",
"Manipulating and building phylogenies" => "man/manipulating.md",
"Traversal and iterators" => "man/traversal.md",
"Getting phylogeny attributes" => "man/attributes.md",
"Modelling traits" => "man/modelling.md",
"Plotting" => "man/plotting.md"],
"List of functions" => "functionlist.md",
"API" => "api.md"];
format = Documenter.HTML(size_threshold_ignore = ["man/plotting.md",
"man/io.md"]))
"man/io.md"]))

deploydocs(repo = "github.com/EcoJulia/Phylo.jl.git",
devbranch = "dev",
Expand Down
13 changes: 7 additions & 6 deletions ext/PhyloRCallExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ end

using Phylo

function rcopy(::Type{T}, rt::Ptr{VecSxp}) where T <: AbstractTree
if !isObject(rt) || isS4(rt) || rcopy(String, rcall_p(:class, rt)) != "phylo"
function rcopy(::Type{T}, rt::Ptr{VecSxp}) where {T <: AbstractTree}
if !isObject(rt) || isS4(rt) ||
rcopy(String, rcall_p(:class, rt)) != "phylo"
error("Object is not of S3 phylo class, aborting")
end

Expand All @@ -44,17 +45,17 @@ function rcopy(::Type{T}, rt::Ptr{VecSxp}) where T <: AbstractTree
return tree
end


rcopytype(::Type{RClass{:phylo}}, s::Ptr{VecSxp}) = RootedTree

function sexp(tree::T) where T <: AbstractTree
function sexp(tree::T) where {T <: AbstractTree}
validate!(tree) || @warn "Tree does not internally validate"
leafnames = getleafnames(tree)
root = getnodename.(tree, getroots(tree))
if (length(root) != 1)
error("Can't currently translate tree with > 1 roots")
end
nontips = [getnodename(tree, node) for node in traversal(tree, preorder)
nontips = [getnodename(tree, node)
for node in traversal(tree, preorder)
if isinternal(tree, node)]
tor = Dict{Symbol, Any}()
tor[:Nnode] = length(nontips) + length(root)
Expand All @@ -69,7 +70,7 @@ function sexp(tree::T) where T <: AbstractTree
for branch in bi
lengths[index] = getlength(tree, branch)
edges[index, :] = indexin([getnodename(tree, src(tree, branch)),
getnodename(tree, dst(tree, branch))], nodes)
getnodename(tree, dst(tree, branch))], nodes)
index += 1
end
tor[:edge] = edges
Expand Down
Loading
Loading