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