Skip to content

Commit 6cb7e22

Browse files
committed
use DataFrames 0.11 and Missings, drop Gadfly and RCall
related: - plots and sexp migrated to PhyloPlots: related files removed - major overhaul of DataFrames: use Missing, drop NullableArrays - use StatsModels and CSV: which were previously part of DataFrames readtable -> CSV.read not updated yet: documentation, barely started broken tests: in test/test_lm_tree.jl, search @test_skip
1 parent d5fe6de commit 6cb7e22

38 files changed

+708
-2462
lines changed

.travis.yml

+5-14
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,15 @@ notifications:
1111
email: false
1212

1313
before_install:
14-
# linux
15-
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9; fi
16-
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y "deb http://cran.rstudio.com/bin/linux/ubuntu $(lsb_release -s -c)/"; fi
17-
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq -y; fi
18-
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install git r-base r-base-dev r-recommended -y; fi
19-
20-
# osx
21-
# faster than using homebrew/science tap
22-
# but no permalink to release download
23-
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then wget "https://cran.rstudio.com/bin/macosx/$(wget -qO- https://cran.rstudio.com/bin/macosx/ | sed -n 's/.*href="\(R-[^"]*.pkg\)".*/\1/p' | head -n 1)"; fi
24-
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then sudo installer -pkg R-*.pkg -target /; fi
2514

2615
# Track master of NLopt. This line should be removed when a a new release of NLopt is out.
2716
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then julia -e 'Pkg.clone("https://github.com/JuliaOpt/NLopt.jl"); Pkg.build("NLopt")'; fi
2817

2918
after_success:
30-
# Build doc
19+
# push coverage results to Coveralls
20+
- julia -e 'cd(Pkg.dir("PhyloNetworks")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
21+
# push coverage results to Codecov
22+
- julia -e 'cd(Pkg.dir("PhyloNetworks")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
23+
# build doc
3124
- chmod +x docs/make.sh
3225
- ./docs/make.sh
33-
# Code coverage
34-
- julia -e 'cd(Pkg.dir("PhyloNetworks")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'

LICENSE.md

+22-697
Large diffs are not rendered by default.

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
[![Build Status](https://travis-ci.org/crsl4/PhyloNetworks.jl.svg)](https://travis-ci.org/crsl4/PhyloNetworks.jl)
44
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://crsl4.github.io/PhyloNetworks.jl/stable)
55
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://crsl4.github.io/PhyloNetworks.jl/latest)
6-
[![codecov](https://codecov.io/gh/crsl4/PhyloNetworks.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/crsl4/PhyloNetworks.jl)
6+
[![codecov.io](http://codecov.io/github/crsl4/PhyloNetworks.jl/coverage.svg?branch=master)](http://codecov.io/github/crsl4/PhyloNetworks.jl?branch=master)
77
<!--
8-
[![Coverage Status](https://coveralls.io/repos/crsl4/PhyloNetworks/badge.svg?branch=master&service=github)](https://coveralls.io/github/crsl4/PhyloNetworks?branch=master)
8+
[![codecov](https://codecov.io/gh/crsl4/PhyloNetworks.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/crsl4/PhyloNetworks.jl)
99
-->
10+
[![Coverage Status](https://coveralls.io/repos/crsl4/PhyloNetworks.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/crsl4/PhyloNetworks?branch=master)
1011

1112
## Overview
1213

@@ -15,7 +16,6 @@ PhyloNetworks is a [Julia](http://julialang.org) package with utilities to:
1516
in (extended) Newick format.
1617
Networks are considered explicit: nodes represent ancestral species.
1718
They can be rooted or unrooted.
18-
- plot networks (and trees)
1919
- manipulate networks: re-root, prune taxa, remove hybrid edges,
2020
extract the major tree from a network, extract displayed networks / trees
2121
- compare networks / trees with dissimilarity measures
@@ -25,6 +25,8 @@ PhyloNetworks is a [Julia](http://julialang.org) package with utilities to:
2525
- estimate species networks from multilocus data (see below)
2626
- phylogenetic comparative methods for continuous trait evolution
2727
on species networks / trees
28+
- plot networks (and trees), via the companion package
29+
[PhyloPlots](https://github.com/cecileane/PhyloPlots.jl)
2830

2931
To get help, check
3032

REQUIRE

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
julia 0.6
22
StatsBase 0.18
3-
NullableArrays 0.1
4-
DataFrames 0.9
3+
DataFrames 0.11 # requires and re-exports Missings
54
DataStructures 0.5.2
65
NLopt 0.3
7-
ColorTypes 0.2
8-
Gadfly 0.4
9-
GLM 0.8.1
6+
GLM 0.10 # requires StatsModels, Distributions
7+
CSV 0.2.2
108
Combinatorics 0.2.1
11-
RCall 0.6.1
12-
StatsFuns 0.4.0 #already required by GLM
13-
IterTools 0.2.1 # possibly 0.1.0
9+
StatsFuns 0.4.0 # already required by GLM
10+
IterTools 0.2.1
1411
BioSequences 0.8.1
1512
BioSymbols 1.2.0
13+
StaticArrays 0.7.0

docs/mkdocs.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ repo_url: https://github.com/crsl4/PhyloNetworks.jl
33
site_description: PhyloNetworks is a Julia package for the manipulation, visualization and inference of phylogenetic networks.
44
site_author: Claudia Sol&iacute;s-Lemus
55

6-
theme: material
7-
8-
extra:
6+
theme:
7+
name: 'material'
98
palette:
109
primary: 'teal'
1110
accent: 'teal'

docs/src/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Pages = [
3030
"man/multiplealleles.md",
3131
"man/trait_tree.md"
3232
]
33-
Depth = 2
33+
Depth = 3
3434
```
3535

3636
## Library Outline

docs/src/man/src/installation.jmd

+17-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ For a quick & basic tutorial on Julia, see
1010

1111
Editors:
1212

13+
- [Visual Studio Code](https://code.visualstudio.com) provides an editor
14+
and an integrated development environment (IDE) for Julia: highly recommended!
1315
- [Juno](http://junolab.org) provides an IDE for Julia,
14-
based on the (fantastic) [Atom](http://atom.io/) editor.
16+
based on the [Atom](http://atom.io/) editor.
1517
- you can also run Julia within a [Jupyter](http://jupyter.org) notebook
1618
(formerly IPython notebook).
1719

@@ -20,9 +22,6 @@ first time you run a function, it will be compiled at that moment. So,
2022
please be patient! Future calls to the function will be much much
2123
faster. Trying out toy examples for the first calls is a good idea.
2224

23-
Users should have Julia 0.4 or above.
24-
25-
2625
## Installation of the package PhyloNetworks
2726

2827
To install the package, type inside Julia:
@@ -59,9 +58,22 @@ users can do the following through the terminal:
5958
where HOME is replaced by your home directory.
6059
-->
6160

62-
The PhyloNetworks package has dependencies like NLopt and Gadfly
61+
The PhyloNetworks package has dependencies like NLopt and
62+
[DataFrames](http://juliadata.github.io/DataFrames.jl/stable/)
6363
(see the REQUIRE file for the full list), but everything is installed automatically.
6464

65+
The companion package [PhyloPlots](https://github.com/cecileane/PhyloPlots.jl)
66+
has utilities to visualize networks, and for interoperability,
67+
such as to export networks to R (which can then be plotted via R).
68+
To install:
69+
70+
```julia
71+
Pkg.add("PhyloPlots")
72+
```
73+
74+
PhyloPlots depends on PhyloNetworks, and has further dependencies
75+
like [Gadfly](http://gadflyjl.org/stable/) and
76+
[RCall](https://github.com/JuliaInterop/RCall.jl)
6577

6678
## Test example
6779

docs/src/man/src/make_weave.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using Weave, Fontconfig, Cairo
1+
using Weave
2+
# using Fontconfig, Cairo
3+
# using PhyloPlots
24

35
set_chunk_defaults(Dict{Symbol, Any}(:results => "hidden", :eval => false))
46

examples/lizard_trait.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"tipNames","AVG.SVL","AVG.ltoe.IV","AVG.lfing.IV","region"
1+
"tipNames","AVG_SVL","AVG_ltoe_IV","AVG_lfing_IV","region"
22
"ahli",4.039125443,2.553343811,1.943287666,0
33
"alayoni",3.815704818,1.875257738,1.40302856,0
44
"alfaroi",3.526654599,1.73254011,1.040276712,0

src/PhyloNetworks.jl

+5-17
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,25 @@ module PhyloNetworks
44

55
using DataStructures # for updateInCycle with priority queue
66
using DataFrames # for functions to read/write tables, and names()
7+
using StatsBase # sample, coef etc.
8+
using StatsModels
79
using GLM # for the lm function
810
using NLopt # for branch lengths optimization
9-
using Gadfly # for plots
10-
using ColorTypes # used by Gadfly already. To resolve data type names (Colorant)
11-
using StatsBase: sample
1211
using Combinatorics.combinations
13-
using RCall
14-
using RCall: protect, unprotect, RClass
15-
using NullableArrays
1612
using StaticArrays
1713
using IterTools
1814
using BioSequences
1915
using BioSymbols
2016

2117
import Base.show
22-
import Gadfly.plot
2318
import GLM.ftest
24-
import RCall.sexp
25-
export plot, ftest, sexp
2619

2720
global DEBUG = false #for debugging only
2821
const DEBUGC = false #more detailed prints
2922
global CHECKNET = false #for debugging only
3023
global REDIRECT = false # changed for debugging to a file
3124

25+
export ftest
3226
export
3327
## Network Definition
3428
HybridNetwork,
@@ -126,11 +120,7 @@ module PhyloNetworks
126120
nStates,
127121
Q, P,
128122
randomTrait,
129-
randomTrait!,
130-
#
131-
apeRExport
132-
133-
# export part
123+
randomTrait!
134124

135125
include("types.jl")
136126
include("auxiliary.jl")
@@ -147,13 +137,11 @@ module PhyloNetworks
147137
include("manipulateNet.jl")
148138
include("bootstrap.jl")
149139
include("multipleAlleles.jl")
150-
include("plotsGadfly.jl")
151-
include("plotsRCall.jl")
152140
include("compareNetworks.jl")
153141
include("traits.jl")
154142
include("parsimony.jl")
155143
include("pairwiseDistanceLS.jl")
156-
include("apeRExport.jl")
144+
include("interop.jl")
157145
include("substitutionModels.jl")
158146
include("biconnectedComponents.jl")
159147

src/RCall_tree.jl

-89
This file was deleted.

src/addHybrid.jl

+11-11
Original file line numberDiff line numberDiff line change
@@ -352,36 +352,36 @@ addHybridizationUpdateSmart!(net::HybridNetwork, N::Integer) = addHybridizationU
352352
## can we put in a different color in the plot?
353353
## Cecile: you could add a new option to our RCall-based plot function to take a vector of colors.
354354
"""
355-
`addAlternativeHybridizations!(net::HybridNetwork,BSe::DataFrame; cutoff=10::Number,top=3::Int)`
355+
addAlternativeHybridizations!(net::HybridNetwork, BSe::DataFrame;
356+
cutoff=10::Number, top=3::Int)
356357
357358
Modify the network `net` (the best network estimated with snaq) by adding other hybridizations
358359
that are present in the bootstrap networks. By default, it will only consider hybrid edges with
359360
more than 10% bootstrap support (`cutoff`) and it will only include the three top hybridizations
360361
(`top`) sorted by bootstrap support.
361362
The function also modifies the dataframe `BSe` obtained with `hybridBootstrapSupport`. In the original
362-
`BSe` dataframe, hybrid edges that do not appear in the best network have NA as number.
363+
`BSe` dataframe, hybrid edges that do not appear in the best network have a missing number.
363364
After the hybrid edges are added with `addAlternativeHybridizations`, `BSe` is modified to include the
364365
edge numbers of the newly added hybrid edges. Note that the function only adds the hybrid edges as minor to
365366
keep the underlying tree topology.
366367
367-
Example:
368+
# example
368369
370+
```julia
369371
bootnet = readMultiTopology("bootstrap-networks.txt")
370-
371372
bestnet = readTopology("best.tre")
372-
373373
BSn, BSe, BSc, BSgam, BSedgenum = hybridBootstrapSupport(bootnet, bestnet);
374-
375374
addAlternativeHybridizations!(bestnet,BSe)
376-
375+
using PhyloPlots
377376
plot(bestnet, edgeLabel=BSe[[:edge,:BS_hybrid_edge]])
377+
```
378378
"""
379379
function addAlternativeHybridizations!(net::HybridNetwork,BSe::DataFrame; cutoff=10::Number,top=3::Int)
380380
top > 0 || error("top must be greater than 0")
381381
BSe[:alternative] = falses(length(BSe[:hybrid]))
382382
newBSe = BSe[BSe[:BS_hybrid_edge] .> cutoff,:]
383-
newBSe = newBSe[.!isna.(newBSe[:hybrid]) & .!isna.(newBSe[:sister]),:]
384-
newBSe = newBSe[isna.(newBSe[:edge]),:]
383+
newBSe = newBSe[.!ismissing.(newBSe[:hybrid]) & .!ismissing.(newBSe[:sister]),:]
384+
newBSe = newBSe[ismissing.(newBSe[:edge]),:]
385385
newHyb = newBSe[1:top,:]
386386

387387
if(size(newHyb,1) == 0)
@@ -393,8 +393,8 @@ function addAlternativeHybridizations!(net::HybridNetwork,BSe::DataFrame; cutoff
393393
hybnum = newHyb[:hybrid][i]
394394
sisnum = newHyb[:sister][i]
395395
edgenum = addHybridBetweenClades!(hybnum,sisnum,net)
396-
ind1 = find(x->!isna(x) && x==hybnum,BSe[:hybrid])
397-
ind2 = find(x->!isna(x) && x==sisnum,BSe[:sister])
396+
ind1 = find(x->!ismissing(x) && x==hybnum,BSe[:hybrid])
397+
ind2 = find(x->!ismissing(x) && x==sisnum,BSe[:sister])
398398
ind = intersect(ind1,ind2)
399399
BSe[ind,:edge] = edgenum
400400
BSe[ind,:alternative] = true

0 commit comments

Comments
 (0)