Skip to content

Commit

Permalink
Merge 9b7325e into 26a8b5c
Browse files Browse the repository at this point in the history
  • Loading branch information
claireh93 committed Mar 2, 2021
2 parents 26a8b5c + 9b7325e commit 08ed7b4
Show file tree
Hide file tree
Showing 14 changed files with 246 additions and 64 deletions.
37 changes: 37 additions & 0 deletions .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()'
14 changes: 14 additions & 0 deletions .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 }}
34 changes: 34 additions & 0 deletions .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 }}
21 changes: 21 additions & 0 deletions .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
68 changes: 68 additions & 0 deletions .github/workflows/testing.yaml
@@ -0,0 +1,68 @@
name: CI

on:
push:
branches:
- master
- claireh93/actions
tags:
- 'v*'
pull_request:

jobs:
diversity-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
6 changes: 3 additions & 3 deletions Project.toml
@@ -1,7 +1,7 @@
name = "Diversity"
uuid = "d3d5718d-52de-57ab-b67a-eca7fd6175a4"
version = "0.5.1"
author = ["Richard Reeve <Richard.Reeve@glasgow.ac.uk>"]
version = "0.5.2"

[deps]
AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9"
Expand All @@ -15,16 +15,16 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
julia = "^1"
AxisArrays = "^0.4"
DataFrames = "^0.20"
DataFrames = "0.21,0.22"
Distances = "^0.8"
EcoBase = "^0.1"
Missings = "^0,4"
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"
Expand Down
7 changes: 3 additions & 4 deletions docs/make.jl
Expand Up @@ -3,12 +3,11 @@ using Diversity

makedocs(modules = [Diversity,
Diversity.Ecology, Diversity.Jost, Diversity.Hill],
clean = false)
clean = false,
sitename = "Diversity.jl")

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")
38 changes: 21 additions & 17 deletions docs/src/ecology.md
Expand Up @@ -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 │
Expand All @@ -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
Expand Down
13 changes: 7 additions & 6 deletions docs/src/hill.md
Expand Up @@ -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
Expand Down
28 changes: 15 additions & 13 deletions docs/src/index.md
Expand Up @@ -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];
Expand All @@ -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
Expand Down
13 changes: 7 additions & 6 deletions docs/src/jost.md
Expand Up @@ -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
Expand Down

0 comments on commit 08ed7b4

Please sign in to comment.