Author: moeller
Date: 2012-08-03 22:50:17 +0000 (Fri, 03 Aug 2012)
New Revision: 11985

Added:
   trunk/packages/psipred/trunk/debian/patches/error_messages.patch
   trunk/packages/psipred/trunk/debian/psipred-data.links
Removed:
   trunk/packages/psipred/trunk/debian/psipred.links
Modified:
   trunk/packages/psipred/trunk/debian/README.source
   trunk/packages/psipred/trunk/debian/copyright
   trunk/packages/psipred/trunk/debian/patches/series
Log:
I-TASSER invokes psipred with its weights.dat4 file, which
throughs a format error. Now it throughs a more informative
error message. Sent upstream.
Added links to render /usr/share/psipred and /usr/lib/psipred
equal.


Modified: trunk/packages/psipred/trunk/debian/README.source
===================================================================
--- trunk/packages/psipred/trunk/debian/README.source   2012-08-03 15:18:05 UTC 
(rev 11984)
+++ trunk/packages/psipred/trunk/debian/README.source   2012-08-03 22:50:17 UTC 
(rev 11985)
@@ -10,4 +10,14 @@
 psipred/bin/psipred
 psipred/bin/pfilt
 
-Patches introduce a toplevel Makefile and adjust paths in the tcsh script.
+Patches:
+
+    Makefile.patch
+       introduce a toplevel Makefile
+
+    runpsipred.patch
+       adjust paths in the tcsh script.
+
+    error_messages.patch
+       extra effort was invested to improve error messages on files
+       that could not be opened.

Modified: trunk/packages/psipred/trunk/debian/copyright
===================================================================
--- trunk/packages/psipred/trunk/debian/copyright       2012-08-03 15:18:05 UTC 
(rev 11984)
+++ trunk/packages/psipred/trunk/debian/copyright       2012-08-03 22:50:17 UTC 
(rev 11985)
@@ -3,7 +3,7 @@
 Source: http://bioinfadmin.cs.ucl.ac.uk/downloads/psipred/
 
 Files: *
-Copyright: 1995-2012 David T. Jones, UCL, London
+Copyright: 1995-2012 David T. Jones, UCL, London <[email protected]>
 License: custom
  PLEASE READ THE FOLLOWING LICENSE AGREEMENT. BY USING THE PROGRAM YOU ARE
  ACKNOWLEDGING THE FACT THAT YOU AGREE TO THE TERMS OUTLINED IN THIS

Added: trunk/packages/psipred/trunk/debian/patches/error_messages.patch
===================================================================
--- trunk/packages/psipred/trunk/debian/patches/error_messages.patch            
                (rev 0)
