module Fastx

Defined in:

fastx.cr
fastx/exceptions.cr
fastx/fasta.cr
fastx/fasta/reader.cr
fastx/fasta/writer.cr
fastx/fastq.cr
fastx/fastq/reader.cr
fastx/fastq/writer.cr
fastx/format.cr
fastx/version.cr

Constant Summary

VERSION = {{ (`shards version /home/runner/work/fastx.cr/fastx.cr/src/fastx`).chomp.stringify }}

Class Method Summary

Class Method Detail

def self.decode_bases(bases : Enumerable(UInt8)) : String #

Converts a UInt8 array (ASCII codes) to a DNA string.


[View source]
def self.decode_phred(scores : Enumerable(UInt8), offset = 33) : String #

Converts an array of Phred scores to a quality string.


[View source]
def self.encode_bases(sequence : IO::Memory | String) : Slice(UInt8) #

Converts a DNA sequence (String or IO::Memory) to a UInt8 slice, where each base is encoded as a single byte (A, C, G, T, N → 65, 67, 71, 84, 78; others → 78). This representation is suitable for byte-wise or array processing.


[View source]
def self.encode_phred(quality : String, offset = 33) : Array(UInt8) #

Converts a quality string to an array of Phred scores.


[View source]
def self.normalize_base(c : UInt8) : UInt8 #

Normalizes a single base character to uppercase ACGTN. Non-ACGTN characters are converted to N (78u8).


[View source]
def self.open(filename : Path | String, mode = "r", format : Format | Nil = nil, &) #

Opens a FASTA/FASTQ file with automatic format detection or explicit format. Yields the appropriate Reader/Writer to the block and automatically closes it.


[View source]
def self.open(filename : Path | String, mode = "r", format : Format | Nil = nil) #

Opens a FASTA/FASTQ file with automatic format detection or explicit format. Returns the appropriate Reader/Writer instance (manual close required).


[View source]