Package model

Record Class Feature.SubFeature

java.lang.Object
java.lang.Record
model.Feature.SubFeature
Record Components:
type - The type of the sub-feature (e.g., "exon", "CDS").
start - The 1-based start position of the sub-feature.
end - The 1-based end position of the sub-feature.
Enclosing class:
Feature

public static record Feature.SubFeature(String type, int start, int end) extends Record
Represents a sub-feature of a genomic feature.

This record encapsulates the type and genomic location of a sub-feature, such as an exon or CDS, within a parent genomic feature. It includes:

  • The type of the sub-feature (e.g., "exon", "CDS").
  • The 1-based start position of the sub-feature on the reference genome.
  • The 1-based end position of the sub-feature on the reference genome.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SubFeature(String type, int start, int end)
    Creates an instance of a SubFeature record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    end()
    Returns the value of the end record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    ID(String parentIdentifier)
    Generates a GFF3 conform identifier (ID) for a sub-feature based on its type and a parent identifier.
    int
    Returns the value of the start record component.
    final String
    Returns a string representation of this record class.
    Returns the value of the type record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SubFeature

      public SubFeature(String type, int start, int end)
      Creates an instance of a SubFeature record class.
      Parameters:
      type - the value for the type record component
      start - the value for the start record component
      end - the value for the end record component
  • Method Details

    • ID

      public String ID(String parentIdentifier)
      Generates a GFF3 conform identifier (ID) for a sub-feature based on its type and a parent identifier.

      This method constructs an ID string for the sub-feature using its type and the provided parent identifier. The format of the ID depends on the type of the sub-feature:

      • If the type is "CDS", the ID is formatted as "ID=cds-{parentIdentifier};Parent=transcript-{parentIdentifier}".
      • If the type is "exon", the ID is formatted as "ID=exon-{parentIdentifier};Parent=transcript-{parentIdentifier}".
      • If the type contains "RNA", the ID is formatted as "ID=transcript-{parentIdentifier};Parent={parentIdentifier}".
      • For other types, the ID is formatted as "ID={type}-{parentIdentifier};Parent={parentIdentifier}".
      Parameters:
      parentIdentifier - The identifier of the parent feature.
      Returns:
      A formatted string representing the GFF3 ID value of the sub-feature.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • start

      public int start()
      Returns the value of the start record component.
      Returns:
      the value of the start record component
    • end

      public int end()
      Returns the value of the end record component.
      Returns:
      the value of the end record component