~ubuntu-branches/ubuntu/maverick/ncbi-tools6/maverick

« back to all changes in this revision

Viewing changes to biostruc/cblast/cn3dutil.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-03-27 12:00:15 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050327120015-embhesp32nj73p9r
Tags: 6.1.20041020-3
* Fix FTBFS under GCC 4.0 caused by inconsistent use of "static" on
  functions.  (Closes: #295110.)
* Add a watch file, now that we can.  (Upstream's layout needs version=3.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*===========================================================================
 
2
*
 
3
*                            PUBLIC DOMAIN NOTICE
 
4
*               National Center for Biotechnology Information
 
5
*
 
6
*  This software/database is a "United States Government Work" under the
 
7
*  terms of the United States Copyright Act.  It was written as part of
 
8
*  the author's official duties as a United States Government employee and
 
9
*  thus cannot be copyrighted.  This software/database is freely available
 
10
*  to the public for use. The National Library of Medicine and the U.S.
 
11
*  Government have not placed any restriction on its use or reproduction.
 
12
*
 
13
*  Although all reasonable efforts have been taken to ensure the accuracy
 
14
*  and reliability of the software and data, the NLM and the U.S.
 
15
*  Government do not and cannot warrant the performance or results that
 
16
*  may be obtained by using this software or data. The NLM and the U.S.
 
17
*  Government disclaim all warranties, express or implied, including
 
18
*  warranties of performance, merchantability or fitness for any particular
 
19
*  purpose.
 
20
*
 
21
*  Please cite the author in any work or product based on this material.
 
22
*
 
23
* ===========================================================================
 
24
*
 
25
* File Name: cn3dutils.c 
 
26
*
 
27
* Author:  Yanli Wang
 
28
*
 
29
* Initial Version Creation Date: 8/12/2002
 
30
*
 
31
* File Description:
 
32
*         facility function for adding drawing-style and user annotations 
 
33
*
 
34
*
 
35
* Modifications:
 
36
* --------------------------------------------------------------------------
 
37
* $Log: cn3dutil.c,v $
 
38
* Revision 1.5  2002/12/12 15:59:45  ywang
 
39
* wording improvement
 
40
*
 
41
*
 
42
* ==========================================================================
 
43
*/
 
44
#include <ncbi.h>  /* the NCBI SDK header */
 
45
#include <asn.h>   /* the ASN.1 header */
 
46
#include <mmdbapi.h>   /* the MMDB-API header */
 
47
#include <sequtil.h>
 
48
#include <objsset.h>
 
49
#include <mmdbdata.h>
 
50
#include <mmdblocl.h>
 
51
#include <string.h>
 
52
#include <accentr.h>
 
53
#include <saledit.h>
 
54
#include <lsqfetch.h>
 
55
#include <objseq.h>
 
56
#include <asnseq.h>
 
57
#include <objmgr.h>
 
58
#include <sequtil.h>
 
59
#include <objmime.h>
 
60
#include <blast.h>
 
61
#include <www.h>
 
62
#include <accutils.h>
 
63
#include <netentr.h>
 
64
#include <cddutil.h>
 
65
#include <objcn3d.h>
 
66
/*-------- set cn3dcolor ---------*/
 
67
void SetCn3dColor(Cn3dColorPtr ccp, Int4 scale_factor, Int4 red, Int4 green, Int4 blue, Int4 alpha)
 
68
{
 
69
  ccp->scale_factor = scale_factor;
 
70
  ccp->red = red;
 
71
  ccp->green = green;
 
72
  ccp->blue = blue;
 
73
  ccp->alpha = alpha;
 
74
 
 
75
}
 
76
/*-------- get default style setting -----------*/
 
77
Cn3dStyleSettingsPtr GetDefaultCn3DStyleSettings()
 
78
{
 
79
  Cn3dStyleSettingsPtr      cssp = NULL;
 
80
  Cn3dBackboneStylePtr      cbsp = NULL;
 
81
  Cn3dGeneralStylePtr       cgsp = NULL;
 
82
  Cn3dColorPtr              ccp = NULL;
 
83
  Cn3dBackboneLabelStylePtr cblsp = NULL;
 
84
 
 
85
    cssp = Cn3dStyleSettingsNew();
 
86
    cssp->next = NULL;
 
87
    cssp->name = NULL;
 
88
 
 
89
    cbsp = Cn3dBackboneStyleNew();
 
90
      cbsp->type = Cn3d_backbone_type_trace;
 
91
/*    cbsp->style = Cn3d_drawing_style_tubes; */
 
92
      cbsp->style = Cn3d_drawing_style_wire;
 
93
/*    cbsp->color_scheme = Cn3d_color_scheme_weighted_variety;  */
 
94
      cbsp->color_scheme = Cn3d_color_scheme_identity; 
 
95
      ccp = Cn3dColorNew();
 
96
      SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
 
97
      cbsp->user_color = ccp;
 
98
    cssp->protein_backbone = cbsp;
 
99
 
 
100
    cbsp = Cn3dBackboneStyleNew();
 
101
      cbsp->type = Cn3d_backbone_type_trace;
 
102
/*    cbsp->style = Cn3d_drawing_style_tubes; */
 
103
      cbsp->style = Cn3d_drawing_style_wire;
 
104
      cbsp->color_scheme = Cn3d_color_scheme_molecule;
 
105
      ccp = Cn3dColorNew();
 
106
      SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
 
107
      cbsp->user_color = ccp;
 
108
    cssp->nucleotide_backbone = cbsp;
 
109
 
 
110
    cgsp = Cn3dGeneralStyleNew();
 
111
      cgsp->is_on = TRUE;
 
112
      cgsp->style = Cn3d_drawing_style_wire;
 
113
/*    cgsp->color_scheme = Cn3d_color_scheme_weighted_variety; */ 
 
114
      cgsp->color_scheme = Cn3d_color_scheme_identity; 
 
115
      ccp = Cn3dColorNew();
 
116
      SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);    
 
117
      cgsp->user_color = ccp;
 
118
    cssp->protein_sidechains = cgsp;
 
119
 
 
120
    cgsp = Cn3dGeneralStyleNew();
 
121
      cgsp->is_on = TRUE;
 
122
      cgsp->style = Cn3d_drawing_style_wire;
 
123
      cgsp->color_scheme = Cn3d_color_scheme_molecule;
 
124
      ccp = Cn3dColorNew();
 
125
      SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
 
126
      cgsp->user_color = ccp;
 
127
    cssp->nucleotide_sidechains = cgsp;
 
128
 
 
129
    cgsp = Cn3dGeneralStyleNew();
 
130
      cgsp->is_on = TRUE;
 
131
      cgsp->style = Cn3d_drawing_style_ball_and_stick;
 
132
      cgsp->color_scheme = Cn3d_color_scheme_element;
 
133
      ccp = Cn3dColorNew();
 
134
      SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
 
135
      cgsp->user_color = ccp;
 
136
    cssp->heterogens = cgsp;
 
137
 
 
138
    cgsp = Cn3dGeneralStyleNew();
 
139
      cgsp->is_on = FALSE;
 
140
      cgsp->style = Cn3d_drawing_style_ball_and_stick;
 
141
      cgsp->color_scheme = Cn3d_color_scheme_element;
 
142
      ccp = Cn3dColorNew();
 
143
      SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
 
144
      cgsp->user_color = ccp;
 
145
    cssp->solvents = cgsp;
 
146
 
 
147
    cgsp = Cn3dGeneralStyleNew();
 
148
      cgsp->is_on = TRUE;
 
149
      cgsp->style = Cn3d_drawing_style_tubes;
 
150
      cgsp->color_scheme = Cn3d_color_scheme_user_select;
 
151
      ccp = Cn3dColorNew();
 
152
      SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
 
153
      cgsp->user_color = ccp;
 
154
    cssp->connections = cgsp;
 
155
 
 
156
    cgsp = Cn3dGeneralStyleNew();
 
157
      cgsp->is_on = FALSE;
 
158
      cgsp->style = Cn3d_drawing_style_with_arrows;
 
159
      cgsp->color_scheme = Cn3d_color_scheme_object;
 
160
      ccp = Cn3dColorNew();
 
161
      SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
 
162
      cgsp->user_color = ccp;
 
163
    cssp->helix_objects = cgsp;
 
164
 
 
165
    cgsp = Cn3dGeneralStyleNew();
 
166
      cgsp->is_on = FALSE;
 
167
      cgsp->style = Cn3d_drawing_style_with_arrows;
 
168
      cgsp->color_scheme = Cn3d_color_scheme_object;
 
169
      ccp = Cn3dColorNew();
 
170
      SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
 
171
      cgsp->user_color = ccp;
 
172
    cssp->strand_objects = cgsp;
 
173
 
 
174
    cssp->virtual_disulfides_on = TRUE;
 
175
      ccp = Cn3dColorNew();
 
176
      SetCn3dColor(ccp, 10000, 9300, 5500, 500, 10000);
 
177
    cssp->virtual_disulfide_color = ccp;
 
178
    cssp->hydrogens_on = FALSE;
 
179
      ccp = Cn3dColorNew();
 
180
      SetCn3dColor(ccp, 10000, 0, 0, 0, 10000);
 
181
    cssp->background_color = ccp;
 
182
    cssp->scale_factor = 10000;
 
183
    cssp->space_fill_proportion = 10000;
 
184
    cssp->ball_radius = 4000;
 
185
    cssp->stick_radius = 2000;
 
186
    cssp->tube_radius = 3000;
 
187
    cssp->tube_worm_radius = 3000;
 
188
    cssp->helix_radius = 18000;
 
189
    cssp->strand_width = 20000;
 
190
    cssp->strand_thickness = 5000;
 
191
 
 
192
    cblsp = Cn3dBackboneLabelStyleNew();
 
193
      cblsp->spacing = 0;
 
194
      cblsp->type = Cn3d_backbone_label_style_type_three_letter;
 
195
      cblsp->number = Cn3d_backbone_label_style_number_sequential;
 
196
      cblsp->termini = FALSE;
 
197
      cblsp->white = TRUE;
 
198
    cssp->protein_labels = cblsp;
 
199
 
 
200
    cblsp = Cn3dBackboneLabelStyleNew();
 
201
      cblsp->spacing = 0;
 
202
      cblsp->type = Cn3d_backbone_label_style_type_three_letter;
 
203
      cblsp->number = Cn3d_backbone_label_style_number_sequential;
 
204
      cblsp->termini = FALSE;
 
205
      cblsp->white = TRUE;
 
206
    cssp->nucleotide_labels =cblsp;
 
207
    cssp->ion_labels = TRUE;
 
208
 
 
209
    return cssp;
 
210
}