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

org.opencb.biodata.models.variant.metadata.VariantFileMetadata Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.opencb.biodata.models.variant.metadata;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class VariantFileMetadata 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\":\"VariantFileMetadata\",\"namespace\":\"org.opencb.biodata.models.variant.metadata\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"File id. Will match with the {@link org.opencb.biodata.models.variant.avro.FileEntry#getFileId}\"},{\"name\":\"path\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"Path to the original file\",\"default\":null},{\"name\":\"sampleIds\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},\"doc\":\"Ordered list of sample ids contained in the file\",\"default\":[]},{\"name\":\"stats\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"VariantSetStats\",\"doc\":\"Variant statistics for a set of variants.\\n     The variants set can be contain a whole study, a cohort, a sample, a region, ...\",\"fields\":[{\"name\":\"variantCount\",\"type\":\"long\",\"doc\":\"Number of variants in the variant set\"},{\"name\":\"sampleCount\",\"type\":\"long\",\"doc\":\"Number of samples in the variant set\"},{\"name\":\"filterCount\",\"type\":{\"type\":\"map\",\"values\":\"long\",\"avro.java.string\":\"String\"},\"doc\":\"* The number of occurrences for each FILTER value in files from this set.\\n         * Each file can contain more than one filter value (usually separated by ';').\\n         *\"},{\"name\":\"genotypeCount\",\"type\":{\"type\":\"map\",\"values\":\"long\",\"avro.java.string\":\"String\"},\"doc\":\"Number of genotypes found for all samples in variants set\",\"default\":{}},{\"name\":\"filesCount\",\"type\":\"long\",\"doc\":\"Number of files in the variant set\"},{\"name\":\"tiTvRatio\",\"type\":\"float\",\"doc\":\"TiTvRatio = num. transitions / num. transversions\"},{\"name\":\"qualityAvg\",\"type\":\"float\",\"doc\":\"Mean Quality for all the variants with quality\"},{\"name\":\"qualityStdDev\",\"type\":\"float\",\"doc\":\"Standard Deviation of the quality\"},{\"name\":\"typeCount\",\"type\":{\"type\":\"map\",\"values\":\"long\",\"avro.java.string\":\"String\"},\"doc\":\"Variants count group by type. e.g. SNP, INDEL, MNP, SNV, ...\",\"default\":{}},{\"name\":\"biotypeCount\",\"type\":{\"type\":\"map\",\"values\":\"long\",\"avro.java.string\":\"String\"},\"doc\":\"Variants count group by biotype. e.g. protein-coding, miRNA, lncRNA, ...\",\"default\":{}},{\"name\":\"consequenceTypeCount\",\"type\":{\"type\":\"map\",\"values\":\"long\",\"avro.java.string\":\"String\"},\"doc\":\"Variants count group by consequence type. e.g. synonymous_variant, missense_variant, stop_lost, ...\",\"default\":{}},{\"name\":\"chromosomeCount\",\"type\":{\"type\":\"map\",\"values\":\"long\",\"avro.java.string\":\"String\"},\"doc\":\"Number of variants per chromosome\",\"default\":{}},{\"name\":\"chromosomeDensity\",\"type\":{\"type\":\"map\",\"values\":\"float\",\"avro.java.string\":\"String\"},\"doc\":\"Total density of variants within the chromosome. counts / chromosome.length\",\"default\":{}}]}],\"doc\":\"Global statistics calculated for this file\",\"default\":null},{\"name\":\"header\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"VariantFileHeader\",\"doc\":\"Variant File Header. Contains simple and complex metadata lines describing the content of the file.\\n    This header matches with the VCF header.\\n    A header may have multiple Simple or Complex lines with the same key\",\"fields\":[{\"name\":\"version\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"complexLines\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"VariantFileHeaderComplexLine\",\"fields\":[{\"name\":\"key\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Key of group of the Complex Header Line, e.g. INFO, FORMAT, FILTER, ALT, ...\"},{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"ID or Name of the line\"},{\"name\":\"description\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"The description\",\"default\":null},{\"name\":\"number\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"Arity of the values associated with this metadata line.\\n        Only present if the metadata line describes data fields, i.e. key == INFO or FORMAT\\n        Accepted values:\\n          - : The field has always this number of values.\\n          - A: The field has one value per alternate allele.\\n          - R: The field has one value for each possible allele, including the reference.\\n          - G: The field has one value for each possible genotype\\n          - .: The number of possible values varies, is unknown or unbounded.\",\"default\":null},{\"name\":\"type\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"Type of the values associated with this metadata line.\\n        Only present if the metadata line describes data fields, i.e. key == INFO or FORMAT\\n        Accepted values:\\n          - Integer\\n          - Float\\n          - String\\n          - Character\\n          - Flag\",\"default\":null},{\"name\":\"genericFields\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"},\"doc\":\"Other optional fields\",\"default\":{}}]}},\"doc\":\"complex lines, e.g. INFO=\",\"default\":[]},{\"name\":\"simpleLines\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"VariantFileHeaderSimpleLine\",\"fields\":[{\"name\":\"key\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Key of group of the Simple Header Line, e.g. source, assembly, pedigreeDB, ...\"},{\"name\":\"value\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Value\"}]}},\"doc\":\"simple lines, e.g. fileDate=20090805\",\"default\":[]}]}],\"doc\":\"The Variant File Header\",\"default\":null},{\"name\":\"attributes\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"},\"doc\":\"Other user defined attributes related with the file\",\"default\":{}}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  /** File id. Will match with the {@link org.opencb.biodata.models.variant.avro.FileEntry#getFileId} */
   private java.lang.String id;
  /** Path to the original file */
   private java.lang.String path;
  /** Ordered list of sample ids contained in the file */
   private java.util.List sampleIds;
  /** Global statistics calculated for this file */
   private org.opencb.biodata.models.variant.metadata.VariantSetStats stats;
  /** The Variant File Header */
   private org.opencb.biodata.models.variant.metadata.VariantFileHeader header;
  /** Other user defined attributes related with the file */
   private java.util.Map attributes;

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

  /**
   * All-args constructor.
   */
  public VariantFileMetadata(java.lang.String id, java.lang.String path, java.util.List sampleIds, org.opencb.biodata.models.variant.metadata.VariantSetStats stats, org.opencb.biodata.models.variant.metadata.VariantFileHeader header, java.util.Map attributes) {
    this.id = id;
    this.path = path;
    this.sampleIds = sampleIds;
    this.stats = stats;
    this.header = header;
    this.attributes = attributes;
  }

  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 id;
    case 1: return path;
    case 2: return sampleIds;
    case 3: return stats;
    case 4: return header;
    case 5: return attributes;
    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: id = (java.lang.String)value$; break;
    case 1: path = (java.lang.String)value$; break;
    case 2: sampleIds = (java.util.List)value$; break;
    case 3: stats = (org.opencb.biodata.models.variant.metadata.VariantSetStats)value$; break;
    case 4: header = (org.opencb.biodata.models.variant.metadata.VariantFileHeader)value$; break;
    case 5: attributes = (java.util.Map)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'id' field.
   * File id. Will match with the {@link org.opencb.biodata.models.variant.avro.FileEntry#getFileId}   */
  public java.lang.String getId() {
    return id;
  }

  /**
   * Sets the value of the 'id' field.
   * File id. Will match with the {@link org.opencb.biodata.models.variant.avro.FileEntry#getFileId}   * @param value the value to set.
   */
  public void setId(java.lang.String value) {
    this.id = value;
  }

  /**
   * Gets the value of the 'path' field.
   * Path to the original file   */
  public java.lang.String getPath() {
    return path;
  }

  /**
   * Sets the value of the 'path' field.
   * Path to the original file   * @param value the value to set.
   */
  public void setPath(java.lang.String value) {
    this.path = value;
  }

  /**
   * Gets the value of the 'sampleIds' field.
   * Ordered list of sample ids contained in the file   */
  public java.util.List getSampleIds() {
    return sampleIds;
  }

  /**
   * Sets the value of the 'sampleIds' field.
   * Ordered list of sample ids contained in the file   * @param value the value to set.
   */
  public void setSampleIds(java.util.List value) {
    this.sampleIds = value;
  }

  /**
   * Gets the value of the 'stats' field.
   * Global statistics calculated for this file   */
  public org.opencb.biodata.models.variant.metadata.VariantSetStats getStats() {
    return stats;
  }

  /**
   * Sets the value of the 'stats' field.
   * Global statistics calculated for this file   * @param value the value to set.
   */
  public void setStats(org.opencb.biodata.models.variant.metadata.VariantSetStats value) {
    this.stats = value;
  }

  /**
   * Gets the value of the 'header' field.
   * The Variant File Header   */
  public org.opencb.biodata.models.variant.metadata.VariantFileHeader getHeader() {
    return header;
  }

  /**
   * Sets the value of the 'header' field.
   * The Variant File Header   * @param value the value to set.
   */
  public void setHeader(org.opencb.biodata.models.variant.metadata.VariantFileHeader value) {
    this.header = value;
  }

  /**
   * Gets the value of the 'attributes' field.
   * Other user defined attributes related with the file   */
  public java.util.Map getAttributes() {
    return attributes;
  }

  /**
   * Sets the value of the 'attributes' field.
   * Other user defined attributes related with the file   * @param value the value to set.
   */
  public void setAttributes(java.util.Map value) {
    this.attributes = value;
  }

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

    private java.lang.String id;
    private java.lang.String path;
    private java.util.List sampleIds;
    private org.opencb.biodata.models.variant.metadata.VariantSetStats stats;
    private org.opencb.biodata.models.variant.metadata.VariantFileHeader header;
    private java.util.Map attributes;

    /** Creates a new Builder */
    private Builder() {
      super(org.opencb.biodata.models.variant.metadata.VariantFileMetadata.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.path)) {
        this.path = data().deepCopy(fields()[1].schema(), other.path);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.sampleIds)) {
        this.sampleIds = data().deepCopy(fields()[2].schema(), other.sampleIds);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.stats)) {
        this.stats = data().deepCopy(fields()[3].schema(), other.stats);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.header)) {
        this.header = data().deepCopy(fields()[4].schema(), other.header);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.attributes)) {
        this.attributes = data().deepCopy(fields()[5].schema(), other.attributes);
        fieldSetFlags()[5] = true;
      }
    }
    
    /** Creates a Builder by copying an existing VariantFileMetadata instance */
    private Builder(org.opencb.biodata.models.variant.metadata.VariantFileMetadata other) {
            super(org.opencb.biodata.models.variant.metadata.VariantFileMetadata.SCHEMA$);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.path)) {
        this.path = data().deepCopy(fields()[1].schema(), other.path);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.sampleIds)) {
        this.sampleIds = data().deepCopy(fields()[2].schema(), other.sampleIds);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.stats)) {
        this.stats = data().deepCopy(fields()[3].schema(), other.stats);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.header)) {
        this.header = data().deepCopy(fields()[4].schema(), other.header);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.attributes)) {
        this.attributes = data().deepCopy(fields()[5].schema(), other.attributes);
        fieldSetFlags()[5] = true;
      }
    }

    /** Gets the value of the 'id' field */
    public java.lang.String getId() {
      return id;
    }
    
    /** Sets the value of the 'id' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder setId(java.lang.String value) {
      validate(fields()[0], value);
      this.id = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'id' field has been set */
    public boolean hasId() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'id' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder clearId() {
      id = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'path' field */
    public java.lang.String getPath() {
      return path;
    }
    
    /** Sets the value of the 'path' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder setPath(java.lang.String value) {
      validate(fields()[1], value);
      this.path = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'path' field has been set */
    public boolean hasPath() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'path' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder clearPath() {
      path = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'sampleIds' field */
    public java.util.List getSampleIds() {
      return sampleIds;
    }
    
    /** Sets the value of the 'sampleIds' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder setSampleIds(java.util.List value) {
      validate(fields()[2], value);
      this.sampleIds = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'sampleIds' field has been set */
    public boolean hasSampleIds() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'sampleIds' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder clearSampleIds() {
      sampleIds = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /** Gets the value of the 'stats' field */
    public org.opencb.biodata.models.variant.metadata.VariantSetStats getStats() {
      return stats;
    }
    
    /** Sets the value of the 'stats' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder setStats(org.opencb.biodata.models.variant.metadata.VariantSetStats value) {
      validate(fields()[3], value);
      this.stats = value;
      fieldSetFlags()[3] = true;
      return this; 
    }
    
    /** Checks whether the 'stats' field has been set */
    public boolean hasStats() {
      return fieldSetFlags()[3];
    }
    
    /** Clears the value of the 'stats' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder clearStats() {
      stats = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    /** Gets the value of the 'header' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileHeader getHeader() {
      return header;
    }
    
    /** Sets the value of the 'header' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder setHeader(org.opencb.biodata.models.variant.metadata.VariantFileHeader value) {
      validate(fields()[4], value);
      this.header = value;
      fieldSetFlags()[4] = true;
      return this; 
    }
    
    /** Checks whether the 'header' field has been set */
    public boolean hasHeader() {
      return fieldSetFlags()[4];
    }
    
    /** Clears the value of the 'header' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder clearHeader() {
      header = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    /** Gets the value of the 'attributes' field */
    public java.util.Map getAttributes() {
      return attributes;
    }
    
    /** Sets the value of the 'attributes' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder setAttributes(java.util.Map value) {
      validate(fields()[5], value);
      this.attributes = value;
      fieldSetFlags()[5] = true;
      return this; 
    }
    
    /** Checks whether the 'attributes' field has been set */
    public boolean hasAttributes() {
      return fieldSetFlags()[5];
    }
    
    /** Clears the value of the 'attributes' field */
    public org.opencb.biodata.models.variant.metadata.VariantFileMetadata.Builder clearAttributes() {
      attributes = null;
      fieldSetFlags()[5] = false;
      return this;
    }

    @Override
    public VariantFileMetadata build() {
      try {
        VariantFileMetadata record = new VariantFileMetadata();
        record.id = fieldSetFlags()[0] ? this.id : (java.lang.String) defaultValue(fields()[0]);
        record.path = fieldSetFlags()[1] ? this.path : (java.lang.String) defaultValue(fields()[1]);
        record.sampleIds = fieldSetFlags()[2] ? this.sampleIds : (java.util.List) defaultValue(fields()[2]);
        record.stats = fieldSetFlags()[3] ? this.stats : (org.opencb.biodata.models.variant.metadata.VariantSetStats) defaultValue(fields()[3]);
        record.header = fieldSetFlags()[4] ? this.header : (org.opencb.biodata.models.variant.metadata.VariantFileHeader) defaultValue(fields()[4]);
        record.attributes = fieldSetFlags()[5] ? this.attributes : (java.util.Map) defaultValue(fields()[5]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy