View source: R/weighted_consensus.r
weighted_consensus | R Documentation |
This is an auxiliary function in single package. It computes consensus from a data.frame as the one returned by single_evaluate()
weighted_consensus(df, cutoff_prob = 0.2)
df |
data.frame with the columns: nucleotide, probability, position |
cutoff_prob |
Numeric. Nucleotides with probability below this number will be removed from consensus computation. |
Character vector, consensus sequence
fastq_seqs_example <- system.file("extdata", "test_sequences.fastq",package = "single")
seqs_example <- Biostrings::readQualityScaledDNAStringSet(fastq_seqs_example)
# Using single weights
data_barcode = data.frame(
nucleotide = unlist(sapply(as.character(seqs_example),strsplit, split="")),
p_SINGLe=unlist(1-as(Biostrings::quality(seqs_example),"NumericList")),
pos=rep(1:Biostrings::width(seqs_example[1]),length(seqs_example)))
weighted_consensus(df = data_barcode, cutoff_prob = 0.9)
# Replacing weights by ones
data_barcode = data.frame(
nucleotide = unlist(sapply(as.character(seqs_example),strsplit, split="")),
p_SINGLe=1,pos=rep(1,sum(Biostrings::width(seqs_example))))
weighted_consensus(df = data_barcode, cutoff_prob = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.