 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
32 #define NTEMPATOM 6 // Number of atoms defined in template
33 #define DAXIS 2.303 // Distance between Ca and helical axis
34 #define HRISE 1.5 // Helical rise per residue
35 #define HANGLE 100 // Helical rotation per residue in degrees
41 {
"N", {1.378, -0.646, -0.926}},
42 {
"CA", {2.303, 0.000, 0.000}},
43 {
"C", {1.599, 0.860, 1.028}},
44 {
"O", {2.020, 1.002, 2.171}},
45 {
"CB", {3.260, 0.864, -0.824}},
46 {
"H", {1.279, -0.316, -1.865}}
71 char molname[8] =
"A";
72 char restype[8] =
"ALA";
83 cout <<
"Generating an aplha helix of length " <<
length << endl << endl;
85 for ( i=n=0; i<
length; i++ ) {
123 for ( mol = molgroup->
mol; mol; mol = mol->
next ) {
124 for ( res1 = mol->
res; res1 && res1->
num < helix_start; res1 = res1->
next ) ;
126 for ( res2 = res1; res2->
next && res2->
next->
num < helix_end; res2 = res2->
next ) ;
128 if ( res2->
next->
num == helix_end ) res2 = res2->
next;
155 cout <<
"Mol\tHelix\tFirst\tLast\tLength\tCenter\t\t\tAxis" << endl;
156 for ( mol = molgroup->
mol; mol; mol = mol->
next ) {
157 for ( i=1, sec = mol->
sec; sec; sec = sec->
next, i++ ) {
163 c[0] <<
tab << c[1] <<
tab << c[2] <<
tab <<
164 a[0] <<
tab << a[1] <<
tab << a[2] << endl;
186 for ( n=1, res = resfirst; res && res != reslast; res = res->
next ) n++;
187 for ( i=0, res = resfirst; res && i<n/2-1; res = res->
next ) i++;
189 for ( i=0; res && i<3; res = res->
next, i++ ) {
190 for ( atom = res->
atom; atom && strncmp(atom->
type,
"CA", 2); atom = atom->
next ) ;
197 cout <<
"Helical center: " << center <<
" (" << n/2 <<
")" << endl;
215 for ( nca=0, res = resfirst; res != reslast->
next; res = res->
next )
216 for ( atom = res->
atom; atom; atom = atom->
next )
217 if ( strncmp(atom->
type,
"CA", 2) == 0 )
218 ca[nca++] = atom->
coord;
220 for ( i=0; i<nca-3; i++ ) {
221 v1 = (ca[i] + ca[i+2]) - (ca[i+1] * 2);
222 v2 = (ca[i+1] + ca[i+3]) - (ca[i+2] * 2);
236 cout <<
"Helical center: " << va << endl;
237 cout <<
"Helical axis: " << vas << endl << endl;
252 cout <<
"Finding the helical axis:" << endl;
253 cout <<
"Molecule: " << mol->
id << endl;
263 for ( nca=0, res = mol->
res; res; res = res->
next )
264 for ( atom = res->
atom; atom; atom = atom->
next )
265 if ( strncmp(atom->
type,
"CA", 2) == 0 )
266 ca[nca++] = atom->
coord;
268 for ( i=0; i<nca-3; i++ ) {
269 v1 = (ca[i] + ca[i+2]) - (ca[i+1] * 2);
270 v2 = (ca[i+1] + ca[i+3]) - (ca[i+2] * 2);
276 d = ((va * 1.5) + (ca[i+1] - ca[i+2])) / (v2 - v1);
279 cout << va <<
" " << d << endl;
286 if (
isfinite(d[0]) && fabs(d[0]) > 0.5 ) {
290 if (
isfinite(d[1]) && fabs(d[1]) > 0.5 ) {
294 if (
isfinite(d[2]) && fabs(d[2]) > 0.5 ) {
304 cout <<
"Helical center: " << v1 << endl;
305 cout <<
"Helical axis: " << vas << endl;
306 cout <<
"Ca-axis distance: " << dca <<
" A" << endl << endl;
320 if ( t.
angle > 1e-20 )
325 for ( i=0, res = mol->
res; res && i<nca/2; res = res->next ) i++;
326 for ( atom = res->
atom; atom && strncmp(atom->
type,
"CA", 2); atom = atom->
next ) ;
354 v = (v *
DAXIS) + ca2;
362 double d, dmin = 1e30, angle;
364 for ( i=0; i<k; i++ ) {
366 angle = afac*a.
angle(ma[i]);
367 d = sqrt(d + angle*angle);
384 long i, j, x, y, z, nsec;
389 for ( nsec=0, mol = molgroup->
mol; mol; mol = mol->
next )
390 for ( sec = mol->
sec; sec; sec = sec->
next ) nsec++;
393 cerr <<
"Error: No helices found!" << endl;
401 for ( i=0, mol = molgroup->
mol; mol; mol = mol->
next ) {
402 for ( sec = mol->
sec; sec; sec = sec->
next, i++ ) {
408 molgroup->
box = molgroup->
max - molgroup->
min;
412 (
long) (molgroup->
box[0]/sampling+1),
413 (
long) (molgroup->
box[1]/sampling+1),
414 (
long) (molgroup->
box[2]/sampling+1), 1);
415 p->
sampling(sampling, sampling, sampling);
417 for ( i=0; i<nsec; i++ ) {
418 x = (long) ((c[i][0] - molgroup->
min[0])/p->
sampling(0)[0]);
419 y = (long) ((c[i][1] - molgroup->
min[1])/p->
sampling(0)[1]);
420 z = (long) ((c[i][2] - molgroup->
min[2])/p->
sampling(0)[2]);
421 j = p->
index(0, x, y, z, 0);
422 p->
set(j, (*p)[j] + 1);
431 long k = (long) pseg->
maximum();
440 for ( i=0; i<k; i++ ) n[k] = 0;
442 for ( i=z=0; z<pseg->
sizeZ(); z++ ) {
443 for ( y=0; y<pseg->
sizeY(); y++ ) {
444 for ( x=0; x<pseg->
sizeX(); x++, i++ ) {
445 if ( (*pseg)[i] > 0 ) {
446 j = (long)(*pseg)[i] - 1;
458 cout <<
"Consolidating a set of helices:" << endl;
459 cout <<
"Number of helix groups: " << k << endl;
462 for ( j=0; j<k; j++ )
463 if ( n[j] ) mc[j] /= n[j];
469 while ( d > 1e-10 ) {
471 for ( j=0; j<k; j++ ) {
477 for ( i=0; i<nsec; i++ ) {
481 min[j] = min[j].
min(c[i]);
482 max[j] = max[j].
max(c[i]);
487 cout <<
"Iteration " << it <<
":" << endl;
488 for ( j=0; j<k; j++ ) {
498 cout << j+1 <<
tab << n[j] <<
tab <<
499 mcn[j][0] <<
tab << mcn[j][1] <<
tab << mcn[j][2] <<
tab <<
500 man[j][0] <<
tab << man[j][1] <<
tab << man[j][2] << endl;
509 cout << it <<
tab << d << endl;
521 for ( j=0; j<k; j++ )
if ( n[j] ) {
526 view =
View(-ma[j][0], -ma[j][1], ma[j][2], 0);
528 newmol->
id[0] = molname;
529 if ( !molgroup->
mol ) molgroup->
mol = newmol;
530 else mol->
next = newmol;
533 if ( molname >
'Z' ) molname =
'A';
Bimage * regions(double threshold, int sign)
Segments an image into contiguous regions.
Bmolgroup * molgroup_init()
Initializes and allocates a new molecule group.
Batom * atom_add(Batom **atom, const char *type)
Adds an atom to a linked list.
Bresidue * residue_add(Bresidue **res, const char *type)
Adds a residue to a linked list.
int molgroup_kill(Bmolgroup *molgroup)
Destroys a molecule group.
void set(long j, double v)
Sets a single value at the given index.
int molgroup_find_helical_axes(Bmolgroup *molgroup)
Calculates the centers and orientations of all alpha helices.
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
Header file for functions for creating random images.
3x3 Matrix manipulation functions
double distance2(const Vector3 &v)
Vector3< double > vector3_random(const double min, const double max)
Generates a random vector within a defined cube.
double length(vector< T > v)
double distance(const Vector3 &v)
Header file for reading reflection files.
General image parameter class.
Vector3< double > point_on_helix_axis(Vector3< double > ca1, Vector3< double > ca2, Vector3< double > ca3)
Calculates a point on an alpha helix corresponding to a Ca atom.
Header file for image class.
Header file for general utilities.
ostream & tab(ostream &out)
long find_closest_mean(long k, Vector3< double > *mc, Vector3< double > *ma, Vector3< double > c, Vector3< double > a, double afac)
Vector3< double > mol_find_alpha_orientation(Bmolecule *mol, int set_std)
Calculates the orientation of an alpha helix.
int molecule_kill(Bmolecule *mol)
Destroys a molecule.
bool isfinite(complex< T > &value)
Header for functions to make and analyze alpha helices.
long index(long nx, long ny) const
double angle(Vector3< T2 > &v)
Bmolgroup * molgroup_consolidate_alpha(Bmolgroup *molgroup)
Cluster a set of alpha helices to consolidate helices.
Header file for generalized linked list functions.
Vector3< double > alpha_find_center(Bresidue *resfirst, Bresidue *reslast)
Calculates the center of an alpha helix.
void sampling(long nn, Vector3< double > u)
Bmolgroup * molgroup_generate_alpha_helix(int length)
Generates an alpha helix of the desired length.
Bmolecule * mol_generate_alpha_helix(int length)
Generates an alpha helix of the desired length.
int molgroup_set_alpha_helix(Bmolgroup *molgroup, int helix_start, int helix_end)
Sets a residue range to an alpha helix in all molecules.
Bmolecule * molecule_add(Bmolecule **mol, char *name)
Adds a molecule to a linked list.
struct AlphaTemplate alpha_template[]
Vector3 cross(const Vector3 &v)
Vector3< double > alpha_find_orientation(Bresidue *resfirst, Bresidue *reslast)
Calculates the orientation of an alpha helix.
Library routines used for atomic coordinates.