File: special_select.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 (629 lines) | stat: -rw-r--r-- 19,330 bytes parent folder | download | duplicates (3)
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
/* Copyright (C) 2000-2006 Damir Zucic */

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

				special_select.c

Purpose:
	Execute select command (the special version): try to interpret the
	selection string  as the special keyword.  Three selections  modes
	are available:  0 = overwrite,  1 = restrict,  2 = expand previous
	selection.  Special keywords  are:  ALL,  *,  POLAR,  HYDROPHOBIC,
	AROMATIC,  ALIPHATIC,  SMALL,  TINY,  POSITIVE,  NEGATIVE,  BASIC,
	ACIDIC, CHARGED, MAIN_CHAIN, SIDE_CHAINS, HETERO, CIS, TRANS, BAD,
	COMPLEMENT,  SEQUENCE,  SPHERE, ALTERNATE,  MODEL,  ABOVE,  BELOW,
	TRIPLET, TM, PATTERN, 2C3, 2CZ3, 2NZ3, 3C4, 3CZ4, 3NZ4, 3C5, 3CZ5,
	3NZ5, 3P5, 4C5, 4CZ5, 4NZ5, 3C6, 3CZ6, 3NZ6, 4C6, 4CZ6, 4NZ6, 4P6,
	5C6, 5CZ6, 5NZ6,  4C7, 4CZ7, 4NZ7, 5C7, 5CZ7, 5NZ7, 5P7, 6P7, 4C9,
	4CZ9, 4NZ9, 5C9, 5CZ9, 5NZ9 and  $1.  Most keywords may be abbrev.
	to 3 characters.  The exceptions are keywords HYDROPHOBIC  (it may
	be replaced by  PHO or shortened to  HYDROPHO),  2CZ3, 2NZ3, 3CZ4,
	3NZ4, 3CZ5, 3NZ5, 4CZ5, 4NZ5,  3CZ6, 3NZ6, 4CZ6, 4NZ6, 5CZ6, 5NZ6,
	4CZ7, 4NZ7, 5CZ7, 5NZ7, 4CZ9, 5CZ9 and  5NZ9.  The keyword $1 is a
	special selection keyword (not implemented yet, @@).

Input:
	(1) Pointer to MolComplexS structure, with macromol. complexes.
	(2) Number of macromolecular complexes.
	(3) Pointer to RuntimeS structure  (the sequence buffer is there).
	(4) The selection string.
	(5) Selection mode index  (0 = overwr., 1 = restrict, 2 = expand).

Output:
	(1) The flag selectedF will be equal to one for selected atoms and
	    equal to zero for all other atoms.
	(2) Return value.

Return value:
	(1) The number of  selected atoms,  if selection  is done  in this
	    function.
	(2) -1 if selection string is not suitable for this function.
	(3) Some other negative value on failure.

========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:=================================================*/

