From 2386044fc46b3b9411505c6c4f7e6b83bc5907ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilo=20Garc=C3=ADa?= Date: Mon, 5 Feb 2024 22:36:51 -0500 Subject: [PATCH] Update score field type in ORF struct --- src/types.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/types.jl b/src/types.jl index 97d827d..70c7e57 100644 --- a/src/types.jl +++ b/src/types.jl @@ -45,19 +45,19 @@ The ORF struct represents an open reading frame in a DNA sequence. It has two fi - `location`: which is a UnitRange{Int64} indicating the start and end locations of the ORF in the sequence - `strand`: is a Char type indicating whether the ORF is on the forward ('+') or reverse ('-') strand of the sequence. - `frame`: is an Int type indicating the reading frame of the ORF. The frame is the position of the first nucleotide of the codon that starts the ORF, relative to the start of the sequence. It can be 1, 2, or 3. -- `score`: is a Union{Float64, Nothing} type indicating the score of the ORF. It can be a Float64 or nothing. +- `score`: is a Union{Nothing, Float64} type indicating the score of the ORF. It can be a Float64 or nothing. """ struct ORF <: AbstractGene location::UnitRange{Int64} # Note that it is also called position for gene struct in GenomicAnotations strand::Char frame::Int # Use Int64 instead of Int - score::Union{Float64, Nothing} # Add score field + score::Union{Nothing, Float64} # Add score field - function ORF(location::UnitRange{Int64}, strand::Char, frame::Int, score::Union{Float64, Nothing} = nothing) + function ORF(location::UnitRange{Int64}, strand::Char, frame::Int, score::Union{Nothing, Float64} = nothing) @assert frame in (1, 2, 3) "Invalid frame value. Frame must be 1, 2, or 3." @assert strand in ('+', '-') "Invalid strand value. Strand must be '+' or '-'." @assert location[1] < location[end] "Invalid location. Start must be less than stop." - @assert score isa Union{Float64, Nothing} "Invalid score value. Score must be a Float64 or nothing." + @assert score isa Union{Nothing, Float64} "Invalid score value. Score must be a Float64 or nothing." return new(location, strand, frame, score) end