Utility functions

Public names

SeqFold.gc_contentFunction
SeqFold.gc_content(::AbstractString) -> Float64

Compute the GC-content of a DNA(/RNA) sequence. Does not validate character correctness. For emplty sequence returns NaN.

Examples

julia> SeqFold.gc_content("ACGT")
0.5

julia> SeqFold.gc_content("GGC")
1.0

julia> SeqFold.gc_content("ABCD")
0.25

julia> SeqFold.gc_content("")
NaN

See also

SeqFold.gc_cache

source
SeqFold.gc_cacheFunction
SeqFold.gc_cache(seq) -> Matrix{Float64}

Compute a matrix of GC scores for all possible subsequences of a DNA sequence.

The resulting matrix has element [i, j] representing the GC score of the DNA subsequence from position i to position j. This cache enables efficient GC ratio calculations for various subsequences without redundant computations.

Arguments

  • seq::AbstractString: The DNA sequence to analyze

Returns

A Matrix{Float64} where element [i, j] contains the GC ratio of the subsequence from position i to j. Elements where j < i contain NaN as they represent invalid ranges.

Examples

julia> SeqFold.gc_cache("GGAA")
4×4 Matrix{Float64}:
   1.0    1.0    0.666667  0.5
 NaN      1.0    0.5       0.333333
 NaN    NaN      0.0       0.0
 NaN    NaN    NaN         0.0

julia> SeqFold.gc_cache("GAAA")
4×4 Matrix{Float64}:
   1.0    0.5    0.333333  0.25
 NaN      0.0    0.0       0.0
 NaN    NaN      0.0       0.0
 NaN    NaN    NaN         0.0

julia> SeqFold.gc_cache("ATA")
3×3 Matrix{Float64}:
   0.0    0.0  0.0
 NaN      0.0  0.0
 NaN    NaN    0.0

See also

SeqFold.tm_cache, tm, SeqFold.dg_cache

source
SeqFold.complementFunction
SeqFold.complement(::AbstractString) -> String
SeqFold.complement(::AbstractChar) -> Char

Compute the Watson-Crick all uppercase complement of a DNA sequence. Non-standard bases (anything other than 'A', 'T', 'C', 'G') are converted to 'N'.

Examples

julia> SeqFold.complement("ACGT")
"TGCA"

julia> SeqFold.complement("ACGTacgt")
"TGCATGCA"

julia> SeqFold.complement("ACGTN")
"TGCAN"

julia> SeqFold.complement("XYZ")
"NNN"

julia> SeqFold.complement('C')
'G': ASCII/Unicode U+0047 (category Lu: Letter, uppercase)

See also

SeqFold.revcomp

source
SeqFold.revcompFunction
SeqFold.revcomp(::AbstractString) -> String
SeqFold.revcomp(::AbstractChar) -> Char

Compute the Watson-Crick all uppercase reverse complement of a DNA sequence. Non-standard bases (anything other than 'A', 'T', 'C', 'G') are converted to 'N'.

Examples

julia> SeqFold.revcomp("ACGT")
"ACGT"

julia> SeqFold.revcomp("ACGTacgt")
"ACGTACGT"

julia> SeqFold.revcomp("ACGTN")
"NACGT"

julia> SeqFold.revcomp("XYZ")
"NNN"

julia> SeqFold.revcomp('C')
'G': ASCII/Unicode U+0047 (category Lu: Letter, uppercase)

See also

SeqFold.complement

source