Skip to content

Commit ab6116f

Browse files
committed
2 parents ab09a15 + 7b8b331 commit ab6116f

31 files changed

+191
-150
lines changed

.github/workflows/test-lts.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: julia-1.0
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
julia-version: ['1.0']
12+
julia-arch: [x64]
13+
os: [ubuntu-latest, macOS-latest]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: julia-actions/setup-julia@v1
18+
with:
19+
version: ${{ matrix.julia-version }}
20+
arch: ${{ matrix.julia-arch }}
21+
- uses: actions/cache@v1
22+
env:
23+
cache-name: cache-artifacts
24+
with:
25+
path: ~/.julia/artifacts
26+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
27+
restore-keys: |
28+
${{ runner.os }}-test-${{ env.cache-name }}-
29+
${{ runner.os }}-test-
30+
${{ runner.os }}-
31+
- uses: julia-actions/julia-buildpkg@v1
32+
- uses: julia-actions/julia-runtest@v1
33+
with:
34+
depwarn: no

.github/workflows/test-nightly.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: julia-nightly
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
julia-version: ['nightly']
12+
julia-arch: [x64]
13+
os: [ubuntu-latest, macOS-latest]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: julia-actions/setup-julia@v1
18+
with:
19+
version: ${{ matrix.julia-version }}
20+
arch: ${{ matrix.julia-arch }}
21+
- uses: actions/cache@v1
22+
env:
23+
cache-name: cache-artifacts
24+
with:
25+
path: ~/.julia/artifacts
26+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
27+
restore-keys: |
28+
${{ runner.os }}-test-${{ env.cache-name }}-
29+
${{ runner.os }}-test-
30+
${{ runner.os }}-
31+
- uses: julia-actions/julia-buildpkg@v1
32+
- uses: julia-actions/julia-runtest@v1
33+
with:
34+
depwarn: no

.github/workflows/ci-stable.yml renamed to .github/workflows/test-stable.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests
1+
name: julia-1.6
22

33
on: [push, pull_request]
44

@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
julia-version: ['1.0', '1']
11+
julia-version: ['1.6']
1212
julia-arch: [x64]
1313
os: [ubuntu-latest, macOS-latest]
1414

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SubstitutionModels"
22
uuid = "8365b1bb-bd83-58ee-a267-f2965fc81c73"
33
authors = ["Justin Angevaare <[email protected]>"]
4-
version = "0.4.2"
4+
version = "0.5.0"
55

66
[deps]
77
BioSymbols = "3c28c6f8-a34d-59c4-9654-267d177fcfa9"
@@ -11,7 +11,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1111
[compat]
1212
BioSymbols = "3, 4, 5"
1313
StaticArrays = "0.12, 1"
14-
julia = "1"
14+
julia = "1.0, 1"
1515

1616
[extras]
1717
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
**Development status:**
1212

