Skip to content

Commit

Permalink
add tests, some docs and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
longemen3000 committed May 31, 2023
1 parent 864a9eb commit 0746ff1
Show file tree
Hide file tree
Showing 17 changed files with 544 additions and 284 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
40 changes: 40 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI
on:
push:
branches:
- main
tags: ['*']
pull_request:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.6'
- '1.9'
- 'nightly'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
files: lcov.info
16 changes: 16 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CompatHelper
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
15 changes: 15 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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 }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
16 changes: 16 additions & 0 deletions .github/workflows/register.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Register Package
on:
workflow_dispatch:
inputs:
version:
description: Version to register or component to bump
required: true
jobs:
register:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: julia-actions/RegisterAction@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Manifest.toml
docs/build/
docs/site/
*.jl.cov
*.jl.*.cov
*.jl.mem
lcov.info
LocalPreferences.toml
17 changes: 15 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "ClapeyronGCIdentifier"
name = "GCIdentifier"
uuid = "b7ea765e-cbac-4e4a-9b0d-5427cc302506"
authors = ["Hon Wa Yew <[email protected]>", "Pierre Walker <[email protected]>", "Andrés Riedemann <[email protected]>"]
version = "0.1.0"
Expand All @@ -8,5 +8,18 @@ ChemicalIdentifiers = "fa4ea961-1416-484e-bda2-883ee1634ba5"
Clapeyron = "7c7805af-46cc-48c9-995b-ed0ed2dc909a"
RDKitMinimalLib = "44044271-7623-48dc-8250-42433c44e4b7"

[weakdeps]
Clapeyron = "7c7805af-46cc-48c9-995b-ed0ed2dc909a"

[extensions]
GCIdentifierClapeyronExt = "Clapeyron"

[compat]
Clapeyron = "0.4"
Clapeyron = "0.4"

[extras]
Clapeyron = "7c7805af-46cc-48c9-995b-ed0ed2dc909a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# ClapeyronGCIdentifier
identifies subgroups, given a SMILES
# GCIdentifier

identifies subgroups, given a SMILES.

A l
19 changes: 19 additions & 0 deletions ext/GCIdentifierClapeyronExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module GCIdentifierClapeyronExt

if !isdefined(Base,:get_extension)
using Clapeyron
using GCIdentifier
else
using ..Clapeyron
using ..GCIdentifier
end

const GC = GCIdentifier

GC.get_grouplist(m::Clapeyron.EoSModel) = GC.get_grouplist(typeof(m))
GC.get_grouplist(Type{T}) where T <: UNIFAC = GC.UNIFACGroups
GC.get_grouplist(Type{T}) where T <: SAFTgammaMie = GC.SAFTgammaMieGroups
GC.get_grouplist(Type{T}) where T <: Joback = GC.JobackGroups
GC.get_grouplist(Type{T}) where T <: gcPCSAFT = GC.gcPCSAFTgroups

end #module
8 changes: 0 additions & 8 deletions src/ClapeyronGCIdentifier.jl

This file was deleted.

19 changes: 19 additions & 0 deletions src/GCIdentifier.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module GCIdentifier
using RDKitMinimalLib, ChemicalIdentifiers

@static if !isdefined(Base,:eachsplit)
eachsplit(str::AbstractString, dlm; limit::Integer=0, keepempty::Bool=true) = split(str,dlm;limit,keepempty)
eachsplit(str::AbstractString; limit::Integer=0, keepempty::Bool=false) = split(str;limit,keepempty)
end

split_2(str) = NTuple{2}(eachsplit(str, limit=2))
split_2(str,dlm) = NTuple{2}(eachsplit(str,dlm, limit=2))

include("group_search.jl")
include("database/database.jl")

