[Seqinr-commits] r1778 - in pkg: . R src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed May 21 17:38:04 CEST 2014


Author: simonpenel
Date: 2014-05-21 17:38:04 +0200 (Wed, 21 May 2014)
New Revision: 1778

Modified:
   pkg/DESCRIPTION
   pkg/R/query.r
   pkg/src/alignment.c
Log:
Now the mase format is checked, thanks to Jan-Hendrik Troesemeier


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2014-01-30 14:39:20 UTC (rev 1777)
+++ pkg/DESCRIPTION	2014-05-21 15:38:04 UTC (rev 1778)
@@ -1,6 +1,6 @@
 Package: seqinr
-Version: 3.0-9
-Date: 2014-1-30
+Version: 3.0-10
+Date: 2014-5-21
 Title: Biological Sequences Retrieval and Analysis 
 Author: Delphine Charif and Jean R. Lobry and Anamaria Necsulea and Leonor Palmeira and Simon Penel and Guy Perriere
 Maintainer: Simon Penel <simon.penel at univ-lyon1.fr>

Modified: pkg/R/query.r
===================================================================
--- pkg/R/query.r	2014-01-30 14:39:20 UTC (rev 1777)
+++ pkg/R/query.r	2014-05-21 15:38:04 UTC (rev 1778)
@@ -50,10 +50,17 @@
   
   if(verbose) cat(paste("... answer from server is:", res, "\n"))
   if(length(res) == 0){
-    if(verbose) cat("... answer from server is empty!\n")
-    while(length(res) == 0){
-      if(verbose) cat("... reading again.\n")
-      res <- readLines(socket, n = 1)
+    if(verbose) cat("... answer from server is empty!\n")    
+    # Modif de Simon suite au mail de Augusto Ribas
+    maxIter <- 10
+    attemptNumber <- 0
+    while((length(res) == 0) & (attemptNumber < maxIter)) {
+      if(verbose) cat("... reading again (",attemptNumber,").\n")
+      res <- readLines(socket, n = 1) 
+      attemptNumber <- attemptNumber+1
+    }    
+    if(length(res) == 0){
+    stop(paste("Unable to get any answer from socket after ",attemptNumber , " trials."))
     }
   }
   #

Modified: pkg/src/alignment.c
===================================================================
--- pkg/src/alignment.c	2014-01-30 14:39:20 UTC (rev 1777)
+++ pkg/src/alignment.c	2014-05-21 15:38:04 UTC (rev 1778)
@@ -105,7 +105,6 @@
     error("Can't open file");
   }
   
-  
   c1 = 0;
   nb_seq = 0;
   lg = lgc = 0;
@@ -169,9 +168,14 @@
  while(fgets(string, MAXSTRING, fic) != NULL) {
    numline++;
    string[MAXSTRING] = 0;
+   if ((string[0] != ';') && (numline == 1))
+   	{
+	error("Not a MASE file"); /* check format, thanks to J.H. Troesemeier */
+	goto fini;
+	}
    
+   c2 = string[0];
    
-   c2 = string[0];
    if(string[0] == ';' && string[1] != ';') {
      strcat(aln[ii + 1].com, string);
         }
@@ -185,7 +189,8 @@
      if((int) strlen(string) >= (MAXMNMASE - 1)) {
        REprintf("Error. Maximum sequance name is   %d characters\n", MAXMNMASE);
        error("sequence name too long!");
-     }
+     } 
+     
      strcpy(aln[ii].mn, string);
      
      lg = 0;
@@ -233,7 +238,7 @@
  SET_ELEMENT(essai,2,listseq);
  SET_ELEMENT(essai,3,listcom);
  
-  
+ fini: 
  free_mase(aln,nb_seq);
  UNPROTECT(5);
  



More information about the Seqinr-commits mailing list