[adegenet-commits] r748 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 26 14:29:08 CET 2010


Author: jombart
Date: 2010-12-26 14:29:07 +0100 (Sun, 26 Dec 2010)
New Revision: 748

Modified:
   pkg/R/SNPbin.R
Log:
minor correction to initialization of SNPbin objects.


Modified: pkg/R/SNPbin.R
===================================================================
--- pkg/R/SNPbin.R	2010-12-25 00:58:28 UTC (rev 747)
+++ pkg/R/SNPbin.R	2010-12-26 13:29:07 UTC (rev 748)
@@ -14,7 +14,7 @@
                                   NA.posi = "integer",
                                   label = "charOrNULL",
                                   ploidy = "integer"),
-         prototype(snp = list(0), n.loc = integer(0), label = NULL, ploidy = 1L))
+         prototype(snp = list(), n.loc = integer(0), label = NULL, ploidy = 1L))
 
 
 
@@ -22,12 +22,12 @@
 ###############
 ## genlight class
 ###############
-setClass("genlight", representation(tab = "list",
+setClass("genlight", representation(gen = "list",
                                     n.loc = "integer",
                                     ind.names = "charOrNULL",
                                     loc.names = "charOrNULL",
                                     ploidy = "integer"),
-         prototype(tab = list(0), n.loc = integer(0), ind.names = NULL, loc.names = NULL, ploidy = 1L))
+         prototype(gen = list(0), n.loc = integer(0), ind.names = NULL, loc.names = NULL, ploidy = 1L))
 
 
 
@@ -52,7 +52,7 @@
 
 
     ## handle snp data ##
-    if(!is.null(input$snp)){
+    if(!is.null(input$snp) && length(input$snp)>1){
         ## a vector of raw is provided
         if(is.raw(input$snp)){
             x at snp <-list(input$snp)
@@ -133,13 +133,32 @@
 
 
 
+####################
+## genlight constructor
+####################
+setMethod("initialize", "genlight", function(.Object, ...) {
+    x <- .Object
+    input <- list(...)
+    if(length(input)==1) names(input) <- "gen"
 
 
+    ## handle gen (SNPbin list) ##
+    if(!is.null(input$gen)){
 
+    }
 
 
+}) # end genlight constructor
 
 
+
+
+
+
+
+
+
+
 ################################
 ##
 ##   METHODS AND ACCESSORS



More information about the adegenet-commits mailing list