onehot_vectorizer {kmers} R Documentation

make the sequence embedding via the one-hot encoding(Bag-of-n-grams) of

Description

the k-mer composition

Usage

onehot_vectorizer(x,
    type = Protein,
    k = 6);

Arguments

x

should be a collection of the FastaSeq sequence collection, which can be a FastaFile object, a vector of the @T:SMRUCC.genomics.SequenceModel.FASTA.FastaSeq

type

[as SeqTypes]

k

[as integer]

env

[as Environment]

Details

unlike the tfidf_vectorizer api, which evaluates the weight of each k-mer term by the term frequency and the inverse document frequency, this api just encodes the k-mer composition of the sequence data as a binary vector, i.e. the presence or absence of each k-mer term.

Authors

seqtoolkit

Value

a data frame object: each row is a sequence in the input sequence collection(the row name is the fasta title of the corresponding sequence), and each column is a k-mer term, the cell value is ONE when the k-mer is exists in the corresponding sequence, otherwise ZERO.

this function returns NULL if the input data can not be cast to a fasta sequence collection.

clr value class

Examples


[Package kmers version 1.0.0.0 Index]