[med-svn] [psipred] 03/15: 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.
Andreas Tille
tille at debian.org
Mon Dec 18 20:32:21 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository psipred.
commit 918f76a0e7788ae91069ef677ed3e2271446713c
Author: Steffen Moeller <moeller at debian.org>
Date: Fri Aug 3 22:50:17 2012 +0000
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.
---
debian/README.source | 12 +-
debian/copyright | 2 +-
debian/patches/error_messages.patch | 230 ++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
debian/psipred-data.links | 2 +
debian/psipred.links | 1 -
6 files changed, 245 insertions(+), 3 deletions(-)
diff --git a/debian/README.source b/debian/README.source
index 6baf28c..deba7da 100644
--- a/debian/README.source
+++ b/debian/README.source
@@ -10,4 +10,14 @@ psipred/bin/psipass2
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.
diff --git a/debian/copyright b/debian/copyright
index d168a30..c052657 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -3,7 +3,7 @@ Upstream-Name: psipred
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 <d.jones at cs.ucl.ac.uk>
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
diff --git a/debian/patches/error_messages.patch b/debian/patches/error_messages.patch
new file mode 100644
index 0000000..58097dd
--- /dev/null
+++ b/debian/patches/error_messages.patch
@@ -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);
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 02e8c91..7fad46d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
runpsipred.patch
Makefile.patch
+error_messages.patch
diff --git a/debian/psipred-data.links b/debian/psipred-data.links
new file mode 100644
index 0000000..8fddf6d
--- /dev/null
+++ b/debian/psipred-data.links
@@ -0,0 +1,2 @@
+usr/lib/psipred/bin usr/share/psipred/bin
+usr/share/psipred/data usr/lib/psipred/data
diff --git a/debian/psipred.links b/debian/psipred.links
deleted file mode 100644
index aa50d9a..0000000
--- a/debian/psipred.links
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/psipred/bin usr/share/psipred/bin
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/psipred.git
More information about the debian-med-commit
mailing list