Skip to content

Commit c4d8142

Browse files
Merge branch 'hotfix/Metabolite_object'
2 parents be0b89c + e280e21 commit c4d8142

1 file changed

Lines changed: 51 additions & 1 deletion

File tree

R/metabolite.R

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#' @field name name character [optional]
1212
#' @field db_identifier unique identifier character [optional]
1313
#' @field id_collection database id of the collection integer [optional]
14+
#' @field caas caas for Metabolite character [optional]
15+
#' @field smiles smiles for Metabolite character [optional]
1416
#' @field chemical_formula chemical_formula for Metabolite character [optional]
1517
#' @field weight weight for Metabolite character [optional]
1618
#' @field mono_iso_mass mono_iso_mass for Metabolite character [optional]
@@ -30,6 +32,8 @@ Metabolite <- R6::R6Class(
3032
`name` = NULL,
3133
`db_identifier` = NULL,
3234
`id_collection` = NULL,
35+
`caas` = NULL,
36+
`smiles` = NULL,
3337
`chemical_formula` = NULL,
3438
`weight` = NULL,
3539
`mono_iso_mass` = NULL,
@@ -47,6 +51,8 @@ Metabolite <- R6::R6Class(
4751
#' @param name name
4852
#' @param db_identifier unique identifier
4953
#' @param id_collection database id of the collection
54+
#' @param caas caas for Metabolite
55+
#' @param smiles smiles for Metabolite
5056
#' @param chemical_formula chemical_formula for Metabolite
5157
#' @param weight weight for Metabolite
5258
#' @param mono_iso_mass mono_iso_mass for Metabolite
@@ -57,7 +63,7 @@ Metabolite <- R6::R6Class(
5763
#' @param inchi inchi for Metabolite
5864
#' @param sbo Systems Biology Ontology identifier for Metabolite
5965
#' @param ... Other optional arguments.
60-
initialize = function(`id` = NULL, `name` = NULL, `db_identifier` = NULL, `id_collection` = NULL, `chemical_formula` = NULL, `weight` = NULL, `mono_iso_mass` = NULL, `exact_neutral_mass` = NULL, `average_mass` = NULL, `generic` = NULL, `charge` = NULL, `inchi` = NULL, `sbo` = NULL, ...) {
66+
initialize = function(`id` = NULL, `name` = NULL, `db_identifier` = NULL, `id_collection` = NULL, `caas` = NULL, `smiles` = NULL, `chemical_formula` = NULL, `weight` = NULL, `mono_iso_mass` = NULL, `exact_neutral_mass` = NULL, `average_mass` = NULL, `generic` = NULL, `charge` = NULL, `inchi` = NULL, `sbo` = NULL, ...) {
6167
if (!is.null(`id`)) {
6268
if (!(is.numeric(`id`) && length(`id`) == 1)) {
6369
stop(paste("Error! Invalid data for `id`. Must be an integer:", `id`))
@@ -82,6 +88,18 @@ Metabolite <- R6::R6Class(
8288
}
8389
self$`id_collection` <- `id_collection`
8490
}
91+
if (!is.null(`caas`)) {
92+
if (!(is.character(`caas`) && length(`caas`) == 1)) {
93+
stop(paste("Error! Invalid data for `caas`. Must be a string:", `caas`))
94+
}
95+
self$`caas` <- `caas`
96+
}
97+
if (!is.null(`smiles`)) {
98+
if (!(is.character(`smiles`) && length(`smiles`) == 1)) {
99+
stop(paste("Error! Invalid data for `smiles`. Must be a string:", `smiles`))
100+
}
101+
self$`smiles` <- `smiles`
102+
}
85103
if (!is.null(`chemical_formula`)) {
86104
if (!(is.character(`chemical_formula`) && length(`chemical_formula`) == 1)) {
87105
stop(paste("Error! Invalid data for `chemical_formula`. Must be a string:", `chemical_formula`))
@@ -160,6 +178,14 @@ Metabolite <- R6::R6Class(
160178
MetaboliteObject[["id_collection"]] <-
161179
self$`id_collection`
162180
}
181+
if (!is.null(self$`caas`)) {
182+
MetaboliteObject[["caas"]] <-
183+
self$`caas`
184+
}
185+
if (!is.null(self$`smiles`)) {
186+
MetaboliteObject[["smiles"]] <-
187+
self$`smiles`
188+
}
163189
if (!is.null(self$`chemical_formula`)) {
164190
MetaboliteObject[["chemical_formula"]] <-
165191
self$`chemical_formula`
@@ -218,6 +244,12 @@ Metabolite <- R6::R6Class(
218244
if (!is.null(this_object$`id_collection`)) {
219245
self$`id_collection` <- this_object$`id_collection`
220246
}
247+
if (!is.null(this_object$`caas`)) {
248+
self$`caas` <- this_object$`caas`
249+
}
250+
if (!is.null(this_object$`smiles`)) {
251+
self$`smiles` <- this_object$`smiles`
252+
}
221253
if (!is.null(this_object$`chemical_formula`)) {
222254
self$`chemical_formula` <- this_object$`chemical_formula`
223255
}
@@ -286,6 +318,22 @@ Metabolite <- R6::R6Class(
286318
self$`id_collection`
287319
)
288320
},
321+
if (!is.null(self$`caas`)) {
322+
sprintf(
323+
'"caas":
324+
"%s"
325+
',
326+
self$`caas`
327+
)
328+
},
329+
if (!is.null(self$`smiles`)) {
330+
sprintf(
331+
'"smiles":
332+
"%s"
333+
',
334+
self$`smiles`
335+
)
336+
},
289337
if (!is.null(self$`chemical_formula`)) {
290338
sprintf(
291339
'"chemical_formula":
@@ -374,6 +422,8 @@ Metabolite <- R6::R6Class(
374422
self$`name` <- this_object$`name`
375423
self$`db_identifier` <- this_object$`db_identifier`
376424
self$`id_collection` <- this_object$`id_collection`
425+
self$`caas` <- this_object$`caas`
426+
self$`smiles` <- this_object$`smiles`
377427
self$`chemical_formula` <- this_object$`chemical_formula`
378428
self$`weight` <- this_object$`weight`
379429
self$`mono_iso_mass` <- this_object$`mono_iso_mass`

0 commit comments

Comments
 (0)