aboutsummaryrefslogtreecommitdiff
path: root/man/chent.Rd
blob: 686d6c77335fd0256028415f1a10e12f5a250ab2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/chent.R
\name{chent}
\alias{chent}
\title{An R6 class for chemical entities with associated data}
\format{
An \code{\link{R6Class}} generator object
}
\description{
The class is initialised with an identifier. Chemical
information is retrieved from the internet. Additionally, it can be
generated using RDKit if RDKit and its python bindings are installed.
}
\examples{
oct <- chent$new("1-octanol", smiles = "CCCCCCCCO", pubchem = FALSE)
print(oct)
if (!is.null(oct$Picture)) {
  plot(oct)
}

caffeine <- chent$new("caffeine")
print(caffeine)
if (!is.null(caffeine$Picture)) {
  plot(caffeine)
}
}
\section{Public fields}{
\if{html}{\out{<div class="r6-fields">}}
\describe{
\item{\code{identifier}}{(\code{character(1)})\cr
The identifier that was used to initiate the object, with attribute 'source'}

\item{\code{inchikey}}{(\code{character(1)})\cr
InChI Key, with attribute 'source'}

\item{\code{smiles}}{(\code{character()})\cr
SMILES code(s), with attribute 'source'}

\item{\code{mw}}{(\code{numeric(1)})\cr
Molecular weight, with attribute 'source'}

\item{\code{pubchem}}{(\code{list()})\cr
List of information retrieved from PubChem}

\item{\code{rdkit}}{List of information obtained with RDKit}

\item{\code{mol}}{<rdkit.Chem.rdchem.Mol> object}

\item{\code{svg}}{SVG code}

\item{\code{Picture}}{Graph as a \code{\link{picture}} object obtained using grImport}

\item{\code{Pict_font_size}}{Font size as extracted from the intermediate PostScript file}

\item{\code{pdf_height}}{Height of the MediaBox in the pdf after cropping}

\item{\code{p0}}{Vapour pressure in Pa}

\item{\code{cwsat}}{Water solubility in mg/L}

\item{\code{PUF}}{Plant uptake factor}

\item{\code{chyaml}}{List of information obtained from a YAML file}

\item{\code{TPs}}{List of transformation products as chent objects
Add a transformation product to the internal list}

\item{\code{transformations}}{Data frame of observed transformations
Add a line in the internal dataframe holding observed transformations}

\item{\code{soil_degradation}}{Dataframe of modelling DT50 values
Add a line in the internal dataframe holding modelling DT50 values}

\item{\code{soil_ff}}{Dataframe of formation fractions}

\item{\code{soil_sorption}}{Dataframe of soil sorption data
Add soil sorption data}
}
\if{html}{\out{</div>}}
}
\section{Methods}{
\subsection{Public methods}{
\itemize{
\item \href{#method-chent-new}{\code{chent$new()}}
\item \href{#method-chent-try_pubchem}{\code{chent$try_pubchem()}}
\item \href{#method-chent-get_pubchem}{\code{chent$get_pubchem()}}
\item \href{#method-chent-get_rdkit}{\code{chent$get_rdkit()}}
\item \href{#method-chent-get_chyaml}{\code{chent$get_chyaml()}}
\item \href{#method-chent-add_p0}{\code{chent$add_p0()}}
\item \href{#method-chent-add_cwsat}{\code{chent$add_cwsat()}}
\item \href{#method-chent-add_PUF}{\code{chent$add_PUF()}}
\item \href{#method-chent-add_TP}{\code{chent$add_TP()}}
\item \href{#method-chent-add_transformation}{\code{chent$add_transformation()}}
\item \href{#method-chent-add_soil_degradation}{\code{chent$add_soil_degradation()}}
\item \href{#method-chent-add_soil_ff}{\code{chent$add_soil_ff()}}
\item \href{#method-chent-add_soil_sorption}{\code{chent$add_soil_sorption()}}
\item \href{#method-chent-pdf}{\code{chent$pdf()}}
\item \href{#method-chent-png}{\code{chent$png()}}
\item \href{#method-chent-emf}{\code{chent$emf()}}
\item \href{#method-chent-clone}{\code{chent$clone()}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-new"></a>}}
\if{latex}{\out{\hypertarget{method-chent-new}{}}}
\subsection{Method \code{new()}}{
Creates a new instance of this \link[R6:R6Class]{R6} class.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$new(
  identifier,
  smiles = NULL,
  inchikey = NULL,
  pubchem = TRUE,
  pubchem_from = c("name", "smiles", "inchikey"),
  rdkit = TRUE,
  template = NULL,
  chyaml = TRUE
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{identifier}}{Identifier to be stored in the object}

\item{\code{smiles}}{Optional user provided SMILES code}

\item{\code{inchikey}}{Optional user provided InChI Key}

\item{\code{pubchem}}{Should an attempt be made to retrieve chemical
information from PubChem via the webchem package?}

\item{\code{pubchem_from}}{Possibility to select the argument
that is used to query pubchem}

\item{\code{rdkit}}{Should an attempt be made to retrieve chemical
information from a local rdkit installation via python
and the reticulate package?}

\item{\code{template}}{An optional SMILES code to be used as template for RDKit}

\item{\code{chyaml}}{Should we look for a identifier.yaml file in the working
directory?
Try to get chemical information from PubChem}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-try_pubchem"></a>}}
\if{latex}{\out{\hypertarget{method-chent-try_pubchem}{}}}
\subsection{Method \code{try_pubchem()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$try_pubchem(query, from = "name")}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{query}}{Query string to be passed to \link[webchem:get_cid]{get_cid}}

\item{\code{from}}{Passed to \link[webchem:get_cid]{get_cid}
Get chemical information from PubChem for a known PubChem CID}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-get_pubchem"></a>}}
\if{latex}{\out{\hypertarget{method-chent-get_pubchem}{}}}
\subsection{Method \code{get_pubchem()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$get_pubchem(pubchem_cid)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{pubchem_cid}}{CID
Get chemical information from RDKit if available}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-get_rdkit"></a>}}
\if{latex}{\out{\hypertarget{method-chent-get_rdkit}{}}}
\subsection{Method \code{get_rdkit()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$get_rdkit(template = NULL)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{template}}{Optional template specified as a SMILES code
Obtain information from a YAML file}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-get_chyaml"></a>}}
\if{latex}{\out{\hypertarget{method-chent-get_chyaml}{}}}
\subsection{Method \code{get_chyaml()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$get_chyaml(
  repo = c("wd", "local", "web"),
  chyaml = paste0(URLencode(self$identifier), ".yaml")
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{repo}}{Should the file be looked for in the current working
directory, a local git repository under \verb{~/git/chyaml}, or from
the web (not implemented).}

\item{\code{chyaml}}{The filename to be looked for
Add a vapour pressure}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-add_p0"></a>}}
\if{latex}{\out{\hypertarget{method-chent-add_p0}{}}}
\subsection{Method \code{add_p0()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$add_p0(p0, T = NA, source = NA, page = NA, remark = "")}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{p0}}{The vapour pressure in Pa}

\item{\code{T}}{Temperature}

\item{\code{source}}{An acronym specifying the source of the information}

\item{\code{page}}{The page from which the information was taken}

\item{\code{remark}}{A remark
Add a water solubility}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-add_cwsat"></a>}}
\if{latex}{\out{\hypertarget{method-chent-add_cwsat}{}}}
\subsection{Method \code{add_cwsat()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$add_cwsat(cwsat, T = NA, pH = NA, source = NA, page = NA, remark = "")}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{cwsat}}{The water solubility in mg/L}

\item{\code{T}}{Temperature}

\item{\code{pH}}{The pH value}

\item{\code{source}}{An acronym specifying the source of the information}

\item{\code{page}}{The page from which the information was taken}

\item{\code{remark}}{A remark
Add a plant uptake factor}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-add_PUF"></a>}}
\if{latex}{\out{\hypertarget{method-chent-add_PUF}{}}}
\subsection{Method \code{add_PUF()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$add_PUF(
  PUF = 0,
  source = "focus_generic_gw_2014",
  page = 41,
  remark = "Conservative default value"
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{PUF}}{The plant uptake factor, a number between 0 and 1}

\item{\code{source}}{An acronym specifying the source of the information}

\item{\code{page}}{The page from which the information was taken}

\item{\code{remark}}{A remark}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-add_TP"></a>}}
\if{latex}{\out{\hypertarget{method-chent-add_TP}{}}}
\subsection{Method \code{add_TP()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$add_TP(x, smiles = NULL, pubchem = FALSE)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{x}}{A \link{chent} object, or an identifier to generate a \link{chent} object}

\item{\code{smiles}}{A SMILES code for defining a \link{chent} object}

\item{\code{pubchem}}{Should chemical information be obtained from PubChem?}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-add_transformation"></a>}}
\if{latex}{\out{\hypertarget{method-chent-add_transformation}{}}}
\subsection{Method \code{add_transformation()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$add_transformation(
  study_type,
  TP_identifier,
  max_occurrence,
  remark = "",
  source = NA,
  pages = NA
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{study_type}}{A characterisation of the study type}

\item{\code{TP_identifier}}{An identifier of one of the transformation products
in \code{self$TPs}}

\item{\code{max_occurrence}}{The maximum observed occurrence of the
transformation product, expressed as a fraction of the amount that would
result from stochiometric transformation}

\item{\code{remark}}{A remark}

\item{\code{source}}{An acronym specifying the source of the information}

\item{\code{pages}}{The page from which the information was taken}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-add_soil_degradation"></a>}}
\if{latex}{\out{\hypertarget{method-chent-add_soil_degradation}{}}}
\subsection{Method \code{add_soil_degradation()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$add_soil_degradation(
  soils,
  DT50_mod,
  DT50_mod_ref,
  type = NA,
  country = NA,
  pH_orig = NA,
  pH_medium = NA,
  pH_H2O = NA,
  perc_OC = NA,
  temperature = NA,
  moisture = NA,
  category = "lab",
  formulation = NA,
  model = NA,
  chi2 = NA,
  remark = "",
  source,
  page = NA
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{soils}}{Names of the soils}

\item{\code{DT50_mod}}{The modelling DT50 in the sense of regulatory pesticide
fate modelling}

\item{\code{DT50_mod_ref}}{The normalised modelling DT50 in the sense of
regulatory pesticide fate modelling}

\item{\code{type}}{The soil type}

\item{\code{country}}{The country (mainly for field studies)}

\item{\code{pH_orig}}{The pH stated in the study}

\item{\code{pH_medium}}{The medium in which this pH was measured}

\item{\code{pH_H2O}}{The pH extrapolated to pure water}

\item{\code{perc_OC}}{The percentage of organic carbon in the soil}

\item{\code{temperature}}{The temperature during the study in degrees Celsius}

\item{\code{moisture}}{The moisture during the study}

\item{\code{category}}{Is it a laboratory ('lab') or field study ('field')}

\item{\code{formulation}}{Name of the formulation applied, if it was not
the technical active ingredient}

\item{\code{model}}{The degradation model used for deriving \code{DT50_mod}}

\item{\code{chi2}}{The relative error as defined in FOCUS kinetics}

\item{\code{remark}}{A remark}

\item{\code{source}}{An acronym specifying the source of the information}

\item{\code{page}}{The page from which the information was taken}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-add_soil_ff"></a>}}
\if{latex}{\out{\hypertarget{method-chent-add_soil_ff}{}}}
\subsection{Method \code{add_soil_ff()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$add_soil_ff(target, soils, ff = 1, remark = "", source, page = NA)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{target}}{The identifier(s) of the transformation product}

\item{\code{soils}}{The soil name(s) in which the transformation was observed}

\item{\code{ff}}{The formation fraction(s)}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-add_soil_sorption"></a>}}
\if{latex}{\out{\hypertarget{method-chent-add_soil_sorption}{}}}
\subsection{Method \code{add_soil_sorption()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$add_soil_sorption(
  soils,
  Kf,
  Kfoc,
  N,
  type = NA,
  pH_orig = NA,
  pH_medium = NA,
  pH_H2O = NA,
  perc_OC = NA,
  perc_clay = NA,
  CEC = NA,
  remark = "",
  source,
  page = NA
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{Kf}}{The sorption constant in L/kg, either linear (then \code{N} is 1)
or according to Freundlich}

\item{\code{Kfoc}}{The constant from above, normalised to soil organic carbon}

\item{\code{N}}{The Freundlich exponent}

\item{\code{perc_clay}}{The percentage of clay in the soil}

\item{\code{CEC}}{The cation exchange capacity
Write a PDF image of the structure}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-pdf"></a>}}
\if{latex}{\out{\hypertarget{method-chent-pdf}{}}}
\subsection{Method \code{pdf()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$pdf(
  file = paste0(self$identifier, ".pdf"),
  dir = "structures/pdf",
  template = NULL
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{file}}{The file to write to}

\item{\code{dir}}{The directory to write the file to}

\item{\code{template}}{A template expressed as SMILES to use in RDKit
Write a PNG image of the structure}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-png"></a>}}
\if{latex}{\out{\hypertarget{method-chent-png}{}}}
\subsection{Method \code{png()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$png(
  file = paste0(self$identifier, ".png"),
  dir = "structures/png",
  antialias = "gray"
)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{antialias}}{Passed to \link[grDevices:png]{png}
Write an EMF image of the structure using \link[devEMF:emf]{emf}}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-emf"></a>}}
\if{latex}{\out{\hypertarget{method-chent-emf}{}}}
\subsection{Method \code{emf()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$emf(file = paste0(self$identifier, ".emf"), dir = "structures/emf")}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{file}}{The file to write to}
}
\if{html}{\out{</div>}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-chent-clone"></a>}}
\if{latex}{\out{\hypertarget{method-chent-clone}{}}}
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{chent$clone(deep = FALSE)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{deep}}{Whether to make a deep clone.}
}
\if{html}{\out{</div>}}
}
}
}

Contact - Imprint