if !isdefined(Base,:get_extension)
using Clapeyron
include("../ext/GCIdentifierClapeyronExt.jl")
end
end # module
83 changes: 42 additions & 41 deletions src/database/Joback.jl
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
JobackGroups = [raw"[CX4H3]" "-CH3";
raw"[!R;CX4H2]" "-CH2-";
raw"[!R;CX4H]" ">CH-";
raw"[!R;CX4H0]" ">C<";
raw"[CX3H2][CX3H1]" "CH2=CH-";
raw"[CX3H1][CX3H1]" "-CH=CH-";
raw"[$([!R;#6X3H0]);!$([!R;#6X3H0]=[#8])]" "=C<";
raw"[$([CX2H0](=*)=*)]" "=C=";
raw"[$([CX2H1]#[!#7])]" "CH";
raw"[$([CX2H0]#[!#7])]" "C";
raw"[R;CX4H2]" "ring-CH2-";
raw"[R;CX4H]" "ring>CH-";
raw"[R;CX4H0]" "ring>C<";
raw"[R;CX3H1,cX3H1]" "ring=CH-";
raw"[$([R;#6X3H0]);!$([R;#6X3H0]=[#8])]" "ring=C<";
raw"[F]" "-F";
raw"[Cl]" "-Cl";
raw"[Br]" "-Br";
raw"[I]" "-I";
raw"[OX2H;!$([OX2H]-[#6]=[O]);!$([OX2H]-a)]" "-OH (alcohol)";
raw"[O;H1;$(O-!@c)]" "-OH (phenol)";
raw"[OX2H0;!R;!$([OX2H0]-[#6]=[#8])]" "-O- (non-ring)";
raw"[#8X2H0;R;!$([#8X2H0]~[#6]=[#8])]" "-O- (ring)";
raw"[$([CX3H0](=[OX1]));!$([CX3](=[OX1])-[OX2]);!R]=O" ">C=O (non-ring)";
raw"[$([#6X3H0](=[OX1]));!$([#6X3](=[#8X1])~[#8X2]);R]=O" ">C=O (ring)";
raw"[CH;D2](=O)" "O=CH- (aldehyde)";
raw"[OX2H]-[C]=O" "-COOH (acid)";
raw"[#6X3H0;!$([#6X3H0](~O)(~O)(~O))](=[#8X1])[#8X2H0]" "-COO- (ester)";
raw"[OX1H0;!$([OX1H0]~[#6X3]);!$([OX1H0]~[#7X3]~[#8])]" "=O (other than above)";
raw"[NX3H2]" "-NH2";
raw"[NX3H1;!R]" ">NH (non-ring)";
raw"[#7X3H1;R]" ">NH (ring)";
raw"[#7X3H0;!$([#7](~O)~O)]" ">N- (non-ring)";
raw"[#7X2H0;!R]" "-N= (non-ring)";
raw"[#7X2H0;R]" "-N= (ring)";
raw"[#7X2H1]" "=NH";
raw"[#6X2]#[#7X1H0]" "-CN";
raw"[$([#7X3,#7X3+][!#8])](=[O])~[O-]" "-NO2";
raw"[SX2H]" "-SH";
raw"[#16X2H0;!R]" "-S- (non-ring)";
raw"[#16X2H0;R]" "-S- (ring)"]
JobackGroups = [GCPair(raw"[CX4H3]","-CH3"),
GCPair(raw"[!R;CX4H2]","-CH2-"),
GCPair(raw"[!R;CX4H]",">CH-"),
GCPair(raw"[!R;CX4H0]",">C<"),
GCPair(raw"[CX3H2][CX3H1]","CH2=CH-"),
GCPair(raw"[CX3H1][CX3H1]","-CH=CH-"),
GCPair(raw"[$([!R;#6X3H0]);!$([!R;#6X3H0]=[#8])]","=C<"),
GCPair(raw"[$([CX2H0](=*)=*)]","=C="),
GCPair(raw"[$([CX2H1]#[!#7])]","CH"),
GCPair(raw"[$([CX2H0]#[!#7])]","C"),
GCPair(raw"[R;CX4H2]","ring-CH2-"),
GCPair(raw"[R;CX4H]","ring>CH-"),
GCPair(raw"[R;CX4H0]","ring>C<"),
GCPair(raw"[R;CX3H1,cX3H1]","ring=CH-"),
GCPair(raw"[$([R;#6X3H0]);!$([R;#6X3H0]=[#8])]","ring=C<"),
GCPair(raw"[F]","-F"),
GCPair(raw"[Cl]","-Cl"),
GCPair(raw"[Br]","-Br"),
GCPair(raw"[I]","-I"),
GCPair(raw"[OX2H;!$([OX2H]-[#6]=[O]);!$([OX2H]-a)]","-OH (alcohol)"),
GCPair(raw"[O;H1;$(O-!@c)]","-OH (phenol)"),
GCPair(raw"[OX2H0;!R;!$([OX2H0]-[#6]=[#8])]","-O- (non-ring)"),
GCPair(raw"[#8X2H0;R;!$([#8X2H0]~[#6]=[#8])]","-O- (ring)"),
GCPair(raw"[$([CX3H0](=[OX1]));!$([CX3](=[OX1])-[OX2]);!R]=O",">C=O (non-ring)"),
GCPair(raw"[$([#6X3H0](=[OX1]));!$([#6X3](=[#8X1])~[#8X2]);R]=O",">C=O (ring)"),
GCPair(raw"[CH;D2](=O)","O=CH- (aldehyde)"),
GCPair(raw"[OX2H]-[C]=O","-COOH (acid)"),
GCPair(raw"[#6X3H0;!$([#6X3H0](~O)(~O)(~O))](=[#8X1])[#8X2H0]","-COO- (ester)"),
GCPair(raw"[OX1H0;!$([OX1H0]~[#6X3]);!$([OX1H0]~[#7X3]~[#8])]","=O (other than above)"),
GCPair(raw"[NX3H2]","-NH2"),
GCPair(raw"[NX3H1;!R]",">NH (non-ring)"),
GCPair(raw"[#7X3H1;R]",">NH (ring)"),
GCPair(raw"[#7X3H0;!$([#7](~O)~O)]",">N- (non-ring)"),
GCPair(raw"[#7X2H0;!R]","-N= (non-ring)"),
GCPair(raw"[#7X2H0;R]","-N= (ring)"),
GCPair(raw"[#7X2H1]","=NH"),
GCPair(raw"[#6X2]#[#7X1H0]","-CN"),
GCPair(raw"[$([#7X3,#7X3+][!#8])](=[O])~[O-]","-NO2"),
GCPair(raw"[SX2H]","-SH"),
GCPair(raw"[#16X2H0;!R]","-S- (non-ring)"),
GCPair(raw"[#16X2H0;R]","-S- (ring)")
]

