seqComplexity {dada2} | R Documentation |
This function calculates the oligonucleotide complexity of input sequences. Complexity is quantified as the Shannon richness of oligonucleotides, which can be thought of as the effective number of oligonucleotides if they were all at equal frequencies. If a window size is provided, the minimum Shannon richness observed over sliding window along the sequence is returned.
seqComplexity(seqs, wordSize = 2, window = NULL, by = 5)
seqs |
(Required). A |
wordSize |
(Optional). Default 2. The size of the oligonucleotides (or "words" or "kmers") to use. |
window |
(Optional). Default NULL. The width in nucleotides of the moving window. If NULL the whole sequence is used. |
by |
(Optional). Default 5. The step size in nucleotides between each moving window tested. |
This function can be used to identify potentially artefactual or undesirable low-complexity sequences, or sequences with low-complexity regions, as are sometimes observed in Illumina sequencing runs. When such artefactual sequences are present, a simple plot of the Shannon oligonucleotide richness values returned by this function will typically show a clear bimodal signal.
numeric
.
A vector of minimum olignucleotide complexities for each sequence.
sq.norm <- "TACGGAAGGTCCGGGCGTTATCCGGATTTATTGGGTTTAAAGGGAGCGTAGGCCGGAGATTAAGCGTGTTGTGA" sq.lowc <- "TCCTTCTTCTCCTCTCTTTCTCCTTCTTTCTTTTTTTTCCCTTTCTCTTCTTCTTTTTCTTCCTTCCTTTTTTC" sq.part <- "TTTTTCTTCTCCCCCTTCCCCTTTCCTTTTCTCCTTTTTTCCTTTAGTGCAGTTGAGGCAGGCGGAATTCGTGG" sqs <- c(sq.norm, sq.lowc, sq.part) seqComplexity(sqs) seqComplexity(sqs, window=25)