All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opencb.biodata.models.variant.avro.HeritableTrait Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.opencb.biodata.models.variant.avro;  
@SuppressWarnings("all")
/** The entity representing a phenotype and its inheritance pattern. */
@org.apache.avro.specific.AvroGenerated
public class HeritableTrait extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"HeritableTrait\",\"namespace\":\"org.opencb.biodata.models.variant.avro\",\"doc\":\"The entity representing a phenotype and its inheritance pattern.\",\"fields\":[{\"name\":\"trait\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"The trait (e.g.: HPO term, MIM term, DO term etc.)\"},{\"name\":\"inheritanceMode\",\"type\":[\"null\",{\"type\":\"enum\",\"name\":\"ModeOfInheritance\",\"doc\":\"An enumeration for the different mode of inheritances:\\n\\n* `monoallelic_not_imprinted`: MONOALLELIC, autosomal or pseudoautosomal, not imprinted\\n* `monoallelic_maternally_imprinted`: MONOALLELIC, autosomal or pseudoautosomal, maternally imprinted (paternal allele expressed)\\n* `monoallelic_paternally_imprinted`: MONOALLELIC, autosomal or pseudoautosomal, paternally imprinted (maternal allele expressed)\\n* `monoallelic`: MONOALLELIC, autosomal or pseudoautosomal, imprinted status unknown\\n* `biallelic`: BIALLELIC, autosomal or pseudoautosomal\\n* `monoallelic_and_biallelic`: BOTH monoallelic and biallelic, autosomal or pseudoautosomal\\n* `monoallelic_and_more_severe_biallelic`: BOTH monoallelic and biallelic, autosomal or pseudoautosomal (but BIALLELIC mutations cause a more SEVERE disease form), autosomal or pseudoautosomal\\n* `xlinked_biallelic`: X-LINKED: hemizygous mutation in males, biallelic mutations in females\\n* `xlinked_monoallelic`: X linked: hemizygous mutation in males, monoallelic mutations in females may cause disease (may be less severe, later onset than males)\\n* `mitochondrial`: MITOCHONDRIAL\\n* `unknown`: Unknown\\n* `NA`: Not applicable\",\"symbols\":[\"monoallelic\",\"monoallelic_not_imprinted\",\"monoallelic_maternally_imprinted\",\"monoallelic_paternally_imprinted\",\"biallelic\",\"monoallelic_and_biallelic\",\"monoallelic_and_more_severe_biallelic\",\"xlinked_biallelic\",\"xlinked_monoallelic\",\"mitochondrial\",\"unknown\",\"NA\"]}],\"doc\":\"The mode of inheritance\"}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  /** The trait (e.g.: HPO term, MIM term, DO term etc.) */
   private java.lang.String trait;
  /** The mode of inheritance */
   private org.opencb.biodata.models.variant.avro.ModeOfInheritance inheritanceMode;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use newBuilder(). 
   */
  public HeritableTrait() {}

  /**
   * All-args constructor.
   */
  public HeritableTrait(java.lang.String trait, org.opencb.biodata.models.variant.avro.ModeOfInheritance inheritanceMode) {
    this.trait = trait;
    this.inheritanceMode = inheritanceMode;
  }

  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call. 
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return trait;
    case 1: return inheritanceMode;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }
  // Used by DatumReader.  Applications should not call. 
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: trait = (java.lang.String)value$; break;
    case 1: inheritanceMode = (org.opencb.biodata.models.variant.avro.ModeOfInheritance)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'trait' field.
   * The trait (e.g.: HPO term, MIM term, DO term etc.)   */
  public java.lang.String getTrait() {
    return trait;
  }

  /**
   * Sets the value of the 'trait' field.
   * The trait (e.g.: HPO term, MIM term, DO term etc.)   * @param value the value to set.
   */
  public void setTrait(java.lang.String value) {
    this.trait = value;
  }

  /**
   * Gets the value of the 'inheritanceMode' field.
   * The mode of inheritance   */
  public org.opencb.biodata.models.variant.avro.ModeOfInheritance getInheritanceMode() {
    return inheritanceMode;
  }

  /**
   * Sets the value of the 'inheritanceMode' field.
   * The mode of inheritance   * @param value the value to set.
   */
  public void setInheritanceMode(org.opencb.biodata.models.variant.avro.ModeOfInheritance value) {
    this.inheritanceMode = value;
  }

  /** Creates a new HeritableTrait RecordBuilder */
  public static org.opencb.biodata.models.variant.avro.HeritableTrait.Builder newBuilder() {
    return new org.opencb.biodata.models.variant.avro.HeritableTrait.Builder();
  }
  
  /** Creates a new HeritableTrait RecordBuilder by copying an existing Builder */
  public static org.opencb.biodata.models.variant.avro.HeritableTrait.Builder newBuilder(org.opencb.biodata.models.variant.avro.HeritableTrait.Builder other) {
    return new org.opencb.biodata.models.variant.avro.HeritableTrait.Builder(other);
  }
  
  /** Creates a new HeritableTrait RecordBuilder by copying an existing HeritableTrait instance */
  public static org.opencb.biodata.models.variant.avro.HeritableTrait.Builder newBuilder(org.opencb.biodata.models.variant.avro.HeritableTrait other) {
    return new org.opencb.biodata.models.variant.avro.HeritableTrait.Builder(other);
  }
  
  /**
   * RecordBuilder for HeritableTrait instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
    implements org.apache.avro.data.RecordBuilder {

    private java.lang.String trait;
    private org.opencb.biodata.models.variant.avro.ModeOfInheritance inheritanceMode;

    /** Creates a new Builder */
    private Builder() {
      super(org.opencb.biodata.models.variant.avro.HeritableTrait.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.opencb.biodata.models.variant.avro.HeritableTrait.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.trait)) {
        this.trait = data().deepCopy(fields()[0].schema(), other.trait);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.inheritanceMode)) {
        this.inheritanceMode = data().deepCopy(fields()[1].schema(), other.inheritanceMode);
        fieldSetFlags()[1] = true;
      }
    }
    
    /** Creates a Builder by copying an existing HeritableTrait instance */
    private Builder(org.opencb.biodata.models.variant.avro.HeritableTrait other) {
            super(org.opencb.biodata.models.variant.avro.HeritableTrait.SCHEMA$);
      if (isValidValue(fields()[0], other.trait)) {
        this.trait = data().deepCopy(fields()[0].schema(), other.trait);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.inheritanceMode)) {
        this.inheritanceMode = data().deepCopy(fields()[1].schema(), other.inheritanceMode);
        fieldSetFlags()[1] = true;
      }
    }

    /** Gets the value of the 'trait' field */
    public java.lang.String getTrait() {
      return trait;
    }
    
    /** Sets the value of the 'trait' field */
    public org.opencb.biodata.models.variant.avro.HeritableTrait.Builder setTrait(java.lang.String value) {
      validate(fields()[0], value);
      this.trait = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'trait' field has been set */
    public boolean hasTrait() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'trait' field */
    public org.opencb.biodata.models.variant.avro.HeritableTrait.Builder clearTrait() {
      trait = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'inheritanceMode' field */
    public org.opencb.biodata.models.variant.avro.ModeOfInheritance getInheritanceMode() {
      return inheritanceMode;
    }
    
    /** Sets the value of the 'inheritanceMode' field */
    public org.opencb.biodata.models.variant.avro.HeritableTrait.Builder setInheritanceMode(org.opencb.biodata.models.variant.avro.ModeOfInheritance value) {
      validate(fields()[1], value);
      this.inheritanceMode = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'inheritanceMode' field has been set */
    public boolean hasInheritanceMode() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'inheritanceMode' field */
    public org.opencb.biodata.models.variant.avro.HeritableTrait.Builder clearInheritanceMode() {
      inheritanceMode = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    @Override
    public HeritableTrait build() {
      try {
        HeritableTrait record = new HeritableTrait();
        record.trait = fieldSetFlags()[0] ? this.trait : (java.lang.String) defaultValue(fields()[0]);
        record.inheritanceMode = fieldSetFlags()[1] ? this.inheritanceMode : (org.opencb.biodata.models.variant.avro.ModeOfInheritance) defaultValue(fields()[1]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy