Skip to content

Commit

Permalink
Update score field type in ORF struct
Browse files Browse the repository at this point in the history
  • Loading branch information
camilogarciabotero committed Feb 6, 2024
1 parent fe3496e commit 2386044
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2386044

Please sign in to comment.