[adegenet-commits] r275 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Apr 1 12:41:58 CEST 2009
Author: jombart
Date: 2009-04-01 12:41:58 +0200 (Wed, 01 Apr 2009)
New Revision: 275
Modified:
pkg/R/handling.R
Log:
Added locNames accessor
Modified: pkg/R/handling.R
===================================================================
--- pkg/R/handling.R 2009-04-01 10:34:24 UTC (rev 274)
+++ pkg/R/handling.R 2009-04-01 10:41:58 UTC (rev 275)
@@ -662,3 +662,39 @@
return(x)
})
+
+
+
+
+
+###########
+# locNames
+###########
+setGeneric("locNames", function(x,...){
+ standardGeneric("locNames")
+})
+
+
+
+setMethod("locNames","genind", function(x, withAlleles=FALSE, ...){
+ ## return simply locus names
+ if(x at type=="PA" | !withAlleles) return(x at loc.names)
+
+ ## return locus.allele
+ res <- rep(x at loc.names, x at loc.nall)
+ res <- paste(res,unlist(x at all.names),sep=".")
+ return(res)
+})
+
+
+
+setMethod("locNames","genpop", function(x, withAlleles=FALSE, ...){
+ ## return simply locus names
+ if(x at type=="PA" | !withAlleles) return(x at loc.names)
+
+ ## return locus.allele
+ res <- rep(x at loc.names, x at loc.nall)
+ res <- paste(res,unlist(x at all.names),sep=".")
+ return(res)
+})
+
More information about the adegenet-commits
mailing list