Package model

Class SequenceType

Direct Known Subclasses:
Allele, Proteoform

public class SequenceType extends Attributes
Represents a sequence type with associated variants and attributes.

It extends the Attributes class to inherit functionality for managing attributes associated with the sequence type. This class is extended by the Allele and Proteoform classes.

  • Field Details

    • _id

      public final String _id
      Unique identifier of this sequence type.

      This field serves as the unique identifier for the feature and is used to reference it in the model.

  • Method Details

    • hasVariant

      public boolean hasVariant(int position, String alternative)
      Checks if a specific variant exists at the given position.

      This method verifies whether a variant with the specified position and alternative allele is present in the variants map. It first checks if the position exists as a key in the map and then compares the associated value (alternative allele) with the provided alternative allele.

      Parameters:
      position - The position of the variant to check.
      alternative - The alternative allele to check for at the specified position.
      Returns:
      true if the variant exists at the given position with the specified alternative allele; false otherwise.
    • hasVariantAt

      public boolean hasVariantAt(int position)
      Checks if this sequence type has a variant at the specified position.
      Parameters:
      position - The position to check for a variant.
      Returns:
      true if a variant exists at the specified position, false otherwise.
    • getVariant

      public String getVariant(int position)
      Retrieves the alternative allele at the specified position.

      This method fetches the alternative allele for a given position from the variants map. If no variant exists at the specified position, it returns null.

      Parameters:
      position - The position of the variant to retrieve.
      Returns:
      The alternative allele as a String, or null if no variant exists at the position.
    • getStubs

      public List<Variant.Stub> getStubs()
      Retrieves all variants as stubs.

      Converts the variants map into a list of Variant.Stub objects, where each stub contains the position and alternative allele. Returns an empty list if no variants exist. The resulting list is unmodifiable.

      Returns:
      An unmodifiable List of Variant.Stub objects.
    • getVariants

      public Map<Integer,String> getVariants()
      Retrieves an unmodifiable view of the variants map.

      This method returns the variants map as an unmodifiable map to ensure that the internal state of the object cannot be altered. The map contains positions as keys and their corresponding alternative alleles as values.

      Returns:
      An unmodifiable Map where the keys are variant positions and the values are the alternative alleles.