1
/* Copyright (C) 2000 Damir Zucic */
3
/*=============================================================================
8
Execute scale command: change the hydrophobicity scale. This scale
9
will be assigned to all caught macromolecular complexes and to the
10
sequence stored in the sequence buffer.
13
(1) Pointer to MolComplexS structure.
14
(2) The number of macromolecular complexes.
15
(3) Pointer to RuntimeS structure.
16
(4) Pointer to the remainder of the command string. The remainder
17
should contain the hydrophobicity scale name. The keywords
18
are: EIS (EISENBERG), KD (KYTE-DOOLITLE) and WHI (WHITE).
21
(1) Hydrophobicity scale changed for each caught complex and for
22
the sequence stored in the sequence buffer.
26
(1) Positive (command) code on success.
27
(2) Negative (error) code on failure.
30
(1) The main window content will not be refreshed.
32
========includes:============================================================*/
39
#include <X11/Xutil.h>
41
#include <X11/Xatom.h>
47
/*======function prototypes:=================================================*/
49
char *ExtractToken_ (char *, int, char *, char *);
50
int AssignHydrophobicity_ (MolComplexS *, int);
51
void InitHyphob_ (RuntimeS *);
53
/*======execute scale command:===============================================*/
55
int Scale_ (MolComplexS *mol_complexSP, int mol_complexesN,
56
RuntimeS *runtimeSP, char *stringP)
59
char tokenA[STRINGSIZE];
62
MolComplexS *curr_mol_complexSP;
64
/* Extract the first token, if present: */
65
remainderP = ExtractToken_ (tokenA, STRINGSIZE, stringP, " \t\n");
67
/* If there are no tokens in the remainder of the */
68
/* command string, the scale name is missing: */
71
strcpy (runtimeSP->messageA, "Scale name missing!");
72
runtimeSP->message_length = strlen (runtimeSP->messageA);
77
else if (strstr (tokenA, "WHI") == tokenA) scaleI = 0;
79
/* KD (KYTE-DOOLITLE): */
80
else if (strstr (tokenA, "KD") == tokenA) scaleI = 1;
82
/* EIS (EISENBERG): */
83
else if (strstr (tokenA, "EIS") == tokenA) scaleI = 2;
85
/* Keyword not recognized: */
88
strcpy (runtimeSP->messageA, "Keyword not recognized!");
89
runtimeSP->message_length = strlen (runtimeSP->messageA);
93
/* For each caught macromolecular complex, change the scale: */
94
for (mol_complexI = 0; mol_complexI < mol_complexesN; mol_complexI++)
96
/* Pointer to the current macromolecular complex: */
97
curr_mol_complexSP = mol_complexSP + mol_complexI;
99
/* Check is the current macromolecular complex caught: */
100
if (curr_mol_complexSP->catchF == 0) continue;
102
/* Change hydrophobicity scale: */
103
AssignHydrophobicity_ (curr_mol_complexSP, scaleI);
106
/* Update the hydrophobicity scale index in RuntimeS structure: */
107
runtimeSP->hydrophobicity_scaleI = scaleI;
109
/* Update hydrophobicity values assigned to residues in the sequence buffer: */
110
InitHyphob_ (runtimeSP);
112
/* Return the command code: */
113
return COMMAND_SCALE;
116
/*===========================================================================*/