Showing 3 of 4 files from the diff.

@@ -38,7 +38,7 @@
Loading
38 38
# ------------------------------
39 39
40 40
"Invalid Amino Acid"
41 -
const AA_INVALID = reinterpret(AminoAcid, 0x1c)  # Used during conversion from strings
41 +
const AA_INVALID = encode(AminoAcid, 0x1c)  # Used during conversion from strings
42 42
43 43
# lookup table for characters
44 44
const char_to_aa = [AA_INVALID for _ in 0x00:0x7f]
@@ -78,7 +78,7 @@
Loading
78 78
        ('X', "Unspecified or Unknown Amino Acid", 0x19)]  # ambiguous
79 79
        var = Symbol("AA_", aa)
80 80
        @eval begin
81 -
            @doc $doc const $var = reinterpret(AminoAcid, $code)
81 +
            @doc $doc const $var = encode(AminoAcid, $code)
82 82
            char_to_aa[$(Int(aa)+1)] = char_to_aa[$(Int(lowercase(aa))+1)] = $var
83 83
            $(aatochar)[$(code)+1] = $aa
84 84
        end
@@ -97,13 +97,13 @@
Loading
97 97
98 98
    @eval begin
99 99
        "Terminal"
100 -
        const AA_Term = reinterpret(AminoAcid, 0x1a)
100 +
        const AA_Term = encode(AminoAcid, 0x1a)
101 101
        char_to_aa[Int('*')+1] = AA_Term
102 102
        $(aatochar)[0x1a+1] = '*'
103 103
        $(compatbitsaa)[0x1a+1] = 1 << 0x1a
104 104
105 105
        "Amino Acid Gap"
106 -
        const AA_Gap = reinterpret(AminoAcid, 0x1b)
106 +
        const AA_Gap = encode(AminoAcid, 0x1b)
107 107
        char_to_aa[Int('-') + 1] = AA_Gap
108 108
        $(aatochar)[0x1b+1] = '-'
109 109
        $(compatbitsaa)[0x1b+1] = 0
@@ -111,7 +111,7 @@
Loading
111 111
    (Tuple(aatochar), Tuple(compatbitsaa))
112 112
end
113 113
114 -
@eval alphabet(::Type{AminoAcid}) = $(tuple([reinterpret(AminoAcid, x) for x in 0x00:0x1b]...))
114 +
@eval alphabet(::Type{AminoAcid}) = $(tuple([encode(AminoAcid, x) for x in 0x00:0x1b]...))
115 115
116 116
"""
117 117
    alphabet(AminoAcid)
@@ -272,4 +272,4 @@
Loading
272 272
273 273
```
274 274
"""
275 -
compatbits(aa::AminoAcid) = @inbounds compatbits_aa[reinterpret(UInt8, aa) + 1]
275 +
compatbits(aa::AminoAcid) = @inbounds compatbits_aa[encoded_data(aa) + 1]

@@ -66,7 +66,7 @@
Loading
66 66
    if !isvalid(DNA, dna)
67 67
        throw(InexactError(:convert, DNA, c))
68 68
    end
69 -
    return reinterpret(DNA, dna)
69 +
    return encode(DNA, dna)
70 70
end
71 71
DNA(c::Char) = convert(DNA, c)
72 72
@@ -78,7 +78,7 @@
Loading
78 78
    if !isvalid(RNA, rna)
79 79
        throw(InexactError(:convert, RNA, c))
80 80
    end
81 -
    return reinterpret(RNA, rna)
81 +
    return encode(RNA, rna)
82 82
end
83 83
RNA(c::Char) = convert(RNA, c)
84 84
@@ -163,7 +163,7 @@
Loading
163 163
        ('N', "DNA Adenine, Cytosine, Guanine or Thymine", 0b1111)]
164 164
        var = Symbol("DNA_", char != '-' ? char : "Gap")
165 165
        @eval begin
166 -
            @doc $(doc) const $(var) = reinterpret(DNA, $(bits))
166 +
            @doc $(doc) const $(var) = encode(DNA, $(bits))
167 167
            char_to_dna[$(convert(Int, char) + 1)] = char_to_dna[$(convert(Int, lowercase(char)) + 1)] = $(bits)
168 168
            $(chararray)[$(convert(Int, bits) + 1)] = $(char)
169 169
        end
