Browse code

commit of missing files

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

Ulrich Bodenhofer authored on 23/06/2016 13:34:29
Showing2 changed files

1 1
new file mode 100644
... ...
@@ -0,0 +1,31 @@
1
+#include <Rcpp.h>
2
+
3
+using namespace Rcpp;
4
+using namespace std;
5
+
6
+#include "SplitCharVector2Matrix.h"
7
+
8
+RcppExport SEXP SplitCharVector2Matrix(SEXP xR, SEXP replR)
9
+{
10
+    vector<string> x = as< vector<string> >(xR);
11
+    string repl = as< string >(replR);
12
+    int i, j, n = x.size(), m = x[0].length();
13
+    CharacterMatrix out(n, m);
14
+
15
+    for (i = 0; i < n; i++)
16
+    {
17
+	m = x[i].length();
18
+	
19
+	for (j = 0; j < m; j++)
20
+	{
21
+	    string tmp = x[i].substr(j, 1);
22
+
23
+	    if (tmp.compare("-") == 0)
24
+		tmp = repl;
25
+
26
+	    out(i, j) = tmp;
27
+	}
28
+    }
29
+
30
+    return(out);
31
+}
0 32
new file mode 100644
... ...
@@ -0,0 +1,11 @@
1
+//
2
+// File SplitCharVector2Matrix.h defining prototypes for SplitCharVector2Matrix.cpp
3
+//
4
+
5
+#ifndef _SplitCharVector2Matrix_H_
6
+
7
+#define _SplitCharVector2Matrix_H_
8
+
9
+RcppExport SEXP SplitCharVector2Matrix(SEXP xR, SEXP replR);
10
+
11
+#endif