chemomer 1.1.2.0 → 1.1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/lib/chemomer/bindings.rb +35 -0
- data/lib/chemomer/version.rb +1 -1
- data/lib/chemomer.rb +26 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 05d88fc3287c84e5301c6bc4b6fbc5fe06a6cc376c9de3583163c9cbc06a2778
|
|
4
|
+
data.tar.gz: e87d30f636285b37a29345ba28badbde0000b741c4364ab153136dcf4c6a4f5c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7749cc4df18b7e548485837812101c5889a9eeea7176778e768b4a15f24c1b2d79e8e6981aa79ea2731edeb491797abae8d1d52d3ebca1330c07e2fd16c14b68
|
|
7
|
+
data.tar.gz: 183d13e57a7e6f98039039c56f761d6f12f31bb3915ee10b71f8b73b46d615f3d8b3971e2a83df95b1871ae36958288a7ce62404d969a605257f53a0995c259c
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -9,7 +9,7 @@ env:
|
|
|
9
9
|
# Hermetic CI: the engine ref and the oracle corpus ref are pinned,
|
|
10
10
|
# never floating. Bump these lines deliberately with each engine
|
|
11
11
|
# ride (the tag carries what changed).
|
|
12
|
-
ENGINE_REF: v1.1.
|
|
12
|
+
ENGINE_REF: v1.1.4
|
|
13
13
|
CORPUS_REF: v0.3.41
|
|
14
14
|
|
|
15
15
|
jobs:
|
data/lib/chemomer/bindings.rb
CHANGED
|
@@ -144,6 +144,41 @@ module Chemomer
|
|
|
144
144
|
raise Error, load_failure(e)
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
+
# The ABI-v2 surface (chemomer 1.1.3+): the single-crossing RInChI
|
|
148
|
+
# record with the force-equilibrium option bit, and the SMILES
|
|
149
|
+
# reader. Attached on first use — a v1 cdylib keeps the v1 path.
|
|
150
|
+
def record(*names)
|
|
151
|
+
record_bindings[names] ||= attach_record(names)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def record_bindings
|
|
155
|
+
@record_bindings ||= {}
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def attach_record(names)
|
|
159
|
+
guard_readable(names)
|
|
160
|
+
Module.new do
|
|
161
|
+
extend FFI::Library
|
|
162
|
+
|
|
163
|
+
ffi_lib(*names)
|
|
164
|
+
attach_function :chemomer_rinchi_record_from_rxn2, %i[string uint32], :pointer
|
|
165
|
+
attach_function :chemomer_from_smiles, %i[string], :pointer
|
|
166
|
+
attach_function :chemomer_string_free, %i[pointer], :void
|
|
167
|
+
attach_function :chemomer_last_error, [], :pointer
|
|
168
|
+
|
|
169
|
+
def self.last_error
|
|
170
|
+
pointer = chemomer_last_error
|
|
171
|
+
pointer.null? ? nil : pointer.read_string
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
rescue FFI::NotFoundError
|
|
175
|
+
raise Error,
|
|
176
|
+
"chemomer: the cdylib does not export the ABI-v2 symbols — " \
|
|
177
|
+
"the record/smiles surface needs chemomer 1.1.3+ (github.com/chemomer/chemomer)"
|
|
178
|
+
rescue LoadError => e
|
|
179
|
+
raise Error, load_failure(e)
|
|
180
|
+
end
|
|
181
|
+
|
|
147
182
|
# An explicit CHEMOMER_LIB path is one candidate; a missing or
|
|
148
183
|
# unreadable file deserves the direct message rather than the
|
|
149
184
|
# loader's. The default soname list is searched by the loader
|
data/lib/chemomer/version.rb
CHANGED
data/lib/chemomer.rb
CHANGED
|
@@ -101,7 +101,32 @@ module Chemomer
|
|
|
101
101
|
Rinchi.decode_table(call(bindings, :chemomer_rinchi_decode, rinchi, rauxinfo))
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
#
|
|
104
|
+
# RXNfile → the identity record in one crossing, with the
|
|
105
|
+
# equilibrium option: { "rinchi" =>, "rauxinfo" =>, "rinchikey" =>,
|
|
106
|
+
# "longKey" =>, "webKey" => } — the five lines the v1 export needed
|
|
107
|
+
# five calls for. `force_equilibrium: true` derives the `/d` form
|
|
108
|
+
# and the equilibrium key shapes exactly as the oracle corpus's
|
|
109
|
+
# `forceEquilibrium` cases record. Needs an ABI-v2 cdylib
|
|
110
|
+
# (chemomer 1.1.3+).
|
|
111
|
+
def rinchi_record_from_rxn(rxnfile, force_equilibrium: false)
|
|
112
|
+
bindings = Bindings.record(*lib)
|
|
113
|
+
options = force_equilibrium ? 0x1 : 0x0
|
|
114
|
+
table = call(bindings, :chemomer_rinchi_record_from_rxn2, rxnfile, options)
|
|
115
|
+
keys = %w[rinchi rauxinfo rinchikey longKey webKey]
|
|
116
|
+
keys.zip(table.split("\n")).to_h
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# SMILES → the derived identifier (the day-1 `smiles.parg` contract:
|
|
120
|
+
# chains, branches, ring closures, organic + bracket atoms, charges,
|
|
121
|
+
# isotopes, explicit H counts, aromatic markers). Needs an ABI-v2
|
|
122
|
+
# cdylib (chemomer 1.1.3+).
|
|
123
|
+
def from_smiles(smiles)
|
|
124
|
+
bindings = Bindings.record(*lib)
|
|
125
|
+
call(bindings, :chemomer_from_smiles, smiles)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# The C ABI version of the attached cdylib (2 today; v1 exports
|
|
129
|
+
# unchanged).
|
|
105
130
|
def ffi_version
|
|
106
131
|
Bindings.for(*lib).chemomer_ffi_version
|
|
107
132
|
end
|