The seqR package provides in-memory, probabilistic, highly-optimized, and multi-threaded implementation of k-mer counting.

Author

Jadwiga Słowik

Examples

# Load exemplary sequences data(CsgA) # Counting 1-mers (amino acid composition) count_kmers( CsgA, k = 1, batch_size = 1)
#> Single-threaded mode enabled. In order to speed up computations, increase defined batch_size or use a default value
#> 5 x 19 sparse Matrix of class "dgCMatrix"
#> [[ suppressing 19 column names ‘R’, ‘L’, ‘Y’ ... ]]
#> #> [1,] 2 9 4 1 8 5 10 2 2 4 16 29 4 11 9 2 16 3 14 #> [2,] 3 8 5 2 7 6 11 2 2 4 17 22 3 11 10 2 20 1 15 #> [3,] 3 8 5 2 7 6 11 2 2 4 17 22 3 11 10 2 20 1 15 #> [4,] 2 9 4 1 9 5 10 2 1 4 15 30 4 11 9 2 17 4 13 #> [5,] 3 8 5 2 7 6 11 2 2 4 17 22 3 11 10 2 20 1 15
# Counting 1-mers and 2-mers count_multimers( CsgA, k_vector = c(1, 2), batch_size = 1)
#> Single-threaded mode enabled. In order to speed up computations, increase defined batch_size or use a default value
#> 5 x 144 sparse Matrix of class "dgCMatrix"
#> [[ suppressing 144 column names ‘R’, ‘L’, ‘Y’ ... ]]
#> #> [1,] 2 9 4 1 8 5 10 2 2 4 16 29 4 11 9 2 16 3 14 1 2 1 1 1 1 2 1 1 1 1 1 3 1 2 #> [2,] 3 8 5 2 7 6 11 2 2 4 17 22 3 11 10 2 20 1 15 1 3 1 . . 3 1 1 1 2 5 2 3 . 2 #> [3,] 3 8 5 2 7 6 11 2 2 4 17 22 3 11 10 2 20 1 15 1 3 1 . . 3 1 1 1 2 5 2 3 . 2 #> [4,] 2 9 4 1 9 5 10 2 1 4 15 30 4 11 9 2 17 4 13 1 2 1 1 1 1 2 1 1 1 1 1 3 1 2 #> [5,] 3 8 5 2 7 6 11 2 2 4 17 22 3 11 10 2 20 1 15 1 3 1 . . 3 1 1 1 2 5 2 3 . 2 #> #> [1,] 1 3 1 3 1 2 7 1 1 1 1 3 1 1 2 2 1 1 12 3 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 #> [2,] . 2 . 2 1 2 3 . 1 2 . 3 1 . 3 2 2 1 6 4 2 3 1 2 1 . 1 . 1 1 . 1 . 1 1 2 . #> [3,] . 2 . 2 1 2 3 . 1 2 . 3 1 . 3 2 2 1 6 4 2 3 1 2 1 . 1 . 1 1 . 1 . 1 1 2 . #> [4,] 1 3 1 3 1 2 6 1 1 2 1 3 2 1 2 2 1 . 13 3 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 #> [5,] . 2 . 2 1 2 3 . 1 2 . 3 1 . 3 2 2 1 6 4 2 3 1 2 1 . 1 . 1 1 . 1 . 1 1 2 . #> #> [1,] 1 1 1 1 1 1 2 7 1 1 2 1 1 1 2 1 1 1 1 1 1 2 2 3 1 1 1 1 1 1 1 2 2 1 1 3 1 #> [2,] . 1 . 1 1 1 1 5 . . 2 . . 1 1 1 . . . 1 1 2 1 4 1 1 1 1 . 1 . 2 3 1 1 1 . #> [3,] . 1 . 1 1 1 1 5 . . 2 . . 1 1 1 . . . 1 1 2 1 4 1 1 1 1 . 1 . 2 3 1 1 1 . #> [4,] 1 1 . 1 1 1 1 7 1 1 2 1 1 1 2 1 . 1 1 1 1 2 2 3 1 . 1 1 1 1 1 1 2 1 1 3 1 #> [5,] . 1 . 1 1 1 1 5 . . 2 . . 1 1 1 . . . 1 1 2 1 4 1 1 1 1 . 1 . 2 3 1 1 1 . #> #> [1,] 1 1 2 1 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #> [2,] . 1 . 1 3 1 1 1 1 1 1 1 1 1 1 2 1 1 2 2 1 1 1 2 1 1 1 1 1 1 1 1 . . . . #> [3,] . 1 . 1 3 1 1 1 1 1 1 1 1 1 1 2 1 1 2 2 1 1 1 2 1 1 1 1 1 1 1 1 . . . . #> [4,] 1 1 2 1 2 . . . . . . . . . . . . . 1 . . . . . . . . . . . . . 1 1 1 1 #> [5,] . 1 . 1 3 1 1 1 1 1 1 1 1 1 1 2 1 1 2 2 1 1 1 2 1 1 1 1 1 1 1 1 . . . .