char		*ExtractToken_ (char *, int, char *, char *);
int		ExtractIndex_ (char *);
long		SelectHetero_ (MolComplexS *, int, int);
long		SelectCisTrans_ (MolComplexS *, int, int, int);
long		SelectComplement_ (MolComplexS *, int, int);
long		SelectSequence_ (MolComplexS *, int, RuntimeS *, int);
long		SelectSphere_ (MolComplexS *, int, RuntimeS *, int);
long		SelectAlternate_ (MolComplexS *, int, int);
long		SelectModel_ (MolComplexS *, int, int, int);
long		SelectAbove_ (MolComplexS *, int, int);
long		SelectBelow_ (MolComplexS *, int, int);
long		SelectTriplet_ (MolComplexS *, int, int);
long		SelectTM_ (MolComplexS *, int, int);
long		SelectPattern_ (MolComplexS *, int, RuntimeS *, int);
long		Select2C3_ (MolComplexS *, int, int);
long		Select2CZ3_ (MolComplexS *, int, int);
long		Select2NZ3_ (MolComplexS *, int, int);
long		Select3C4_ (MolComplexS *, int, int);
long		Select3CZ4_ (MolComplexS *, int, int);
long		Select3NZ4_ (MolComplexS *, int, int);
long		Select3C5_ (MolComplexS *, int, int);
long		Select3CZ5_ (MolComplexS *, int, int);
long		Select3NZ5_ (MolComplexS *, int, int);
long		Select3P5_ (MolComplexS *, int, int);
long		Select4C5_ (MolComplexS *, int, int);
long		Select4CZ5_ (MolComplexS *, int, int);
long		Select4NZ5_ (MolComplexS *, int, int);
long		Select3C6_ (MolComplexS *, int, int);
long		Select3CZ6_ (MolComplexS *, int, int);
long		Select3NZ6_ (MolComplexS *, int, int);
long		Select4C6_ (MolComplexS *, int, int);
long		Select4CZ6_ (MolComplexS *, int, int);
long		Select4NZ6_ (MolComplexS *, int, int);
long		Select4P6_ (MolComplexS *, int, int);
long		Select5C6_ (MolComplexS *, int, int);
long		Select5CZ6_ (MolComplexS *, int, int);
long		Select5NZ6_ (MolComplexS *, int, int);
long		Select4C7_ (MolComplexS *, int, int);
long		Select4CZ7_ (MolComplexS *, int, int);
long		Select4NZ7_ (MolComplexS *, int, int);
long		Select5C7_ (MolComplexS *, int, int);
long		Select5CZ7_ (MolComplexS *, int, int);
long		Select5NZ7_ (MolComplexS *, int, int);
long		Select5P7_ (MolComplexS *, int, int);
long		Select6P7_ (MolComplexS *, int, int);
long		Select4C9_ (MolComplexS *, int, int);
long		Select4CZ9_ (MolComplexS *, int, int);
long		Select4NZ9_ (MolComplexS *, int, int);
long		Select5C9_ (MolComplexS *, int, int);
long		Select5CZ9_ (MolComplexS *, int, int);
long		Select5NZ9_ (MolComplexS *, int, int);
int		Include_ (SelectS *, char *);
int		Exclude_ (SelectS *, char *);
long		ApplySelection_ (MolComplexS *, int,
				 SelectS *, SelectS *, int);

/*======execute select command (special selection string):===================*/

