From 9e1a802ba6e56c816449c18defaf464eccb570e7 Mon Sep 17 00:00:00 2001 From: Claire Harris Date: Mon, 1 Mar 2021 15:11:55 +0000 Subject: [PATCH 1/8] First try at gh actions. --- .github/workflows/docs.yaml | 34 +++++++++++++++++ .github/workflows/testing.yaml | 68 ++++++++++++++++++++++++++++++++++ Project.toml | 6 +-- 3 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/docs.yaml create mode 100644 .github/workflows/testing.yaml diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000..67d19fe7 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,34 @@ +name: Documentation + +on: + push: + branches: + - master + tags: + - 'v*' + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up julia + uses: julia-actions/setup-julia@v1 + with: + version: '1' + arch: x64 + - name: Install dependencies + run: | + julia --project=docs/ -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate() + Pkg.add("Documenter")' + - name: Build and deploy + run: | + julia --project=docs/ --color=yes docs/make.jl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml new file mode 100644 index 00000000..b820d323 --- /dev/null +++ b/.github/workflows/testing.yaml @@ -0,0 +1,68 @@ +name: CI + +on: + push: + branches: + - master + - claireh93/actions + tags: + - 'v*' + pull_request: + +jobs: + phylo-tests: + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + strategy: + matrix: + julia-version: + - '1.4' + - '1' + - '~1.6.0-rc1' + os: + - ubuntu-latest + - macOS-latest + - windows-latest + R-version: + - 'release' + arch: + - x64 + experimental: + - false + include: + - julia-version: 'nightly' + os: ubuntu-latest + R-version: 'release' + arch: x64 + experimental: true + fail-fast: false + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up julia + uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.julia-version }} + arch: ${{ matrix.arch }} + - name: Install R + if: matrix.os == 'macOS-latest' + uses: r-lib/actions/setup-r@master + with: + r-version: ${{ matrix.R-version }} + - name: Install ape + if: matrix.os == 'macOS-latest' + run: | + R -e 'install.packages("ape", repos="http://cran.r-project.org")' + - name: Build package + uses: julia-actions/julia-buildpkg@master + - name: Running + uses: julia-actions/julia-runtest@master + - name: Process coverage + uses: julia-actions/julia-processcoverage@v1 + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ./lcov.info + - name: Codecov + uses: codecov/codecov-action@v1 diff --git a/Project.toml b/Project.toml index 6ad898e2..b46656ea 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Diversity" uuid = "d3d5718d-52de-57ab-b67a-eca7fd6175a4" -version = "0.5.1" author = ["Richard Reeve "] +version = "0.5.1" [deps] AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9" @@ -15,9 +15,8 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] -julia = "^1" AxisArrays = "^0.4" -DataFrames = "^0.20" +DataFrames = "^0.21" Distances = "^0.8" EcoBase = "^0.1" Missings = "^0,4" @@ -25,6 +24,7 @@ Phylo = "^0.4.1" RecipesBase = "0.6,0.7,0.8,1" Requires = "^1" StatsBase = "0.32,0.33" +julia = "^1" [extras] Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" From 90064235f21ab2726607c29bb2a1908544593e38 Mon Sep 17 00:00:00 2001 From: Claire Harris Date: Mon, 1 Mar 2021 15:35:22 +0000 Subject: [PATCH 2/8] Add more workflows (based on Phylo). --- .github/workflows/CompatHelper.yaml | 37 +++++++++++++++++++++++++++++ .github/workflows/TagBot.yaml | 14 +++++++++++ .github/workflows/nightly.yaml | 21 ++++++++++++++++ .github/workflows/testing.yaml | 2 +- 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/CompatHelper.yaml create mode 100644 .github/workflows/TagBot.yaml create mode 100644 .github/workflows/nightly.yaml diff --git a/.github/workflows/CompatHelper.yaml b/.github/workflows/CompatHelper.yaml new file mode 100644 index 00000000..61d1e6a5 --- /dev/null +++ b/.github/workflows/CompatHelper.yaml @@ -0,0 +1,37 @@ +name: CompatHelper + +on: + push: + branches: + - master + schedule: + - cron: '0 4 * * 0' # Weekly at 4 AM GMT Sunday + +jobs: + CompatHelper: + runs-on: ${{ matrix.os }} + strategy: + matrix: + julia-version: + - '1' + arch: + - x86 + os: + - ubuntu-latest + steps: + - uses: julia-actions/setup-julia@latest + with: + version: ${{ matrix.julia-version }} + arch: ${{ matrix.arch }} + - name: Pkg.add("CompatHelper") + run: | + julia -e ' + using Pkg + Pkg.add("CompatHelper")' + - name: CompatHelper.main() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + julia -e ' + using CompatHelper + CompatHelper.main()' diff --git a/.github/workflows/TagBot.yaml b/.github/workflows/TagBot.yaml new file mode 100644 index 00000000..778c06fe --- /dev/null +++ b/.github/workflows/TagBot.yaml @@ -0,0 +1,14 @@ +name: TagBot +on: + issue_comment: + types: + - created + workflow_dispatch: +jobs: + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml new file mode 100644 index 00000000..d1917ca3 --- /dev/null +++ b/.github/workflows/nightly.yaml @@ -0,0 +1,21 @@ +name: JuliaNightly +# Nightly Scheduled Julia Nightly Run +on: + schedule: + - cron: '0 2 * * 0' # Weekly at 2 AM UTC Sunday +jobs: + test: + name: Julia Nightly - Ubuntu - x64 + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up julia + uses: julia-actions/setup-julia@v1 + with: + version: nightly + arch: x64 + - name: Build package + uses: julia-actions/julia-buildpkg@latest + - name: Run tests + uses: julia-actions/julia-runtest@latest diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index b820d323..b2535749 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -10,7 +10,7 @@ on: pull_request: jobs: - phylo-tests: + diversity-tests: runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.experimental }} strategy: From 87ea57565ad1eda070f709b6aa584434a56fa1da Mon Sep 17 00:00:00 2001 From: Claire Harris Date: Mon, 1 Mar 2021 15:59:48 +0000 Subject: [PATCH 3/8] Add sitename to docs. --- docs/make.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index 5097ae58..f62dc526 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -3,7 +3,8 @@ using Diversity makedocs(modules = [Diversity, Diversity.Ecology, Diversity.Jost, Diversity.Hill], - clean = false) + clean = false, + sitename = "Diversity.jl") deploydocs(deps = Deps.pip("pygments", "mkdocs", From df862beff3b4afbbbcf59b7b64dc4761623b5d20 Mon Sep 17 00:00:00 2001 From: Claire Harris Date: Mon, 1 Mar 2021 16:54:24 +0000 Subject: [PATCH 4/8] Simplify make file. --- docs/make.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index f62dc526..e6782fea 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -10,6 +10,4 @@ deploydocs(deps = Deps.pip("pygments", "mkdocs", "mkdocs-material", "python-markdown-math"), - repo = "github.com/richardreeve/Diversity.jl.git", - julia="0.6", - osname="linux") + repo = "github.com/richardreeve/Diversity.jl.git") From 0668f0d03f5777dfe978a4d2689d0c2d437d3430 Mon Sep 17 00:00:00 2001 From: Claire Harris Date: Mon, 1 Mar 2021 17:28:45 +0000 Subject: [PATCH 5/8] Update doc tests for DataFrame changes. --- docs/src/ecology.md | 38 +++++++++++++++++++++----------------- docs/src/hill.md | 13 +++++++------ docs/src/index.md | 28 +++++++++++++++------------- docs/src/jost.md | 13 +++++++------ docs/src/phylogenetics.md | 27 ++++++++++++++------------- 5 files changed, 64 insertions(+), 55 deletions(-) diff --git a/docs/src/ecology.md b/docs/src/ecology.md index b8b9b0e7..a2f3e11c 100644 --- a/docs/src/ecology.md +++ b/docs/src/ecology.md @@ -19,8 +19,9 @@ julia> community = [10, 20, 20]; julia> community /= sum(community); julia> diversity = simpson(community) -1×7 DataFrames.DataFrame +1×7 DataFrame │ Row │ div_type │ measure │ type_level │ type_name │ partition_level │ partition_name │ diversity │ +│ │ String │ String │ String │ String │ String │ String │ Float64 │ ├─────┼──────────┼─────────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ │ 1 │ Unique │ Simpson │ types │ │ subcommunity │ 1 │ 0.36 │ @@ -29,26 +30,29 @@ julia> ecosystem = [2 2 0.; 0 2 2]'; julia> ecosystem /= sum(ecosystem); julia> jaccard(ecosystem) -1×8 DataFrames.DataFrame -│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ -├─────┼──────────┼─────────┼───┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ -│ 1 │ Unique │ Jaccard │ 0 │ types │ │ metacommunity │ │ 0.333333 │ +1×8 DataFrame +│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ +│ │ String │ String │ Int64 │ String │ String │ String │ String │ Float64 │ +├─────┼──────────┼─────────┼───────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ +│ 1 │ Unique │ Jaccard │ 0 │ types │ │ metacommunity │ │ 0.333333 │ julia> generalisedjaccard(ecosystem, [0, 1, 2]) -3×8 DataFrames.DataFrame -│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ -├─────┼─────────────┼─────────┼───┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ -│ 1 │ Arbitrary Z │ Jaccard │ 0 │ types │ │ metacommunity │ │ 0.333333 │ -│ 2 │ Arbitrary Z │ Jaccard │ 1 │ types │ │ metacommunity │ │ 0.414214 │ -│ 3 │ Arbitrary Z │ Jaccard │ 2 │ types │ │ metacommunity │ │ 0.5 │ +3×8 DataFrame +│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ +│ │ String │ String │ Int64 │ String │ String │ String │ String │ Float64 │ +├─────┼─────────────┼─────────┼───────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ +│ 1 │ Arbitrary Z │ Jaccard │ 0 │ types │ │ metacommunity │ │ 0.333333 │ +│ 2 │ Arbitrary Z │ Jaccard │ 1 │ types │ │ metacommunity │ │ 0.414214 │ +│ 3 │ Arbitrary Z │ Jaccard │ 2 │ types │ │ metacommunity │ │ 0.5 │ julia> generalisedjaccard(ecosystem, [0, 1, 2], Matrix(1.0I, 3, 3)) -3×8 DataFrames.DataFrame -│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ -├─────┼─────────────┼─────────┼───┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ -│ 1 │ Arbitrary Z │ Jaccard │ 0 │ types │ │ metacommunity │ │ 0.333333 │ -│ 2 │ Arbitrary Z │ Jaccard │ 1 │ types │ │ metacommunity │ │ 0.414214 │ -│ 3 │ Arbitrary Z │ Jaccard │ 2 │ types │ │ metacommunity │ │ 0.5 │ +3×8 DataFrame +│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ +│ │ String │ String │ Int64 │ String │ String │ String │ String │ Float64 │ +├─────┼─────────────┼─────────┼───────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ +│ 1 │ Arbitrary Z │ Jaccard │ 0 │ types │ │ metacommunity │ │ 0.333333 │ +│ 2 │ Arbitrary Z │ Jaccard │ 1 │ types │ │ metacommunity │ │ 0.414214 │ +│ 3 │ Arbitrary Z │ Jaccard │ 2 │ types │ │ metacommunity │ │ 0.5 │ ``` ```@contents diff --git a/docs/src/hill.md b/docs/src/hill.md index 8c5a3c45..415f3103 100644 --- a/docs/src/hill.md +++ b/docs/src/hill.md @@ -13,12 +13,13 @@ julia> community = [10, 20, 20, 0, 3]; julia> community /= sum(community); julia> diversities = hillnumber(community, [0, 1, 2]) -3×7 DataFrames.DataFrame -│ Row │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ -├─────┼────────────┼───┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ -│ 1 │ HillNumber │ 0 │ types │ │ subcommunity │ 1 │ 4.0 │ -│ 2 │ HillNumber │ 1 │ types │ │ subcommunity │ 1 │ 3.36264 │ -│ 3 │ HillNumber │ 2 │ types │ │ subcommunity │ 1 │ 3.09021 │ +3×7 DataFrame +│ Row │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ +│ │ String │ Int64 │ String │ String │ String │ String │ Float64 │ +├─────┼────────────┼───────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ +│ 1 │ HillNumber │ 0 │ types │ │ subcommunity │ 1 │ 4.0 │ +│ 2 │ HillNumber │ 1 │ types │ │ subcommunity │ 1 │ 3.36264 │ +│ 3 │ HillNumber │ 2 │ types │ │ subcommunity │ 1 │ 3.09021 │ ``` ```@contents diff --git a/docs/src/index.md b/docs/src/index.md index 6a021e24..a570b708 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -33,13 +33,14 @@ julia> # Create Metacommunity object meta = Metacommunity(pop); julia> diversities = norm_meta_alpha(meta, [0, 1, 2, Inf]) -4×8 DataFrames.DataFrame -│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ -├─────┼──────────┼─────────────────┼─────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ -│ 1 │ Unique │ NormalisedAlpha │ 0.0 │ types │ │ metacommunity │ │ 2.16667 │ -│ 2 │ Unique │ NormalisedAlpha │ 1.0 │ types │ │ metacommunity │ │ 1.86121 │ -│ 3 │ Unique │ NormalisedAlpha │ 2.0 │ types │ │ metacommunity │ │ 1.63636 │ -│ 4 │ Unique │ NormalisedAlpha │ Inf │ types │ │ metacommunity │ │ 1.0 │ +4×8 DataFrame +│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ +│ │ String │ String │ Float64 │ String │ String │ String │ String │ Float64 │ +├─────┼──────────┼─────────────────┼─────────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ +│ 1 │ Unique │ NormalisedAlpha │ 0.0 │ types │ │ metacommunity │ │ 2.16667 │ +│ 2 │ Unique │ NormalisedAlpha │ 1.0 │ types │ │ metacommunity │ │ 1.86121 │ +│ 3 │ Unique │ NormalisedAlpha │ 2.0 │ types │ │ metacommunity │ │ 1.63636 │ +│ 4 │ Unique │ NormalisedAlpha │ Inf │ types │ │ metacommunity │ │ 1.0 │ julia> Z = [1.0 0 0; 0 1 1; 1 1 1]; @@ -48,12 +49,13 @@ julia> meta_z = Metacommunity(pop, Z); julia> rho = RawRho(meta_z); julia> redundancies = subdiv(rho, 2) -3×8 DataFrames.DataFrame -│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ -├─────┼─────────────┼─────────┼───┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ -│ 1 │ Arbitrary Z │ RawRho │ 2 │ types │ │ subcommunity │ 1 │ 2.0 │ -│ 2 │ Arbitrary Z │ RawRho │ 2 │ types │ │ subcommunity │ 2 │ 3.0 │ -│ 3 │ Arbitrary Z │ RawRho │ 2 │ types │ │ subcommunity │ 3 │ 3.0 │ +3×8 DataFrame +│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ +│ │ String │ String │ Int64 │ String │ String │ String │ String │ Float64 │ +├─────┼─────────────┼─────────┼───────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ +│ 1 │ Arbitrary Z │ RawRho │ 2 │ types │ │ subcommunity │ 1 │ 2.0 │ +│ 2 │ Arbitrary Z │ RawRho │ 2 │ types │ │ subcommunity │ 2 │ 3.0 │ +│ 3 │ Arbitrary Z │ RawRho │ 2 │ types │ │ subcommunity │ 3 │ 3.0 │ ``` ```@contents diff --git a/docs/src/jost.md b/docs/src/jost.md index f3d069ad..fc30a00a 100644 --- a/docs/src/jost.md +++ b/docs/src/jost.md @@ -15,12 +15,13 @@ julia> ecosystem = [2 2 0; 0 2 2]'; julia> ecosystem /= sum(ecosystem); julia> diversities = jostbeta(ecosystem, [0, 1, 2]) -3×8 DataFrames.DataFrame -│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ -├─────┼──────────┼──────────┼───┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ -│ 1 │ Unique │ JostBeta │ 0 │ types │ │ metacommunity │ │ 1.5 │ -│ 2 │ Unique │ JostBeta │ 1 │ types │ │ metacommunity │ │ 1.41421 │ -│ 3 │ Unique │ JostBeta │ 2 │ types │ │ metacommunity │ │ 1.33333 │ +3×8 DataFrame +│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ +│ │ String │ String │ Int64 │ String │ String │ String │ String │ Float64 │ +├─────┼──────────┼──────────┼───────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ +│ 1 │ Unique │ JostBeta │ 0 │ types │ │ metacommunity │ │ 1.5 │ +│ 2 │ Unique │ JostBeta │ 1 │ types │ │ metacommunity │ │ 1.41421 │ +│ 3 │ Unique │ JostBeta │ 2 │ types │ │ metacommunity │ │ 1.33333 │ ``` ```@contents diff --git a/docs/src/phylogenetics.md b/docs/src/phylogenetics.md index 67a72914..68d143c2 100644 --- a/docs/src/phylogenetics.md +++ b/docs/src/phylogenetics.md @@ -19,23 +19,23 @@ julia> species = ["Dog", "Cat", "Human", "Potato"]; julia> community = [4, 1, 3, 2] / 10; julia> nt = rand(Nonultrametric(species)) -BinaryTree{DataFrames.DataFrame,Dict{String,Any}} with 4 tips, 7 nodes and 6 branches. -Leaf names are Dog, Cat, Human and Potato +LinkTree{OneRoot,String,LinkNode{OneRoot,String,Dict{String,Any},LinkBranch{OneRoot,String,Dict{String,Any},Float64}},LinkBranch{OneRoot,String,Dict{String,Any},Float64},Dict{String,Any}} with 4 tips, 7 nodes and 6 branches. +Leaf names are Dog, Cat, Potato and Human julia> collect(getbranches(nt)) -6-element Array{Pair{Int64,Branch{String}},1}: - [node "Node 2"]-->[0.5097599049872488 length branch 4]-->[node "Dog"] +6-element Array{LinkBranch{OneRoot,String,Dict{String,Any},Float64},1}: + LinkBranch 7, from node Node 5 to node Cat (length 0.9239010134651334). - [node "Node 1"]-->[0.09388407179505037 length branch 2]-->[node "Human"] + LinkBranch 8, from node Node 5 to node Potato (length 0.22314202428976326). - [node "Node 2"]-->[0.03694779049915409 length branch 3]-->[node "Potato"] + LinkBranch 9, from node Node 6 to node Node 5 (length 0.8631183174331696). - [node "Node 3"]-->[1.1304368761257053 length branch 5]-->[node "Node 1"] + LinkBranch 10, from node Node 6 to node Human (length 0.00018168653247226503). - [node "Node 3"]-->[2.690399241213393 length branch 6]-->[node "Node 2"] + LinkBranch 11, from node Node 7 to node Dog (length 0.20720995300152265). - [node "Node 1"]-->[1.069077819992828 length branch 1]-->[node "Cat"] + LinkBranch 12, from node Node 7 to node Node 6 (length 0.3064428959482562). julia> ph = PhyloTypes(nt); @@ -50,10 +50,11 @@ julia> leafnames = gettypenames(metaphylo, true) "Potato" julia> meta_gamma(metaphylo, 0) -1×8 DataFrames.DataFrame -│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ -├─────┼──────────────┼─────────┼───┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ -│ 1 │ Phylogenetic │ Gamma │ 0 │ types │ │ metacommunity │ │ 2.29217 │``` +1×8 DataFrame +│ Row │ div_type │ measure │ q │ type_level │ type_name │ partition_level │ partition_name │ diversity │ +│ │ String │ String │ Int64 │ String │ String │ String │ String │ Float64 │ +├─────┼─────────────────────┼─────────┼───────┼────────────┼───────────┼─────────────────┼────────────────┼───────────┤ +│ 1 │ Phylogenetic Branch │ Gamma │ 0 │ types │ │ metacommunity │ │ 3.27211 │``` ```@contents ``` From f577ec1bdd3cd01cc09ff10c65e18173d81c66ed Mon Sep 17 00:00:00 2001 From: Richard Reeve Date: Mon, 1 Mar 2021 23:38:05 +0000 Subject: [PATCH 6/8] Apply suggestions from code review --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index b46656ea..f01931e3 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Diversity" uuid = "d3d5718d-52de-57ab-b67a-eca7fd6175a4" author = ["Richard Reeve "] -version = "0.5.1" +version = "0.5.2" [deps] AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9" @@ -16,7 +16,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] AxisArrays = "^0.4" -DataFrames = "^0.21" +DataFrames = "0.20,0.21,0.22" Distances = "^0.8" EcoBase = "^0.1" Missings = "^0,4" From af990758c5a0e16d434a7b5491620c4636faa52b Mon Sep 17 00:00:00 2001 From: Claire Harris Date: Tue, 2 Mar 2021 14:13:45 +0000 Subject: [PATCH 7/8] Update join calls to new DataFrames. --- src/Ecology.jl | 2 +- src/Jost.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ecology.jl b/src/Ecology.jl index 151e953a..5edfa7c9 100644 --- a/src/Ecology.jl +++ b/src/Ecology.jl @@ -240,7 +240,7 @@ function generalisedjaccard(proportions::AbstractMatrix, qs, error("Can only calculate Jaccard index for 2 subcommunities") ab = metadiv(α(meta), qs) g = metadiv(Γ(meta), qs) - j = join(ab, g, on=[:q, :type_level, :type_name, + j = innerjoin(ab, g, on=[:q, :type_level, :type_name, :partition_level, :partition_name, :div_type], makeunique=true) j[!,:diversity] .= j[!,:diversity] ./ j[!,:diversity_1] .- 1 diff --git a/src/Jost.jl b/src/Jost.jl index be61ed75..c83aded9 100644 --- a/src/Jost.jl +++ b/src/Jost.jl @@ -58,7 +58,7 @@ Jost's alpha diversity function jostbeta(proportions::AbstractMatrix, qs) md = metacommunityDiversity(Gamma(Metacommunity(proportions)), qs) ja = jostalpha(proportions, qs) - j = join(md, ja, on=[:q, :type_level, :type_name, + j = innerjoin(md, ja, on=[:q, :type_level, :type_name, :partition_level, :partition_name, :div_type], makeunique=true) j[!,:diversity] ./= j[!,:diversity_1] From 9b7325ee292b55679e8fc02c84a71456be7b94c5 Mon Sep 17 00:00:00 2001 From: Claire Harris Date: Tue, 2 Mar 2021 14:56:50 +0000 Subject: [PATCH 8/8] =?UTF-8?q?Innerjoin=20doesn=E2=80=99t=20exist=20on=20?= =?UTF-8?q?DataFrames=200.20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index f01931e3..b86f7d29 100644 --- a/Project.toml +++ b/Project.toml @@ -16,7 +16,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] AxisArrays = "^0.4" -DataFrames = "0.20,0.21,0.22" +DataFrames = "0.21,0.22" Distances = "^0.8" EcoBase = "^0.1" Missings = "^0,4"