Revision: 6051
http://sashimi.svn.sourceforge.net/sashimi/?rev=6051&view=rev
Author: real_procopio
Date: 2013-02-01 01:36:09 +0000 (Fri, 01 Feb 2013)
Log Message:
-----------
[comet-fastadb] Implement on-page error reporting via javascript; Forget specified enzyme if not recognized; Removed a bare pointer and redundant logic in NXST check (courtesy of http://www.viva64.com/en/b/0156/ )
Modified Paths:
--------------
branches/4-6/trans_proteomic_pipeline/src/Visualization/Comet/comet-fastadb/comet-fastadb1.cxx
Modified: branches/4-6/trans_proteomic_pipeline/src/Visualization/Comet/comet-fastadb/comet-fastadb1.cxx
===================================================================
--- branches/4-6/trans_proteomic_pipeline/src/Visualization/Comet/comet-fastadb/comet-fastadb1.cxx 2013-01-31 23:06:00 UTC (rev 6050)
+++ branches/4-6/trans_proteomic_pipeline/src/Visualization/Comet/comet-fastadb/comet-fastadb1.cxx 2013-02-01 01:36:09 UTC (rev 6051)
@@ -69,7 +69,7 @@
double dMaxMass;
char szDbFile[SIZE_FILE]; /* database filename */
- char szEnzyme[SIZE_FILE]; /* database filename */
+ char szEnzyme[SIZE_FILE]; /* enzyme */
char szPeptide[MAX_NUM_PEPTIDES][MAX_PEPTIDE_LEN]; /* can take up to MAX_PEPTIDE number of peptides */
char szReference[MAX_NUM_REFERENCES][MAX_HEADER_LEN]; /* sequence reference */
char cPepMatched[MAX_NUM_PEPTIDES];
@@ -120,7 +120,6 @@
int *iLenSeq);
void prntMsg(const char *message);
-void closeMsgs(void);
void prntPageFooter(void);
#include "common/util.h"
@@ -219,7 +218,7 @@
printf(" }\n");
printf("</style>\n");
- // javascript (might use later...)
+ // javascript
printf("<script language=\"JavaScript\">\n");
printf(" function showdiv(div_id,nothidden){\n");
printf(" if (document.getElementById(div_id).className == nothidden) {\n");
@@ -250,9 +249,9 @@
enzyme_spec = new ProteolyticEnzymeFactory();
enzyme_digest = enzyme_spec->getProteolyticEnzyme(pOptions.szEnzyme);
if(enzyme_digest == NULL) {
- sprintf(tmpMsg,"Warning: no enzyme information for <b>%s</b>. Ignoring enzyme.\n", pOptions.szEnzyme);
+ sprintf(tmpMsg,"Warning: no enzyme information for <b>%s</b>. Ignoring enzyme.", pOptions.szEnzyme);
prntMsg(tmpMsg);
- closeMsgs();
+ pOptions.szEnzyme[0] = 0;
}
}
@@ -260,7 +259,7 @@
if (strlen(pOptions.szDbFile) == 0)
{
- prntMsg(" Error - no database file specified.\n");
+ prntMsg(" Error - no database file specified.");
prntPageFooter();
exit(EXIT_FAILURE);
}
@@ -273,7 +272,7 @@
sprintf(Cometlinksfile, "%s%s", COMETLINKSDIR, COMETLINKSFILE);
if ((fpdb = fopen(Cometlinksfile, "r")) == NULL)
{
- sprintf(tmpMsg," Error - cannot open %s%s\n", COMETLINKSDIR, COMETLINKSFILE);
+ sprintf(tmpMsg," Error - cannot open <b.%s%s</b>", COMETLINKSDIR, COMETLINKSFILE);
prntMsg(tmpMsg);
prntPageFooter();
exit(EXIT_FAILURE);
@@ -309,7 +308,7 @@
if ((fpdb = fopen(pOptions.szDbFile, "r")) == NULL)
{
- sprintf(tmpMsg, " Error - cannot open %s (%s)\n", pOptions.szDbFile, strerror(errno));
+ sprintf(tmpMsg, " Error - cannot open <b>%s</b> (%s)", pOptions.szDbFile, strerror(errno));
prntMsg(tmpMsg);
prntPageFooter();
exit(EXIT_FAILURE);
@@ -339,7 +338,7 @@
SEARCH_PEPTIDE_HEADER(fpdb, szDbFile);
else
{
- prntMsg(" Error - enter references and/or peptides on link with Ref= & Pep=\n");
+ prntMsg(" Error - enter references and/or peptides on link with Ref= & Pep=");
prntPageFooter();
exit(EXIT_FAILURE);
}
@@ -351,7 +350,10 @@
for (i = 0; i < pOptions.iNumReferences; i++)
{
if (pOptions.cRefMatched[i] == 0)
- printf("Unmatched ref: %s<BR>\n", pOptions.szReference[i]);
+ {
+ sprintf(tmpMsg, "Unmatched ref: <b>%s</b>", pOptions.szReference[i]);
+ prntMsg(tmpMsg);
+ }
}
}
@@ -360,7 +362,10 @@
for (i = 0; i < pOptions.iNumPeptides; i++)
{
if (pOptions.cPepMatched[i] == 0)
- printf("Unmatched pep: %s<BR>\n", pOptions.szPeptide[i]);
+ {
+ sprintf(tmpMsg, "Unmatched pep: <b>%s</b>", pOptions.szPeptide[i]);
+ prntMsg(tmpMsg);
+ }
}
}
@@ -1387,7 +1392,7 @@
char szCommand[SIZE_BUF];
sprintf(szCommand, "cygpath -w '%s'", pOptions.szDbFile);
if((fp = popen(szCommand, "r")) == NULL) {
- prntMsg("cygpath error, exiting\n");
+ prntMsg("cygpath error, exiting");
prntPageFooter();
exit(1);
}
@@ -1699,9 +1704,9 @@
if ((fp = FILE_mkstemp(szOutFile)) == NULL)
{
- sprintf(tmpMsg," Error - cannot write to temp file %s<BR>\n", szOutFile);
+ sprintf(tmpMsg," Error - cannot write to temp file <b>%s</b>", szOutFile);
prntMsg(tmpMsg);
- prntMsg(" Skipping digesting protein.\n");
+ prntMsg(" Skipping digesting protein.");
prntPageFooter();
exit(EXIT_FAILURE);
}
@@ -1807,9 +1812,9 @@
if ((fp = fopen(szOutFile, "r")) == NULL)
{
- sprintf(tmpMsg," Error - cannot read file %s<BR>\n", szOutFile);
+ sprintf(tmpMsg," Error - cannot read file <b>%s</b>", szOutFile);
prntMsg(tmpMsg);
- prntMsg(" Skipping digesting protein.\n");
+ prntMsg(" Skipping digesting protein.");
prntPageFooter();
exit(EXIT_FAILURE);
}
@@ -1895,8 +1900,7 @@
if (pOptions.bMarkNXST
&& szPeptide[i] == 'N'
&& szPeptide[i + 1] != 'P'
- && (szPeptide[i + 2] == 'S' || szPeptide[i + 2] == 'T')
- && szPeptide[i + 1] != 'P')
+ && (szPeptide[i + 2] == 'S' || szPeptide[i + 2] == 'T'))
{
printf("<font class=\"glyco\">%c%c%c</font>",
szPeptide[i], szPeptide[i + 1], szPeptide[i + 2]);
@@ -2227,8 +2231,6 @@
*iLenSeq += 1;
}
- *iLenSeq;
-
} /*TRANSLATE*/
@@ -2243,33 +2245,29 @@
printf("<table cellspacing=\"0\">\n");
printf("<tbody>\n<tr>\n");
printf("<td class=\"messages_h\"> Messages </td>\n");
+ printf("<td align=\"left\"> <u><a onclick=\"showdiv('msgs','messages')\">[ Show | Hide ]</a></u></td>\n");
printf("</tr></tbody>\n</table>\n");
printf("<div id=\"msgs\" class=\"messages\">\n");
+ printf("</div>\n<br/>\n");
inMsgPane = 1;
}
+ printf("<SCRIPT LANGUAGE=\"JavaScript\" TYPE=\"text/javascript\">\n");
+ printf("document.getElementById(\"msgs\").innerHTML += ");
+
if (strlen(message) != 0)
- printf("<li>%s</li>\n",message);
+ printf("\"<li>%s</li>\";\n",message);
else
- printf("<br/><br/>\n");
+ printf("\"<br/><br/>\";\n");
+ printf("</SCRIPT>\n");
+
return;
} /* prntMsg */
-void closeMsgs(void)
-{
- if (inMsgPane) {
- printf("</div>\n<br/>\n\n");
- inMsgPane = 0;
- }
- return;
-} /* closeMsgs */
void prntPageFooter(void)
{
- if (inMsgPane)
- closeMsgs();
-
printf("<!-- page footer -->\n");
printf("<hr noshade/>\n");
printf("<h6>%s by J.Eng (c) ISB 2001<br/>\n", TITLE);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|