GCATCodes

Documentation for GCATCodes.

GCATCodes.CodonGraphDataMethod
CodonGraphData(codon_set::Vector{LongDNA{4}}; graph_title::String = "") -> CodonGraphData

Constructs a CodonGraphData instance from a codon set and builds the corresponding graph.

Arguments

  • codon_set::Vector{LongDNA{4}}: Input codons used to build the graph.

Keyword Arguments

  • graph_title::String="": Optional title for the graph.

Returns

  • CodonGraphData: Fully initialized structure with vertices, edges, and labels.

Throws

  • ArgumentError: If codon_set is invalid or graph construction fails.

Examples

julia> using GCATCodes

julia> codon_set = GCATCodes.LongDNA{4}.(["CCA", "GAT"]);

julia> cgd = CodonGraphData(codon_set);

julia> cgd isa CodonGraphData
true
source
GCATCodes.calc_strong_c3_comb_by_sizeMethod
calc_strong_c3_comb_by_size(comb_size::Int, ckp_path::AbstractString, prev_res_path::AbstractString, res_path::AbstractString, stop_flag::Base.Threads.Atomic{Bool}; worker_count::Int=1) -> Bool

Computes strong-C3 combinations of a given size with checkpoint and resume logic.

Arguments

  • comb_size::Int: Size of combinations to compute (1 to 20).
  • ckp_path::AbstractString: Path to the checkpoint file.
  • prev_res_path::AbstractString: Path to the result file of the previous combination size.
  • res_path::AbstractString: Path to the output file for current results.
  • stop_flag::Base.Threads.Atomic{Bool}: Atomic stop flag for graceful interruption.

Keyword Arguments

  • worker_count::Int=nthreads(): Number of parallel workers for processing.

Returns

  • Bool: true if processing ends regularly or is completed cleanly.

Throws

  • ArgumentError: If inputs, checkpoint contents, or file states are invalid.

Examples

source
GCATCodes.codon_set_to_strMethod
codon_set_to_str(codon_set::Vector{LongDNA{4}}) -> String

Formats a codon set as a quoted, comma-separated string.

Arguments

  • codon_set::Vector{LongDNA{4}}: Codon set to format.

Returns

  • String: Formatted representation, e.g. "ATG", "TGA".

Throws

  • ArgumentError: If codon_set is invalid.

Examples

julia> using GCATCodes

julia> codon_set = GCATCodes.LongDNA{4}.(["ATG", "TGA"]);

julia> codon_set_to_str(codon_set) == "\"ATG\", \"TGA\""
true
source
GCATCodes.get_codon_set_from_lineMethod
get_codon_set_from_line(line::AbstractString) -> Vector{LongDNA{4}}

Parses one line in the format COD1|COD2|...,idx1|idx2|... into a codon set.

Arguments

  • line::AbstractString: Input line with codons and corresponding indices.

Returns

  • Vector{LongDNA{4}}: Parsed and validated codon set.

Throws

  • ArgumentError: If the format, indices, or codons are invalid.

Examples

julia> using GCATCodes

julia> line = "AAC|AAG,1|2";

julia> get_codon_set_from_line(line)
2-element Vector{BioSequences.LongSequence{BioSequences.DNAAlphabet{4}}}:
 AAC
 AAG
source
GCATCodes.get_comp_rev_codon_setMethod
get_comp_rev_codon_set(codon_set::Vector{LongDNA{4}}) -> Vector{LongDNA{4}}

Builds the complemented and reversed codon for each codon in the set.

Arguments

  • codon_set::Vector{LongDNA{4}}: Input codon set.

Returns

  • Vector{LongDNA{4}}: Complemented-and-reversed codon set in the same order.

Throws

  • ArgumentError: If codon_set is invalid.

Examples

julia> using GCATCodes

julia> codon_set = GCATCodes.LongDNA{4}.(["ATG", "TGA", "TCA"]);

julia> get_comp_rev_codon_set(codon_set)
3-element Vector{BioSequences.LongSequence{BioSequences.DNAAlphabet{4}}}:
 CAT
 TCA
 TGA
source
GCATCodes.is_c3Method
is_c3(cgd::CodonGraphData) -> Bool

Checks whether a codon graph satisfies the C3 property.

Arguments

  • cgd::CodonGraphData: Codon graph data object that contains the graph.

Returns

  • Bool: true if cgd is C3, otherwise false.

Throws

  • ArgumentError: If cgd is invalid.

Examples

julia> using GCATCodes

julia> codon_set = GCATCodes.LongDNA{4}.(["ATG", "TGA"]);

julia> cgd = CodonGraphData(codon_set);

julia> is_c3(cgd)
false
source
GCATCodes.is_circularMethod
is_circular(cgd::CodonGraphData) -> Bool

Checks whether a codon graph is acyclic aka. contains no cycles.

Arguments

  • cgd::CodonGraphData: Codon graph data object that contains the graph.

Returns

  • Bool: true if no cycles are present, otherwise false.

Throws

  • ArgumentError: If cgd is invalid.

Examples

julia> using GCATCodes

julia> codon_set = GCATCodes.LongDNA{4}.(["AAC", "GTT"]);

julia> cgd = CodonGraphData(codon_set);

julia> is_circular(cgd)
true
source
GCATCodes.is_comma_freeMethod
is_comma_free(cgd::CodonGraphData) -> Bool