@@ -172,7 +172,7 @@
Loading
172 172
end
173 173
174 174
@eval function alphabet(::Type{DNA})
175 -
    return $(tuple([reinterpret(DNA, x) for x in 0b0000:0b1111]...))
175 +
    return $(tuple([encode(DNA, x) for x in 0b0000:0b1111]...))
176 176
end
177 177
178 178
"""
@@ -300,7 +300,7 @@
Loading
300 300
end
301 301
302 302
@eval function alphabet(::Type{RNA})
303 -
    return $(tuple([reinterpret(RNA, x) for x in 0b0000:0b1111]...))
303 +
    return $(tuple([encode(RNA, x) for x in 0b0000:0b1111]...))
304 304
end
305 305
306 306
"""
@@ -354,14 +354,6 @@
Loading
354 354
"""
355 355
const ACGUN = (RNA_A, RNA_C, RNA_G, RNA_U, RNA_N)
356 356
357 -
function Base.:~(x::N) where N <: NucleicAcid
358 -
    return reinterpret(N, ~encoded_data(x) & 0b1111)
359 -
end
360 -
361 -
function Base.:|(x::N, y::N) where N <: NucleicAcid
362 -
    return reinterpret(N, encoded_data(x) | encoded_data(y))
363 -
end
364 -
365 357
"""
366 358
    gap(DNA)
367 359
@@ -448,7 +440,7 @@
Loading
448 440
"""
449 441
function complement(nt::NucleicAcid)
450 442
    bits = compatbits(nt)
451 -
    return reinterpret(
443 +
    return encode(
452 444
        typeof(nt),
453 445
        (bits & 0x01) << 3 | (bits & 0x08) >> 3 |
454 446
        (bits & 0x02) << 1 | (bits & 0x04) >> 1)

@@ -96,7 +96,8 @@
Loading
96 96
    iscompatible,
97 97
    compatbits,
98 98
    alphabet,
99 -
    encoded_data
99 +
    encoded_data,
100 +
    encode
100 101
101 102
import Automa
102 103
import Automa.RegExp: @re_str
@@ -118,6 +119,9 @@
Loading
118 119
abstract type BioSymbol end
119 120
120 121
encoded_data(x::BioSymbol) = reinterpret(encoded_data_eltype(typeof(x)), x)
122 +
function encode(::Type{T}, x) where T <: BioSymbol
123 +
    return reinterpret(T, convert(encoded_data_eltype(T), x))
124 +
end
121 125
Base.length(::BioSymbol) = 1
122 126
Base.iterate(sym::BioSymbol) = (sym, nothing)
123 127
Base.iterate(sym::BioSymbol, state) = nothing
@@ -140,15 +144,6 @@
Loading
140 144
# like iteration, sort, comparison, and so on.
141 145
Base.isless(x::S, y::S) where S <: BioSymbol = isless(encoded_data(x), encoded_data(y))
142 146
143 -
function Base.:~(x::BioSymbol)
144 -
    return reinterpret(typeof(x), ~encoded_data(x) & bytemask(x))
145 -
end
146 -
147 -
function Base.:&(x::S, y::S) where S <: BioSymbol
148 -
    return reinterpret(S, encoded_data(x) & encoded_data(y))
149 -
end
150 -
151 -
152 147
@inline function Base.count_ones(symbol::BioSymbol)
153 148
    return count_ones(encoded_data(symbol))
154 149
end
@@ -188,7 +183,7 @@
Loading
188 183
end
189 184
190 185
Base.write(io::IO, symbol::BioSymbol) = write(io, encoded_data(symbol))
191 -
Base.read(io::IO, ::Type{T}) where T<:BioSymbol = reinterpret(T, read(io, encoded_data_eltype(T)))
186 +
Base.read(io::IO, ::Type{T}) where T<:BioSymbol = encode(T, read(io, encoded_data_eltype(T)))
192 187
193 188
"""
194 189
    iscompatible(x::S, y::S) where S <: BioSymbol
Files Coverage
src 100.00%
Project Totals (3 files) 100.00%
codecov-umbrella
Build #124678467 -
unittests
codecov-umbrella
Build #124678467 -
unittests
codecov-umbrella
Build #124678467 -
unittests
codecov-umbrella
Build #124678467 -
unittests
codecov-umbrella
Build #124678467 -
unittests
codecov-umbrella
Build #124678467 -
unittests
codecov-umbrella
Build #124678467 -
unittests

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading