1 /*
2 * $Id: mmdbuti.hpp,v 1.1 2005/07/26 17:11:46 chenj Exp $
3 *
4 *
5 * ===========================================================================
6 *
7 *                            PUBLIC DOMAIN NOTICE
8 *               National Center for Biotechnology Information
9 *
10 *  This software/database is a "United States Government Work" under the
11 *  terms of the United States Copyright Act.  It was written as part of
12 *  the author's official duties as a United States Government employee and
13 *  thus cannot be copyrighted.  This software/database is freely available
14 *  to the public for use. The National Library of Medicine and the U.S.
15 *  Government have not placed any restriction on its use or reproduction.
16 *
17 *  Although all reasonable efforts have been taken to ensure the accuracy
18 *  and reliability of the software and data, the NLM and the U.S.
19 *  Government do not and cannot warrant the performance or results that
20 *  may be obtained by using this software or data. The NLM and the U.S.
21 *  Government disclaim all warranties, express or implied, including
22 *  warranties of performance, merchantability or fitness for any particular
23 *  purpose.
24 *
25 *  Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 *
30 * Author:  Jie Chen
31 *
32 *
33 * $Log: mmdbuti.hpp,v $
34 * Revision 1.1  2005/07/26 17:11:46  chenj
35 * Making linux VSMmdb.cgi
36 *
37 * Revision 1.3  2003/01/15 16:15:09  chenj
38 * change the definition of ChainScaleMapOrImg()
39 *
40 * Revision 1.2  2003/01/14 19:57:17  chenj
41 * Minor changes
42 *
43 * Revision 1.1.1.1  2002/12/04 21:12:08  chenj
44 * Imported sources
45 *
46 *
47 *
48 *===========================================================================
49 */
50 
51 #ifndef _MMDBUTI_H
52 #define _MMDBUTI_H
53 
54 #include <cgi/cgictx.hpp>
55 #include "hUtilib.hpp"
56 
57 #include <ncbi.h>
58 #include <mmdbdata.h>
59 #include <gifgen.h>
60 #include <mmdbapi.h>
61 
62 #define MAX_TBUFF    8192
63 #define ChainPerImg  10
64 
65 #define MaxSeqImgSize   700
66 #define GraphWidth      800
67 
68 #define ncycle 	10
69 
70 
71 using namespace ncbi;
72 using namespace std;
73 
74 class ImgInfo
75 {
76   public:
ImgInfo()77 		ImgInfo() {};
~ImgInfo()78 		~ImgInfo() {};
79 
80 		static 	unsigned 	id;
81 		static 	unsigned 	chbeg;
82 		static 	unsigned 	chend;
83 		static 	unsigned 	imgsize;
84 		static 	string 		subset;
85 		static 	bool 		ismap;
86 		static 	int		white;
87 		static 	int		black;
88 		static 	int		blue;
89 		static 	int		red;
90 		static 	int		gray;
91 		static 	int		maxseqlen;
92 		static 	double		pix_per_res;
93 		static 	vector<int> 	DartColr;
94 		static 	vector<int> 	Cn3DColr;
95 		static	unsigned 	prot_ch_cnt;
96 		static	unsigned	nucl_ch_cnt;
97 
98 };
99 
100 
101 class ImgConf
102 {
103   public:
ImgConf()104 		ImgConf() {};
~ImgConf()105 		~ImgConf() {};
106 
107 		static 	string 		VastUrl;
108 		static 	string 		VastCgi;
109 		static 	string 		CddUrl;
110         	static 	string 		CddCgi;
111         	static 	string 		EntrezUrl;
112         	static 	string 		EntrezCgi;
113 
114 };
115 
116 
117 
118 typedef struct  domainhead {
119 
120         unsigned short    colidx, thisdomain;
121 	unsigned	domCumid;
122         ResidueIntervalPntrPtr  ripp;
123         struct  domainhead * next;
124 
125 } IntervalHead;
126 
127 unsigned short ModelMapOrImg(gdImagePtr im, PMSD pmsd, IntervalHead **DomHead, unsigned *DomIdx, CCgiContext& ctx, bool VastLink);
128 
129 unsigned short ChainNameMapOrImg(gdImagePtr im, unsigned short x,
130 			unsigned short y, unsigned short protein);
131 
132 void DrawImg(CCgiContext& ctx);
133 
134 void ChainScaleMapOrImg(gdImagePtr im, unsigned short x, unsigned short y,
135 		PMMD pmmd, unsigned sdid, unsigned color, unsigned labelcol,
136 		CCgiContext& ctx, bool VastLink);
137 
138 
139 unsigned short ChainDomMapOrImg(gdImagePtr im, unsigned short  x,
140 		unsigned short  y, PMMD pmmd, unsigned * DomIdx,
141 		IntervalHead **DomHead, CCgiContext& ctx, bool VastLink);
142 
143 short MaxSeqLenProOrDRna(PMSD pmsd, unsigned short protein);
144 
145 PDNMM PdnmmforChainX(PDNMM pdnmm, unsigned short chainx);
146 
147 void GetDomFeaPtr(BiostrucPtr bsp, bool *hasDomain, BiostrucFeaturePtr *domain_bfp);
148 
149 unsigned short ChainCount(PMSD pmsd);
150 
151 void GroupingChains(PMSD pmsd);
152 
153 void CalDomIdx(PDNMM pdnmm, unsigned **DomIdx);
154 
155 void CheckDomColIdx(BiostrucFeaturePtr bfp, PDNMM pdnmm, IntervalHead **DomHead,
156 unsigned* DomIdx, bool hasDomain, bool forImg);
157 
158 
159 #endif
160