Browse code

Reimport with .R suffix

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/seqTools@128658 bc3139a8-67e5-0310-9ffc-ced21a209358

Wolfgang Kaisers authored on 13/04/2017 15:56:15
Showing1 changed files

1 1
new file mode 100644
... ...
@@ -0,0 +1,53 @@
1
+
2
+## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ##
3
+##                                                                           ##
4
+##  Project   :   seqTools                                                   ##
5
+##  Created   :   26.August.2013                                             ##
6
+##  Author    :   W. Kaisers                                                 ##
7
+##  File      :   fastaFunctions.r                                           ##
8
+##  Content   :   Functions which work on fastq and fastq and write output   ##
9
+##                files: writeFai,  countFastaKmers                          ##
10
+##                                                                           ##
11
+## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ##
12
+
13
+writeFai <- function(infiles, outfiles)
14
+{
15
+    if(!is.character(infiles))
16
+        stop("infiles must be character.")
17
+    
18
+    if(!is.character(outfiles))
19
+        stop("outfiles must be character.")
20
+    
21
+    if(length(infiles) != length(outfiles))
22
+        stop("infiles and outfiles must have equal length.")
23
+    
24
+    if(any( !file.exists(infiles) ) )
25
+        stop("Some infile(s) do not exist!\n")
26
+    
27
+    .Call("write_fai", infiles, outfiles, PACKAGE = "seqTools")
28
+    message("[write_fai] done.\n")
29
+    
30
+    return(invisible())
31
+}
32
+
33
+
34
+countFastaKmers <- function(filenames, k=4)
35
+{
36
+    if(!is.character(filenames))
37
+        stop("filenames must be character.")
38
+    
39
+    if(!is.numeric(k))
40
+        stop("k must be numeric.")
41
+    k <- as.integer(k)
42
+    
43
+    if( (k < 0) || (k > max_k) )    
44
+        stop("k must be in range 0,    ... , ", max_k, ".")
45
+    
46
+    res <- .Call("count_fasta_Kmers", filenames, k, PACKAGE="seqTools")
47
+    
48
+    return(res)
49
+}
50
+
51
+## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ##
52
+## END OF FILE
53
+## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ##