Class SequenceType
- Direct Known Subclasses:
Allele,Proteoform
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetStubs()Retrieves all variants as stubs.getVariant(int position) Retrieves the alternative allele at the specified position.Retrieves an unmodifiable view of the variants map.booleanhasVariant(int position, String alternative) Checks if a specific variant exists at the given position.booleanhasVariantAt(int position) Checks if this sequence type has a variant at the specified position.Methods inherited from class model.Attributes
attributesAsString, attributesAsString, clearAttributes, extendAttribute, extendAttributes, getAttribute, getAttributeOrDefault, getAttributes, getAttributeSet, hasAnyAttribute, hasAttribute, removeAttribute, setAttribute, setAttributeIfAbsent, setAttributes, setAttributesIfAbsent
-
Field Details
-
_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
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
variantsmap. 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:
trueif the variant exists at the given position with the specified alternative allele;falseotherwise.
-
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:
trueif a variant exists at the specified position,falseotherwise.
-
getVariant
Retrieves the alternative allele at the specified position.This method fetches the alternative allele for a given position from the
variantsmap. If no variant exists at the specified position, it returnsnull.- Parameters:
position- The position of the variant to retrieve.- Returns:
- The alternative allele as a
String, ornullif no variant exists at the position.
-
getStubs
Retrieves all variants as stubs.Converts the
variantsmap into a list ofVariant.Stubobjects, 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
ListofVariant.Stubobjects.
-
getVariants
Retrieves an unmodifiable view of the variants map.This method returns the
variantsmap 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
Mapwhere the keys are variant positions and the values are the alternative alleles.
-