13-
[![CI-stable](https://github.com/BioJulia/SubstitutionModels.jl/actions/workflows/ci-stable.yml/badge.svg)](https://github.com/BioJulia/SubstitutionModels.jl/actions/workflows/ci-stable.yml)
13+
[![test-lts](https://github.com/BioJulia/SubstitutionModels.jl/actions/workflows/test-lts.yml/badge.svg)](https://github.com/BioJulia/SubstitutionModels.jl/actions/workflows/test-lts.yml)
14+
[![test-stable](https://github.com/BioJulia/SubstitutionModels.jl/actions/workflows/test-stable.yml/badge.svg)](https://github.com/BioJulia/SubstitutionModels.jl/actions/workflows/test-stable.yml)
15+
[![test-nightly](https://github.com/BioJulia/SubstitutionModels.jl/actions/workflows/test-nightly.yml/badge.svg)](https://github.com/BioJulia/SubstitutionModels.jl/actions/workflows/test-nightly.yml)
1416
[![codecov.io](http://codecov.io/github/BioJulia/SubstitutionModels.jl/coverage.svg?branch=master)](http://codecov.io/github/BioJulia/SubstitutionModels.jl?branch=master)
1517
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://BioJulia.github.io/SubstitutionModels.jl/latest)
1618

@@ -30,8 +32,8 @@ The current release version can be installed
3032
from the Julia REPL:
3133

3234
```julia
33-
julia> using Pkg
34-
julia> add("SubstitutionModels")
35+
using Pkg
36+
Pkg.add("SubstitutionModels")
3537
```
3638

3739
## Contributing and Questions

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
site/

docs/Project.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3-
4-
[compat]
5-
Documenter = "~0.22"

docs/make.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
using Documenter, SubstitutionModels
1+
using Documenter
2+
using SubstitutionModels
23

34
makedocs(
4-
modules = [SubstitutionModels],
5+
sitename = "SubstitutionModels",
56
format = Documenter.HTML(),
6-
sitename = "SubstitutionModels.jl",
7+
modules = [SubstitutionModels],
78
pages = [
89
"Home" => "index.md",
910
"Manual" => [
@@ -17,5 +18,6 @@ makedocs(
1718
)
1819

1920
deploydocs(
20-
repo = "github.com/BioJulia/SubstitutionModels.jl.git"
21+
repo = "github.com/BioJulia/SubstitutionModels.jl.git",
22+
push_preview = true
2123
)

docs/src/man/modeltypes.md

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
```@setup sm
2+
using SubstitutionModels
3+
```
4+
15
# Nucleic Acid Substitution Models
26

37
## Included Substitution Models
@@ -16,90 +20,56 @@ For the convenience of the user, several construction methods exist for each sub
1620

1721
### Method 1
1822
The most basic construction method detects whether the absolute or relative rate form of a substitution model is being referenced based on the number of parameters, and constructs it:
19-
```jldoctest
23+
```@repl sm
2024
K80(1e-2)
21-
22-
# output
23-
Kimura 1980 model (relative rate form)
24-
κ = 0.01
2525
```
2626

2727
Substitution model construction involves a number of checks for parameter validity, though these may be optionally bypassed:
2828

29-
```jldoctest
30-
K80(-1e-2, false)
31-
32-
# output
33-
Kimura 1980 model (relative rate form)
34-
κ = -0.01
29+
```@repl sm
30+
K80(-1e-2, safe=false)
3531
```
3632

3733
The exact model type may be specific as well, to avoid the software detection of absolute or relative rate specification. The specific forms are the parent models' name followed by `abs` for absolute or `rel` for relative rate form.
3834

39-
```jldoctest
35+
```@repl sm
4036
K80rel<:K80, K80abs<:K80
41-
42-
# output
43-
(true, true)
4437
```
4538

46-
```jldoctest
39+
```@repl sm
4740
K80abs(1e-2, 1.5e-2)
48-
49-
# output
50-
Kimura 1980 model (absolute rate form)
51-
α = 0.01, β = 0.015
5241
```
5342

5443
For models requiring specification of base frequencies, those can be provided in the same manner as the other model parameters:
5544

56-
```jldoctest
45+
```@repl sm
5746
fieldnames(F81abs)
58-
59-
# output
60-
(:β, :πA, :πC, :πG, :πT)
6147
```
6248

63-
```jldoctest
49+
```@repl sm
6450
F81abs(1e-2, 0.2475, 0.2425, 0.2575, 0.2525)
65-
66-
# output
67-
Felsenstein 1981 model (absolute rate form)
68-
β = 0.01, π = [0.2475, 0.2425, 0.2575, 0.2525]
6951
```
7052

7153
### Method 2
7254
It may be familar or convenient for some SubstitutionModels.jl users to construct substitution model objects using a parameter vector of some kind.
7355
This is also a supported construction method. When specifying a model with an equal base frequency, a single parameter vector is required for construction.
7456
For models that support different base frequencies, a parameter vector and a base frequency vector are both required.
7557

76-
```jldoctest
58+
```@repl sm
7759
F81abs([1e-2], [0.2475, 0.2425, 0.2575, 0.2525])
78-
79-
# output
80-
Felsenstein 1981 model (absolute rate form)
81-
β = 0.01, π = [0.2475, 0.2425, 0.2575, 0.2525]
8260
```
8361

8462
The unsafe construction method is still available, as is auto-detection of absolute or relative rate types of substitution models.
8563

86-
```jldoctest
87-
K80([1e-2, 1.5e-2], true)
88-
89-
# output
90-
Kimura 1980 model (absolute rate form)
91-
α = 0.01, β = 0.015
64+
```@repl sm
65+
K80([1e-2, 1.5e-2], safe = true)
9266
```
9367

9468
### Method 3
9569
Lastly, `convert` methods are also provided for each substitution model type:
9670

97-
```jldoctest
98-
convert(K80, [1e-2, 1.5e-2], true)
99-
100-
# output
101-
Kimura 1980 model (absolute rate form)
102-
α = 0.01, β = 0.015
71+
```@repl sm
72+
convert(K80, [1e-2, 1.5e-2])
10373
```
10474

10575
## User defined substitution models

src/core.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ const Pmatrix = SMatrix{4, 4, Float64}
2222

2323

2424
function Base.convert(::Type{T}, θ::F...; safe::Bool=true) where {T <: NASM, F <: Float64}
25-
return T..., safe)
25+
return T..., safe=safe)
2626
end
2727

2828

2929
function Base.convert(::Type{T}, θ_vec::A; safe::Bool=true) where {T <: NASM, A <: AbstractArray}
30-
return T(θ_vec, safe)
30+
return T(θ_vec, safe=safe)
3131
end
3232

3333

3434
function Base.convert(::Type{T}, θ_vec::A, π_vec::A; safe::Bool=true) where {T <: NASM, A <: AbstractArray}
35-
return T(θ_vec, π_vec, safe)
35+
return T(θ_vec, π_vec, safe=safe)
3636
end

0 commit comments

Comments
 (0)