Checks whether a codon graph is comma-free.

Arguments

  • cgd::CodonGraphData: Codon graph data object to check.

Returns

  • Bool: true if cgd is comma-free, otherwise false.

Throws

  • ArgumentError: If cgd is invalid.

Examples

julia> using GCATCodes

julia> codon_set = GCATCodes.LongDNA{4}.(["CGA", "TAC"]);

julia> cgd = CodonGraphData(codon_set);

julia> is_comma_free(cgd)
true
source
GCATCodes.is_self_complementaryMethod
is_self_complementary(cgd::CodonGraphData) -> Bool

Checks whether a codon graph is invariant under complement and reversal.

Arguments

  • cgd::CodonGraphData: Codon graph data object to check.

Returns

  • Bool: true if the graph is self-complementary, otherwise false.

Throws

  • ArgumentError: If cgd is invalid.

Examples

julia> using GCATCodes

julia> codon_set = GCATCodes.LongDNA{4}.(["AGC", "CTG", "TGT", "ATC"]);

julia> cgd = CodonGraphData(codon_set);

julia> is_self_complementary(cgd)
false
source
GCATCodes.is_strong_c3Method
is_strong_c3(cgd::CodonGraphData) -> Bool

Checks whether a codon graph is strong C3.

Arguments

  • cgd::CodonGraphData: Codon graph data object to check.

Returns

  • Bool: true if cgd is strong C3, otherwise false.

Throws

  • ArgumentError: If cgd is invalid.

Examples

julia> using GCATCodes

julia> codon_set = GCATCodes.LongDNA{4}.(["GGA", "TAA"]);

julia> cgd = CodonGraphData(codon_set);

julia> is_strong_c3(cgd)
true
source
GCATCodes.left_shift_codonMethod
left_shift_codon(codon::LongDNA{4}, shift_by::Int) -> LongDNA{4}

Performs a cyclic left shift on a codon.

Arguments

  • codon::LongDNA{4}: Codon to shift.
  • shift_by::Int: Number of left shifts.

Returns

  • LongDNA{4}: Cyclically left-shifted codon.

Throws

  • ArgumentError: If shift_by < 0 or codon is invalid.

Examples

julia> using GCATCodes

julia> codon = GCATCodes.LongDNA{4}("ACT");

julia> left_shift_codon(codon, 1)
3nt DNA Sequence:
CTA
source
GCATCodes.left_shift_codon_setMethod
left_shift_codon_set(codon_set::Vector{LongDNA{4}}, shift_by::Int) -> Vector{LongDNA{4}}

Performs a cyclic left shift on all codons in a set.

Arguments

  • codon_set::Vector{LongDNA{4}}: Codon set to shift.
  • shift_by::Int: Number of left shifts.

Returns

  • Vector{LongDNA{4}}: Shifted codon set.

Throws

  • ArgumentError: If shift_by < 0 or codon_set is invalid.

Examples

julia> using GCATCodes

julia> codon_set = GCATCodes.LongDNA{4}.(["TTG", "TGA"]);

julia> left_shift_codon_set(codon_set, 1)
2-element Vector{BioSequences.LongSequence{BioSequences.DNAAlphabet{4}}}:
 TGT
 GAT
source
GCATCodes.plot_codon_graphMethod
plot_codon_graph(cgd::CodonGraphData; fig_size::Tuple{Int, Int} = (1800, 900)) -> Figure

Creates a single visualization of a codon graph in a Figure.

Arguments

  • cgd::CodonGraphData: Codon graph to plot.

Keyword Arguments

  • fig_size::Tuple{Int, Int}=(1800, 900): Size of the generated figure in pixels.

Returns

  • Figure: Makie figure containing the plotted graph.

Throws

  • ArgumentError: If cgd is invalid.

Examples

julia> using GCATCodes

julia> codon_set = GCATCodes.LongDNA{4}.(["CAA", "GTC"]);

julia> cgd = CodonGraphData(codon_set);

julia> fig = plot_codon_graph(cgd);

julia> typeof(fig)
Makie.Figure
source
GCATCodes.plot_multiple_codon_graphsMethod
plot_multiple_codon_graphs(cgd_list::Vector{CodonGraphData}; fig_title::Union{String, Nothing}=nothing, fig_size::Tuple{Int, Int}=(1800, 900)) -> Figure

Creates a grid visualization of multiple codon graphs in a Figure.

Arguments

  • cgd_list::Vector{CodonGraphData}: List of codon graphs to plot.

Keyword Arguments

  • fig_title::Union{String, Nothing}=nothing: Optional global title above the grid.
  • fig_size::Tuple{Int, Int}=(1800, 900): Size of the generated figure in pixels.

Returns

  • Figure: Makie figure containing all plotted graphs.

Throws

  • ArgumentError: If cgd_list is empty or contains invalid entries.

Examples

julia> using GCATCodes

julia> codon_set_1 = GCATCodes.LongDNA{4}.(["ATA", "GGA"]);

julia> codon_set_2 = GCATCodes.LongDNA{4}.(["TTC", "GCA"]);

julia> cgd_1 = CodonGraphData(codon_set_1);

julia> cgd_2 = CodonGraphData(codon_set_2);

julia> cgd_list = [cgd_1, cgd_2];

julia> fig = plot_multiple_codon_graphs(cgd_list);

julia> typeof(fig)
Makie.Figure
source