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

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

The newest version!
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.opencb.biodata.models.variant.avro;  
@SuppressWarnings("all")
/** The genomic feature */
@org.apache.avro.specific.AvroGenerated
public class GenomicFeature 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\":\"GenomicFeature\",\"namespace\":\"org.opencb.biodata.models.variant.avro\",\"doc\":\"The genomic feature\",\"fields\":[{\"name\":\"featureType\",\"type\":[\"null\",{\"type\":\"enum\",\"name\":\"FeatureTypes\",\"doc\":\"The feature types\",\"symbols\":[\"regulatory_region\",\"gene\",\"transcript\",\"protein\"]}],\"doc\":\"Feature Type\"},{\"name\":\"ensemblId\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"Feature used, this should be a feature ID from Ensembl, (i.e, ENST00000544455)\"},{\"name\":\"xrefs\",\"type\":[\"null\",{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}],\"doc\":\"Others IDs. Fields like the HGNC symbol if available should be added here\"}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  /** Feature Type */
   private org.opencb.biodata.models.variant.avro.FeatureTypes featureType;
  /** Feature used, this should be a feature ID from Ensembl, (i.e, ENST00000544455) */
   private java.lang.String ensemblId;
  /** Others IDs. Fields like the HGNC symbol if available should be added here */
   private java.util.Map xrefs;

  /**
   * 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 GenomicFeature() {}

  /**
   * All-args constructor.
   */
  public GenomicFeature(org.opencb.biodata.models.variant.avro.FeatureTypes featureType, java.lang.String ensemblId, java.util.Map xrefs) {
    this.featureType = featureType;
    this.ensemblId = ensemblId;
    this.xrefs = xrefs;
  }

  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 featureType;
    case 1: return ensemblId;
    case 2: return xrefs;
    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: featureType = (org.opencb.biodata.models.variant.avro.FeatureTypes)value$; break;
    case 1: ensemblId = (java.lang.String)value$; break;
    case 2: xrefs = (java.util.Map)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'featureType' field.
   * Feature Type   */
  public org.opencb.biodata.models.variant.avro.FeatureTypes getFeatureType() {
    return featureType;
  }

  /**
   * Sets the value of the 'featureType' field.
   * Feature Type   * @param value the value to set.
   */
  public void setFeatureType(org.opencb.biodata.models.variant.avro.FeatureTypes value) {
    this.featureType = value;
  }

  /**
   * Gets the value of the 'ensemblId' field.
   * Feature used, this should be a feature ID from Ensembl, (i.e, ENST00000544455)   */
  public java.lang.String getEnsemblId() {
    return ensemblId;
  }

  /**
   * Sets the value of the 'ensemblId' field.
   * Feature used, this should be a feature ID from Ensembl, (i.e, ENST00000544455)   * @param value the value to set.
   */
  public void setEnsemblId(java.lang.String value) {
    this.ensemblId = value;
  }

  /**
   * Gets the value of the 'xrefs' field.
   * Others IDs. Fields like the HGNC symbol if available should be added here   */
  public java.util.Map getXrefs() {
    return xrefs;
  }

  /**
   * Sets the value of the 'xrefs' field.
   * Others IDs. Fields like the HGNC symbol if available should be added here   * @param value the value to set.
   */
  public void setXrefs(java.util.Map value) {
    this.xrefs = value;
  }

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

    private org.opencb.biodata.models.variant.avro.FeatureTypes featureType;
    private java.lang.String ensemblId;
    private java.util.Map xrefs;

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

    /** Gets the value of the 'featureType' field */
    public org.opencb.biodata.models.variant.avro.FeatureTypes getFeatureType() {
      return featureType;
    }
    
    /** Sets the value of the 'featureType' field */
    public org.opencb.biodata.models.variant.avro.GenomicFeature.Builder setFeatureType(org.opencb.biodata.models.variant.avro.FeatureTypes value) {
      validate(fields()[0], value);
      this.featureType = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'featureType' field has been set */
    public boolean hasFeatureType() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'featureType' field */
    public org.opencb.biodata.models.variant.avro.GenomicFeature.Builder clearFeatureType() {
      featureType = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'ensemblId' field */
    public java.lang.String getEnsemblId() {
      return ensemblId;
    }
    
    /** Sets the value of the 'ensemblId' field */
    public org.opencb.biodata.models.variant.avro.GenomicFeature.Builder setEnsemblId(java.lang.String value) {
      validate(fields()[1], value);
      this.ensemblId = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'ensemblId' field has been set */
    public boolean hasEnsemblId() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'ensemblId' field */
    public org.opencb.biodata.models.variant.avro.GenomicFeature.Builder clearEnsemblId() {
      ensemblId = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'xrefs' field */
    public java.util.Map getXrefs() {
      return xrefs;
    }
    
    /** Sets the value of the 'xrefs' field */
    public org.opencb.biodata.models.variant.avro.GenomicFeature.Builder setXrefs(java.util.Map value) {
      validate(fields()[2], value);
      this.xrefs = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'xrefs' field has been set */
    public boolean hasXrefs() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'xrefs' field */
    public org.opencb.biodata.models.variant.avro.GenomicFeature.Builder clearXrefs() {
      xrefs = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public GenomicFeature build() {
      try {
        GenomicFeature record = new GenomicFeature();
        record.featureType = fieldSetFlags()[0] ? this.featureType : (org.opencb.biodata.models.variant.avro.FeatureTypes) defaultValue(fields()[0]);
        record.ensemblId = fieldSetFlags()[1] ? this.ensemblId : (java.lang.String) defaultValue(fields()[1]);
        record.xrefs = fieldSetFlags()[2] ? this.xrefs : (java.util.Map) defaultValue(fields()[2]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy