[adegenet-commits] r775 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 24 18:55:06 CET 2011


Author: jombart
Date: 2011-01-24 18:55:06 +0100 (Mon, 24 Jan 2011)
New Revision: 775

Modified:
   pkg/R/SNPbin.R
   pkg/R/import.R
Log:
Fixes for checking >> allele vector.


Modified: pkg/R/SNPbin.R
===================================================================
--- pkg/R/SNPbin.R	2011-01-24 16:15:57 UTC (rev 774)
+++ pkg/R/SNPbin.R	2011-01-24 17:55:06 UTC (rev 775)
@@ -287,8 +287,9 @@
                 warning("Inconsistent length for loc.all - ignoring this argument.")
             } else {
                 ## check string consistency (format is e.g. "a/t")
-                if(any(grep("^[[:alpha:]]{1}/[[:alpha:]]{1}$", input$loc.all) != 1:nLoc(x at gen[[1]]))){
-                    input$loc.all <- gsub("[[:space:]]","", input$loc.all)
+                temp <- grep("^[[:alpha:]]{1}/[[:alpha:]]{1}$", input$loc.all)
+                if(any(! 1:nLoc(x at gen[[1]]) %in% temp)){
+                    ## input$loc.all <- gsub("[[:space:]]","", input$loc.all)
                     warning("Miss-formed strings in loc.all (must be e.g. 'c/g') - ignoring this argument.")
                 } else {
                     x at loc.all <- input$loc.all

Modified: pkg/R/import.R
===================================================================
--- pkg/R/import.R	2011-01-24 16:15:57 UTC (rev 774)
+++ pkg/R/import.R	2011-01-24 17:55:06 UTC (rev 775)
@@ -775,8 +775,9 @@
     txt <- scan(file,what="character",sep="\n",quiet=TRUE, skip=lines.to.skip, nmax=1)
 
     COUNT <- 0 # used to count the nb of genotypes read
-    
+
     while(length(grep(">", txt))>0){
+        COUNT <- COUNT + 1
         if(!quiet) {
             if(COUNT %% 10 == 0){
                 cat(COUNT)
@@ -784,7 +785,7 @@
                 cat(".")
             }
         }
-        
+
         indName <- gsub(">","", txt)
         indName <- gsub("(^[[:space:]]+)|([[:space:]]+$)", "", indName)
         temp <- strsplit(scan(file,what="character",sep="\n",quiet=TRUE, skip=lines.to.skip + 1, nmax=1), "")[[1]]



More information about the adegenet-commits mailing list