+++ trunk/packages/psipred/trunk/debian/patches/error_messages.patch    
2012-08-03 22:50:17 UTC (rev 11985)
@@ -0,0 +1,230 @@
+Index: psipred-3.3/src/sspred_avpred.c
+===================================================================
+--- psipred-3.3.orig/src/sspred_avpred.c       2012-05-30 03:04:45.000000000 
+0200
++++ psipred-3.3/src/sspred_avpred.c    2012-08-04 00:30:12.877787305 +0200
+@@ -11,6 +11,7 @@
+ #include <math.h>
+ #include <ctype.h>
+ #include <time.h>
++#include <errno.h>
+ 
+ #include "ssdefs.h"
+ #include "sspred_net.h"
+@@ -78,14 +79,28 @@
+     double          t, chksum = 0.0;
+     FILE           *ifp;
+ 
+-    if (!(ifp = fopen(fname, "r")))
++    if (!(ifp = fopen(fname, "r"))) {
++        fprintf(stderr,"Failed to open file '%s'.\n",fname);
+       fail("Cannot open weight file!\n");
++    }
+ 
+     /* Load input units to hidden layer weights */
+     for (i = NUM_IN; i < NUM_IN + NUM_HID; i++)
+       for (j = fwt_to[i]; j < lwt_to[i]; j++)
+       {
+-          fscanf(ifp, "%lf", &t);
++          errno=0;
++          int n=fscanf(ifp, "%lf", &t);
++          if (n != 1) {
++                fprintf(stderr,"avpred: Problem while parsing hidden layer 
weights of '%s' with %d<=i=%d<%d, %d<=j=%d<%d.\n",
++                             
fname,NUM_IN,i,NUM_IN+NUM+HID,fwt_to[i],j,lwt_to[i]);
++                if (0==errno) {
++                     perror("fscanf");
++                }
++                else {
++                     fprintf(stderr,"No matching characters while parsing 
'%s'. ",fname);
++                }
++              fail("Weight file read error!");
++          }
+           weight[i][j] = t;
+           chksum += t*t;
+       }
+@@ -94,7 +109,17 @@
+     for (i = NUM_IN + NUM_HID; i < TOTAL; i++)
+       for (j = fwt_to[i]; j < lwt_to[i]; j++)
+       {
+-          fscanf(ifp, "%lf", &t);
++          int n=fscanf(ifp, "%lf", &t);
++          if (n != 1) {
++                fprintf(stderr,"Problem while parsing hidden layer to output 
unit weights of s '%s' with i=%d,j=%d.\n",fname,i,j);
++                if (0==errno) {
++                     perror("fscanf");
++                }
++                else {
++                     fprintf(stderr,"No matching characters while parsing 
'%s'. ",fname);
++                }
++              fail("Weight file read error!");
++          }
+           weight[i][j] = t;
+           chksum += t*t;
+       }
+@@ -102,14 +127,38 @@
+     /* Load bias weights */
+     for (j = NUM_IN; j < TOTAL; j++)
+     {
+-      fscanf(ifp, "%lf", &t);
++      int n=fscanf(ifp, "%lf", &t);
++      if (n != 1) {
++            fprintf(stderr,"Problem while parsing bias weights of s '%s' with 
j=%d.\n",fname,j);
++            if (0==errno) {
++                 perror("fscanf");
++            }
++            else {
++                 fprintf(stderr,"No matching characters while parsing '%s'. 
",fname);
++            }
++          fail("Weight file read error!");
++      }
+       bias[j] = t;
+       chksum += t*t;
+     }
+ 
+     /* Read expected checksum at end of file */
+-    if (fscanf(ifp, "%lf", &t) != 1 || ferror(ifp))
++    errno=0;
++    int m=fscanf(ifp, "%lf", &t);
++    if (m != 1 || ferror(ifp)) {
++        if (ferror(ifp)) {
++          fprintf(stderr,"Spotted error with file '%s'.\n",fname);
++      }
++      else {
++          if (0==errno) {
++               perror("fscanf");
++          }
++          else {
++               fprintf(stderr,"No matching characters while parsing '%s'. 
",fname);
++          }
++        }
+       fail("Weight file read error!");
++    }
+ 
+     fclose(ifp);
+ 
+Index: psipred-3.3/src/sspred_hmulti.c
+===================================================================
+--- psipred-3.3.orig/src/sspred_hmulti.c       2012-05-30 03:04:45.000000000 
+0200
++++ psipred-3.3/src/sspred_hmulti.c    2012-08-04 00:29:37.002269954 +0200
+@@ -11,6 +11,7 @@
+ #include <math.h>
+ #include <ctype.h>
+ #include <time.h>
++#include <errno.h>
+ 
+ #include "ssdefs.h"
+ #include "sspred_net2.h"
+@@ -81,14 +82,27 @@
+     double          t, chksum = 0.0;
+     FILE           *ifp;
+ 
+-    if (!(ifp = fopen(fname, "r")))
++    if (!(ifp = fopen(fname, "r"))) {
++      fprintf(stderr,"Failed to open file '%s'.\n",fname);
+       fail("Cannot open weight file!\n");
++    }
+ 
+     /* Load input units to hidden layer weights */
+     for (i = NUM_IN; i < NUM_IN + NUM_HID; i++)
+       for (j = fwt_to[i]; j < lwt_to[i]; j++)
+       {
+-          fscanf(ifp, "%lf", &t);
++          int n=fscanf(ifp, "%lf", &t);
++          if (n != 1) {
++                fprintf(stderr,"hmultic: Problem while parsing hidden layer 
weights of '%s' with %d<=i=%d<%d, %d<=j=%d<%d.\n",
++                             
fname,NUM_IN,i,NUM_IN+NUM+HID,fwt_to[i],j,lwt_to[i]);
++                if (0==errno) {
++                     perror("fscanf");
++                }
++                else {
++                     fprintf(stderr,"No matching characters while parsing 
'%s'. ",fname);
++                }
++              fail("Weight file read error!");
++          }
+           weight[i][j] = t;
+           chksum += t*t;
+       }
+@@ -97,7 +111,17 @@
+     for (i = NUM_IN + NUM_HID; i < TOTAL; i++)
+       for (j = fwt_to[i]; j < lwt_to[i]; j++)
+       {
+-          fscanf(ifp, "%lf", &t);
++          int n=fscanf(ifp, "%lf", &t);
++          if (n != 1) {
++                fprintf(stderr,"Problem while parsing hidden layer to output 
unit weights of s '%s' with i=%d,j=%d.\n",fname,i,j);
++                if (0==errno) {
++                     perror("fscanf");
++                }
++                else {
++                     fprintf(stderr,"No matching characters while parsing 
'%s'. ",fname);
++                }
++              fail("Weight file read error!");
++          }
+           weight[i][j] = t;
+           chksum += t*t;
+       }
+@@ -105,14 +129,38 @@
+     /* Load bias weights */
+     for (j = NUM_IN; j < TOTAL; j++)
+     {
+-      fscanf(ifp, "%lf", &t);
++      int n=fscanf(ifp, "%lf", &t);
++      if (n != 1) {
++            fprintf(stderr,"Problem while parsing bias weights of s '%s' with 
j=%d.\n",fname,j);
++            if (0==errno) {
++                 perror("fscanf");
++            }
++            else {
++                 fprintf(stderr,"No matching characters while parsing '%s'. 
",fname);
++            }
++          fail("Weight file read error!");
++      }
+       bias[j] = t;
+       chksum += t*t;
+     }
+ 
+     /* Read expected checksum at end of file */
+-    if (fscanf(ifp, "%lf", &t) != 1 || ferror(ifp))
+-      fail("Weight file read error!");
++    int m = fscanf(ifp, "%lf", &t);
++    if (m != 1 || ferror(ifp)) {
++        if (ferror(ifp)) {
++          fprintf(stderr,"Spotted error with file '%s'.\n",fname);
++      }
++      else {
++            fprintf(stderr,"Problem while parsing expected checksum at end of 
file '%s'.\n",fname);
++            if (0==errno)     {
++                perror("fscanf");
++            }
++            else {
++                fprintf(stderr,"No matching characters while parsing '%s'. 
",fname);
++            }
++          fail("Weight file read error!");
++      }
++    }
+ 
+     fclose(ifp);
+ 
+@@ -167,8 +215,10 @@
+     FILE *ofp;
+ 
+     ofp = fopen(outname, "w");
+-    if (!ofp)
++    if (!ofp) {
++      fprintf(stderr,"Failed to open file '%s'.\n",outname);
+       fail("Cannot open output file!");
++    }
+ 
+     fputs("# PSIPRED VFORMAT (PSIPRED V3.3)\n\n", ofp);
+     
+@@ -356,8 +406,10 @@
+     for (i=6; i<argc; i++)
+     {
+       ifp = fopen(argv[i], "r");
+-      if (!ifp)
++      if (!ifp) {
++            fprintf(stderr,"Failed to open file '%s'.\n",argv[i]);
+           fail("Cannot open input file!");
++      }
+       seqlen = getss(ifp);
+       fclose(ifp);
+     }

Modified: trunk/packages/psipred/trunk/debian/patches/series
===================================================================
--- trunk/packages/psipred/trunk/debian/patches/series  2012-08-03 15:18:05 UTC 
(rev 11984)
+++ trunk/packages/psipred/trunk/debian/patches/series  2012-08-03 22:50:17 UTC 
(rev 11985)
@@ -1,2 +1,3 @@
 runpsipred.patch
 Makefile.patch
+error_messages.patch

Copied: trunk/packages/psipred/trunk/debian/psipred-data.links (from rev 11983, 
trunk/packages/psipred/trunk/debian/psipred.links)
===================================================================
--- trunk/packages/psipred/trunk/debian/psipred-data.links                      
        (rev 0)
+++ trunk/packages/psipred/trunk/debian/psipred-data.links      2012-08-03 
22:50:17 UTC (rev 11985)
@@ -0,0 +1,2 @@
+usr/lib/psipred/bin    usr/share/psipred/bin
+usr/share/psipred/data usr/lib/psipred/data

Deleted: trunk/packages/psipred/trunk/debian/psipred.links
===================================================================
--- trunk/packages/psipred/trunk/debian/psipred.links   2012-08-03 15:18:05 UTC 
(rev 11984)
+++ trunk/packages/psipred/trunk/debian/psipred.links   2012-08-03 22:50:17 UTC 
(rev 11985)
@@ -1 +0,0 @@
-usr/lib/psipred/bin    usr/share/psipred/bin


_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to