git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/affxparser@74592 bc3139a8-67e5-0310-9ffc-ced21a209358
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/affxparser@21818 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-#########################################################################/** |
|
1 |
+#########################################################################/-Rdoc TURNED OFF-** |
|
2 | 2 |
# @RdocFunction .assertMap |
3 | 3 |
# |
4 | 4 |
# @title "Validates a read or a write map" |
... | ... |
@@ -25,7 +25,7 @@ |
25 | 25 |
# @keyword "file" |
26 | 26 |
# @keyword "IO" |
27 | 27 |
# @keyword "internal" |
28 |
-#*/######################################################################### |
|
28 |
+#*-Rdoc TURNED OFF-/######################################################################### |
|
29 | 29 |
.assertMap <- function(map, nbrOfCells=length(map), ...) { |
30 | 30 |
n <- length(map); |
31 | 31 |
if (n != nbrOfCells) { |
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/affxparser@21794 bc3139a8-67e5-0310-9ffc-ced21a209358
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,64 @@ |
1 |
+#########################################################################/** |
|
2 |
+# @RdocFunction .assertMap |
|
3 |
+# |
|
4 |
+# @title "Validates a read or a write map" |
|
5 |
+# |
|
6 |
+# @synopsis |
|
7 |
+# |
|
8 |
+# \description{ |
|
9 |
+# @get "title". |
|
10 |
+# } |
|
11 |
+# |
|
12 |
+# \arguments{ |
|
13 |
+# \item{map}{An @integer @vector.} |
|
14 |
+# \item{nbrOfCells}{The number of cells on the array.} |
|
15 |
+# \item{...}{Not used.} |
|
16 |
+# } |
|
17 |
+# |
|
18 |
+# \value{ |
|
19 |
+# Returns (invisibly) the map as an @integer @vector, if it is a valid |
|
20 |
+# map, otherwise an error is thrown. |
|
21 |
+# } |
|
22 |
+# |
|
23 |
+# @author |
|
24 |
+# |
|
25 |
+# @keyword "file" |
|
26 |
+# @keyword "IO" |
|
27 |
+# @keyword "internal" |
|
28 |
+#*/######################################################################### |
|
29 |
+.assertMap <- function(map, nbrOfCells=length(map), ...) { |
|
30 |
+ n <- length(map); |
|
31 |
+ if (n != nbrOfCells) { |
|
32 |
+ stop("Argument 'map' is not a valid map. The number of elements does not match the number of cells on the array: ", n, " != ", nbrOfCells); |
|
33 |
+ } |
|
34 |
+ |
|
35 |
+ # Coerce to integers |
|
36 |
+ map <- as.integer(map); |
|
37 |
+ |
|
38 |
+ # Assert that there are no NAs |
|
39 |
+ r <- range(map); |
|
40 |
+ if (any(is.na(r))) { |
|
41 |
+ stop("Argument 'map' is not a valid map. It contains NA values."); |
|
42 |
+ } |
|
43 |
+ |
|
44 |
+ # Check range |
|
45 |
+ if (r[1] != 1 || r[2] != nbrOfCells) { |
|
46 |
+ stop("Argument 'map' is not a valid map. Its range is not [1,", |
|
47 |
+ nbrOfCells, "]: ", "[", r[1], ", ", r[2], "]"); |
|
48 |
+ } |
|
49 |
+ |
|
50 |
+ # Check that the map is bijective |
|
51 |
+# map2 <- invertMap(invertMap(map)); |
|
52 |
+# if (!identical(map, map2)) { |
|
53 |
+# stop("Argument 'map' is not a valid map. It is not bijective."); |
|
54 |
+# } |
|
55 |
+ |
|
56 |
+ invisible(map); |
|
57 |
+} # .assertMap() |
|
58 |
+ |
|
59 |
+ |
|
60 |
+############################################################################ |
|
61 |
+# HISTORY: |
|
62 |
+# 2007-01-04 |
|
63 |
+# o Created. |
|
64 |
+############################################################################ |