File: init_hyphob.c

package info (click to toggle)
garlic 1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,516 kB
  • sloc: ansic: 52,465; makefile: 2,254
file content (96 lines) | stat: -rw-r--r-- 2,473 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* Copyright (C) 2000-2003 Damir Zucic */

/*=============================================================================

				init_hyphob.c

Purpose:
	Initialize hydrophobicity values associated with the general purpose
	sequence and with the reference sequence.

Input:
	(1) Pointer to RuntimeS structure,  with both input and output data.

Output:
	(1) Hydrophobicity information initialized.

Return value:
	No return value.

Notes:
	(1) Check init_runtime.c for default hydrophobicity scale!

========includes:============================================================*/

#include <stdio.h>

#include <string.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>

#include "defines.h"
#include "typedefs.h"

/*======function prototypes:=================================================*/

double		Hydrophobicity_ (char *, int, int);

/*======initialize hydrophobicity values:====================================*/

void InitHyphob_ (RuntimeS *runtimeSP)
{
int		max_length;
size_t		residueI;
int		scaleI;
char		*residue_nameP;
char		residue_nameA[RESNAMESIZE];
double		hydrophobicity;

/* The maximal residue name length: */
max_length = RESNAMESIZE - 1;

/* Hydrophobicity scale index: */
scaleI = runtimeSP->hydrophobicity_scaleI;

/* Scan the general purpose sequence: */
for (residueI = 0; residueI < runtimeSP->residuesN; residueI++)
	{
	/* Pointer to the current residue name: */
	residue_nameP = runtimeSP->sequenceP + residueI * max_length;

	/* Copy the residue name: */
	strncpy (residue_nameA, residue_nameP, max_length);
	residue_nameA[max_length] = '\0';

	/* The corresponding hydrophobicity: */
	hydrophobicity = Hydrophobicity_ (residue_nameA, scaleI, 0);

	/* Store the hydrophobicity value: */
	*(runtimeSP->hydrophobicityP + residueI) = hydrophobicity;
	}

/* Scan the reference sequence: */
for (residueI = 0; residueI < runtimeSP->reference_residuesN; residueI++)
	{
	/* Pointer to the current residue name: */
	residue_nameP = runtimeSP->reference_sequenceP + residueI * max_length;

	/* Copy the residue name: */
	strncpy (residue_nameA, residue_nameP, max_length);
	residue_nameA[max_length] = '\0';

	/* The corresponding hydrophobicity: */
	hydrophobicity = Hydrophobicity_ (residue_nameA, scaleI, 0);

	/* Store the hydrophobicity value: */
	*(runtimeSP->reference_hydrophobicityP + residueI) = hydrophobicity;
	}

}

/*===========================================================================*/