Last data update: 2014.03.03

R: countFastaKmers function: Counts DNA k-mers from (compressed)...
countFastaKmersR Documentation

countFastaKmers function: Counts DNA k-mers from (compressed) fasta files.

Description

Reads (compressed) fasta files and counts for DNA k-mers in the sequence.

Usage

countFastaKmers(filenames,k=4)

Arguments

filenames

character: Vector of fasta file names. Files can be gz compressed.

k

Length of counted DNA k-mers.

Details

Maximal allowed value for k is 12.

Value

matrix.

Note

The static size of the retured k-mer array is 4^k.

Author(s)

Wolfgang Kaisers

References

Cock PJA, Fields CJ, Goto N, Heuer ML, Rice PM The sanger FASTQ file format for sequences with quality scores and the Solexa/Illumina FASTQ variants. Nucleic Acids Research 2010 Vol.38 No.6 1767-177

Examples

basedir <- system.file("extdata", package="seqTools")
filename <- file.path(basedir,"small.fa")
## Not run: writeFai(filename, "small.fa.fai")
res <- countFastaKmers(filename, k=2)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(seqTools)
Loading required package: zlibbioc
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/seqTools/countFastaKmers.Rd_%03d_medium.png", width=480, height=480)
> ### Name: countFastaKmers
> ### Title: countFastaKmers function: Counts DNA k-mers from (compressed)
> ###   fasta files.
> ### Aliases: countFastaKmers
> ### Keywords: countFastaKmers kmer
> 
> ### ** Examples
> 
> basedir <- system.file("extdata", package="seqTools")
> filename <- file.path(basedir,"small.fa")
> ## Not run: writeFai(filename, "small.fa.fai")
> res <- countFastaKmers(filename, k=2)
[count_fasta_Kmers] Opened file '/home/ddbj/local/lib64/R/library/seqTools/extdata/small.fa'.
[count_fasta_Kmers] done.
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>