export JobackGroups
65 changes: 33 additions & 32 deletions src/database/SAFTgammaMie.jl
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
SAFTgammaMieGroups = [raw"[CX4H3]" "CH3";
raw"[!R;CX4H2]" "CH2";
raw"[!R;CX4H]" "CH";
raw"[!R;CX4H0]" "C";
raw"[cX3;H1]" "aCH";
raw"[cX3;H0][CX4;H2]" "aCCH2";
raw"[cX3;H0][CX4;H1]" "aCCH";
raw"[CX3H2]" "CH2=";
raw"[!R;CX3H1;!$([CX3H1](=O))]" "CH=";
raw"[CH2;R]" "cCH2";
raw"[OX2H]-[C]=O" "COOH";
raw"[#6X3H0;!$([#6X3H0](~O)(~O)(~O))](=[#8X1])[#8X2H0]" "COO";
raw"[OX2H;!$([OX2H]-[#6]=[O]);!$([OX2H]-a)]" "OH";
raw"[CX4;H2;!R][OH1]" "CH2OH";
raw"[CX4;H1;!R][OH1]" "CHOH";
raw"[NX3H2]" "NH2";
raw"[NX3H1;!R]" "NH";
raw"[#7X3H0;!$([#7](~O)~O)]" "N";
raw"[#7X3H1;R]" "cNH";
raw"[#7X3H0;R]" "cN";
raw"[!R;CX3H0;!$([CX3H0](=O))]" "CH=";
raw"[cX3;H0][CX4;H3]" "aCCH3";
raw"[cX3;H0;R][OX2;H1]" "aCOH";
raw"[CH1;R]" "cCH";
raw"[CH1;R][NH1;!R]" "cCHNH";
raw"[CH1;R][NH0;!R]" "cCHN";
raw"[cH0][C;!R](=O)[cH0]" "aCCOaC";
raw"[OX2H]-[C](=O)[cH0]" "aCCOOH";
raw"[cH0][NH1;!R][cH0]" "aCNHaC";
raw"[CH3][CX3](=O)" "CH3CO";
raw"[OH0;!R;$([OH0;!R][CH3;!R]);$([OH0;!R][CH2;!R])]" "eO";
raw"[OH0;!R;$([OH0;!R][CH2;!R])]" "cO"]
SAFTgammaMieGroups = [GCPair(raw"[CX4H3]","CH3"),
GCPair(raw"[!R;CX4H2]","CH2"),
GCPair(raw"[!R;CX4H]","CH"),
GCPair(raw"[!R;CX4H0]","C"),
GCPair(raw"[cX3;H1]","aCH"),
GCPair(raw"[cX3;H0][CX4;H2]","aCCH2"),
GCPair(raw"[cX3;H0][CX4;H1]","aCCH"),
GCPair(raw"[CX3H2]","CH2="),
GCPair(raw"[!R;CX3H1;!$([CX3H1](=O))]","CH="),
GCPair(raw"[CH2;R]","cCH2"),
GCPair(raw"[OX2H]-[C]=O","COOH"),
GCPair(raw"[#6X3H0;!$([#6X3H0](~O)(~O)(~O))](=[#8X1])[#8X2H0]","COO"),
GCPair(raw"[OX2H;!$([OX2H]-[#6]=[O]);!$([OX2H]-a)]","OH"),
GCPair(raw"[CX4;H2;!R][OH1]","CH2OH"),
GCPair(raw"[CX4;H1;!R][OH1]","CHOH"),
GCPair(raw"[NX3H2]","NH2"),
GCPair(raw"[NX3H1;!R]","NH"),
GCPair(raw"[#7X3H0;!$([#7](~O)~O)]","N"),
GCPair(raw"[#7X3H1;R]","cNH"),
GCPair(raw"[#7X3H0;R]","cN"),
GCPair(raw"[!R;CX3H0;!$([CX3H0](=O))]","CH="),
GCPair(raw"[cX3;H0][CX4;H3]","aCCH3"),
GCPair(raw"[cX3;H0;R][OX2;H1]","aCOH"),
GCPair(raw"[CH1;R]","cCH"),
GCPair(raw"[CH1;R][NH1;!R]","cCHNH"),
GCPair(raw"[CH1;R][NH0;!R]","cCHN"),
GCPair(raw"[cH0][C;!R](=O)[cH0]","aCCOaC"),
GCPair(raw"[OX2H]-[C](=O)[cH0]","aCCOOH"),
GCPair(raw"[cH0][NH1;!R][cH0]","aCNHaC"),
GCPair(raw"[CH3][CX3](=O)","CH3CO"),
GCPair(raw"[OH0;!R;$([OH0;!R][CH3;!R]);$([OH0;!R][CH2;!R])]","eO"),
GCPair(raw"[OH0;!R;$([OH0;!R][CH2;!R])]","cO")
]

export SAFTgammaMieGroups
Loading

0 comments on commit 0746ff1

Please sign in to comment.