Browse code

o Now readCdfUnits(..., readDirections=TRUE) also return unit group directions.

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

Henrik Bengtsson authored on 04/01/2007 11:35:18
Showing 2 changed files

... ...
@@ -18,7 +18,8 @@
18 18
 #  \item{readBases}{If @TRUE, cell P and T bases are retrieved, otherwise not.}
19 19
 #  \item{readExpos}{If @TRUE, cell "expos" values are retrieved, otherwise not.}
20 20
 #  \item{readType}{If @TRUE, unit types are retrieved, otherwise not.}
21
-#  \item{readDirection}{If @TRUE, unit directions are retrieved, otherwise not.}
21
+#  \item{readDirection}{If @TRUE, unit \emph{and} group directions are
22
+#    retrieved, otherwise not.}
22 23
 #  \item{stratifyBy}{A @character string specifying which and how
23 24
 #    elements in group fields are returned.
24 25
 #    If \code{"nothing"}, elements are returned as is, i.e. as @vectors.
... ...
@@ -44,8 +45,13 @@
44 45
 #  @list structure with three components:
45 46
 #  \item{groups}{A @list with one component for each group 
46 47
 #   (also called block). The information on each group is a 
47
-#   @list with five components: \code{x}, \code{y}, 
48
-#   \code{pbase}, \code{tbase}, \code{expos}, and \code{indices}.}
48
+#   @list of up to seven components: \code{x}, \code{y}, 
49
+#   \code{pbase}, \code{tbase}, \code{expos}, \code{indices},
50
+#   and \code{direction}.
51
+#   All fields but the latter have the same number of values as 
52
+#   there are cells in the group.  The latter field has only
53
+#   one value indicating the direction for the whole group.
54
+#  }
49 55
 #  \item{type}{An @integer specifying the type of the
50 56
 #    unit, where 1 is "expression", 2 is "genotyping", 3 is "CustomSeq", 
51 57
 #    and 4 "tag".}
... ...
@@ -242,6 +248,8 @@ readCdfUnits <- function(filename, units=NULL, readXY=TRUE, readBases=TRUE, read
242 248
 
243 249
 ############################################################################
244 250
 # HISTORY:
251
+# 2006-12-30
252
+# o Now 'readDirection=TRUE' also return group directions.
245 253
 # 2006-03-28
246 254
 # o Unit indices are now one-based. /HB
247 255
 # o Renamed argument 'readCells' to 'readIndices'. /HB
... ...
@@ -1360,7 +1360,8 @@ extern "C" {
1360 1360
     PROTECT(unitNames = NEW_CHARACTER(nbrOfUnits));
1361 1361
 
1362 1362
     int nbrOfUnitElements = i_readGroups + i_readType + i_readDirection;
1363
-    int nbrOfGroupElements = 2*i_readXY + 2*i_readBases + i_readExpos + i_readIndices;
1363
+    int nbrOfGroupElements = 2*i_readXY + 2*i_readBases + i_readExpos 
1364
+                                          + i_readIndices + i_readDirection;
1364 1365
 
1365 1366
 
1366 1367
     /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
... ...
@@ -1392,6 +1393,10 @@ extern "C" {
1392 1393
       if (i_readExpos) {
1393 1394
         SET_STRING_ELT(cell_list_names, fieldIdx++, mkChar("expos"));
1394 1395
       }
1396
+
1397
+      if (i_readDirection) {
1398
+        SET_STRING_ELT(cell_list_names, fieldIdx++, mkChar("direction"));
1399
+      }
1395 1400
     }
1396 1401
 
1397 1402
 
... ...
@@ -1573,6 +1578,14 @@ extern "C" {
1573 1578
            * Assign field values
1574 1579
 					 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
1575 1580
           fieldIdx = 0;
1581
+
1582
+          if (i_readDirection) {
1583
+            PROTECT(tmp = allocVector(INTSXP, 1));
1584
+            INTEGER(tmp)[0] = group.GetDirection();
1585
+            UNPROTECT(1);
1586
+            SET_VECTOR_ELT(cell_list, fieldIdx++, tmp);
1587
+          }
1588
+
1576 1589
           /** do I have to make the attribute vector everytime? **/
1577 1590
           if (i_readXY) {
1578 1591
             SET_VECTOR_ELT(cell_list, fieldIdx++, xvals);
... ...
@@ -1750,6 +1763,9 @@ extern "C" {
1750 1763
 
1751 1764
 /***************************************************************************
1752 1765
  * HISTORY:
1766
+ * 2006-12-30
1767
+ * o Added group directions to R_affx_get_cdf_units() too.  That is the
1768
+ *   most important group element missing. /HB
1753 1769
  * 2006-08-28
1754 1770
  * o If a unit index is out of range, the error now show the invalid index.
1755 1771
  * 2006-04-02