FastaRecord
Mojo struct 🡭
FastaRecord
Section titled “FastaRecord”@memory_onlystruct FastaRecordA single FASTA record (two logical parts: >id, sequence).
Multi-line sequences are stored as a single logical line (no embedded newlines). Owned representation; safe to store in collections and reuse.
Attributes: id: Read identifier (id line content after the ’>’; stored without leading ’>’). sequence: Sequence line (normalized to a single line, no ‘\n’ or ‘\r’).
Implemented traits
Section titled “Implemented traits”AnyType, Copyable, Hashable, ImplicitlyDestructible, Movable, Sized, Writable
Methods
Section titled “Methods”__init__
Section titled “__init__”def __init__(out self, id: String, sequence: String)Build from id and sequence strings.
Args:
- id (
String) - sequence (
String) - self (
Self)
Returns:
Self
Raises:
def __init__(out self, id: Span[Byte, id.origin], sequence: Span[Byte, sequence.origin])Args:
- id (
Span) - sequence (
Span) - self (
Self)
Returns:
Self
Raises:
def __init__(out self, var id: BString, var sequence: BString)Args:
- id (
BString) - sequence (
BString) - self (
Self)
Returns:
Self
__eq__
Section titled “__eq__”def __eq__(self, other: Self) -> BoolArgs:
- self (
Self) - other (
Self)
Returns:
Bool
__ne__
Section titled “__ne__”def __ne__(self, other: Self) -> BoolArgs:
- self (
Self) - other (
Self)
Returns:
Bool
sequence
Section titled “sequence”def sequence(ref self) -> StringSlice[origin_of(self)]Return the sequence line as a string slice.
Args:
- self (
Self)
Returns:
StringSlice
def id(ref self) -> StringSlice[origin_of(self)]Return the read identifier (id without leading ’>’) as a string slice.
Args:
- self (
Self)
Returns:
StringSlice
definition
Section titled “definition”def definition(self) -> DefinitionArgs:
- self (
Self)
Returns:
Definition
byte_len
Section titled “byte_len”def byte_len(self) -> IntReturn total byte length when written (”>” + id + “\n” + sequence + “\n”).
Args:
- self (
Self)
Returns:
Int
def write[w: Writer](self, mut writer: w, line_width: Int = 60)Write the record in standard FASTA format.
Parameters:
- w (
Writer)
Args:
- self (
Self) - writer (
w) - line_width (
Int)
write_to
Section titled “write_to”def write_to[w: Writer](self, mut writer: w)Parameters:
- w (
Writer)
Args:
- self (
Self) - writer (
w)
__len__
Section titled “__len__”def __len__(self) -> IntReturn the sequence length (number of bases).
Args:
- self (
Self)
Returns:
Int
__hash__
Section titled “__hash__”def __hash__[H: Hasher](self, mut hasher: H)Parameters:
- H (
Hasher)
Args:
- self (
Self) - hasher (
H)
__repr__
Section titled “__repr__”def __repr__(self) -> StringArgs:
- self (
Self)
Returns:
String