/*
* $Id: vastsrvDB.c,v 1.8 2003/01/31 16:11:44 chenj Exp $
*
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
* File Name: vastsrvDB.c --- The database version of vastsrv.c
*
* Author: Christopher Hogue, Tom Madej, Siqian He, Jie Chen
*
*
* $Log: vastsrvDB.c,v $
* Revision 1.8 2003/01/31 16:11:44 chenj
* set ODBCINI correctly
*
* Revision 1.7 2003/01/15 17:15:39 chenj
* delete all SelfNbr stuff
*
* Revision 1.6 2003/01/15 16:24:52 chenj
* Change some posting messages
*
* Revision 1.5 2003/01/14 21:15:19 chenj
* change VastToCn3d() to VastToCn3DAndAli()
*
*
*
* This file with others together produce graphical display of structure
* alignment.
*
*
* ===========================================================================
*
*/
/* Main program for VAST structure neighbor server. */
/* Use vastlocl.c instead of vastdtbs.c because it's faster to read in the
* existing BiostrucAnnotSet file than to load it from database.
*/
/* define DEBUG_1 1 */
#include "vastuti.h"
#define CPUTIME_MAX 120
#define DEFAULT_SUBSET_NUM NRBlast10e_40 /* the NR set BLAST 10e-40 */
#define DEFAULT_SORT_BY NRes /* Number of Aligned Residues */
#define NUM_HITS_PER_PAGE 60
#define DEFAULT_PAGE 1
#define DEF_ALL_NBR 1
#define SELECTED_NBR 0
#define VIEW_STR_SUBMIT 0
#define VIEW_ALI_SUBMIT 1
#define DEF_LIST_SUBMIT 2
#define FIND_SUBMIT 3
#define MAX_KEPT_NBR 30
#define DOMID_SIZE 7 /* used to be 6, as length of domId */
#define MaxVPP 150
#define HEADFILE "sshead.txt"
Char VSPATH[PATH_MAX];
static Char URLBase[PATH_MAX];
Char URLcgi[PATH_MAX];
Char DATApath[PATH_MAX];
static Char VASTpath[PATH_MAX];
Char ENTREZurl[PATH_MAX];
static Char DOCSUMurl[PATH_MAX];
Char MAILto[PATH_MAX];
Char CGIname[PATH_MAX];
Char MMDBCGIname[PATH_MAX];
static Char HELPname[PATH_MAX];
Char Database[PATH_MAX];
static Char DART[PATH_MAX];
static Char LOGIN[PATH_MAX];
static Char PASSWD[PATH_MAX];
static Char INITpath[PATH_MAX];
static Char LIBpath[PATH_MAX];
Char CDDurl[PATH_MAX];
Int4 aSdi = 0;
Uint1 numSubsets = 0;
SubsetNameData subsetNames[6];
Boolean SubsetInfoLoaded = FALSE;
Dart_Connect *dartcon;
extern BiostrucAnnotSetPtr LocalGetBiostrucAnnotSet(Int4 mmdbid, CharPtr JobID);
Boolean psok;
static Uint1 getSubsetNbr(Char *subname)
{
Uint1 i = 0;
if(! SubsetInfoLoaded) loadSubsetInfo();
for(i = 0; i < numSubsets; i++)
if(strcmp(subsetNames[i].subName,subname)==0)
return subsetNames[i].subId;
PrtMes(MAILto, "VASTSRV", "GetSubsetNumber_DB() failed.", NULL, FALSE);
} /* getSubsetNbr() */
static void
VastTableBegin (FILE *table, Int4 iMMDBid, Int4 iFSID, SortBy sortby,
SubSetID subsetnum, Int4 iKept, CharPtr NonNbr, VastPageDataPtr vpp,
Int4 numhitsdisplayed, Int4 numhits, Int4 numpages,
Int4 pagenum, char cTable, Int4 NbrFlag, CharPtr JobID, CharPtr pcPass)
{
Int4 domNo;
Char pdbId[5], chainLett;
/* J. Chen */
StrCut(pdbId, vpp[0].aDomName, 1, 4);
chainLett = vpp[0].aDomName[4];
domNo = (Int4) atol(vpp[0].aDomName+5);
fprintf(table, "Content-type: text/html\n\n");
WWWPrintFileData(HEADFILE, stdout);
fprintf(table, "
\n\n");
PrintQueryInfo(table, pdbId, chainLett, domNo, iMMDBid, JobID);
/* insert a blank row for spacing */
/* fprintf(table, "