[Gtdb-commits] r54 - in pkg/gt.db: R data man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 1 22:34:01 CEST 2010


Author: dahinds
Date: 2010-06-01 22:33:59 +0200 (Tue, 01 Jun 2010)
New Revision: 54

Modified:
   pkg/gt.db/R/attr.R
   pkg/gt.db/R/sample.R
   pkg/gt.db/R/subject.R
   pkg/gt.db/data/hapmap.rda
   pkg/gt.db/man/hapmap.Rd
Log:
- improved parsing of levels for factors
- fixed store.*.data() to handle all-null columns
- update to HapMap subject table for phase 3 release 3



Modified: pkg/gt.db/R/attr.R
===================================================================
--- pkg/gt.db/R/attr.R	2010-05-27 22:05:31 UTC (rev 53)
+++ pkg/gt.db/R/attr.R	2010-06-01 20:33:59 UTC (rev 54)
@@ -72,7 +72,8 @@
         } else if (dt == 'boolean') {
             data[,n] <- as.logical(as.numeric(data[,n]))
         } else if (dt == 'factor') {
-            lv <- eval(parse(text=paste('c(', info[n,'levels'], ')')))
+            lv <- sub("^'(.*)'$", "\\1", info[n,"levels"])
+            lv <- strsplit(lv, "','")[[1]]
             data[,n] <- factor(data[,n], levels=lv)
         }
     }

Modified: pkg/gt.db/R/sample.R
===================================================================
--- pkg/gt.db/R/sample.R	2010-05-27 22:05:31 UTC (rev 53)
+++ pkg/gt.db/R/sample.R	2010-06-01 20:33:59 UTC (rev 54)
@@ -148,6 +148,7 @@
     insert.column <- function(attr.id, col)
     {
         w <- !is.na(col)
+        if (!any(w)) return(0)
         sql.exec(gt.db::.gt.db, sql, samp.id[w], attr.id, col[w])
     }
     mapply(insert.column, attr.id, data)

Modified: pkg/gt.db/R/subject.R
===================================================================
--- pkg/gt.db/R/subject.R	2010-05-27 22:05:31 UTC (rev 53)
+++ pkg/gt.db/R/subject.R	2010-06-01 20:33:59 UTC (rev 54)
@@ -103,6 +103,7 @@
     insert.column <- function(attr.id, col)
     {
         w <- !is.na(col)
+        if (!any(w)) return(0)
         sql.exec(gt.db::.gt.db, sql, subj.id[w], attr.id, col[w])
     }
     mapply(insert.column, attr.id, data)

Modified: pkg/gt.db/data/hapmap.rda
===================================================================
(Binary files differ)

Modified: pkg/gt.db/man/hapmap.Rd
===================================================================
--- pkg/gt.db/man/hapmap.Rd	2010-05-27 22:05:31 UTC (rev 53)
+++ pkg/gt.db/man/hapmap.Rd	2010-06-01 20:33:59 UTC (rev 54)
@@ -22,8 +22,9 @@
 \title{Subject Data from the International HapMap Project}
 \description{
   \code{hapmap.subjects} describes sample plate and panel membership,
-  and parent/child relationships, for the 1301 individuals genotyped in
-  the Phase II and Phase III HapMap Projects.
+  and parent/child relationships, for 1506 individuals genotyped in the
+  Phase II and Phase III HapMap Projects.  The table includes the union
+  of samples reported in phase 3 releases 2 and 3.
 }
 \usage{data(hapmap)}
 \source{The International HapMap Project}



More information about the Gtdb-commits mailing list