kmer_strm: Counting kmer of nucleotide sequence

Description Usage Arguments Value Examples

View source: R/kmer_strm.R

Description

kmer counting from fastq or fasta format file and return kmer table

Usage

1
kmer_strm(x, k, n, resfmt)

Arguments

x

An input fastq file path or DNAStrinset object.

k

integer: Length of kmer

n

integer: chunk size for splitting fastq data. The default value is 1L for no splitting.

resfmt

character: "total" as total k-mer, or "pos" as k-mer contents at read position.

Value

kmer table or kmer count at position

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
# fastq which reads are same length
fq <- list.files(system.file("extdata/E-MTAB-1147", package = "ShortRead"), full.names = TRUE)

# k-mer table
kmer_tab <- rskoseq::kmer_strm(fq[1], 7)

# k-mer table with parallel processing
kmer_tab <- rskoseq::kmer_strm(fq[1], 7, 5000)

# k-mer contents at read position
kmer_content <- rskoseq::kmer_strm(fq[1], 7, 5000, "pos")

# A DNAStringset object as input which reads are different length
fa <- ShortRead::readFastq(fq[1]) %>%
  ShortRead::trimTails(., k = 2, a = "4", halfwidth = 2) %>%
  ShortRead::sread()
res <- rskoseq::kmer_strm(fa, 7, 5000)

## End(Not run)

shkonishi/rskoseq documentation built on April 18, 2021, 3:50 p.m.