[Genabel-commits] r813 - in pkg/GenABEL: . R inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Dec 5 17:23:11 CET 2011
Author: yurii
Date: 2011-12-05 17:23:11 +0100 (Mon, 05 Dec 2011)
New Revision: 813
Added:
pkg/GenABEL/inst/unitTests/runit.sortmap.internal.R
Modified:
pkg/GenABEL/CHANGES.LOG
pkg/GenABEL/R/sortmap.internal.R
pkg/GenABEL/inst/unitTests/runit.merge.R
Log:
Addressed bug [#1673], added unit test runit.sortmap.internal.R/test.sortmap.internal.bug1673
Modified: pkg/GenABEL/CHANGES.LOG
===================================================================
--- pkg/GenABEL/CHANGES.LOG 2011-12-05 15:33:44 UTC (rev 812)
+++ pkg/GenABEL/CHANGES.LOG 2011-12-05 16:23:11 UTC (rev 813)
@@ -1,7 +1,13 @@
*** v. 1.7-0 (2011.11.15)
-Addressed bug [#1676], added unit test runit.merge.R/test.merge.bug1676
+Addressed bug [#1673] (bug in load.gwaa.data and export.merlin when
+sorting is enabled, filed in by Daniel Taliun), added unit test
+runit.sortmap.internal.R/test.sortmap.internal.bug1673
+Addressed bug [#1676] (regression in merge of gwaa.data, phenotypes
+don't get merged correctly; filed in by Lennart Karssen), added unit
+test runit.merge.R/test.merge.bug1676
+
Added 'KS' method to estimate lambda in 'estlambda'. Generates rather
good results (under null) and may be considered as default option in the future,
after testing under the alternative.
@@ -16,10 +22,11 @@
export.merlin, export.plink now runs much faster (exports on C++ code)
-Bug [#1641] reported by Karl Froner fixed. Now GenABEL
-deals with exceptional situation in merge.snp.data / monomorphic part;
-added case of no overlap in SNPs (skip monomorphic staff then). RUnit
-regression test runit.merge.R/test.merge.bug1641 added.
+Bug [#1641] (regression bug with merge.snp.data in version 1.6.9;
+filed in by Karl Froner) fixed. Now GenABEL deals with exceptional
+situation in merge.snp.data / monomorphic part; added case of no overlap
+in SNPs (skip monomorphic staff then). RUnit regression test
+runit.merge.R/test.merge.bug1641 added.
Modifications in 'estlambda': plot=FALSE by default, added option
to estimate Lambda with median method; added option 'filter' for
Modified: pkg/GenABEL/R/sortmap.internal.R
===================================================================
--- pkg/GenABEL/R/sortmap.internal.R 2011-12-05 15:33:44 UTC (rev 812)
+++ pkg/GenABEL/R/sortmap.internal.R 2011-12-05 16:23:11 UTC (rev 813)
@@ -1,16 +1,16 @@
"sortmap.internal" <-
-function(chrom,map,delta=1) {
+ function(chrom,map,delta=1) {
chnum <- chrom.char2num(chrom)
-
+
ix <- order(chnum,map)
-
+
map <- map[ix]
-
- off <- c(0,map[1:(length(map)-1)])
+
+ off <- c(0,map[1:(length(map)-1)])
off <- map - off
off[which(off<=0)] <- delta
cummap <- cumsum(off)
-
+
out <- list()
out$ix <- ix
out$cummap <- cummap
@@ -20,11 +20,15 @@
chrom.char2num <- function(chrom) {
chrom <- as.character(chrom)
- chdesU <- unique(chrom)
- chnumU <- suppressWarnings(as.numeric(chdesU))
- chCHU <- sort(chdesU[is.na(chnumU)])
- maxch <- max(chnumU,na.rm=T)
- j <- 1
+ chdesU <- unique(chrom)
+ chnumU <- suppressWarnings(as.numeric(chdesU))
+ chCHU <- sort(chdesU[is.na(chnumU)])
+ if (any(!is.na(chnumU))) {
+ maxch <- max(chnumU,na.rm=T)
+ } else {
+ maxch <- 0
+ }
+ j <- 1
for (i in chCHU) {
chrom[which(chrom==i)] <- as.character(maxch+j)
j <- j + 1
Modified: pkg/GenABEL/inst/unitTests/runit.merge.R
===================================================================
--- pkg/GenABEL/inst/unitTests/runit.merge.R 2011-12-05 15:33:44 UTC (rev 812)
+++ pkg/GenABEL/inst/unitTests/runit.merge.R 2011-12-05 16:23:11 UTC (rev 813)
@@ -39,4 +39,4 @@
phdata(xy)
checkIdentical(phdata(xy)[1:dim(phdata(x1))[1],],phdata(x1))
checkIdentical(phdata(xy)[(dim(phdata(x1))[1]+1):(dim(phdata(x1))[1]+dim(phdata(x2))[1]),],phdata(x2))
-}
\ No newline at end of file
+}
Added: pkg/GenABEL/inst/unitTests/runit.sortmap.internal.R
===================================================================
--- pkg/GenABEL/inst/unitTests/runit.sortmap.internal.R (rev 0)
+++ pkg/GenABEL/inst/unitTests/runit.sortmap.internal.R 2011-12-05 16:23:11 UTC (rev 813)
@@ -0,0 +1,39 @@
+### --- Test setup ---
+#
+# regression test
+#
+
+if(FALSE) {
+ ## Not really needed, but can be handy when writing tests
+ library(RUnit)
+ library(GenABEL)
+}
+
+### do not run
+#stop("SKIP THIS TEST")
+###
+
+### ---- common functions and data -----
+
+#source(paste("../inst/unitTests/shared_functions.R"))
+#source(paste(path,"/shared_functions.R",sep=""))
+
+### --- Test functions ---
+
+test.sortmap.internal.bug1673 <- function()
+{
+ source("../R/sortmap.internal.R")
+ nmrkInChr <- c(7,5,3)
+ chrLevels <- c("cH1","X","Y")
+ chroms <- mappos <- rep(NA,sum(nmrkInChr))
+ k <- 1
+ for (i in 1:length(nmrkInChr)) {
+ for (j in seq(nmrkInChr[i],1,-1)) {
+ chroms[k] <- chrLevels[i]
+ mappos[k] <- j
+ k <- k + 1
+ }
+ }
+ a <- sortmap.internal(chroms,mappos)
+ checkTrue( all(is.finite(a$chnum)) )
+}
Property changes on: pkg/GenABEL/inst/unitTests/runit.sortmap.internal.R
___________________________________________________________________
Added: svn:mime-type
+ text/plain
More information about the Genabel-commits
mailing list