-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPKINCOUT.c
2833 lines (2670 loc) · 106 KB
/
PKINCOUT.c
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
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/* PKINCOUT.c */
#include "PKIN.h"
#include "PKINDLOG.h"
/*needed in several routines in this source file:*/
static char topname[32]={" "};
//void writeVRMLvector(char[256]); /*050211*/
void writeVRMLvectorextrusion(char[256]); /*050208*/
void writeVRMLsphere(char[256],char[20]); /*050208*/
void VRMLxSectionCircle(float); /*050204*/
int LsplineVRMLout=0, LvectorVRMLout=0, LsphereVRMLout=0;/*050208*/
/* local specific output control*/
static float VRMLx=0,VRMLy=0,VRMLz=0;
/****writeoutput()***********************************************************/
void writeoutput()
{
char cntl[5]; /* 4 actual characters */
char kol[20],extra[256],aname[13];
char chain[32],atoms[32],cpks[32],hygen[32],hbond[32];
char subname[32],allstr[32];
char mastername[32]; /*051128*/
char domrec1[32],domrec2[32]; /*040406 for dominant or recessiveon*/
char alphcol[16],betacol[16],coilcol[16],nuclcol[16]; /*041029*/
static char topnameold[32]={" "};
static char onlynameold[32]={" "}; /*050922*/
int j,k,Ldoit;
char basetype[3];
static char onlyname[32]={" "};
float ballradiushold=0;
int NMOD=0, Ncase=0; /*041106 colorset distinguish multiple subunits*/
char ribidentityold[5]={'\0','\0','\0','\0','\0'}; /*060929*/
char colsetstr[6][16]; /*060929*/
int numcolsets = 6; /*060929*/
int indexribID = 0; /*060929*/
if( Ldumppperptobase || Lcbdevdump || Lpdbmutout || Ldumpcispeptides
|| LdumpVRML || Lconnectresiduesdump)
{
Ldump = 1; /*generic control for dump mode not a kin*/
}
/*Listca,Listmc,Listsc,Listhy,Listhb,Listss,Listlb,Listrot*/
/*mcoutl,scoutl,lboutl,croutl,htoutl,hyoutl,hboutl,cxoutl,caonly,caoutl*/
/*rotoutl,riboutl,extoutl*/
/*#define PRINTLISTS*/
#ifdef PRINTLISTS
fprintf(stderr,"Listmc %d, Listca %d, Listsc %d, Listss %d, Listhy %d, Listht %d, Listhb %d, Listwa %d, Listwao %d, Listat %d, Listlb %d, Listrot %d, Listrib %d, Listext %d, Listtabl %d, Listcbdev %d, Listtaudev %d, Ldump %d, Listsuppos %d, Listpdb %d\n"
,Listmc,Listca,Listsc,Listss,Listhy,Listht,Listhb,Listwa,Listwao,Listat,Listlb
,Listrot,Listrib,Listext,Listtabl,Listcbdev,Listtaudev,Ldump,Listsuppos,Listpdb);
#endif /*PRINTLISTS*/
if(LIOpipe) /*020514*/
{
fprintf(fpoutput,EOLO"@start"EOLO); /*020514*/
}
/*There can be either kinemage format or colon:delineated format output*/
/*check that some output has been requested, and points have been found*/
/*as of 030520 do not correlate type of request with type of found points*/
if(!Ldump
&&( Listmc
|| Listca
|| Listsc
|| Listss
|| Listhy
|| Listht
|| Listhb
|| Listwa
|| Listat
|| Listlb
|| Listrot
|| Listrib
|| Listext
|| Listtabl
|| Listcbdev
|| Listtaudev
|| Listsuppos /*uses typenow*/
)
&&( pointcnt[typenull]
|| pointcnt[typemc]
|| pointcnt[typemcn]
|| pointcnt[typemco]
|| pointcnt[typemcs]
|| pointcnt[typemcc]
|| pointcnt[typesc]
|| pointcnt[typescn]
|| pointcnt[typesco]
|| pointcnt[typescs]
|| pointcnt[typescc]
|| pointcnt[typeca]
|| pointcnt[typerib]
|| pointcnt[typelb]
|| pointcnt[typelbn]
|| pointcnt[typehb]
|| pointcnt[typehy]
|| pointcnt[typess]
|| pointcnt[typeht]
|| pointcnt[typehtn]
|| pointcnt[typehto]
|| pointcnt[typehts]
|| pointcnt[typehtm]
|| pointcnt[typehtc]
|| pointcnt[typewa]
|| pointcnt[typewao]
|| pointcnt[typeext]
|| pointcnt[typecbda]
|| pointcnt[typecbdb]
|| pointcnt[typecbdc]
|| pointcnt[typecbdm]
|| pointcnt[typecbdv]
|| pointcnt[typecbdl]
|| pointcnt[typecbde]
|| pointcnt[typetau]
|| pointcnt[typetaub]
|| pointcnt[typetaus]
|| pointcnt[typero]
)
)
{/*there is kinemage stuff to output*/
if(Listsuppos)
{/*trumps all other possible output this pass*/
Listmc = 0; Listca = 0; Listsc = 0; Listss = 0; Listhy = 0;
Listht = 0; Listhb = 0; Listwa = 0; Listat = 0; Listlb = 0;
Listrot = 0; Listrib = 0; Listext = 0; Listtabl = 0; Listcbdev = 0;
Listtaudev = 0;
}
if(!Ldid_outfiletext && !Ldump) /*set in ____OUTP/prepareoutputfile()*/
{/*Do kinemage text and caption*/
if(!Lappend)
{/*NOT Lappend: presume a whole new kinemage*/
if(!Lnotext)
{/*write text for text window*/
#ifdef PCWINDOWS
fprintf(fpoutput,"@text "EOLO" coordinates from file: %s "EOLO
,dirstrip(NameStr));
#endif
#ifndef PCWINDOWS
fprintf(fpoutput,"@text "EOLO" coordinates from file: %s "EOLO
,NameStr);
#endif
if(LIOmage)
{
/*fprintf(stderr,"Prekin writing pdbinfostuff under @text\n");*/
rewindtextblock(&pdbinfostuff);
do
{
getonetextblockline(&pdbinfostuff,word);
if(word[0]!='\0') fprintf(fpoutput,"%s",word);
}while(word[0]!='\0');
}
else
{
/*fprintf(stderr,"Prekin writing headerstuff under @text\n");*/
rewindtextblock(&headerstuff);
do
{
getonetextblockline(&headerstuff,word);
if(word[0]!='\0') fprintf(fpoutput,"%s",word);
}while(word[0]!='\0');
}
}/*write text for text window*/
fprintf(fpoutput,EOLO"@kinemage 1 "EOLO); /*990118*/
fprintf(fpoutput,EOLO"@prekin %.2f %s"EOLO,PREKINVERSION,PREKINDATE);
#ifdef PCWINDOWS
fprintf(fpoutput,"@caption "EOLO" coordinates from file: %s "EOLO
,dirstrip(NameStr));
#endif
#ifndef PCWINDOWS
fprintf(fpoutput,"@caption "EOLO" coordinates from file: %s "EOLO
,NameStr);
#endif
/*if(fprintf(fpoutput,"@onewidth "EOLO)<0) Lfpoutput=-1;*/
/*(fprintf(fpoutput,"@onewidth "EOLO)<0); fix warning 130507 JJH */
fprintf(fpoutput,"@onewidth "EOLO); /*130121 remove (...<0) */
}/*NOT Lappend: presume a whole new kinemage*/
/*write file name so MAGE could call prekin or probe to read it*/
fprintf(fpoutput,"@pdbfile {%s} "EOLO,ShortNameStr);
if(Lpasskeyword) /*041107*/
{
if(passkeywordstr[0] != '@')
{fprintf(fpoutput,"@%s"EOLO,passkeywordstr);} /*041107*/
else {fprintf(fpoutput, "%s"EOLO,passkeywordstr);} /*041107*/
}
Ldid_outfiletext = 1;
}/*Do kinemage text and caption*/
if(Lhypertextstuff)
{
rewindtextblock(&hypertextstuff);
do
{
getonetextblockline(&hypertextstuff,word);
if(word[0]!='\0') fprintf(fpoutput,"%s",word);
}while(word[0]!='\0');
Lhypertextstuff = 0;
disposetextblock(&hypertextstuff); /*PKINSCRT.c*/
}
if(Lallbuttons || Listcbdev || Listtaudev || Listsuppos)
{
Lnogroups = 0;
Lonlygroups = 0;
Lonegroup = 0;
}
/*use: mod[maxatm] for actual model number of current piece of molecule */
/*note nmrmodel changes at transition when next is another model*/
/*050121 modelnumber is set to current model being processed*/
if(nmrmodel[0] != '\0') /*nmrmodel set so presumably doing nmrmodels*/
{
if(Lcommanded && Listrot) /*050121 Lcommanded may not be robust...*/
{/*e.g. mage command for rotatable sidechain invoked prekin*/
sprintf(allstr," master= {rotation}");
}
else if(Listrot)
{/*050121 seems prekin requested to make rotatable mutated sidechain*/
sprintf(allstr," master= {rotation}");
}
else /*probably multiple nmr models so set a masters to control them*/
{
sprintf(allstr," animate master= {all}");
}
}
else if(Lnobutton) /*060120*/
{
sprintf(allstr," animate nobutton master={ALL}"); /* < 32 char */
}
else if(Lanimate)
{
sprintf(allstr," animate");
}
else
{
allstr[0]='\0';
}
sprintf(hbond," master= {Hbonds}");
sprintf(hygen," master= {H's}");
sprintf(atoms," master= {atoms}");
sprintf(cpks," master= {CPK}");
/*derive names for whole molecule and subunits*/
/*topID may have both subunit indicator and nmrmodel number*/
/*050121 actually, topID does NOT seem to ever have nmrmodel number!*/
/*not an nmr MODEL will have nmrmodel[0]=='\0', a null string 050121*/
/* null str will have null spaces in %s format conversion*/
/* historically: Listrot inhibited showing chainID in group name*/
/*note nmrmodel changes at transition when next is another model*/
/*050121 modelnumber is set to current model being processed*/
if(MolNameStr[0] == '\0')
{
sprintf(chain,"subunit%s",modelnumber); /*050121*/
sprintf(topname,"molec%s%s",topID,modelnumber); /*050121*/
sprintf(onlyname,"molec%s",modelnumber); /*050121*/
/*e.g. for Lonegroup do not want chainID in group name*/
/*sprintf(topname,"molec");*/
}
else
{
/*sprintf(chain,"%s%s",MolNameStr,modelnumber);*/
sprintf(chain,"%s",MolNameStr);
sprintf(topname,"%s%s%s",MolNameStr,topID,modelnumber); /*050121*/
sprintf(onlyname,"%s%s",MolNameStr,modelnumber); /*050121*/
/*e.g. for Lonegroup do not want chainID in group name*/
/*sprintf(topname,"%s",MolNameStr);*/
}
if(Listrot && Lcommanded)
{/*over-ride @group {topname...} with sidechain name*/
/*e.g. mage command for just a rotatable sidechain*/
sprintf(topname,"%s",rotatorname); /*050121 includes model*/
}
/*
sprintf(temps,CRLF"output Lthispass %d, Ngroups %d, Nchainfirstpass %d, ichainthispass %d",Lthispass,Ngroups,Nchainfirstpass,ichainthispass);
pkintextinsert(temps);
adjusttext(1);
*/
/*colorcoded aspects for individual atoms have labels*/
/*either passed in pdb file header records for inputted aspects*/
/*or generated for internally specified aspects*/
if(MAXaspectcode >0 )
{
for(j=1; j<=MAXaspectcode; j++)
{
fprintf(fpoutput,"@%daspect {%s}"EOLO,j,aspectid[j]);
/* which reads: @...%d...aspect : i.e. @0aspect, @1aspect, @2aspect, ...*/
}
}
if(Lthispass == 2 &&!Ldump)
{/*masters layout*/ /*general at 2nd pass 030503*/
/*Prekin dry first pass to discover file structure, subunits, etc.*/
/*Really needed if(Lonegroup||Lnogroups) when hierarchy hidden*/
/*nmr MODEL invokes Lonegroup mode*/ /*991210*/
if( !Lnosubgroupmasters
&& Ltopout==0
&& Ngroups==0
&& (Lonegroup||Lnogroups) )
{/*masters layout: only once, only in 2nd pass, only at first subunit*/
/*can't do this if specify NO subgroup masters on commandline*/
/* PKININIT default is Lnosubgroupmasters == 1 as of 011028 */
#ifdef OLDMASTERSETUP /*051128 this is a mess with chains and subunits*/
if(Nchainfirstpass>1 || Lnogroups)
{/*set up masters for molecule and subunits*/
if( Nchainfirstpass == 2
&& ( typechainfirstpass[2] == 'H'
||typechainfirstpass[2] == 'W')
)
{
fprintf(fpoutput,"@master {%s}"EOLO,chain);
if(Listht) {fprintf(fpoutput,"@master {%s hets}"EOLO,chain);}
}
else if(Nchainfirstpass >1)
{
for(j=1; j<=Nchainfirstpass; j++)
{
Ldoit = 1; /*allow master specification for this chain*/
if(Nchaincharcode > 0)
{/*chain IDs specified by a command line:*/
/* make masters only for those*/
Ldoit = 0; /*inhibit master specification*/
for(k=0; k<Nchaincharcode; k++)
{ /*chainID case sensitive for pdb v3.0 070926*/
if( (chaincharcode[k][0] ==codechainfirstpass[j][0])
&&(chaincharcode[k][1] ==codechainfirstpass[j][1]))
)
{/*Match of chain IDs allowed to present chain ID*/
Ldoit = 1;
break; /*any one match allows this chain*/
}
}
}
if(Ldoit)
{
if(typechainfirstpass[j]=='H')
{
fprintf(fpoutput,"@master {%s hets}"EOLO,chain);
}
else
{
fprintf(fpoutput,"@master {%s %s}"EOLO
,chain,codechainfirstpass[j]);
}
}
}
}
else
{
if(!Lnosubgroupmasters)
{fprintf(fpoutput,"@master {%s}"EOLO,chain);}
}
}/*set up masters for molecule and subunits*/
#endif /*051128*/
/*micromanage by type of output*/
if(!Lallbases) /*which wreaks havoc with masters anyway*/
{/*set up masters for components*/ /*only do this in the beginning*/
/*mc,ca,sc,hy,even hb usually set as List.. in first level*/
/*nt sometimes set in first level, but wa rarely. */
/*?more robust to use ..outl so exist in a range setting */
/*plus existence of a type: typechainfirstpass[level] */
/* Ltype_ to anticipate need for ordered masters 051201*/
if(mcoutl && (LtypeP || LtypeN) ) /*if(Listmc)*/
{
/*fprintf(fpoutput,"@master {mainchain} indent space"EOLO);*/
fprintf(fpoutput,"@master {mainchain} indent"EOLO); /*060212*/
/*space not neede here, both*/
/*Mage and KiNG put a space between hierarchy and masters*/
}
if(caoutl && (LtypeP || LtypeN) ) /*pseudo-bb incl if(Listca)*/
{
if(LtypeN)
{
fprintf(fpoutput,"@master {Virtual BB} indent"EOLO);
}
else
{
fprintf(fpoutput,"@master {Calphas} indent"EOLO);
}
}
if(scoutl && (LtypeP || LtypeN) ) /*bases incl if(Listsc)*/
{
fprintf(fpoutput,"@master {sidechain} indent"EOLO);
}
if(hyoutl && (LtypeP || LtypeN) ) /*Listhy*/
{
fprintf(fpoutput,"@master {H's} indent"EOLO);
fprintf(fpoutput,"@pointmaster 'H' {H's}"EOLO);
}
if(hboutl && (LtypeP || LtypeN) ) /*Listhb*/
{
fprintf(fpoutput,"@master {Hbonds} indent"EOLO);
}
if(htoutl && LtypeH ) /*Listht*/
{
fprintf(fpoutput,"@master {hets} indent"EOLO);
}
if(waoutl && LtypeW ) /*Listwa*/
{
fprintf(fpoutput,"@master {water} indent"EOLO);
}
}/*set up masters for components*/
}/*masters layout: only once, only in 2nd pass, only at first subunit*/
else if(Lallbases)
{/*Lallbases presumes mainchain, pseudo_mc, and sidechain at least!*/
fprintf(fpoutput,"@master {mainchain}"EOLO);
fprintf(fpoutput,"@master {pseudo_mc}"EOLO);
fprintf(fpoutput,"@master {sidechain}"EOLO);
if(Listhy) fprintf(fpoutput,"@master {H's}"EOLO);
}
/*041031 no cbetadev pointmasters*/
if(Listcbdev)
{/*this should be with the other master controls, */
/*but cbdev is a special case hacked onto prekin's hack commands*/
/*and the interaction of masters with groups is confuscated*/
/*Remember: <...> means an ignored comment to Mage! */
/*fprintf(fpoutput,"@master {dev_.05} indent"EOLO);*/
/*fprintf(fpoutput,"@master {dev.05-.1} indent"EOLO);*/
/*fprintf(fpoutput,"@master {dev.1-.2} indent"EOLO);*/
/*fprintf(fpoutput,"@master {dev.2-.3} indent"EOLO);*/
/*fprintf(fpoutput,"@master {dev.3-.4} indent"EOLO);*/
/*fprintf(fpoutput,"@master {dev.4-.5} indent"EOLO);*/
/*fprintf(fpoutput,"@master {dev_.5} indent"EOLO);*/
/*fprintf(fpoutput,"@pointmaster 't' {dev_.05}"EOLO);*/
/*fprintf(fpoutput,"@pointmaster 'u' {dev.05-.1}"EOLO);*/
/*fprintf(fpoutput,"@pointmaster 'v' {dev.1-.2}"EOLO);*/
/*fprintf(fpoutput,"@pointmaster 'w' {dev.2-.3}"EOLO);*/
/*fprintf(fpoutput,"@pointmaster 'x' {dev.3-.4}"EOLO);*/
/*fprintf(fpoutput,"@pointmaster 'y' {dev.4-.5}"EOLO);*/
/*fprintf(fpoutput,"@pointmaster 'z' {dev_.5}"EOLO);*/
}
if(Lkinmasters && (Listsuppos || Lplotpperptobase) && !Lappend)/*030527*/
{
fprintf(fpoutput,"@master {B 0-10} indent"EOLO);
fprintf(fpoutput,"@master {B10-20} indent"EOLO);
fprintf(fpoutput,"@master {B20-30} indent"EOLO);
fprintf(fpoutput,"@master {B30-40} indent"EOLO);
fprintf(fpoutput,"@master {B40-50} indent"EOLO);
fprintf(fpoutput,"@master {B50-60} indent"EOLO);
fprintf(fpoutput,"@master {B60-70} indent"EOLO);
fprintf(fpoutput,"@master {B70-80} indent"EOLO);
fprintf(fpoutput,"@master {B80-90} indent"EOLO);
fprintf(fpoutput,"@master {B90-100} indent"EOLO);
fprintf(fpoutput,"@master {B100-} indent"EOLO);
}
if(Lkinmasters && Lplotpperptobase && !Lappend) /*030527*/
{
fprintf(fpoutput,"@pointmaster 'p' {B 0-10}"EOLO);
fprintf(fpoutput,"@pointmaster 'q' {B10-20}"EOLO);
fprintf(fpoutput,"@pointmaster 'r' {B20-30}"EOLO);
fprintf(fpoutput,"@pointmaster 's' {B30-40}"EOLO);
fprintf(fpoutput,"@pointmaster 't' {B40-50}"EOLO);
fprintf(fpoutput,"@pointmaster 'u' {B50-60}"EOLO);
fprintf(fpoutput,"@pointmaster 'v' {B60-70}"EOLO);
fprintf(fpoutput,"@pointmaster 'w' {B70-80}"EOLO);
fprintf(fpoutput,"@pointmaster 'x' {B80-90}"EOLO);
fprintf(fpoutput,"@pointmaster 'y' {B90-100}"EOLO);
fprintf(fpoutput,"@pointmaster 'z' {B100-}"EOLO);
/*additional axes group*/
fprintf(fpoutput,"@group {axes} dominant"EOLO);
fprintf(fpoutput,"@vectorlist {axes} dominant"EOLO);
fprintf(fpoutput,"{6,0,0}P 6,0,0 white 16, 0, 0"EOLO);
fprintf(fpoutput,"{6,0,0}P 6,0,0 gold 6,10, 0"EOLO);
fprintf(fpoutput,"{6,0,0}P 6,0,0 green 6, 0,10"EOLO);
fprintf(fpoutput,"@labellist {axes} dominant"EOLO);
fprintf(fpoutput,"{delta/10} 16, 0, 0"EOLO);
fprintf(fpoutput,"{3'P} gold 6,10, 0"EOLO);
fprintf(fpoutput,"{5'P} green 6, 0,10"EOLO);
/*040620 axes permuted as should have been done 040229*/
}
if(Lpointmasteralta) /*030503*/
{
fprintf(fpoutput,"@pointmaster 'a' {alta} on"EOLO);
}
if(Lpointmasteraltb)
{
fprintf(fpoutput,"@pointmaster 'b' {altb} off"EOLO);
}
if(Lpointmasteraltc)
{
fprintf(fpoutput,"@pointmaster 'c' {altc} off"EOLO);
}
Lkinmasters = 0;
}/*masters layout*/ /*general at 2nd pass 030503*/
/*@group line output***********************************************************/
if( Lonlygroups || Lonegroup )
{
/*if(Lallaminoacids||Lallbases)*/
if(Lallbases)
{
sprintf(extra," dominant"); /*040406*/
sprintf(domrec1," dominant"); /*040406*/
sprintf(domrec2," dominant"); /*040406*/
}
else if(Lallaminoacids)
{
sprintf(extra," recessiveon"); /*020614*/
sprintf(domrec1," dominant"); /*040406*/
sprintf(domrec2," recessiveon"); /*040406*/
}
else
{
sprintf(extra," dominant");
sprintf(domrec1," dominant"); /*040406*/
sprintf(domrec2," dominant"); /*040406*/
}
}
else if(Listcbdev) /*041031 dominant group named cbetadev */
{
sprintf(extra," dominant");
sprintf(domrec1," dominant");
sprintf(domrec2," dominant");
sprintf(topname,"cbetadev");
}
else
{
extra[0] = '\0';
domrec1[0] = '\0'; /*040406*/
domrec2[0] = '\0'; /*040406*/
}
if(!Lnogroups && !Ldump)
{/*write @group...*/
if(Ltable) /*991122*/
{/*exlusive pass to make a table group*/
/*group as well as list line done in transferout()*/
/*
if(MolNameStr[0] == '\0')
fprintf(fpoutput,"@group {ROW %d} table \n",level);
else fprintf(fpoutput,"@group {%s %d} table \n",MolNameStr,level);
*/
}
else if( ( (Lallaminoacids||Lallbases) && iresiduecnt == 1) /*ca-ca*/
|| (!Lallaminoacids &&!Lallbases && morsub == 1 && level == 1)
|| (!Lallaminoacids &&!Lallbases && level > 1 ) )
{/*expect more than one level*/
if(Lonegroup) /*takes precedence*/
{/*Lonegroup and button for this molecule or model*/
if(Ngroups==0)
{/*first group of this pass or MODEL*/
/*not an nmr MODEL will have nmrmodel[0]=='\0', a null string*/
/*or just use sub indicator anyway, which inc nmrmodel*/
/*if(strcmp(topnameold,topname))*/
if(strcmp(onlynameold,onlyname)) /*050922*/
{/*not the same*/
/*fprintf(fpoutput,"@group {%s}%s%s"EOLO,topname,extra,allstr);*/
/*BUT group name should not have a chain ID*/
fprintf(fpoutput,"@group {%s}%s%s"EOLO,onlyname,extra,allstr);
/*strcpy(topnameold,topname);*/
strcpy(onlynameold,onlyname); /*050922*/
ichainthispass = 1;
Ngroups = Ngroups + 1;
}
}/*first group of this pass or model*/
/*write subgroup for this chain*/
/*for Lonegroup there are masters on all lists*/
if( Nchainfirstpass > 1
&& !Lnosubgroupmasters
&& !Listrot
&& !Lnosubgroups) /*051129*/
{/*set up subgroups with masters for subunits*/
/*Listrot writes it's own subgroup line below 050121*/
/*master subgroup if >1 chain, unless commandline -nosubgroupmasters*/
if( Nchainfirstpass == 2
&& ( typechainfirstpass[2] == 'H'
||typechainfirstpass[2] == 'W')
)
{/*invent subname for one subunit and its hets*/
if(ichainthispass == 1) /*first: subunit likely protein or nucl*/
{
sprintf(subname,"%s",chain);
sprintf(mastername,"chain %s",ChainID[level]); /*051201*/
}
else /*second: hets or water, name accordingly 051201*/
{
if(typechainfirstpass[2] == 'H')
{
sprintf(subname,"%s hets",chain);
sprintf(mastername,"hets");
}
else if(typechainfirstpass[2] == 'W')
{
sprintf(subname,"%s water",chain);
sprintf(mastername,"water");
}
else
{
sprintf(subname,"%s",chain);
sprintf(mastername,"%s",chain);
}
}
}
else
{/*invent subname for one of multiple subunits*/
if(typechainfirstpass[ichainthispass]=='H')
{
sprintf(subname,"%s hets",chain);
sprintf(mastername,"hets"); /*051128*/
}
if(typechainfirstpass[ichainthispass]=='W') /*051201*/
{
sprintf(subname,"%s water",chain);
sprintf(mastername,"water");
}
else if( (codechainfirstpass[ichainthispass][0] != ' ') /*070926*/
&&(codechainfirstpass[ichainthispass][1] != ' '))/*070926*/
{
sprintf(subname,"%s %s",chain,codechainfirstpass[ichainthispass]);
sprintf(mastername,"chain %s",ChainID[level]); /*051128*/
}
else
{
sprintf(subname,"%s %d",chain,ichainthispass);
sprintf(mastername,"chain %s",ChainID[level]); /*051128*/
}
}
/* fprintf(fpoutput,"@subgroup {%s}%s master= {%s}"EOLO */
/* ,subname,extra,subname); */
fprintf(fpoutput,"@subgroup {%s}%s master= {%s}"EOLO
,subname,extra,mastername); /*051128*/
ichainthispass++;
}/*set up subgroups with masters for subunits*/
else if(!Listrot && !Lnosubgroups) /*051129*/
{/*single chain, no separate subgroups, extra may be dominant*/
/*Listrot writes it's own subgroup line below 050121*/
fprintf(fpoutput,"@subgroup {%s}%s"EOLO,chain,extra);
}
}/*Lonegroup and button for this molecule or model*/
else
{/*no restrictions OR Lonlygroups where extra==dominant */
if( (Lallaminoacids||Lallbases) && iresiduecnt == 1)
{/*test level, whatever level is highest at this point*/
/*040406 replace extra by domrec1*/
if(typechainfirstpass[level]=='N' || typechainfirstpass[level]=='P')
{
fprintf(fpoutput,"@group {%s mc}%s%s"EOLO,topname,domrec1,allstr);
}
else if(typechainfirstpass[level]=='H')
{
fprintf(fpoutput,"@group {%s hets}%s%s"EOLO,topname,domrec1,allstr);
}
else if(typechainfirstpass[level]=='W')
{
fprintf(fpoutput,"@group {%s H2O}%s%s"EOLO,topname,domrec1,allstr);
}
}
else
{
fprintf(fpoutput,"@group {%s}%s%s"EOLO,topname,extra,allstr);
}
strcpy(topnameold,topname);
ichainthispass = 1;
Ngroups = Ngroups + 1;
}/*no restrictions OR Lonlygroups where extra==dominant */
}/*expect more than one level*/
else if(Lallaminoacids && iresiduecnt == 2 && morsub == 1 && level == 1)
{/*special for sets of sidechain type*/
fprintf(fpoutput,"@group {sidechains}%s"EOLO,extra);
Ngroups = Ngroups + 1;
}
/*else if(Lallbases&&iresiduecnt >= 2 && morsub==1&&level==1)*//*001119*/
else if(Lallbases&&iresiduecnt >= 2)/*040406*/
{/*special for sets of base type (naba)*/
if(iresiduecnt==2){ basetype[0]='A';basetype[1]='\0';}
else if(iresiduecnt==3)
{ basetype[0]='T';basetype[1]='U';basetype[2]='\0';}
else if(iresiduecnt==4){ basetype[0]='G';basetype[1]='\0';}
else if(iresiduecnt==5){ basetype[0]='C';basetype[1]='\0';}
else if(iresiduecnt==6){ basetype[0]='?';basetype[1]='\0';}
fprintf(fpoutput,"@group {%s bases}%s"EOLO,basetype,domrec2);
/*040406 replace extra by domrec2*/
Ngroups = Ngroups + 1;
}
else if(!Lallaminoacids&&!Lallbases)
{/*default for single chain and/or nothing fancy*/
fprintf(fpoutput,"@group {%s}%s%s"EOLO,topname,extra,allstr);
strcpy(topnameold,topname);
ichainthispass = 1;
Ngroups = Ngroups + 1;
}
}/*write @group...*/
/*@group line output__________________________________________________________*/
Ltopout = 1; /*now past place for masters layout, etc. */
/*Next section goes through the possible list outputs */
/*master= {list type} generated and carried in variable called chain*/
/*when it is appropriate to have a master on an individual list*/
/*This can be over-ridden by speciallistmaster input from cmdline 040902*/
/*Presumably only used when only one type of list is generated, but does*/
/*provide for a different master button. e.g. can thus distinguish list*/
/*of bad rotamer sidechains from the list with all sidechains. */
if(Lonlygroups||Lonegroup||Lallbases)
{
if(Lspeciallistmaster){sprintf(chain," master= {%s}",speciallistmaster);}
else {sprintf(chain," master= {mainchain}");}
}
else chain[0] = '\0';
if(Listmc)
{/*mainchain*/
/*for Lonegroup there are masters on all lists*/
if(!Lonegroup && !Lnosubgroups) /*051129*/
{
if( (morsub==1&&level==1) || (level>1 && Lonesubunit == 0) )
{
if(Lnosubgroupmasters)
{
fprintf(fpoutput,"@subgroup {mainchain} dominant"EOLO);
}
else
{
fprintf(fpoutput,"@subgroup {mainchain} dominant"
" master= {subunit %d}"EOLO,level);
}
}
else
{
fprintf(fpoutput,"@subgroup {mainchain}"EOLO);
}
}
if(!Lballs && Listmcv)
{/*do main chain vectors first, so dots or croses will overlay them*/
sprintf(cntl,"mcv "); /*4 chars*/
sprintf(aname,"mc");
if(colormcvec[0]!='\0') {sprintf(kol,"%s",colormcvec);}
else if(level==1||level==8||level==15||level==22) /*041031 re colorset*/
{sprintf(kol,"white");}
else if(level==2||level==9||level==16||level==23)
{sprintf(kol,"yellowtint");}
else if(level==3||level==10||level==17||level==24)
{sprintf(kol,"peachtint");}
else if(level==4||level==11||level==18||level==25)
{sprintf(kol,"pinktint");}
else if(level==5||level==12||level==19||level==26)
{sprintf(kol,"lilactint");}
else if(level==6||level==13||level==20||level==27)
{sprintf(kol,"bluetint");}
else if(level==7||level==14||level==21||level==28)
{sprintf(kol,"greentint");}
else {sprintf(kol,"white");}
#ifdef OLDCODE
else if(level==1||level==6||level==11||level>15)
{sprintf(kol,"white");}
else if(level==2||level==7||level==12)
{sprintf(kol,"yellowtint");}
else if(level==3||level==8||level==13)
{sprintf(kol,"greentint");}
else if(level==4||level==9||level==14)
{sprintf(kol,"pinktint");}
else if(level==5||level==10||level==15)
{sprintf(kol,"bluetint");}
else {sprintf(kol,"white");}
#endif
Lvector = 1;
sprintf(extra,"%s%s",chain,offmc);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Listmcc) /*960809*/
{
sprintf(cntl,"mcc "); /*4 chars*/
sprintf(aname,"mc C");
sprintf(kol,"sea");
if(Ldotsonly) Lvector = 0;
else if(Lballs) Lvector = 3;
else Lvector = 1;
sprintf(extra," nobutton%s%s",chain,atoms);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Listmcn)
{
sprintf(cntl,"mcn "); /*4 chars*/
sprintf(aname,"mc N");
sprintf(kol,"sky");
if(Ldotsonly) Lvector = 0;
else if(Lballs) Lvector = 3;
else Lvector = 1;
sprintf(extra," nobutton%s%s",chain,atoms);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Listmco)
{
sprintf(cntl,"mco "); /*4 chars*/
sprintf(aname,"mc O");
sprintf(kol,"red");
if(Ldotsonly) Lvector = 0;
else if(Lballs) Lvector = 3;
else Lvector = 1;
sprintf(extra," nobutton%s%s",chain,atoms);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Listmcs)
{
sprintf(cntl,"mcs "); /*4 chars*/
sprintf(aname,"mc P");
sprintf(kol,"yellow");
if(Ldotsonly) Lvector = 0;
else if(Lballs) Lvector = 3;
else Lvector = 1;
sprintf(extra," nobutton%s%s",chain,atoms);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Lballs && Listmcv)
{/*do main chain vectors after, so MAGE knows balls need lines shortened*/
sprintf(cntl,"mcv "); /*4 chars*/
sprintf(aname,"mc");
if(colormcvec[0]!='\0') {sprintf(kol,"%s",colormcvec);}
else if(level==1||level==8||level==15||level==22) /*041031 re colorset*/
{sprintf(kol,"white");}
else if(level==2||level==9||level==16||level==23)
{sprintf(kol,"yellowtint");}
else if(level==3||level==10||level==17||level==24)
{sprintf(kol,"peachtint");}
else if(level==4||level==11||level==18||level==25)
{sprintf(kol,"pinktint");}
else if(level==5||level==12||level==19||level==26)
{sprintf(kol,"lilactint");}
else if(level==6||level==13||level==20||level==27)
{sprintf(kol,"bluetint");}
else if(level==7||level==14||level==21||level==28)
{sprintf(kol,"greentint");}
else {sprintf(kol,"white");}
#ifdef OLDCODE
else if(level==1||level==6||level==11||level>15)
{sprintf(kol,"white");}
else if(level==2||level==7||level==12)
{sprintf(kol,"yellowtint");}
else if(level==3||level==8||level==13)
{sprintf(kol,"greentint");}
else if(level==4||level==9||level==14)
{sprintf(kol,"pinktint");}
else if(level==5||level==10||level==15)
{sprintf(kol,"bluetint");}
else {sprintf(kol,"white");}
#endif
Lvector = 1;
sprintf(extra,"%s%s",chain,offmc);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Listmckc)
{/*CPK*/ /*960815*/
sprintf(cntl,"mckc"); /*4 chars*/
sprintf(aname,"mc C");
sprintf(kol,"green");
Lvector = 4;
if(Listmckh) sprintf(extra," radius= 1.74 nobutton%s%s",chain,cpks);
else sprintf(extra," radius= 1.9 nobutton%s%s",chain,cpks);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Listmckn)
{/*CPK*/ /*960815*/
sprintf(cntl,"mckn"); /*4 chars*/
sprintf(aname,"mc N");
sprintf(kol,"sky");
Lvector = 4;
if(Listmckh) sprintf(extra," radius= 1.54 nobutton%s%s",chain,cpks);
else sprintf(extra," radius= 1.7 nobutton%s%s",chain,cpks);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Listmcko)
{/*CPK*/ /*960815*/
sprintf(cntl,"mcko"); /*4 chars*/
sprintf(aname,"mc O");
sprintf(kol,"red");
Lvector = 4;
if(Listmckh) sprintf(extra," radius= 1.4 nobutton%s%s",chain,cpks);
else sprintf(extra," radius= 1.5 nobutton%s%s",chain,cpks);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Listmcks)
{/*CPK*/ /*051108 for PO4 of nucleic acids*/
sprintf(cntl,"mcks"); /*4 chars*/
sprintf(aname,"mc P");
sprintf(kol,"yellow");
Lvector = 4;
if(Listmckh) sprintf(extra," radius= 1.9 nobutton%s%s",chain,cpks);
else sprintf(extra," radius= 1.9 nobutton%s%s",chain,cpks);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Listmckh)
{/*CPK*/ /*960815*/
sprintf(cntl,"mckh"); /*4 chars*/
sprintf(aname,"mc H");
sprintf(kol,"white");
Lvector = 4;
sprintf(extra," radius= 1.2 nobutton%s%s%s",chain,cpks,hygen);
transferout(aname,cntl,kol,extra); /*.*/
}
if(Listhy)
{/*mc hydrogens*/
sprintf(cntl,"hymc"); /*4 chars*/
sprintf(aname,"mc H");
if(colorhyvec[0] != '\0') sprintf(kol,"%s",colorhyvec);
else sprintf(kol,"gray");
Lvector = 1;
if(Lhylens) sprintf(extra,"lens nobutton%s%s%s",chain,hygen,offhy);
else sprintf(extra," nobutton%s%s%s",chain,hygen,offhy);
transferout(aname,cntl,kol,extra); /*.*/
}/*mc hydrogens*/
}/*mainchain*/
chain[0] = '\0'; /*set default first, then check for alternatives*/
if(Lonlygroups || Lonegroup)
{
if(LtypeN)
{
sprintf(chain," master= {Virtual BB} ");
}
else
{
sprintf(chain," master= {Calphas} ");
}
}
if(Lallbases) sprintf(chain," master= {pseudo_mc} ");
if(Lspeciallistmaster){sprintf(chain," master= {%s}",speciallistmaster);}
if(Listca || Listtabl)
{/*ca-ca*/
/*if(Lnucleicacid) {sprintf(aname,"backbone");}*/
if(LtypeN) {sprintf(aname,"Virtual BB");}
else {sprintf(aname,"Calphas");}
if(colorcavec[0] != '\0') {sprintf(kol,"%s",colorcavec);}
else if(level==1||level==8||level==15||level==22) /*041031 re colorset*/
{sprintf(kol,"white");}
else if(level==2||level==9||level==16||level==23)
{sprintf(kol,"yellowtint");}
else if(level==3||level==10||level==17||level==24)
{sprintf(kol,"peachtint");}
else if(level==4||level==11||level==18||level==25)
{sprintf(kol,"pinktint");}
else if(level==5||level==12||level==19||level==26)
{sprintf(kol,"lilactint");}
else if(level==6||level==13||level==20||level==27)
{sprintf(kol,"bluetint");}
else if(level==7||level==14||level==21||level==28)
{sprintf(kol,"greentint");}
else {sprintf(kol,"white");}
if(Listca)
{/*one pass for Calphas*/
/*for Lonegroup there are masters on all lists*/
if(!Lonegroup && !Lnosubgroups) /*051129*/
{
if(!Listmc) {fprintf(fpoutput,"@subgroup {mainchain} "EOLO);}
}
sprintf(cntl,"ca "); /*4 chars*/
Lvector = 1;
if(Listmcv) {sprintf(extra," off %s",chain);}
else {sprintf(extra,"%s%s",chain,offca);} /*Calphas off if full mc vectors*/
transferout(aname,cntl,kol,extra); /*.*/
}
else
{/*Listtabl: 2 passes for Ltable control*/
if(MolNameStr[0] == '\0')
{fprintf(fpoutput,"@group {ROW %d} table header\n",level);}
else {fprintf(fpoutput,"@group {%s %d} table header\n",MolNameStr,level);}
sprintf(cntl,"tabh"); /*4 chars*/ /*991122*/
sprintf(extra,"%s",chain);
Lvector = 7; /*wordlist for table*/
transferout(aname,cntl,kol,extra); /*.*/
if(MolNameStr[0] == '\0')
{fprintf(fpoutput,"@group {ROW %d} table \n",level);}
else {fprintf(fpoutput,"@group {%s %d} table \n",MolNameStr,level);}
sprintf(cntl,"tabl"); /*4 chars*/ /*991122*/
sprintf(extra,"%s",chain);
Lvector = 7; /*wordlist for table*/
transferout(aname,cntl,kol,extra); /*.*/
}
}/*ca-ca*/
if(Lonlygroups||Lonegroup||Lallbases)
{
if(Lspeciallistmaster){sprintf(chain," master= {%s}",speciallistmaster);}
else {sprintf(chain," master= {mainchain}");}
}
else chain[0] = '\0';
if(Listhb)
{/*h-bonds*/
/*for Lonegroup there are masters on all lists*/