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

org.ga4gh.models.LinearAlignment Maven / Gradle / Ivy

There is a newer version: 0.6.0a5
Show newest version
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.ga4gh.models;  
@SuppressWarnings("all")
/** A linear alignment describes the alignment of a read to a Reference, using a
position and CIGAR array. */
@org.apache.avro.specific.AvroGenerated
public class LinearAlignment 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\":\"LinearAlignment\",\"namespace\":\"org.ga4gh.models\",\"doc\":\"A linear alignment describes the alignment of a read to a Reference, using a\\nposition and CIGAR array.\",\"fields\":[{\"name\":\"position\",\"type\":{\"type\":\"record\",\"name\":\"Position\",\"doc\":\"A `Position` is an unoriented base in some `Reference`. A `Position` is\\nrepresented by a `Reference` name, and a base number on that `Reference`\\n(0-based).\",\"fields\":[{\"name\":\"referenceName\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"The name of the `Reference` on which the `Position` is located.\"},{\"name\":\"position\",\"type\":\"long\",\"doc\":\"The 0-based offset from the start of the forward strand for that `Reference`.\\n  Genomic positions are non-negative integers less than `Reference` length.\"},{\"name\":\"strand\",\"type\":{\"type\":\"enum\",\"name\":\"Strand\",\"doc\":\"Indicates the DNA strand associate for some data item.\\n* `NEG_STRAND`: The negative (-) strand.\\n* `POS_STRAND`:  The postive (+) strand.\",\"symbols\":[\"NEG_STRAND\",\"POS_STRAND\"]},\"doc\":\"Strand the position is associated with.\"}]},\"doc\":\"The position of this alignment.\"},{\"name\":\"mappingQuality\",\"type\":[\"null\",\"int\"],\"doc\":\"The mapping quality of this alignment, meaning the likelihood that the read\\n  maps to this position.\\n\\n  Specifically, this is -10 log10 Pr(mapping position is wrong), rounded to the\\n  nearest integer.\",\"default\":null},{\"name\":\"cigar\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"CigarUnit\",\"doc\":\"A structure for an instance of a CIGAR operation.\\n`FIXME: This belongs under Reads (only readAlignment refers to this)`\",\"fields\":[{\"name\":\"operation\",\"type\":{\"type\":\"enum\",\"name\":\"CigarOperation\",\"doc\":\"An enum for the different types of CIGAR alignment operations that exist.\\nUsed wherever CIGAR alignments are used. The different enumerated values\\nhave the following usage:\\n\\n* `ALIGNMENT_MATCH`: An alignment match indicates that a sequence can be\\n  aligned to the reference without evidence of an INDEL. Unlike the\\n  `SEQUENCE_MATCH` and `SEQUENCE_MISMATCH` operators, the `ALIGNMENT_MATCH`\\n  operator does not indicate whether the reference and read sequences are an\\n  exact match. This operator is equivalent to SAM's `M`.\\n* `INSERT`: The insert operator indicates that the read contains evidence of\\n  bases being inserted into the reference. This operator is equivalent to\\n  SAM's `I`.\\n* `DELETE`: The delete operator indicates that the read contains evidence of\\n  bases being deleted from the reference. This operator is equivalent to\\n  SAM's `D`.\\n* `SKIP`: The skip operator indicates that this read skips a long segment of\\n  the reference, but the bases have not been deleted. This operator is\\n  commonly used when working with RNA-seq data, where reads may skip long\\n  segments of the reference between exons. This operator is equivalent to\\n  SAM's 'N'.\\n* `CLIP_SOFT`: The soft clip operator indicates that bases at the start/end\\n  of a read have not been considered during alignment. This may occur if the\\n  majority of a read maps, except for low quality bases at the start/end of\\n  a read. This operator is equivalent to SAM's 'S'. Bases that are soft clipped\\n  will still be stored in the read.\\n* `CLIP_HARD`: The hard clip operator indicates that bases at the start/end of\\n  a read have been omitted from this alignment. This may occur if this linear\\n  alignment is part of a chimeric alignment, or if the read has been trimmed\\n  (e.g., during error correction, or to trim poly-A tails for RNA-seq). This\\n  operator is equivalent to SAM's 'H'.\\n* `PAD`: The pad operator indicates that there is padding in an alignment.\\n  This operator is equivalent to SAM's 'P'.\\n* `SEQUENCE_MATCH`: This operator indicates that this portion of the aligned\\n  sequence exactly matches the reference (e.g., all bases are equal to the\\n  reference bases). This operator is equivalent to SAM's '='.\\n* `SEQUENCE_MISMATCH`: This operator indicates that this portion of the\\n  aligned sequence is an alignment match to the reference, but a sequence\\n  mismatch (e.g., the bases are not equal to the reference). This can\\n  indicate a SNP or a read error. This operator is equivalent to SAM's 'X'.\",\"symbols\":[\"ALIGNMENT_MATCH\",\"INSERT\",\"DELETE\",\"SKIP\",\"CLIP_SOFT\",\"CLIP_HARD\",\"PAD\",\"SEQUENCE_MATCH\",\"SEQUENCE_MISMATCH\"]},\"doc\":\"The operation type.\"},{\"name\":\"operationLength\",\"type\":\"long\",\"doc\":\"The number of bases that the operation runs for.\"},{\"name\":\"referenceSequence\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"`referenceSequence` is only used at mismatches (`SEQUENCE_MISMATCH`)\\n  and deletions (`DELETE`). Filling this field replaces the MD tag.\\n  If the relevant information is not available, leave this field as `null`.\",\"default\":null}]}},\"doc\":\"Represents the local alignment of this sequence (alignment matches, indels, etc)\\n  versus the reference.\",\"default\":[]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  /** The position of this alignment. */
   private org.ga4gh.models.Position position;
  /** The mapping quality of this alignment, meaning the likelihood that the read
  maps to this position.

  Specifically, this is -10 log10 Pr(mapping position is wrong), rounded to the
  nearest integer. */
   private java.lang.Integer mappingQuality;
  /** Represents the local alignment of this sequence (alignment matches, indels, etc)
  versus the reference. */
   private java.util.List cigar;

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

  /**
   * All-args constructor.
   */
  public LinearAlignment(org.ga4gh.models.Position position, java.lang.Integer mappingQuality, java.util.List cigar) {
    this.position = position;
    this.mappingQuality = mappingQuality;
    this.cigar = cigar;
  }

  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 position;
    case 1: return mappingQuality;
    case 2: return cigar;
    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: position = (org.ga4gh.models.Position)value$; break;
    case 1: mappingQuality = (java.lang.Integer)value$; break;
    case 2: cigar = (java.util.List)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'position' field.
   * The position of this alignment.   */
  public org.ga4gh.models.Position getPosition() {
    return position;
  }

  /**
   * Sets the value of the 'position' field.
   * The position of this alignment.   * @param value the value to set.
   */
  public void setPosition(org.ga4gh.models.Position value) {
    this.position = value;
  }

  /**
   * Gets the value of the 'mappingQuality' field.
   * The mapping quality of this alignment, meaning the likelihood that the read
  maps to this position.

  Specifically, this is -10 log10 Pr(mapping position is wrong), rounded to the
  nearest integer.   */
  public java.lang.Integer getMappingQuality() {
    return mappingQuality;
  }

  /**
   * Sets the value of the 'mappingQuality' field.
   * The mapping quality of this alignment, meaning the likelihood that the read
  maps to this position.

  Specifically, this is -10 log10 Pr(mapping position is wrong), rounded to the
  nearest integer.   * @param value the value to set.
   */
  public void setMappingQuality(java.lang.Integer value) {
    this.mappingQuality = value;
  }

  /**
   * Gets the value of the 'cigar' field.
   * Represents the local alignment of this sequence (alignment matches, indels, etc)
  versus the reference.   */
  public java.util.List getCigar() {
    return cigar;
  }

  /**
   * Sets the value of the 'cigar' field.
   * Represents the local alignment of this sequence (alignment matches, indels, etc)
  versus the reference.   * @param value the value to set.
   */
  public void setCigar(java.util.List value) {
    this.cigar = value;
  }

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

    private org.ga4gh.models.Position position;
    private java.lang.Integer mappingQuality;
    private java.util.List cigar;

    /** Creates a new Builder */
    private Builder() {
      super(org.ga4gh.models.LinearAlignment.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.ga4gh.models.LinearAlignment.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.position)) {
        this.position = data().deepCopy(fields()[0].schema(), other.position);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.mappingQuality)) {
        this.mappingQuality = data().deepCopy(fields()[1].schema(), other.mappingQuality);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.cigar)) {
        this.cigar = data().deepCopy(fields()[2].schema(), other.cigar);
        fieldSetFlags()[2] = true;
      }
    }
    
    /** Creates a Builder by copying an existing LinearAlignment instance */
    private Builder(org.ga4gh.models.LinearAlignment other) {
            super(org.ga4gh.models.LinearAlignment.SCHEMA$);
      if (isValidValue(fields()[0], other.position)) {
        this.position = data().deepCopy(fields()[0].schema(), other.position);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.mappingQuality)) {
        this.mappingQuality = data().deepCopy(fields()[1].schema(), other.mappingQuality);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.cigar)) {
        this.cigar = data().deepCopy(fields()[2].schema(), other.cigar);
        fieldSetFlags()[2] = true;
      }
    }

    /** Gets the value of the 'position' field */
    public org.ga4gh.models.Position getPosition() {
      return position;
    }
    
    /** Sets the value of the 'position' field */
    public org.ga4gh.models.LinearAlignment.Builder setPosition(org.ga4gh.models.Position value) {
      validate(fields()[0], value);
      this.position = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'position' field has been set */
    public boolean hasPosition() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'position' field */
    public org.ga4gh.models.LinearAlignment.Builder clearPosition() {
      position = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'mappingQuality' field */
    public java.lang.Integer getMappingQuality() {
      return mappingQuality;
    }
    
    /** Sets the value of the 'mappingQuality' field */
    public org.ga4gh.models.LinearAlignment.Builder setMappingQuality(java.lang.Integer value) {
      validate(fields()[1], value);
      this.mappingQuality = value;
      fieldSetFlags()[1] = true;
      return this; 
    }
    
    /** Checks whether the 'mappingQuality' field has been set */
    public boolean hasMappingQuality() {
      return fieldSetFlags()[1];
    }
    
    /** Clears the value of the 'mappingQuality' field */
    public org.ga4gh.models.LinearAlignment.Builder clearMappingQuality() {
      mappingQuality = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'cigar' field */
    public java.util.List getCigar() {
      return cigar;
    }
    
    /** Sets the value of the 'cigar' field */
    public org.ga4gh.models.LinearAlignment.Builder setCigar(java.util.List value) {
      validate(fields()[2], value);
      this.cigar = value;
      fieldSetFlags()[2] = true;
      return this; 
    }
    
    /** Checks whether the 'cigar' field has been set */
    public boolean hasCigar() {
      return fieldSetFlags()[2];
    }
    
    /** Clears the value of the 'cigar' field */
    public org.ga4gh.models.LinearAlignment.Builder clearCigar() {
      cigar = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public LinearAlignment build() {
      try {
        LinearAlignment record = new LinearAlignment();
        record.position = fieldSetFlags()[0] ? this.position : (org.ga4gh.models.Position) defaultValue(fields()[0]);
        record.mappingQuality = fieldSetFlags()[1] ? this.mappingQuality : (java.lang.Integer) defaultValue(fields()[1]);
        record.cigar = fieldSetFlags()[2] ? this.cigar : (java.util.List) defaultValue(fields()[2]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy