Package model

Class Allele


public class Allele extends SequenceType
Represents an allele, which is a specific sequence type associated with a set of samples and a proteoform.

This class extends SequenceType and provides functionality to manage relationships between the allele and associated samples, as well as the proteoform identifier.

  • Constructor Details

    • Allele

      public Allele(List<Variant.Stub> variants)
      Constructs an Allele instance with the specified variants.
      Parameters:
      variants - A list of Variant.Stub objects representing the variants that define this allele.
  • Method Details

    • hasRelation

      public boolean hasRelation(String identifier)
      Checks if this allele is associated with a specific sample by its identifier.
      Parameters:
      identifier - The unique identifier of the sample to check.
      Returns:
      true if the sample is associated with this allele, false otherwise.
    • getRelatedSamples

      public Set<String> getRelatedSamples()
      Retrieves a collection of sample identifiers associated with this allele.

      This method returns an unmodifiable view of the set of sample identifiers associated with the allele. The unmodifiable set ensures that the original set cannot be modified externally, preserving data integrity.

      Returns:
      A Set of sample identifiers related to this allele.
    • getRelatedSamplesCount

      public int getRelatedSamplesCount()
      Retrieves the number of unique samples associated with this allele.
      Returns:
      The count of sample identifiers related to this allele.
    • getRelatedProteoform

      public String getRelatedProteoform()
      Retrieves the proteoform identifier associated with this allele.
      Returns:
      The proteoform identifier as a String, or null if no proteoform is associated.
    • addSampleRelation

      public void addSampleRelation(String sampleIdentifier)
      Associates a sample with this allele.
      Parameters:
      sampleIdentifier - The unique identifier of the sample to associate with this allele.
    • setProteoformRelation

      public void setProteoformRelation(String identifier)
      Sets the proteoform identifier for this allele.
      Parameters:
      identifier - The unique identifier of the proteoform to associate with this allele.
    • toString

      public String toString()
      Converts the allele to its string representation.

      This method returns the unique identifier of the allele as its string representation.

      Overrides:
      toString in class Object
      Returns:
      A String representing the unique identifier of the allele.
    • hashCode

      public int hashCode()
      Computes the hash code for this allele.

      This method calculates the hash code of the allele based on its unique identifier.

      Overrides:
      hashCode in class Object
      Returns:
      The hash code of the allele.
    • equals

      public boolean equals(Object obj)
      Compares this allele to another object for equality.

      This method checks if the provided object is the same instance as this allele. If not, it verifies that the object is of the same class and compares their unique identifiers for equality.

      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare with this Allele instance.
      Returns:
      true if the objects are the same instance or if their unique identifiers are equal; false otherwise.