Skip to content
BioVossEncoder.VossEncoder Type
julia
struct VossEncoder{A<:NucleicAcidAlphabet, B<:BitMatrix}

The VossEncoder struct represents a binary matrix encoding a sequence of nucleic acids. This is also called the Voss representation of a sequence.

Fields

  • alphabet::A: The nucleic acid alphabet used for encoding.

  • bitmatrix::B: The binary matrix representing the encoded sequence.

Constructors

  • VossEncoder(sequence::SeqOrView{A}): Constructs a VossEncoder from a sequence of nucleic acids.

Arguments

  • sequence::SeqOrView{A}: The sequence of nucleic acids to be encoded.

source

BioVossEncoder.pfm Method
julia
pfm(v::Vector{T}) where {T <: SeqOrView{<:Alphabet}}

Calculate the position frequency matrix (PFM) for a given vector of sequences or sequence views.

Arguments

  • v::Vector{T}: A vector of sequences or sequence views, where each element is of type T which is a subtype of SeqOrView parameterized by an Alphabet.

Returns

  • A matrix representing the position frequency matrix (PFM) of the input sequences.

Details

  • The function first creates a copy of the input vector v.

  • It then determines the sequence with the maximum length (vmax) and removes it from the vector.

  • The function computes the Voss matrix for each sequence in the vector.

  • Finally, it sums the Voss matrices and returns the result as the position frequency matrix.

source

BioVossEncoder.vossmatrix Method
julia
vossmatrix(VossEncoder::VossEncoder{A, B}) where {A <: NucleicAcidAlphabet, B <: BitMatrix}
vossmatrix(seq::NucleicSeqOrView{A}) where {A <: NucleicAcidAlphabet}
vossmatrix(seq::SeqOrView{AminoAcidAlphabet}) where {A <: AminoAcidAlphabet}

Create a binary sequence matrix from a given nucleic acid sequence.

Arguments

  • sequence: A nucleic acid sequence.

Returns

The binary sequence matrix.

Examples

julia
julia> vossmatrix(aa"IANRMWRDTIED")

    20×12 BitMatrix:
    0  1  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  1  0  0  0  1
    0  0  0  0  0  0  0  0  0  0  1  0
    0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0
    1  0  0  0  0  0  0  0  0  1  0  0
    0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  1  0  0  0  0  0  0  0
    0  0  1  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  1  0  0  1  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  1  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  1  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0

source

BioVossEncoder.vossvector Method
julia
vossvector(seq::NucleicSeqOrView{A}, molecule::T) where {A <: NucleicAcidAlphabet, T <: BioSymbol}
vossvector(seq::SeqOrView{AminoAcidAlphabet}, molecule::T) where {T <: BioSymbol}
vossvector(seq::SeqOrView{A}, molecules::Tuple{Vararg{T}}) where {A <: Alphabet, T <: BioSymbol}

Converts a sequence of nucleotides into a binary representation.

Arguments

  • seq::SeqOrView{A}: The input sequence of nucleotides.

  • molecule::BioSymbol: The nucleotide to be encoded as 1, while others are encoded as 0.

  • molecules::Tuple{Vararg{T}}: The nucleotides to be encoded as 1, while others are encoded as 0.

Returns

A BitVector representing the binary encoding of the input sequence, where 1 indicates the presence of the specified nucleotide and 0 indicates the absence in the ith position of the sequence.

Examples

julia
julia> vossvector(dna"ACGT", DNA_A)

    4-element view(::BitMatrix, 1, :) with eltype Bool:
     1
     0
     0
     0

source