package phylogenetics
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=de867d7cc017a8e434dab43ef16f0f6495973892cd7b6a8446b18e79393704a8
sha512=0209538caf94be47eabcaa25399c54849bd4fa0fc79e0579acee27f46ef3b72aa50e17bdb48fed8e86674d4caee6c1c4c423833a2757db12e2a6cc28234510de
doc/phylogenetics/Phylogenetics/Codon/module-type-S/index.html
Module type Codon.SSource
include Alphabet.S_int
include Alphabet.S
with type t = private int
and type vector = private Linear_algebra.vec
and type matrix = private Linear_algebra.mat
and type 'a table = private 'a array
type vector = private Linear_algebra.vectype matrix = private Linear_algebra.matval all : t listval to_int : t -> intval counts : t Core.Sequence.t -> int tablemodule Table : sig ... endmodule Vector : sig ... endval flat_profile : unit -> vectormodule Matrix : sig ... endval of_int : int -> t optionval of_int_exn : int -> tval to_string : t -> stringto_string c returns a string representation of codon c
Example:
let codon_option = Codon.of_string "ATG" in
match codon_option with
| Some codon -> assert (Codon.to_string codon = "ATG")
| None -> failwith "Invalid codon string"In this example, the codon is converted to its string representation. The string representation is then compared to the expected value.
val of_string : string -> t optionof_string s tries tp build a codon from a string representation. It returns None if the string is not a valid codon
val neighbours : t -> t -> (int * Nucleotide.t * Nucleotide.t) optionneighbours p q tests if codons p and q are neighbors that is, if they differ by exactly one nucleotide. If so, the function returns the index of the differing nucleotide and the nucleotides themselves; it returns None if the codons are not neighbors.
Example:
let codon_p = Codon.of_string "ATA" in
let codon_q = Codon.of_string "ATG" in
match Codon.neighbours codon_p codon_q with
| Some (index, nucleotide_p, nucleotide_q) ->
assert (index = 2);
assert (nucleotide_p = Nucleotide.A);
assert (nucleotide_q = Nucleotide.G)
| None -> failwith "Codons are not neighbors"In this example, the codons are compared to find the index of the differing nucleotide and the nucleotides themselves. The index and nucleotides are then compared to the expected values.
val nucleotides : t -> Nucleotide.t * Nucleotide.t * Nucleotide.tnucleotides c returns the triplet of nucleotides of c
Example :
let codon_option = Codon.of_string "ATG" in
match codon_option with
| None -> failwith "Invalid codon string"
| Some codon ->
let (n1, n2, n3) = Codon.nucleotides codon in
assert (n1 = Nucleotide.A);
assert (n2 = Nucleotide.T);
assert (n3 = Nucleotide.G)In this example, the nucleotides of the codon are extracted and compared to the expected values.