001/*
002 * mzTab-M reference implementation and validation API.
003 * This is the mzTab-M reference implementation and validation API service.
004 *
005 * OpenAPI spec version: 2.0.0
006 * Contact: nils.hoffmann@isas.de
007 *
008 * NOTE: This class is auto generated by the swagger code generator program.
009 * https://github.com/swagger-api/swagger-codegen.git
010 * Do not edit the class manually.
011 */
012
013
014package de.isas.mztab2.model;
015
016import java.util.Objects;
017import java.util.Arrays;
018import com.fasterxml.jackson.annotation.JsonProperty;
019import com.fasterxml.jackson.annotation.JsonCreator;
020import com.fasterxml.jackson.annotation.JsonValue;
021import de.isas.mztab2.model.Assay;
022import de.isas.mztab2.model.Parameter;
023import io.swagger.annotations.ApiModel;
024import io.swagger.annotations.ApiModelProperty;
025import java.util.ArrayList;
026import java.util.List;
027import com.fasterxml.jackson.dataformat.xml.annotation.*;
028import javax.xml.bind.annotation.*;
029import javax.validation.constraints.*;
030import javax.validation.Valid;
031import de.isas.lipidomics.mztab2.validation.constraints.*;
032/**
033 * 
034 * Specification of study_variable.
035(empty) name: A name for each study variable (experimental condition or factor), to serve as a list of the study variables that MUST be reported in the following tables. For software that does not capture study variables, a single study variable MUST be reported, linking to all assays. This single study variable MUST have the identifier “undefined“.
036assay_refs: Bar-separated references to the IDs of assays grouped in the study variable.
037average_function: The function used to calculate the study variable quantification value and the operation used is not arithmetic mean (default) e.g. “geometric mean”, “median”. The 1-n refers to different study variables.
038variation_function: The function used to calculate the study variable quantification variation value if it is reported and the operation used is not coefficient of variation (default) e.g. “standard error”.
039description: A textual description of the study variable.
040factors: Additional parameters or factors, separated by bars, that are known about study variables allowing the capture of more complex, such as nested designs.  
041
042 * 
043 *
044 * <p>mzTab-M specification example(s):</p>
045 * <pre><code>MTD       study_variable[1]       control
046MTD     study_variable[1]-assay_refs    assay[1]| assay[2]| assay[3]
047MTD     study_variable-average_function [MS, MS:1002883, median, ]
048MTD     study_variable-variation_function       [MS, MS:1002885, standard error, ]
049MTD     study_variable[1]-description   Group B (spike-in 0.74 fmol/uL)
050MTD     study_variable[1]-factors       [,,time point, 1 minute]|[,,rapamycin dose,0.5mg]
051MTD     study_variable[2]       1 minute 0.5mg rapamycin
052</code></pre>
053 * 
054 *
055 */
056@com.fasterxml.jackson.annotation.JsonIdentityInfo(generator = com.fasterxml.jackson.annotation.ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = StudyVariable.class)
057@ApiModel(description = "Specification of study_variable. (empty) name: A name for each study variable (experimental condition or factor), to serve as a list of the study variables that MUST be reported in the following tables. For software that does not capture study variables, a single study variable MUST be reported, linking to all assays. This single study variable MUST have the identifier “undefined“. assay_refs: Bar-separated references to the IDs of assays grouped in the study variable. average_function: The function used to calculate the study variable quantification value and the operation used is not arithmetic mean (default) e.g. “geometric mean”, “median”. The 1-n refers to different study variables. variation_function: The function used to calculate the study variable quantification variation value if it is reported and the operation used is not coefficient of variation (default) e.g. “standard error”. description: A textual description of the study variable. factors: Additional parameters or factors, separated by bars, that are known about study variables allowing the capture of more complex, such as nested designs.   ")
058@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2021-01-02T19:26:21.550+01:00")
059@XmlRootElement(name = "StudyVariable")
060@XmlAccessorType(XmlAccessType.FIELD)
061@JacksonXmlRootElement(localName = "StudyVariable")
062public class StudyVariable {
063
064  /**
065   * Property enumeration for StudyVariable.
066   */
067  public static enum Properties {
068      id("id"), 
069      name("name"), 
070      assayRefs("assay_refs"), 
071      averageFunction("average_function"), 
072      variationFunction("variation_function"), 
073      description("description"), 
074      factors("factors");
075
076    private final String propertyName;
077
078    private Properties(String propertyName) {
079      this.propertyName = propertyName;
080    }
081
082    public String getPropertyName() {
083      return propertyName;
084    }
085
086    public String toString() {
087      return propertyName;
088    }
089
090    public String toUpper() {
091      return propertyName.toUpperCase();
092    }
093
094    public static Properties of(String value) {
095      if(value==null) {
096        throw new NullPointerException("Argument value must not be null!");
097      }
098      return Arrays.asList(Properties.values()).stream().filter(m -> m.propertyName.equals(value.toLowerCase())).findAny().orElseThrow(IllegalArgumentException::new);
099    }
100  };
101  
102  @JsonProperty("id")
103  @JacksonXmlProperty(localName = "id")
104  @XmlElement(name = "id")
105  private Integer id = null;
106  @JsonProperty("name")
107  @JacksonXmlProperty(localName = "name")
108  @XmlElement(name = "name")
109  private String name = null;
110  @JsonProperty("assay_refs")
111  // Is a container wrapped=false
112  // items.name=assayRefs items.baseName=assayRefs items.xmlName= items.xmlNamespace=
113  // items.example= items.type=Assay
114  @XmlElement(name = "assayRefs")
115  private List<Assay> assayRefs = null;
116  @JsonProperty("average_function")
117  @JacksonXmlProperty(localName = "average_function")
118  @XmlElement(name = "average_function")
119  private Parameter averageFunction = null;
120  @JsonProperty("variation_function")
121  @JacksonXmlProperty(localName = "variation_function")
122  @XmlElement(name = "variation_function")
123  private Parameter variationFunction = null;
124  @JsonProperty("description")
125  @JacksonXmlProperty(localName = "description")
126  @XmlElement(name = "description")
127  private String description = null;
128  @JsonProperty("factors")
129  // Is a container wrapped=false
130  // items.name=factors items.baseName=factors items.xmlName= items.xmlNamespace=
131  // items.example= items.type=Parameter
132  @XmlElement(name = "factors")
133  private List<Parameter> factors = null;
134
135 /**
136   * Builder method for id.
137   *
138   * @see StudyVariable#setId StudyVariable#setId for specification examples
139   * @see StudyVariable#getId StudyVariable#getId for validation constraints
140   * @param id a {@code Integer} parameter.
141   * @return StudyVariable
142  **/
143  public StudyVariable id(Integer id) {
144   this.id = id;
145   return this;
146  }
147
148   /**
149   * <p>Get id.</p>
150   *
151   * <p>Minimum: 1</p>
152   * @return id
153  **/
154  @NotNull
155 @Min(1)  @ApiModelProperty(required = true, value = "")
156  public Integer getId() {
157    return id;
158  }
159
160 /**
161   * Set id.
162   *
163   * 
164   * 
165   * @see #getId StudyVariable#getId for validation constraints
166   * @param id a {@code Integer} parameter.
167  **/
168  public void setId(Integer id) {
169    this.id = id;
170  }
171
172
173 /**
174   * Builder method for name.
175   *
176   * @see StudyVariable#setName StudyVariable#setName for specification examples
177   * @see StudyVariable#getName StudyVariable#getName for validation constraints
178   * @param name a {@code String} parameter.
179   * @return StudyVariable
180  **/
181  public StudyVariable name(String name) {
182   this.name = name;
183   return this;
184  }
185
186   /**
187   * The study variable name.
188   *
189   * @return name
190  **/
191  @NotNull
192  @ApiModelProperty(required = true, value = "The study variable name.")
193  public String getName() {
194    return name;
195  }
196
197 /**
198   * Set name.
199   *
200   * 
201   * 
202   * @see #getName StudyVariable#getName for validation constraints
203   * @param name a {@code String} parameter.
204  **/
205  public void setName(String name) {
206    this.name = name;
207  }
208
209
210 /**
211   * Builder method for assayRefs.
212   *
213   * @see StudyVariable#setAssayRefs StudyVariable#setAssayRefs for specification examples
214   * @see StudyVariable#getAssayRefs StudyVariable#getAssayRefs for validation constraints
215   * @param assayRefs a {@code List<Assay>} parameter.
216   * @return StudyVariable
217  **/
218  public StudyVariable assayRefs(List<Assay> assayRefs) {
219   this.assayRefs = assayRefs;
220   return this;
221  }
222
223  /**
224   * Add a single assayRefsItem to the assayRefs collection.
225   *
226   * @see StudyVariable#getAssayRefs StudyVariable#getAssayRefs for validation constraints
227   * @param assayRefsItem a {@code Assay} parameter.
228   * @return StudyVariable
229   */
230  public StudyVariable addAssayRefsItem(Assay assayRefsItem) {
231    if (this.assayRefs == null) {
232      this.assayRefs = new ArrayList<>();
233    }
234    this.assayRefs.add(assayRefsItem);
235    return this;
236  }
237
238   /**
239   * The assays referenced by this study variable.
240   *
241   * @return assayRefs
242  **/
243  @Valid
244  @ApiModelProperty(value = "The assays referenced by this study variable.")
245  public List<Assay> getAssayRefs() {
246    return assayRefs;
247  }
248
249 /**
250   * Set assayRefs.
251   *
252   * 
253   * 
254   * @see #getAssayRefs StudyVariable#getAssayRefs for validation constraints
255   * @param assayRefs a {@code List<Assay>} parameter.
256  **/
257  public void setAssayRefs(List<Assay> assayRefs) {
258    this.assayRefs = assayRefs;
259  }
260
261
262 /**
263   * Builder method for averageFunction.
264   *
265   * @see StudyVariable#setAverageFunction StudyVariable#setAverageFunction for specification examples
266   * @see StudyVariable#getAverageFunction StudyVariable#getAverageFunction for validation constraints
267   * @param averageFunction a {@code Parameter} parameter.
268   * @return StudyVariable
269  **/
270  public StudyVariable averageFunction(Parameter averageFunction) {
271   this.averageFunction = averageFunction;
272   return this;
273  }
274
275   /**
276   * The function used to calculate summarised small molecule quantities over the assays referenced by this study variable.
277   *
278   * @return averageFunction
279  **/
280  @Valid
281  @ApiModelProperty(value = "The function used to calculate summarised small molecule quantities over the assays referenced by this study variable.")
282  public Parameter getAverageFunction() {
283    return averageFunction;
284  }
285
286 /**
287   * Set averageFunction.
288   *
289   * 
290   * 
291   * @see #getAverageFunction StudyVariable#getAverageFunction for validation constraints
292   * @param averageFunction a {@code Parameter} parameter.
293  **/
294  public void setAverageFunction(Parameter averageFunction) {
295    this.averageFunction = averageFunction;
296  }
297
298
299 /**
300   * Builder method for variationFunction.
301   *
302   * @see StudyVariable#setVariationFunction StudyVariable#setVariationFunction for specification examples
303   * @see StudyVariable#getVariationFunction StudyVariable#getVariationFunction for validation constraints
304   * @param variationFunction a {@code Parameter} parameter.
305   * @return StudyVariable
306  **/
307  public StudyVariable variationFunction(Parameter variationFunction) {
308   this.variationFunction = variationFunction;
309   return this;
310  }
311
312   /**
313   * The function used to calculate the variation of small molecule quantities over the assays referenced by this study variable.
314   *
315   * @return variationFunction
316  **/
317  @Valid
318  @ApiModelProperty(value = "The function used to calculate the variation of small molecule quantities over the assays referenced by this study variable.")
319  public Parameter getVariationFunction() {
320    return variationFunction;
321  }
322
323 /**
324   * Set variationFunction.
325   *
326   * 
327   * 
328   * @see #getVariationFunction StudyVariable#getVariationFunction for validation constraints
329   * @param variationFunction a {@code Parameter} parameter.
330  **/
331  public void setVariationFunction(Parameter variationFunction) {
332    this.variationFunction = variationFunction;
333  }
334
335
336 /**
337   * Builder method for description.
338   *
339   * @see StudyVariable#setDescription StudyVariable#setDescription for specification examples
340   * @see StudyVariable#getDescription StudyVariable#getDescription for validation constraints
341   * @param description a {@code String} parameter.
342   * @return StudyVariable
343  **/
344  public StudyVariable description(String description) {
345   this.description = description;
346   return this;
347  }
348
349   /**
350   * A free-form description of this study variable.
351   *
352   * @return description
353  **/
354  @ApiModelProperty(value = "A free-form description of this study variable.")
355  public String getDescription() {
356    return description;
357  }
358
359 /**
360   * Set description.
361   *
362   * 
363   * 
364   * @see #getDescription StudyVariable#getDescription for validation constraints
365   * @param description a {@code String} parameter.
366  **/
367  public void setDescription(String description) {
368    this.description = description;
369  }
370
371
372 /**
373   * Builder method for factors.
374   *
375   * @see StudyVariable#setFactors StudyVariable#setFactors for specification examples
376   * @see StudyVariable#getFactors StudyVariable#getFactors for validation constraints
377   * @param factors a {@code List<Parameter>} parameter.
378   * @return StudyVariable
379  **/
380  public StudyVariable factors(List<Parameter> factors) {
381   this.factors = factors;
382   return this;
383  }
384
385  /**
386   * Add a single factorsItem to the factors collection.
387   *
388   * @see StudyVariable#getFactors StudyVariable#getFactors for validation constraints
389   * @param factorsItem a {@code Parameter} parameter.
390   * @return StudyVariable
391   */
392  public StudyVariable addFactorsItem(Parameter factorsItem) {
393    if (this.factors == null) {
394      this.factors = new ArrayList<>();
395    }
396    this.factors.add(factorsItem);
397    return this;
398  }
399
400   /**
401   * Parameters indicating which factors were used for the assays referenced by this study variable, and at which levels.
402   *
403   * @return factors
404  **/
405  @Valid
406  @ApiModelProperty(value = "Parameters indicating which factors were used for the assays referenced by this study variable, and at which levels.")
407  public List<Parameter> getFactors() {
408    return factors;
409  }
410
411 /**
412   * Set factors.
413   *
414   * 
415   * 
416   * @see #getFactors StudyVariable#getFactors for validation constraints
417   * @param factors a {@code List<Parameter>} parameter.
418  **/
419  public void setFactors(List<Parameter> factors) {
420    this.factors = factors;
421  }
422
423
424  @Override
425  public boolean equals(java.lang.Object o) {
426    if (this == o) {
427      return true;
428    }
429    if (o == null || getClass() != o.getClass()) {
430      return false;
431    }
432    StudyVariable studyVariable = (StudyVariable) o;
433    return Objects.equals(this.id, studyVariable.id) &&
434        Objects.equals(this.name, studyVariable.name) &&
435        Objects.equals(this.assayRefs, studyVariable.assayRefs) &&
436        Objects.equals(this.averageFunction, studyVariable.averageFunction) &&
437        Objects.equals(this.variationFunction, studyVariable.variationFunction) &&
438        Objects.equals(this.description, studyVariable.description) &&
439        Objects.equals(this.factors, studyVariable.factors);
440  }
441
442  @Override
443  public int hashCode() {
444    return Objects.hash(id, name, assayRefs, averageFunction, variationFunction, description, factors);
445  }
446
447
448  @Override
449  public String toString() {
450    StringBuilder sb = new StringBuilder();
451    sb.append("class StudyVariable {\n");
452    
453    sb.append("    id: ").append(toIndentedString(id)).append("\n");
454    sb.append("    name: ").append(toIndentedString(name)).append("\n");
455    sb.append("    assayRefs: ").append(toIndentedString(assayRefs)).append("\n");
456    sb.append("    averageFunction: ").append(toIndentedString(averageFunction)).append("\n");
457    sb.append("    variationFunction: ").append(toIndentedString(variationFunction)).append("\n");
458    sb.append("    description: ").append(toIndentedString(description)).append("\n");
459    sb.append("    factors: ").append(toIndentedString(factors)).append("\n");
460    sb.append("}");
461    return sb.toString();
462  }
463
464  /**
465   * Convert the given object to string with each line indented by 4 spaces
466   * (except the first line).
467   */
468  private String toIndentedString(java.lang.Object o) {
469    if (o == null) {
470      return "null";
471    }
472    return o.toString().replace("\n", "\n    ");
473  }
474
475}
476