[adegenet-commits] r874 - in pkg: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 24 11:00:42 CEST 2011


Author: jombart
Date: 2011-05-24 11:00:42 +0200 (Tue, 24 May 2011)
New Revision: 874

Modified:
   pkg/DESCRIPTION
   pkg/R/glHandle.R
Log:
Fixed glSim with LD structures.
Various fixes in cbind procedures - ploidy no longer lost.



Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2011-05-24 08:18:56 UTC (rev 873)
+++ pkg/DESCRIPTION	2011-05-24 09:00:42 UTC (rev 874)
@@ -7,7 +7,7 @@
   and contributed datasets from: Katayoun Moazami-Goudarzi, Denis Laloe,
   Dominique Pontier, Daniel Maillard, Francois Balloux
 Maintainer: Thibaut Jombart <t.jombart at imperial.ac.uk>
-Suggests: genetics, spdep, tripack, ape, pegas, graph, RBGL, seqinr, multicore
+Suggests: genetics, spdep, tripack, ape, pegas, seqinr, multicore
 Depends: methods, MASS, ade4
 Description: Classes and functions for genetic data analysis within the multivariate framework.
 Collate: classes.R basicMethods.R handling.R auxil.R setAs.R SNPbin.R glHandle.R glFunctions.R glSim.R find.clust.R hybridize.R scale.R fstat.R import.R seqTrack.R chooseCN.R genind2genpop.R loadingplot.R sequences.R gstat.randtest.R makefreq.R colorplot.R monmonier.R spca.R coords.monmonier.R haploGen.R old2new.R spca.rtests.R dapc.R haploPop.R PCtest.R dist.genpop.R Hs.R propShared.R export.R HWE.R propTyped.R inbreeding.R glPlot.R zzz.R

Modified: pkg/R/glHandle.R
===================================================================
--- pkg/R/glHandle.R	2011-05-24 08:18:56 UTC (rev 873)
+++ pkg/R/glHandle.R	2011-05-24 09:00:42 UTC (rev 874)
@@ -112,7 +112,12 @@
 
 
     if(checkPloidy && length(unique(sapply(myList, ploidy))) !=1 ) stop("objects have different ploidy levels")
-    x <- new("SNPbin", unlist(lapply(myList, as.integer)))
+    if(checkPloidy) {
+        ori.ploidy <- ploidy(myList[[1]])
+    } else {
+        ori.ploidy <- NULL
+    }
+    x <- new("SNPbin", unlist(lapply(myList, as.integer)), ploidy=ori.ploidy)
     return(x)
 } # end cbind.SNPbin
 ##})
@@ -151,6 +156,7 @@
     }
     temp <- as.matrix(as.data.frame(lapply(myList, ploidy)))
     if(any(apply(temp,1,function(r) length(unique(r)))>1)) stop("non-consistent ploidy across datasets")
+    ori.ploidy <- ploidy(myList[[1]])
 
 
     ## merge one individual at a time ##
@@ -166,6 +172,7 @@
     locNames(res) <- unlist(lapply(myList, locNames))
     alleles(res) <- unlist(lapply(myList, alleles))
     pop(res) <- pop(myList[[1]])
+    ploidy(res) <- ori.ploidy
 
     ## return object ##
     return(res)



More information about the adegenet-commits mailing list