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.boolean
hasVariant
(int position, String alternative) Checks if a specific variant exists at the given position.boolean
hasVariantAt
(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
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
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 returnsnull
.- Parameters:
position
- The position of the variant to retrieve.- Returns:
- The alternative allele as a
String
, ornull
if no variant exists at the position.
-
getStubs
Retrieves all variants as stubs.Converts the
variants
map into a list ofVariant.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
ofVariant.Stub
objects.
-
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.
-