long SpecialSelect_ (MolComplexS *mol_complexSP, int mol_complexesN,
		     RuntimeS *runtimeSP, char *stringP, int selection_modeI)
{
long		selected_atomsN;
char		tokenA[STRINGSIZE];
char		full_stringA[STRINGSIZE];
char		*P;
int		n;
int		slashesN = 0;
SelectS		include_selectS, exclude_selectS;
int		model_serialI;

/* Purify the selection string (remove the leading and trailing separators): */
if (!ExtractToken_ (tokenA, STRINGSIZE, stringP, " ,;\t\n")) return (long) -1;

/* Check the selection string: */

/** ALL: **/
if ((strstr (tokenA, "ALL") == tokenA) || (strstr (tokenA, "*") == tokenA))
	strcpy (full_stringA, "*/*/*/*");

/** POLAR: **/
else if (strstr (tokenA, "POL") == tokenA)
	strcpy (full_stringA,
		"*/*/ARG,LYS,HIS,ASP,GLU,ASN,GLN,SER,THR,TRP,TYR/*");

/** HYDROPHOBIC: **/
else if ((strstr (tokenA, "HYDROPHO") == tokenA) ||
	 (strstr (tokenA, "PHO") == tokenA))
	strcpy (full_stringA,
		"*/*/ALA,ILE,LEU,MET,PHE,TRP,VAL,TYR,CYS,GLY,HIS/*");

/** AROMATIC: **/
else if (strstr (tokenA, "ARO") == tokenA)
	strcpy (full_stringA, "*/*/PHE,TYR,TRP,HIS/*");

/** ALIPHATIC: **/
else if (strstr (tokenA, "ALI") == tokenA)
	strcpy (full_stringA, "*/*/ILE,LEU,VAL/*");

/** SMALL: **/
else if (strstr (tokenA, "SMA") == tokenA)
	strcpy (full_stringA, "*/*/GLY,ALA,SER,THR,CYS,VAL,PRO,ASP,ASN/*");

/** TINY: **/
else if (strstr (tokenA, "TIN") == tokenA)
	strcpy (full_stringA, "*/*/GLY,ALA,SER/*");

/** POSITIVE: **/
else if (strstr (tokenA, "POS") == tokenA)
	strcpy (full_stringA, "*/*/ARG,LYS,HIS/*");

/** NEGATIVE: **/
else if (strstr (tokenA, "NEG") == tokenA)
	strcpy (full_stringA, "*/*/GLU,ASP/*");

/** BASIC: **/
else if (strstr (tokenA, "BAS") == tokenA)
	strcpy (full_stringA, "*/*/ARG,LYS,HIS/*");

/** ACIDIC: **/
else if (strstr (tokenA, "ACI") == tokenA)
	strcpy (full_stringA, "*/*/GLU,ASP/*");

/** CHARGED: **/
else if (strstr (tokenA, "CHA") == tokenA)
	strcpy (full_stringA, "*/*/ARG,LYS,HIS,GLU,ASP/*");

/** MAIN_CHAIN: **/
else if (strstr (tokenA, "MAI") == tokenA)
	strcpy (full_stringA, "*/*/*/CA,C,N,O,H");

/** SIDE_CHAINS: **/
else if (strstr (tokenA, "SID") == tokenA)
	strcpy (full_stringA, "*/*/*/* EXCEPT CA,C,N,O,H");

/** HETERO: **/
else if (strstr (tokenA, "HET") == tokenA)
	{
	selected_atomsN = SelectHetero_ (mol_complexSP, mol_complexesN,
					 selection_modeI);
	return selected_atomsN;
	}

/** CIS: **/
else if (strstr (tokenA, "CIS") == tokenA)
	{
	selected_atomsN = SelectCisTrans_ (mol_complexSP, mol_complexesN,
					   selection_modeI, 2);
	return selected_atomsN;
	}

/** TRANS: **/
else if (strstr (tokenA, "TRA") == tokenA)
	{
	selected_atomsN = SelectCisTrans_ (mol_complexSP, mol_complexesN,
					   selection_modeI, 1);
	return selected_atomsN;
	}

/** BAD: **/
else if (strstr (tokenA, "BAD") == tokenA)
	{
	selected_atomsN = SelectCisTrans_ (mol_complexSP, mol_complexesN,
					   selection_modeI, 0);
	return selected_atomsN;
	}

/** COMPLEMENT: **/
else if (strstr (tokenA, "COM") == tokenA)
	{
	selected_atomsN = SelectComplement_ (mol_complexSP, mol_complexesN,
					     selection_modeI);
	return selected_atomsN;
	}

/** SEQUENCE: **/
else if (strstr (tokenA, "SEQ") == tokenA)
	{
	selected_atomsN = SelectSequence_ (mol_complexSP, mol_complexesN,
					   runtimeSP, selection_modeI);
	return selected_atomsN;
	}

/** SPHERE: **/
else if (strstr (tokenA, "SPH") == tokenA)
	{
	selected_atomsN = SelectSphere_ (mol_complexSP, mol_complexesN,
					 runtimeSP, selection_modeI);
	return selected_atomsN;
	}

/** ALTERNATE: **/
else if (strstr (tokenA, "ALT") == tokenA)
	{
	selected_atomsN = SelectAlternate_ (mol_complexSP, mol_complexesN,
					    selection_modeI);
	return selected_atomsN;
	}

/** MODEL: **/
else if (strstr (tokenA, "MOD") == tokenA)
	{
	model_serialI = ExtractIndex_ (stringP);
	selected_atomsN = SelectModel_ (mol_complexSP, mol_complexesN,
					selection_modeI, model_serialI);
	return selected_atomsN;
	}

/** ABOVE: **/
else if (strstr (tokenA, "ABO") == tokenA)
	{
	selected_atomsN = SelectAbove_ (mol_complexSP, mol_complexesN,
					selection_modeI);
	return selected_atomsN;
	}

/** BELOW: **/
else if (strstr (tokenA, "BEL") == tokenA)
	{
	selected_atomsN = SelectBelow_ (mol_complexSP, mol_complexesN,
					selection_modeI);
	return selected_atomsN;
	}

/** TRIPLET: **/
else if (strstr (tokenA, "TRI") == tokenA)
	{
	selected_atomsN = SelectTriplet_ (mol_complexSP, mol_complexesN,
					  selection_modeI);
	return selected_atomsN;
	}

/** TM (transmembrane part): **/
else if (strstr (tokenA, "TM") == tokenA)
	{
	selected_atomsN = SelectTM_ (mol_complexSP, mol_complexesN,
				     selection_modeI);
	return selected_atomsN;
	}

/** PATTERN (sequence pattern): **/
else if (strstr (tokenA, "PAT") == tokenA)
	{
	selected_atomsN = SelectPattern_ (mol_complexSP, mol_complexesN,
					  runtimeSP, selection_modeI);
	return selected_atomsN;
	}

/** 2C3 (two or more charged in a fragment of three residues): **/
else if (strstr (tokenA, "2C3") == tokenA)
	{
	selected_atomsN = Select2C3_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 2CZ3 (two or more charged or zwitterionic in a fragment of three): **/
else if (strstr (tokenA, "2CZ3") == tokenA)
	{
	selected_atomsN = Select2CZ3_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 2NZ3 (two or more negative or zwitterionic in a fragment of three): **/
else if (strstr (tokenA, "2NZ3") == tokenA)
	{
	selected_atomsN = Select2NZ3_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 3C4 (three or more charged in a fragment of four residues): **/
else if (strstr (tokenA, "3C4") == tokenA)
	{
	selected_atomsN = Select3C4_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 3CZ4 (three or more charged or zwitterionic in a fragment of four): **/
else if (strstr (tokenA, "3CZ4") == tokenA)
	{
	selected_atomsN = Select3CZ4_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 3NZ4 (three or more negative or zwitterionic in a fragment of four): **/
else if (strstr (tokenA, "3NZ4") == tokenA)
	{
	selected_atomsN = Select3NZ4_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 3C5 (three or more charged in a fragment of five residues): **/
else if (strstr (tokenA, "3C5") == tokenA)
	{
	selected_atomsN = Select3C5_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 3CZ5 (three or more charged or zwitterionic in a fragment of five): **/
else if (strstr (tokenA, "3CZ5") == tokenA)
	{
	selected_atomsN = Select3CZ5_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 3NZ5 (three or more negative or zwitterionic in a fragment of five): **/
else if (strstr (tokenA, "3NZ5") == tokenA)
	{
	selected_atomsN = Select3NZ5_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 4C5 (four or more charged in a fragment of five residues): **/
else if (strstr (tokenA, "4C5") == tokenA)
	{
	selected_atomsN = Select4C5_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 4CZ5 (four or more charged or zwitterionic in a fragment of five): **/
else if (strstr (tokenA, "4CZ5") == tokenA)
	{
	selected_atomsN = Select4CZ5_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 4NZ5 (four or more negative or zwitterionic in a fragment of five): **/
else if (strstr (tokenA, "4NZ5") == tokenA)
	{
	selected_atomsN = Select4NZ5_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 3C6 (three or more charged in a fragment of six residues): **/
else if (strstr (tokenA, "3C6") == tokenA)
	{
	selected_atomsN = Select3C6_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 3CZ6 (three or more charged or zwitterionic in a fragment of six): **/
else if (strstr (tokenA, "3CZ6") == tokenA)
	{
	selected_atomsN = Select3CZ6_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 3NZ6 (three or more negative or zwitterionic in a fragment of six): **/
else if (strstr (tokenA, "3NZ6") == tokenA)
	{
	selected_atomsN = Select3NZ6_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 4C6 (four or more charged in a fragment of six residues): **/
else if (strstr (tokenA, "4C6") == tokenA)
	{
	selected_atomsN = Select4C6_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 4CZ6 (four or more charged or zwitterionic in a fragment of six): **/
else if (strstr (tokenA, "4CZ6") == tokenA)
	{
	selected_atomsN = Select4CZ6_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 4NZ6 (four or more negative or zwitterionic in a fragment of six): **/
else if (strstr (tokenA, "4NZ6") == tokenA)
	{
	selected_atomsN = Select4NZ6_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 4P6 (four or more polar in a fragment of six): **/
else if (strstr (tokenA, "4P6") == tokenA)
	{
	selected_atomsN = Select4P6_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 5C6 (five or more charged in a fragment of six residues): **/
else if (strstr (tokenA, "5C6") == tokenA)
	{
	selected_atomsN = Select5C6_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 5CZ6 (five or more charged or zwitterionic in a fragment of six): **/
else if (strstr (tokenA, "5CZ6") == tokenA)
	{
	selected_atomsN = Select5CZ6_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 5NZ6 (five or more negative or zwitterionic in a fragment of six): **/
else if (strstr (tokenA, "5NZ6") == tokenA)
	{
	selected_atomsN = Select5NZ6_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 4C7 (four or more charged in a fragment of seven residues): **/
else if (strstr (tokenA, "4C7") == tokenA)
	{
	selected_atomsN = Select4C7_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 4CZ7 (four or more charged or zwitterionic in a fragment of seven): **/
else if (strstr (tokenA, "4CZ7") == tokenA)
	{
	selected_atomsN = Select4CZ7_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 4NZ7 (four or more negative or zwitterionic in a fragment of seven): **/
else if (strstr (tokenA, "4NZ7") == tokenA) 
	{
	selected_atomsN = Select4NZ7_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 5C7 (five or more charged in a fragment of seven residues): **/
else if (strstr (tokenA, "5C7") == tokenA) 
	{
	selected_atomsN = Select5C7_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 5CZ7 (five or more charged or zwitterionic in a fragment of seven): **/
else if (strstr (tokenA, "5CZ7") == tokenA)
	{
	selected_atomsN = Select5CZ7_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 5NZ7 (five or more negative or zwitterionic in a fragment of seven): **/
else if (strstr (tokenA, "5NZ7") == tokenA) 
	{       
	selected_atomsN = Select5NZ7_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 3P5 (three or more polar in a fragment of five residues): **/
else if (strstr (tokenA, "3P5") == tokenA)
	{
	selected_atomsN = Select3P5_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 5P7 (five or more polar in a fragment of seven residues): **/
else if (strstr (tokenA, "5P7") == tokenA)
        {
        selected_atomsN = Select5P7_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
        return selected_atomsN;
        }

/** 6P7 (six or more polar in a fragment of seven residues): **/
else if (strstr (tokenA, "6P7") == tokenA)
	{
	selected_atomsN = Select6P7_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 4C9 (four or more charged in a fragment of nine residues): **/
else if (strstr (tokenA, "4C9") == tokenA)
	{
	selected_atomsN = Select4C9_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 4CZ9 (four or more charged or zwitterionic in a fragment of nine): **/
else if (strstr (tokenA, "4CZ9") == tokenA)
	{
	selected_atomsN = Select4CZ9_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 4NZ9 (four or more negative or zwitterionic in a fragment of nine): **/
else if (strstr (tokenA, "4NZ9") == tokenA)
	{
	selected_atomsN = Select4NZ9_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** 5C9 (five or more charged in a fragment of nine residues): **/
else if (strstr (tokenA, "5C9") == tokenA) 
	{
	selected_atomsN = Select5C9_ (mol_complexSP, mol_complexesN,
				      selection_modeI);
	return selected_atomsN;
	}

/** 5CZ9 (five or more charged or zwitterionic in a fragment of nine): **/
else if (strstr (tokenA, "5CZ9") == tokenA)
	{
	selected_atomsN = Select5CZ9_ (mol_complexSP, mol_complexesN, 
				       selection_modeI);
	return selected_atomsN;
	}

/** 5NZ9 (five or more negative or zwitterionic in a fragment of nine): **/
else if (strstr (tokenA, "5NZ9") == tokenA)
	{
	selected_atomsN = Select5NZ9_ (mol_complexSP, mol_complexesN,
				       selection_modeI);
	return selected_atomsN;
	}

/** String not recognized: **/
else return (long) -1;		/* Must be -1! */

/* Count slashes: */
P = full_stringA;
while ((n = *P++) != '\0') if (n == '/') slashesN++;
if (slashesN != 3) return (long) -1;

/* Identify chains,  residue ranges,  residue */
/* names and atoms which have to be included: */
if (Include_ (&include_selectS, full_stringA) < 0) return (long) -2;

/* Identify chains,  residue ranges,  residue */
/* names and atoms which have to be excluded: */
if (Exclude_ (&exclude_selectS, full_stringA) < 0) return (long) -3;

/* Do the selection: */
selected_atomsN = ApplySelection_ (mol_complexSP, mol_complexesN,
				   &include_selectS, &exclude_selectS,
				   selection_modeI);

/* Return the number of selected atoms: */
return selected_atomsN;
}

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