[med-svn] [suitename] 01/02: Imported Upstream version 0.3.070628
Andreas Tille
tille at debian.org
Wed Jul 22 08:34:19 UTC 2015
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository suitename.
commit 9b6123d2cd9b89c18b83645c67bc0c2db5151c54
Author: Andreas Tille <tille at debian.org>
Date: Wed Jul 22 10:32:51 2015 +0200
Imported Upstream version 0.3.070628
---
0.3.070525 | 1 +
Makefile | 37 +++
Makefile.linux | 34 +++
Makefile.macOSX | 37 +++
suitename.c | 830 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
suitename.h | 79 ++++++
suitenhead.h | 79 ++++++
suiteninit.c | 255 +++++++++++++++++
suiteninit.h | 396 +++++++++++++++++++++++++++
suiteninpt.c | 518 +++++++++++++++++++++++++++++++++++
suiteninpt.h | 34 +++
suitenout.c | 605 +++++++++++++++++++++++++++++++++++++++++
suitenout.h | 54 ++++
suitenscrt.c | 131 +++++++++
suitenscrt.h | 32 +++
suitenutil.c | 157 +++++++++++
suitenutil.h | 18 ++
17 files changed, 3297 insertions(+)
diff --git a/0.3.070525 b/0.3.070525
new file mode 100644
index 0000000..856b613
--- /dev/null
+++ b/0.3.070525
@@ -0,0 +1 @@
+suitename.0.2.070524
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1c6c9e9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,37 @@
+# suitename
+
+ifeq ($(MAKECMDGOALS),debug)
+ CFLAGS = -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
+else
+ CFLAGS = -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
+endif
+
+LIBS = -lm -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
+
+# ---------------------------------------------------------------------
+PROG_FLGS =
+OBJS = suitename.o suitenscrt.o suiteninit.o suiteninpt.o \
+ suitenout.o suitenutil.o
+
+# ---------------------------------------------------------------------
+HEADERS = suitename.h suitenscrt.h suitenutil.h suiteninit.h suiteninpt.h \
+ suitenout.h
+
+suitename: $(OBJS)
+ cc -o suitename $(CFLAGS) $(OBJS) $(LIBS)
+
+debug: $(OBJS)
+ cc -o suitename $(CFLAGS) $(OBJS) $(LIBS)
+
+clean:
+ rm -f *.o
+# ------------------------------------------------------------------------
+# Dependencies (presume .o<-.c by standard cc compiler)
+
+suitename.o: $(HEADERS)
+suiteninit.o: $(HEADERS)
+suitenscrt.o: $(HEADERS)
+suiteninpt.o: $(HEADERS)
+suitenout.o: $(HEADERS)
+suitenutil.o: $(HEADERS)
+
diff --git a/Makefile.linux b/Makefile.linux
new file mode 100644
index 0000000..a87c3e1
--- /dev/null
+++ b/Makefile.linux
@@ -0,0 +1,34 @@
+# suitename
+
+ifeq ($(MAKECMDGOALS),debug)
+CFLAGS = -g
+else
+CFLAGS =
+endif
+
+LIBS = -lm
+
+# ---------------------------------------------------------------------
+
+OBJS = suitename.o suitenscrt.o suiteninit.o suiteninpt.o suitenout.o suitenutil.o
+
+# ---------------------------------------------------------------------
+HEADERS = suitename.h suitenscrt.h suitenutil.h suiteninit.h suiteninpt.h suitenout.h
+suitename: $(OBJS)
+ cc -o suitename $(CFLAGS) $(OBJS) $(LIBS)
+
+debug: $(OBJS)
+ cc -o suitename $(CFLAGS) $(OBJS) $(LIBS)
+
+clean:
+ rm -f *.o
+# ------------------------------------------------------------------------
+# Dependencies (presume .o<-.c by standard cc compiler)
+
+suitename.o: $(HEADERS)
+suiteninit.o: $(HEADERS)
+suitenscrt.o: $(HEADERS)
+suiteninpt.o: $(HEADERS)
+suitenout.o: $(HEADERS)
+suitenutil.o: $(HEADERS)
+
diff --git a/Makefile.macOSX b/Makefile.macOSX
new file mode 100644
index 0000000..1c6c9e9
--- /dev/null
+++ b/Makefile.macOSX
@@ -0,0 +1,37 @@
+# suitename
+
+ifeq ($(MAKECMDGOALS),debug)
+ CFLAGS = -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
+else
+ CFLAGS = -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
+endif
+
+LIBS = -lm -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
+
+# ---------------------------------------------------------------------
+PROG_FLGS =
+OBJS = suitename.o suitenscrt.o suiteninit.o suiteninpt.o \
+ suitenout.o suitenutil.o
+
+# ---------------------------------------------------------------------
+HEADERS = suitename.h suitenscrt.h suitenutil.h suiteninit.h suiteninpt.h \
+ suitenout.h
+
+suitename: $(OBJS)
+ cc -o suitename $(CFLAGS) $(OBJS) $(LIBS)
+
+debug: $(OBJS)
+ cc -o suitename $(CFLAGS) $(OBJS) $(LIBS)
+
+clean:
+ rm -f *.o
+# ------------------------------------------------------------------------
+# Dependencies (presume .o<-.c by standard cc compiler)
+
+suitename.o: $(HEADERS)
+suiteninit.o: $(HEADERS)
+suitenscrt.o: $(HEADERS)
+suiteninpt.o: $(HEADERS)
+suitenout.o: $(HEADERS)
+suitenutil.o: $(HEADERS)
+
diff --git a/suitename.c b/suitename.c
new file mode 100644
index 0000000..759c8c6
--- /dev/null
+++ b/suitename.c
@@ -0,0 +1,830 @@
+/* suitename.c */
+/*****************************************************************/
+/* NOTICE: This is free software and the source code is freely */
+/* available. You are free to redistribute or modify under the */
+/* conditions that (1) this notice is not removed or modified */
+/* in any way and (2) any modified versions of the program are */
+/* also available for free. */
+/* ** Absolutely no Warranty ** */
+/* Copyright (C) 2007 David C. Richardson */
+/*****************************************************************/
+
+#define EXTERN
+ /* that is, EXTERN is defined, so suitename.h will do main declarations*/
+#include "suitename.h"
+#undef EXTERN
+
+#include "suitenscrt.h"
+#include "suitenutil.h"
+#include "suiteninit.h"
+#include "suiteninpt.h"
+#include "suitenout.h"
+
+/*0.2.070524 preserve chi-1 and chi, so could preserve eta, theta */
+/*0.2.070525 general read dangle record for, e.g., eta, theta */
+/*0.2.070628 triage reports zeta-1, epsilon-1, delta-1,... Ltriage codes */
+
+/****main()*******************************************************************/
+main(int argc, char** argv)
+{
+ int LOK=1,ibin=0,jclst=0;
+ char sour[32];
+ float suiteness=0, distance=0;
+ char ptmaster[4];
+ char ptcolor[16];
+
+ int i=0,j=0,k=0,m=0;
+
+ ptcolor[0] = '\0'; /*default is no point color*/
+ ptmaster[0] = '\0'; /*default is no point master*/
+
+
+ sprintf(version,"suitename.0.3.070628 "); /* VERSION */
+
+ /* default values before parsecommandline */
+ Ltest = 0; /*compile in... */
+ Ltestout = 0; /*commandline -test */
+ fpin = stdin;
+ fpout = stdout;
+
+ /*NOTE: for consistency, edit defaults text in usageout() */
+ Lreportout = 1; /* suite by suite suiteness report, & summary */
+ Lchart = 0; /* summary-less report for MolProbity multichart 070521*/
+ Ldangle = 0; /* read straight dangle records 070525*/
+ Lsourout = 0; /* extra info in kinemage ptIDs. optional as of 070524*/
+ Letatheta = 0; /* theta,eta instead of chi-1,chi kinemage angles 070524*/
+ Lkinemageout=0; /* kinemage of the clusters */
+ Lstringout = 0; /* 3 char string instead of cluster kinemage */
+ Lsuitesin=0;
+ Lresiduesin=1;
+ NptIDfields=6; /*for dangle residue input*/
+ Nanglefields=9; /*for 9D kinemage edited suite input*/
+ Lnewfile=0;
+ Lhelpout=0;
+ Lchangesout=0;
+ NameStr[0] = '\0';
+ Lgeneralsatw = 0; /*flag for special general case satellite widths 070328*/
+ Lwannabe = 1;/* -wannabe input flag 070429, default 070525, else -nowannabe*/
+
+ Lsequence = 1; /*output 1 letter Base code sequence part of string 070409*/
+ Loverlap = 0; /*overlap string lines, e.g. 1-20, 11-30, 21-40, ... 070409*/
+ Loneline = 0; /*string output all as oneline 070409*/
+
+ if(argc > 1)
+ {
+ LOK = parsecommandline(&argc, argv);
+ }
+ if(LOK)
+ {/*command OK*/
+ inittextblock(&mainscratch); /*__open scratch "tapes" */
+ /*--rewind scratch "tapes", inplicit with inittextblock() */
+ /*--allocation of space automatic when attempting write*/
+
+ newresidueptr = (residuestruct*)malloc(sizeof(struct residuestruct));
+ oldresidueptr = (residuestruct*)malloc(sizeof(struct residuestruct));
+ suiteptr = (suitestruct*)malloc(sizeof(struct suitestruct));
+ if( newresidueptr != NULL
+ && oldresidueptr != NULL
+ && suiteptr != NULL
+ ) {LOK=1;}
+ else {LOK=0;}
+
+ if(LOK)
+ {/*storage allocated*/
+ LOK = initializations(); /*070325*/
+ if(LOK)
+ {/*LOK to work*/
+
+ clearnewresidue(); /*only at beginning so first-1 handled correctly*/
+/*sudo pre-Algorithm: accummulate suites or suites from residues */
+ while(!LatEOF) /*allow EOF on end of last line, see Lhitend */
+ {/*loop over all residues in the file*/
+/*
+if(Lresiduesin)
+{
+fprintf(stderr,"LOOP:newresidue:");
+for(j=0;j<10;j++) fprintf(stderr,"%s,",newresidueptr->ptID[j]);
+fprintf(stderr,";%s;",newresidueptr->basechr);
+fprintf(stderr,"%8.3f ",newresidueptr->alpha);
+fprintf(stderr,"%8.3f ",newresidueptr->beta);
+fprintf(stderr,"%8.3f ",newresidueptr->gamma);
+fprintf(stderr,"%8.3f ",newresidueptr->delta);
+fprintf(stderr,"%8.3f ",newresidueptr->epsilon);
+fprintf(stderr,"%8.3f ",newresidueptr->zeta);
+fprintf(stderr,"\n");
+}
+*/
+ if(Lsuitesin) {LOK = getsuite();}
+ else {LOK = getresidue(); Lresiduesin = 1;}
+ if(LOK)
+ {
+ if(Lresiduesin) {LOK = loadsuite();}
+ if(LOK)
+ {
+ LOK = confirmsuite();
+ if(!LOK)
+ {
+ ibin = 13; /*angles not fully specified*/
+ jclst = 0; /*cluster not assigned in dummy bin*/
+ sprintf(sour," tangled "); /*suite incomplete angles*/
+ writesuite(ibin,jclst,sour,distance,suiteness,ptmaster,ptcolor);
+ /*binname "inc " clustername "__" 070414 */
+ }
+ else /*now have to do some work*/
+ {
+/*sudo Algorithm */
+/*sudo FOR all RNA suites si in S */
+ /*sudo program body: evaluate suite, cluster membership */
+
+ ibin = evaluatesuite();
+
+ if(ibin > 0){membership(ibin);}
+
+ }
+ }/*loaded suite*/
+ }/*got a residue (or a suite from a kinemage)*/
+ }/*loop over all residues in the file*/
+
+ writeoutput(); /*has logicals for what output possible*/
+
+ }/*LOK to work*/
+ }/*storage allocated*/
+ }/*command OK*/
+ else
+ {
+ if(Lkinemageout) /*dump of actual cluster information 070421*/
+ {
+ initializations();
+ L33out = L32out = L23out = L22out = 1;
+ for(i=1; i<=12; i++)
+ {
+ binout[i]=1;
+ /*for(j=1; j<ddgmax; j++)*/
+ j=0; /*zeroth cluster of a bin holds its outliers*/
+ while(bin[i].clst[j].LOK || j==0) /*070429*/
+ {
+ clusterout[i][j] = 1;
+ j++;
+ }
+ }
+ writeoutput();
+ }
+ else if(Ltestout) /*test of alternate storage of cluster info 070421*/
+ { /*brute force show what is in the suiteninit.h defined arrays */
+ for(i=0; i<14; i++)
+ {
+ for(j=0; j<MAXCLST; j++) /*stupidly loop over whole array*/
+ {
+ if(bin[i].clst[j].LOK) /*however, only take defined clusters*/
+ {
+ fprintf(stderr,"%s %s :%d: %s %s %s: "
+ "%7.3f %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n"
+ ,bin[i].binname
+ ,bin[i].clst[j].clustername
+ ,bin[i].clst[j].LOK
+ ,bin[i].clst[j].status
+ ,bin[i].clst[j].clustercolor
+ ,bin[i].clst[j].domsatness
+ ,bin[i].clst[j].ang[1]
+ ,bin[i].clst[j].ang[2]
+ ,bin[i].clst[j].ang[3]
+ ,bin[i].clst[j].ang[4]
+ ,bin[i].clst[j].ang[5]
+ ,bin[i].clst[j].ang[6]
+ ,bin[i].clst[j].ang[7]
+ );
+ }
+ }
+ }
+ /*format spacings for output layout columns: */
+ fprintf(stderr,"triage axes limits version: %s\n",axeslimitsversion);
+ fprintf(stderr,"epsilonmin %.0f, epsilonmax %.0f\n",epsilonmin,epsilonmax);
+ fprintf(stderr,"delta3min %.0f, delta3max %.0f\n",delta3min,delta3max);
+ fprintf(stderr,"delta2min %.0f, delta2max %.0f\n",delta2min,delta2max);
+ fprintf(stderr,"gammapmin %.0f, gammapmax %.0f\n",gammapmin,gammapmax);
+ fprintf(stderr,"gammatmin %.0f, gammatmax %.0f\n",gammatmin,gammatmax);
+ fprintf(stderr,"gammammin %.0f, gammammax %.0f\n",gammammin,gammammax);
+ fprintf(stderr,"alphamin %.0f, alphamax %.0f\n",alphamin,alphamax);
+ fprintf(stderr,"betamin %.0f, betamax %.0f\n",betamin,betamax);
+ fprintf(stderr,"zetamin %.0f, zetamax %.0f\n",zetamin,zetamax);
+ fprintf(stderr,"cluster half-widths, & special satellite widths");
+ fprintf(stderr," version: %s\n",clusterhalfwidthsversion);
+ fprintf(stderr,"deltamw %.0f\n",deltamw);
+ fprintf(stderr,"epsilonw %.0f, epsilonsatw %.0f\n",epsilonw,epsilonsatw);
+ fprintf(stderr,"zetaw %.0f, zetasatw %.0f\n",zetaw,zetasatw);
+ fprintf(stderr,"alphaw %.0f, alphasatw %.0f\n",alphaw,alphasatw);
+ fprintf(stderr,"betaw %.0f, betasatw %.0f\n",betaw,betasatw);
+ fprintf(stderr,"gammaw %.0f\n",gammaw);
+ fprintf(stderr,"deltaw %.0f\n",deltaw);
+
+ for(k=0; k<MAXSAT; k++)
+ {
+ if(satinfo[k].name[0] != '\0')
+ {
+ fprintf(stderr,"satellite: %s, satw: ",satinfo[k].name);
+ for(m=1; m<8; m++)
+ {
+ fprintf(stderr,"%3.0f ",satinfo[k].satw[m]);
+ }
+ fprintf(stderr,", domw: ");
+ for(m=1; m<8; m++)
+ {
+ fprintf(stderr,"%3.0f ",satinfo[k].domw[m]);
+ }
+ fprintf(stderr,": %s\n",satinfo[k].doma);
+ }
+ }
+ }
+ else /*Lhelpout*/
+ {
+ usageout();
+ }
+ }
+ exit(0);
+}
+/*___main()__________________________________________________________________*/
+
+/****evaluatesuite()**********************************************************/
+int evaluatesuite(void)
+{
+ int ibin=0; /* 0 for no bin assignment*/
+ int jclst=0; /* 0 for no cluster assignment, i.e. for triaged suite*/
+ char sour[32]; /*flag type of non-suiteness */
+ int LOK=1; /*presume OK */
+ int puckerdm=0,puckerd=0;
+ char gammaname=' ';
+ float suiteness=0, distance=0;
+ int ddg=0; /*deltam,delta,gamma 12 group numbers */
+ char ptmaster[4];
+ char ptcolor[16];
+
+ /*enters with LOK = 1 */
+ Ltriage=0; Liswannabe=0; Lcomment=0; /*reset flags 070521,070525,070628*/
+ ptcolor[0] = '\0'; /*default is no point color*/
+ ptmaster[0] = '\0'; /*default is no point master*/
+
+ sour[0] = '\0'; /* flagless */
+
+ /*sudo program body: evaluate suite is a decision cascade*/
+ /*sudo order important, epsilon and delta triage faulty pucker */
+
+ if(LOK) /*------ filter on epsilon -----------------------------*/
+ {
+ /*sudo IF si(e) < e_min OR si(e) > e_max */
+ /*sudo THEN s_bini = e_triage AND !OK */
+
+ if(suiteptr->epsilon < epsilonmin || suiteptr->epsilon > epsilonmax)
+ { sprintf(sour," e out "); LOK = 0;
+ Ltriage = EPSILONM; sprintf(ptmaster,"'E'");}
+ }
+ if(LOK) /*------ filter on delta minus 1 -----------------------*/
+ {
+ /*sudo IF OK AND si(dm) >= d3_min AND si(dm) <= d3_max */
+ /*sudo THEN s_dm = 3 AND OK */
+ /*sudo ELSE IF OK AND si(dm) >= d2_min AND si(dm) <= d2_max */
+ /*sudo THEN s_dm = 2 AND OK */
+ /*sudo ELSE s_bini = dm_triage AND !OK */
+
+ if(suiteptr->deltam >= delta3min && suiteptr->deltam <= delta3max)
+ { puckerdm = 3; LOK = 1; }
+ else if(suiteptr->deltam >= delta2min && suiteptr->deltam <= delta2max)
+ { puckerdm = 2; LOK = 1; }
+ else
+ { puckerdm = 0; sprintf(sour," bad deltam "); LOK = 0;
+ Ltriage = DELTAM; sprintf(ptmaster,"'D'");}
+ }
+ if(LOK) /*------ filter on delta -----------------------*/
+ {
+ /*sudo IF OK AND si(d) >= d3_min AND si(d) <= d3_max */
+ /*sudo THEN s_d = 3 AND OK */
+ /*sudo ELSE IF OK AND si(d) >= d2_min AND si(d) <= d2_max */
+ /*sudo THEN s_d = 2 AND OK */
+ /*sudo ELSE s_bini = d_triage AND !OK */
+
+ if(suiteptr->delta >= delta3min && suiteptr->delta <= delta3max)
+ { puckerd = 3; LOK = 1; }
+ else if(suiteptr->delta >= delta2min && suiteptr->delta <= delta2max)
+ { puckerd = 2; LOK = 1; }
+ else
+ { puckerd = 0; sprintf(sour," bad delta "); LOK = 0;
+ Ltriage = DELTA; sprintf(ptmaster,"'D'");}
+ if(LOK)
+ {/*both deltas in range*/
+ sprintf(sour," %1d%1d delta ",puckerdm,puckerd);
+ }
+ }
+ if(LOK) /*------ filter on gamma -----------------------*/
+ {
+ /*sudo IF OK AND si(g) >= gp_min AND si(g) <= gp_max */
+ /*sudo THEN s_g = p AND OK */
+ /*sudo ELSE IF OK AND si(g) >= gt_min AND si(g) <= gt_max */
+ /*sudo THEN s_g = t AND OK */
+ /*sudo ELSE IF OK AND si(g) >= gm_min AND si(g) <= gm_max */
+ /*sudo THEN s_g = m AND OK */
+ /*sudo ELSE s_bini = g_triage AND !OK */
+
+ if(suiteptr->gamma >= gammapmin && suiteptr->gamma <= gammapmax)
+ { gammaname = 'p'; LOK = 1; }
+ else if(suiteptr->gamma >= gammatmin && suiteptr->gamma <= gammatmax)
+ { gammaname = 't'; LOK = 1; }
+ else if(suiteptr->gamma >= gammammin && suiteptr->gamma <= gammammax)
+ { gammaname = 'm'; LOK = 1; }
+ else
+ { gammaname = 'o'; LOK = 0; sprintf(sour," g out ");
+ Ltriage = GAMMA; sprintf(ptmaster,"'T'");}
+ }
+ if(LOK) /*------ filter on alpha -----------------------*/
+ {
+ /*sudo IF OK AND si(a) >= a_min AND si(a) <= a_max */
+ /*sudo THEN OK */
+ /*sudo ELSE s_bini = a_triage AND !OK */
+
+ if(suiteptr->alpha >= alphamin && suiteptr->alpha <= alphamax)
+ {LOK = 1; }
+ else
+ {LOK = 0; sprintf(sour," a out ");
+ Ltriage = ALPHA; sprintf(ptmaster,"'T'");}
+ }
+ if(LOK) /*------ filter on beta -----------------------*/
+ {
+ /*sudo IF OK AND si(b) >= b_min AND si(b) <= b_max */
+ /*sudo THEN OK */
+ /*sudo ELSE s_bini = b_triage AND !OK */
+
+ if(suiteptr->beta >= betamin && suiteptr->beta <= betamax)
+ {LOK = 1; }
+ else
+ {LOK = 0; sprintf(sour," b out ");
+ Ltriage = BETA; sprintf(ptmaster,"'T'");}
+ }
+ if(LOK) /*------ filter on zeta -----------------------*/
+ {
+ /*sudo IF OK AND si(z) >= z_min AND si(z) <= z_max */
+ /*sudo THEN OK */
+ /*sudo ELSE s_bini = z_triage AND !OK */
+
+ if(suiteptr->zeta >= zetamin && suiteptr->zeta <= zetamax)
+ {LOK = 1; }
+ else
+ {LOK = 0; sprintf(sour," z out ");
+ Ltriage = ZETAM; sprintf(ptmaster,"'T'");}
+ }
+
+ ddg = 0; /*NO bin assigned yet...*/
+ /*sudo IF OK ASSIGN s_bini to one of 12 delta,delta,gamma bins */
+ if(LOK) /*------ categorize as one of the 12 ddg groups ------*/
+ {/*OK to place in one of the 12 bins*/
+ /* ddg */
+ /* 0 out */
+ /* 33 123 ptm */
+ /* 32 456 ptm */
+ /* 23 789 ptm */
+ /* 22 ABC ptm */
+
+
+ /*sudo IF s_dm == 3 */
+ if (puckerdm == 3)
+ {
+ /*sudo IF s_d == 3 */
+ if (puckerd == 3)
+ {
+ L33out = 1;
+ /*sudo IF s_g == p THEN s_bini = 33p */
+ if (gammaname == 'p') {ddg = 1; binout[ddg] = 1;}
+ /*sudo ELSE IF s_g == t THEN s_bini = 33t */
+ else if(gammaname == 't') {ddg = 2; binout[ddg] = 1;}
+ /*sudo ELSE IF s_g == m THEN s_bini = 33m */
+ else if(gammaname == 'm') {ddg = 3; binout[ddg] = 1;}
+ }
+ /*sudo ELSE IF s_d == 2 */
+ else if(puckerd == 2)
+ {
+ L32out = 1;
+ /*sudo IF s_g == p THEN s_bini = 32p */
+ if (gammaname == 'p') {ddg = 4; binout[ddg] = 1;}
+ /*sudo ELSE IF s_g == t THEN s_bini = 32t */
+ else if(gammaname == 't') {ddg = 5; binout[ddg] = 1;}
+ /*sudo ELSE IF s_g == m THEN s_bini = 32m */
+ else if(gammaname == 'm') {ddg = 6; binout[ddg] = 1;}
+ }
+ }
+ /*sudo ELSE IF OK AND s_dm == 2 */
+ else if(puckerdm == 2)
+ {
+ /*sudo IF s_d == 3 */
+ if (puckerd == 3)
+ {
+ L23out = 1;
+ /*sudo IF s_g == p THEN s_bini = 23p */
+ if (gammaname == 'p') {ddg = 7; binout[ddg] = 1;}
+ /*sudo ELSE IF s_g == t THEN s_bini = 23t */
+ else if(gammaname == 't') {ddg = 8; binout[ddg] = 1;}
+ /*sudo ELSE IF s_g == m THEN s_bini = 23m */
+ else if(gammaname == 'm') {ddg = 9; binout[ddg] = 1;}
+ }
+ /*sudo ELSE IF s_d == 2 */
+ else if(puckerd == 2)
+ {
+ L22out = 1;
+ /*sudo IF s_g == p THEN s_bini = 22p */
+ if (gammaname == 'p') {ddg = 10; binout[ddg] = 1;}
+ /*sudo ELSE IF s_g == t THEN s_bini = 22t */
+ else if(gammaname == 't') {ddg = 11; binout[ddg] = 1;}
+ /*sudo ELSE IF s_g == m THEN s_bini = 22m */
+ else if(gammaname == 'm') {ddg = 12; binout[ddg] = 1;}
+
+ }
+ }
+ sprintf(sour," ddg== %2d ",ddg);
+ }/*OK to place in one of the 12 bins*/
+ else
+ {/*culled by single angle triage*/
+
+ /*sudo ELSE {s_bini already set to be some kind of triage} */
+
+ Ltriageout = 1;
+ binout[0] = 1;
+ ibin = 0;
+ jclst = 0;
+ suiteness = 0; /*ibin,jclst,suiteness default to zero anyway*/
+ clusterout[0][0] = 1; /*triage bin, cluster number 0 */
+ writesuite(ibin,jclst,sour,distance,suiteness,ptmaster,ptcolor);
+ /*binname "trig" clustername "!!" 070414 */
+ }
+ return(ddg); /* ddg is the ibin number! */
+}
+/*___evaluatesuite()_________________________________________________________*/
+
+/****membership()*************************************************************/
+void membership(int ibin)
+{
+ int i=0,j=0,k=0,minj=0,matchcnt=0,domj=0,thej=0;
+ float dsq = 0, del = 0, distance = 0, mindistance = 999;
+ float disttodom=0, disttosat=0, thedist=0;
+ float penmindist = 999;
+ float pi = 3.14159;
+ float suiteness=0;
+ char sour[96],sourness[32]; /*070311 accum report*/
+ int Ldominant=0;
+ int LOK = 0;
+ float sattodom[8], domtosat[8],sattopt[8],domtopt[8];
+ char ptmaster[4];
+ int closestj = 0, nextclosej=0;
+ float closestd = 999, nextclosed = 999;
+ char ptcolor[16];
+ int Lassigned = 0; /*070430 status of this point...*/
+
+ ptcolor[0] = '\0'; /*default is no point color*/
+ sour[0] = '\0'; /*extra comment in outputed ptID*/
+ sourness[0] = '\0'; /*extra comment in outputed ptID*/
+ ptmaster[0] = '\0'; /*default is no point master*/
+
+ clearmatches();
+
+ matchcnt = 0;
+ i = ibin;
+
+ /*sudo */
+ /*sudo program body: cluster membership in assigned s_bini */
+
+ /*logic: find all clusters in this bin that match this conformation*********/
+
+ /*bin[].clst[].ang working-arrays count from 1 for known clusters*/
+
+ /* some bins have a major cluster with satellites */
+ /*--first clear the flags */
+ domj = 0; /*default, no dominant cluster in the bin*/
+ Ldominant = 0; /*conformation close to a major (dominant) cluster*/
+
+ mindistance = 999; /*especially note closest cluster*/
+ closestd = 999;
+
+ /*sudo FOR each cluster cj in this delta,delta,gamma bin */
+ /*for(j=1; j<=ddgcnt[i]; j++)*/
+ j = 1; /*start with index 1 for first observed clst in this bin 070428*/
+
+ while(bin[i].clst[j].LOK) /*070428*/
+ {/*loop over all observed clusters in this ith bin*/
+ if( !Lwannabe
+ && strcmp(bin[i].clst[j].status,"wannabe")==0) {j++;continue;}/*match*/
+ /*empty bin dummy cluster at 0,0,0,0,0,0,0 is out of angle range*/
+ /*but safer to explicity skip*/
+ /*if(i==3 || i==9){continue;} not needed 070428*/
+
+ /*sudo COMPUTE d=scaled 4D distance of si to cj (epsilon,zeta,alpha,beta)*/
+
+ resetcoordw(coordw,i,j,Lgeneralsatw); /*revert to general defaults*/
+ /*insert this resetcoordw() here 070414 */
+ distance = hyperellipsoiddist(i,j,4,coordw);
+ /*4D scaled, normalized distance*/
+ if(distance < closestd) /*070311*/
+ {
+ closestd = distance;
+ closestj = j;
+ }
+
+ if(distance >= 0) /* store all distances, needed for diagnostics */
+ {
+ matches[i][j] = distance;
+ /*sudo IF 0 <= d < 1 THEN */
+ if(distance < 1) /* suite could be a member of this cluster */
+ { /*APPEND to list of clusters of which suite could be a member*/
+ /*sudo APPEND cj to s_list_ci */
+ /*sudo FLAG when possible_cluster is a dominant_cluster */
+
+ matchcnt++; /*only count possible clusters*/
+ /*if(j== domj) {Ldominant = 1;}*/
+ if(strcmp(bin[i].clst[j].domsatness,"dom")==0) /*match 070429*/
+ {
+ domj = j; /*this j is a dominant cluster*/
+ Ldominant = 1; /*there is a close dominant cluster to consider*/
+ }
+ }
+ /*sudo END IF */
+ /*sudo FLAG closest_cluster */
+ if(distance < mindistance)
+ {
+ mindistance = distance;
+ minj = j;
+ }
+ }
+ j++; /*increment index for next cycle...*/
+ }/*loop over all clusters in this ith bin*/
+ /*sudo END FOR each cluster cj in this delta,delta,gamma bin */
+
+ /*now find the next closest cluster (for debugging purposes)*/
+ nextclosed = 999; /*next closest cluster*/
+
+ j = 1; /*start with index 1 for first observed clst in this bin 070428*/
+ while(bin[i].clst[j].LOK) /*070428*/
+ {/*loop over all clusters in this ith bin*/
+ if( !Lwannabe
+ && strcmp(bin[i].clst[j].status,"wannabe")==0) {j++;continue;}/*match*/
+ if(matches[i][j] < nextclosed && j != closestj)
+ {
+ nextclosed = matches[i][j];
+ nextclosej = j;
+ }
+ j++; /*increment index for next cycle...*/
+ }/*loop over all clusters in this ith bin*/
+
+ /*end logic: find all clusters that match this conformation_______________*/
+
+ /*now assign suite to a particular cluster*/
+ Lassigned = 0;
+
+ /*sudo */
+ /*sudo IF |s_list_ci| == 1 THEN */
+ if(matchcnt == 1)
+ { /*output the only distance match*/
+
+ /*sudo ASSIGN s_cluster = cj in s_list_ci */
+
+ thej = minj; /*cluster number in this bin*/
+ Lassigned = 1;
+ sprintf(sourness,"%d-only-one",matchcnt);
+ thedist = matches[ibin][thej];
+ }
+ /*sudo ELSE IF |s_list_ci| > 1 THEN */
+ else if(matchcnt > 1 )
+ {/*suite close to more than one cluster*/
+
+ /*sudo IF all cj in s_list_ci are not dominant THEN */
+ if(!Ldominant) /*dominant_cluster is not a member of possible_clusters */
+ { /*output the minimum distance match*/
+
+ /*sudo ASSIGN s_cluster = cj in s_list_ci minimizing d */
+
+ thej = minj; /*cluster number in this bin*/
+ Lassigned = 1;
+ sprintf(sourness,"%d-none-dom",matchcnt);
+ }
+
+ /*sudo ELSE IF s_list_ci contains a dominant cj THEN */
+ else if(Ldominant)
+ {/*match dominant cluster and highest quality other cluster*/
+
+ /*sudo ASSIGN domj = dominant cj in s_list_ci */
+ /*sudo ASSIGN thej = cj in s_list_ci minimizing d for all non-dominant cj in s_list_ci */
+
+ penmindist = 999;
+
+ j = 1;/*start with index 1 for first observed clst in this bin 070428*/
+ while(bin[i].clst[j].LOK) /*070428*/
+ {/*loop over all clusters in this ith bin*/
+ if( !Lwannabe
+ && strcmp(bin[i].clst[j].status,"wannabe")==0) {j++;continue;}
+
+ if( ( strcmp(bin[i].clst[j].domsatness,"dom")!=0 )/*i.e. NOT dom*/
+ && (matches[i][j] < penmindist))
+ {/*find shortest distance to non-dominant and satellite clusters*/
+ penmindist = matches[i][j];
+ thej = j; /*j index of closest other cluster*/
+ }
+ j++; /*increment index for next cycle...*/
+ }
+
+ /*distinguish best match cluster as satellite or just another cluster*/
+ /*this bin has a dominant cluster and thus satellite clusters*/
+
+ /*sudo IF thej is a satellite of domj THEN */
+
+ if( strcmp(bin[i].clst[thej].domsatness,"sat")==0 )/*i.e. matches sat*/
+ { /*the other cluster is a satellite cluster*/
+ /*point close to both a satellite and the dominant cluster*/
+
+ /*NEED TO KNOW IF INBETWEEN DOMINANT AND SATELLITE CLUSTERS*/
+
+ /*if dotproducts both positive, then inbetween*/
+ /* p p */
+ /* dom/___sat and dom___\sat */
+
+ vector7ab(domtopt, bin[i].clst[domj].ang, suiteptr->ang);
+
+ vector7ab(sattopt, bin[i].clst[thej].ang, suiteptr->ang);
+
+ vector7ab(domtosat, bin[i].clst[domj].ang, bin[i].clst[thej].ang);
+
+ vector7ab(sattodom, bin[i].clst[thej].ang, bin[i].clst[domj].ang);
+
+ /*sudo IF si is located between the means of thej and domj THEN */
+ if( (dotproduct(domtopt,domtosat,4) > 0)
+ &&(dotproduct(sattopt,sattodom,4) > 0) )
+ {/*pt between dom and sat*/
+
+ /*sudo CALCULATE rescaled distances d* of si to thej and domj */
+ /*sudo ASSIGN s_clusteri = thej or domj minimizing rescaled distance d* */
+
+ /*recalc distances to dominant cluster and to satellite cluster*/
+ /*considering different weights between special cluster pairs */
+ resetcoordw(dominantw, i,domj,0); /*set to dominant widths*/
+ resetcoordw(satellitew,i,thej,Lgeneralsatw);
+ /*set to satellite widths, using Lgeneralsatw 070414*/
+ assignweights(i,thej,dominantw,satellitew);
+ /*special widths for this satellite: weight dom--sat pair*/
+/*
+fprintf(stderr,"satj: %d satw: ",thej);
+for(k=1; k<=7; k++) {fprintf(stderr,"%3.0f ",satellitew[k]);}
+fprintf(stderr,", domj: %d domw: ",domj);
+for(k=1; k<=7; k++) {fprintf(stderr,"%3.0f ",dominantw[k]);}
+fprintf(stderr,"\n");
+*/
+ disttodom = hyperellipsoiddist(i,domj,4,dominantw);
+ disttosat = hyperellipsoiddist(i,thej,4,satellitew);
+
+ if(disttosat <= disttodom) {thej = thej;} /*bookkeeping*/
+ else {thej = domj;} /*in effect, the default*/
+ Lassigned = 1;
+ sprintf(sourness,"%d-BETWEEN-dom-sat(%7.3f|%7.3f)"
+ ,matchcnt,disttodom,disttosat);
+ }/*pt between dom and sat*/
+ /*sudo ELSE (not between the means of thej and domj) */
+ else
+ {/*pt NOT inbetween*/
+ /*just assign by closest standard distance evaluation*/
+
+ /*sudo ASSIGN s_clusteri = thej or domj minimizing d */
+
+ if(matches[i][domj] < matches[i][thej]) {thej = domj;}
+ Lassigned = 1;
+ sprintf(sourness,"%d-OUTSIDE-dom-sat",matchcnt);
+ }/*pt NOT inbetween*/
+ /*sudo END IF (between or not between satellite and dominant) */
+
+ }/*point close to both a satellite and the dominant cluster*/
+
+ /*sudo ELSE (thej is NOT a satellite of domj) */
+ else /* near cluster is not a satellite */
+ { /*point just belongs to the closest cluster*/
+ /*output the minimum distance match*/
+
+ /*sudo ASSIGN s_clusteri = thej or domj minimizing d */
+
+ thej = minj; /*cluster number in this bin*/
+ Lassigned = 1;
+ sprintf(sourness,"%d-not-sat",matchcnt);
+ }
+ /*sudo END IF (satellite or not a satellite) */
+ }/*match dominant cluster and highest quality other cluster*/
+ /*sudo END IF (a cj in s_list_ci is or is not dominant) */
+
+ thedist = matches[ibin][thej];
+ }/*suite close to more than one cluster*/
+ else
+ /*sudo ELSE IF |s_list_ci| == 0 THEN */
+ { /*NO match in this bin*/
+
+ /*sudo ASSIGN s_clusteri = outlier */
+
+ thej = 0; /*outlier named !!*/
+ Lassigned = 0;
+ Loutlier = 1;
+ thedist = closestd;
+ sprintf(sourness,"outlier distance %.3f",closestd); /*070311*/
+ sprintf(ptmaster,"'O'"); /*outlier within a bin*/
+ sprintf(ptcolor," white"); /*leading space*/
+ /*thej = closestj; NOT viable to have outlier named by closest cluster*/
+ /* some are very far from any cluster, */
+ /* and even a singleton defines an extant cluster and makes a ring*/
+ }
+ /*sudo END IF ( |s_list_ci| == ? ) */
+
+ sprintf(sour," %s:%s, %7.3f:%s, %7.3f: "
+ ,sourness
+ ,bin[i].clst[closestj].clustername,matches[i][closestj]
+ ,bin[i].clst[nextclosej].clustername,matches[i][nextclosej]);
+
+ clusterout[i][thej] = 1; /*this specific cluster has an entry*/
+
+ if(Lwannabe && strcmp(bin[i].clst[thej].status,"wannabe")==0)
+ {
+ Lwannabeout = 1; /*once set, stays set*/
+ Liswannabe = 1; /*set only for this cluster*/
+ }
+
+ /*----------- final suiteness ------------------------------------------*/
+ /*sudo COMPUTE dist_si = scaled 7D distance of si to cluster s_clusteri */
+ /*sudo possible reassignment based on 7D distance */
+
+ resetcoordw(coordw,i,thej,Lgeneralsatw); /*revert to general defaults*/
+
+ /*recompute distance for all 7 dimensions, calc suiteness*/
+ if(Lassigned){distance = hyperellipsoiddist(i,thej,7,coordw);}
+ else {distance = hyperellipsoiddist(i,closestj,7,coordw);}
+
+ /*sudo IF s_clusteri not outlier THEN */
+ /*sudo IF dist_si <= 1 THEN */
+ if(distance <= 1) /* less than ... or equal added 070430 */
+ {
+ /*sudo COMPUTE "suiteness" suiti = (cos(pi*dist_si) +1)/2 */
+ /*sudo limit "suiteness" suiti >= 0.01 */
+ /*sudo ASSIGN s_clusteri = thej */
+
+ suiteness = (cos(pi*distance) +1)/2;
+ if(suiteness < 0.01) {suiteness = 0.01;} /*floor 070430*/
+
+ if(!Lassigned)
+ {
+ thej = closestj; /*assign in this case*/
+ if(Lreportout)
+ {
+ /*"7D distance forces assignment to closest cluster\n");*/
+ sprintf(commentstr," by 7Ddist"); /*070628*/
+ Lcomment=1;
+ }
+ }
+ }
+ /*sudo ELSE "suiteness" suiti = 0 */
+ /*sudo ASSIGN s_clusteri = outlier */
+ else
+ {
+ if(Lassigned)
+ {
+ if(Lreportout)
+ { /*"7D distance forces %s assignment to be outlier\n"*/
+ sprintf(commentstr," 7D dist %s",bin[ibin].clst[thej].clustername);
+ Lcomment=1; /*070628*/
+ }
+ }
+ thej = 0; /*make not assigned in any case! */
+ suiteness = 0;
+ }
+ /*Decisions are made piecemeal (ddg) or in 4D (abez) */
+ /* inclusion is definite to a particular cluster, based on 4D distances */
+ /* exclusion is general, except for knowledge of closest in 4D */
+ /* final suiteness is based on 7D distance */
+ /* but it is very difficult to understand shape in 7D */
+ /*Use 7D suiteness to do final choice about inclusion: */
+ /*case: currently assigned membership in a cluster: */
+ /* calc 7D dist to assigned cluster: retain as member or make an outlier*/
+ /*case: currently an outlier: */
+ /* calc 7D dist to closest cluster: assign as member or leave as outlier*/
+ /*----------------------------------------------------------------------*/
+
+ writesuite(ibin,thej,sour,distance,suiteness,ptmaster,ptcolor);
+ /*binname "## c" clustername "#c" ; outlier "!!" 070414 */
+ if(Ltestout)
+ {
+ fprintf(fpout," [suite: %s %s power== %4.2f, 4Ddist== %f, 7Ddist== %f, suiteness==%f] \n",bin[ibin].clst[thej].clustername,suiteptr->ptID,power,thedist,distance,suiteness);
+ }
+}
+/*___membership()____________________________________________________________*/
+
+/*sudo END FOR */
+
+/****clearmatches()***********************************************************/
+void clearmatches(void) /*called from membership()*/
+{
+ int i=0,j=0;
+
+ for(i=1; i<=12; i++) /*12 actual named bins, this is robust within MAXBINS*/
+ {
+ /*named clusters start at index 1, no tally of actual # defined clusters*/
+ for(j=1; j<MAXCLST; j++) /*MAXCLST should be > # defined clusters*/
+ {
+ matches[i][j] = 999; /*going for minimum of match distance*/
+ }
+ }
+}
+/*___clearmatches()__________________________________________________________*/
+
diff --git a/suitename.h b/suitename.h
new file mode 100644
index 0000000..2f00557
--- /dev/null
+++ b/suitename.h
@@ -0,0 +1,79 @@
+/* suitename.h */
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+
+#define MAXBINS 14 /*1--12 named bins, bin 0 triaged, bin 13 incomplete*/
+#define MAXCLST 16 /*practical, <observed, limit of clusters in a bin*/
+ /*clst indexed from 1: bin 33p had 10, index to 11, as of 070428 */
+
+/* main defines EXTERN as nothing ( "" ), so really does the declarations */
+/* if EXTERN not defined, then it is defined as "extern" so only referenced*/
+
+#ifdef EXTERN
+#undef EXTERN
+#define EXTERN /*no prefix, so do definition */
+#else
+#undef EXTERN
+#define EXTERN extern /*extern prefix so just declaration*/
+#endif
+
+
+#define EOLO "\n" /*for UNIX_X11 */
+#define CRLF "\n" /*for UNIX_X11 */
+
+EXTERN int Ltest;
+
+EXTERN FILE *fpin,*fpout; /*070210 input stdin, output stdout*/
+EXTERN char version[256];
+EXTERN int LatEOF;
+EXTERN int Lhitend;
+EXTERN int itext;
+EXTERN char texts[256];
+
+typedef struct suitestruct {
+ char ptID[256];
+ char basechr[2]; /*070412*/
+ float chim;
+ float deltam;
+ float epsilon;
+ float zeta;
+ float alpha;
+ float beta;
+ float gamma;
+ float delta;
+ float chi;
+ float ang[9]; /*8 to allow count from 1, */
+ /*9 to save chi-1, chi OR theta, eta angles 070524*/
+ /*stores as names for readability, and indexed for computations*/
+}suitestruct;
+EXTERN struct suitestruct* suiteptr;
+
+typedef struct residuestruct {
+ char ptID[10][32];
+ char basechr[2]; /*070412*/
+ float alpha;
+ float beta;
+ float gamma;
+ float delta;
+ float epsilon;
+ float zeta;
+}residuestruct;
+EXTERN residuestruct* residueptr;
+EXTERN residuestruct* newresidueptr;
+EXTERN residuestruct* oldresidueptr;
+
+EXTERN float matches[MAXBINS][MAXCLST];
+ /*incl 1--12 named bins, # defined clsters070429*/
+
+EXTERN float coordw[8]; /*general weightings*/
+EXTERN float dominantw[8]; /*weights of dominant next to a satellite*/
+EXTERN float satellitew[8]; /*weights of satellite next to a dominant*/
+
+/*prototypes*/
+/*main(int argc, char** argv)*/
+int evaluatesuite(void);
+void membership(int);
+void clearmatches(void);
+
diff --git a/suitenhead.h b/suitenhead.h
new file mode 100644
index 0000000..6e35324
--- /dev/null
+++ b/suitenhead.h
@@ -0,0 +1,79 @@
+/* suitenhead.h */
+
+/* suitenhead.h containing kinemageframe[] 070414*/
+
+#ifdef SUITENOUT
+
+#define EOL '\n' /*unix X11 standard */
+
+static char* kinemageframe[] =
+{"\r"
+,"@group {frame} dominant \r"
+,"@vectorlist {frame} color= white \r"
+,"P 0.000 0.000 0.000 5.000 0.000 0.000 \r"
+,"P 35.000 0.000 0.000 40.000 0.000 0.000 \r"
+,"P 80.000 0.000 0.000 160.000 0.000 0.000 \r"
+,"P 0.000 0.000 0.000 0.000 5.000 0.000 \r"
+,"P 0.000 35.000 0.000 0.000 40.000 0.000 \r"
+,"P 0.000 80.000 0.000 0.000 160.000 0.000 \r"
+,"P 0.000 0.000 0.000 0.000 0.000 5.000 \r"
+,"P 0.000 0.000 35.000 0.000 0.000 40.000 \r"
+,"P 0.000 0.000 80.000 0.000 0.000 160.000 \r"
+,"P 200.000 0.000 0.000 280.000 0.000 0.000 \r"
+,"P 320.000 0.000 0.000 360.000 0.000 0.000 \r"
+,"P 0.000 200.000 0.000 0.000 280.000 0.000 \r"
+,"P 0.000 320.000 0.000 0.000 360.000 0.000 \r"
+,"P 0.000 0.000 200.000 0.000 0.000 280.000 \r"
+,"P 0.000 0.000 320.000 0.000 0.000 360.000 \r"
+,"@labellist {XYZ} color= white \r"
+,"{X} 20.000 -5.000 -5.000 \r"
+,"{X} 380.000 -5.000 -5.000 \r"
+,"{Y} -5.000 20.000 -5.000 \r"
+,"{Y} -5.000 380.000 -5.000 \r"
+,"{Z} -5.000 -5.000 20.000 \r"
+,"{Z} -5.000 -5.000 380.000 \r"
+,"@labellist {mtp} color= green \r"
+,"{p} 60.000 0.000 0.000 \r"
+,"{t} 180.000 0.000 0.000 \r"
+,"{m} 300.000 0.000 0.000 \r"
+,"{p} 0.000 60.000 0.000 \r"
+,"{t} 0.000 180.000 0.000 \r"
+,"{m} 0.000 300.000 0.000 \r"
+,"{p} 0.000 0.000 60.000 \r"
+,"{t} 0.000 0.000 180.000 \r"
+,"{m} 0.000 0.000 300.000 \r"
+,"\r"
+,"END\r"
+};
+
+static char* janesviews[] =
+{"\r"
+,"@viewid {d e z}\r"
+,"@zoom 1.00\r"
+,"@zslab 200\r"
+,"@ztran 0\r"
+,"@center 197.500 172.300 178.300\r"
+,"@axischoice 2 3 4\r"
+,"@matrix\r"
+,"0.07196 0.11701 -0.99052 -0.00336 0.99312 0.11707 0.99740 -0.00509 0.07186\r"
+,"@2viewid {zag front}\r"
+,"@2zoom 1.00\r"
+,"@2zslab 200\r"
+,"@2ztran 0\r"
+,"@2center 174.091 194.887 207.768\r"
+,"@2axischoice 4 5 7\r"
+,"@2matrix\r"
+,"0.99508 -0.00018 -0.09905 -0.00135 -0.99993 -0.01172 -0.09904 0.0118 -0.99501\r"
+,"@3viewid {a b g}\r"
+,"@3zoom 1.00\r"
+,"@3zslab 200\r"
+,"@3ztran 0\r"
+,"@3center 175.700 189.600 64.100\r"
+,"@3axischoice 5 6 7\r"
+,"@3matrix\r"
+,"0.99955 0.000101 0.030002 0.0002 0.99995 -0.010012 -0.030001 0.010013 0.9995\r"
+,"\r"
+,"END\r"
+};
+#endif
+
diff --git a/suiteninit.c b/suiteninit.c
new file mode 100644
index 0000000..736bb6c
--- /dev/null
+++ b/suiteninit.c
@@ -0,0 +1,255 @@
+/* suiteninit.c */
+
+#include "suitename.h"
+#define SUITENINIT
+#include "suiteninit.h"
+#undef SUITENINIT
+#include "suitenscrt.h"
+#include "suitenutil.h"
+#include "suiteninpt.h"
+#include "suitenout.h"
+
+/****initializations()********************************************************/
+int initializations(void)
+{
+ int i=0,j=0,LOK=1; /*070426 not using LOK here, was for buildclusterav*/
+
+ Lcomment = 0; /*report 7D distance forces outlier or assignment 070628*/
+ Ltriage = 0; Loutlier = 0; /*diagnostic flags*/
+ L33out = 0; L32out = 0; L23out = 0; L22out = 0; Ltriageout = 0; /*group*/
+ LTdeltam=0;LTdelta=0;LTepsilon=0;LTzeta=0;LTalpha=0;LTbeta=0;LTgamma=0;
+ /* LT...flags accummulate for pointmaster definition 070628*/
+ Liswannabe=0; Lwannabeout = 0; /*070429*/
+ clearbinout(); /*flags each found bin: subgroup */
+ clearclusterout(); /*flags each found cluster: list */
+ resetcoordw(coordw,0,0,0); /*default general cluster half-widths along axes*/
+
+ return(LOK);
+}
+/*___initializations()_______________________________________________________*/
+
+/****assignweights()**********************************************************/
+void assignweights(int ibin, int jth, float* domWarray, float* satWarray)
+{ /*called from membership() for a dom-sat pair: empirical values to edit */
+
+ /*observation is only one dominant cluster in any one bin*/
+ /* so test on common bin number and number of satellite cluster*/
+ /* 1 2 3 4 5 6 7 */
+ /* deltam epsilon zeta alpha beta gamma delta */
+ /*special pair half-widths*/
+ /*dominant Width toward satellite, satellite Width toward dominant*/
+ /* dom sat w, sat dom w; ibin domj satj angle(s)*/
+
+ /*rewritten to use initialized suiteninit.h arrays 070429*/
+ int k=0,m=0;
+
+ /*sanity check: */
+ if(strcmp(bin[ibin].clst[jth].domsatness,"sat")==0) /*match*/
+ {
+ for(k=0; k<MAXSAT; k++)
+ {
+ if(strcmp(satinfo[k].name,bin[ibin].clst[jth].clustername)==0)/*match*/
+ {
+/*fprintf(stderr,"assignweights called with bin[%d].clst[%d].domsatness: %s, clstname: %s\n",ibin,jth,bin[ibin].clst[jth].domsatness,satinfo[k].name);*/
+ for(m=0; m<9; m++)
+ {
+ if(satinfo[k].satw[m] > 0)
+{
+satWarray[m] = satinfo[k].satw[m];
+/*fprintf(stderr,"sat ang %d = %3.0f ",m,satWarray[m]);*/
+}
+ if(satinfo[k].domw[m] > 0)
+{
+domWarray[m] = satinfo[k].domw[m];
+/*fprintf(stderr,"dom ang %d = %3.0f \n",m,domWarray[m]);*/
+}
+ }
+ break; /*just find one*/
+ }
+ }
+ }
+ /*no match just leaves arrays unmodified*/
+}
+/*___assignweights()_________________________________________________________*/
+
+/****parsecommandline()*******************************************************/
+int parsecommandline(int *argc, char** argv)
+{
+ int LOK=0;
+ char *p;
+ int i=0,j=0,k=0;
+ char numstr[256];
+
+ for(i=1; i<*argc; i++)
+ {/*loop over arguments*/
+ p = argv[i];
+ if(p[0] == '-')
+ {/*flag*/
+ if(p[1] == '\0')
+ {/*naked flag ignored*/
+ ;
+ }/*naked flag ignored*/
+ else
+ {/*interpret flag*/
+ if( CompArgStr(p+1,"residuein", 7)
+ || CompArgStr(p+1,"residuesin", 7))
+ {
+ Lsuitesin = 0;
+ Lresiduesin = 1;
+ }
+ else if( CompArgStr(p+1,"suitein", 5)
+ || CompArgStr(p+1,"suitesin", 5))
+ {
+ Lsuitesin = 1;
+ Lresiduesin = 0;
+ }
+ else if(CompArgStr(p+1,"string", 6))
+ {
+ Lstringout = 1;
+ Lreportout = 0;
+ Lkinemageout = 0;
+ Lchart = 0;
+ }
+ else if(CompArgStr(p+1,"report", 6))
+ {
+ Lreportout = 1;
+ Lstringout = 0;
+ Lkinemageout = 0;
+ Lchart = 0;
+ }
+ else if(CompArgStr(p+1,"chart", 5))
+ {
+ Lreportout = 1;
+ Lstringout = 0;
+ Lkinemageout = 0;
+ Lchart = 1; /*no summary of report, MolProbity multichart use*/
+ }
+ else if(CompArgStr(p+1,"kinemage", 3))
+ {
+ Lkinemageout = 1;
+ Lreportout = 0;
+ Lstringout = 0;
+ }
+ else if(CompArgStr(p+1,"satellites", 9))
+ {
+ Lgeneralsatw = 1;
+ }
+ else if(CompArgStr(p+1,"wannabes", 7)) /*070429*/
+ {
+ Lwannabe = 1;
+ }
+ else if(CompArgStr(p+1,"nowannabes", 9)) /*070525*/
+ {
+ Lwannabe = 0;
+ }
+ else if(CompArgStr(p+1,"nosequence", 5))
+ {
+ Lsequence = 0;
+ }
+ else if(CompArgStr(p+1,"overlaps", 7))
+ {
+ Loverlap = 1;
+ }
+ else if(CompArgStr(p+1,"oneline", 7))
+ {
+ Loneline = 1;
+ }
+ else if(CompArgStr(p+1,"help", 1))
+ {
+ Lhelpout = 1;
+ }
+ else if(CompArgStr(p+1,"changes", 7))
+ {
+ Lchangesout = 1;
+ }
+ else if(CompArgStr(p+1,"test", 4))
+ {
+ Ltestout = 1;
+ }
+ else if(CompArgStr(p+1,"sour", 4)) /*070524*/
+ {
+ Lsourout = 1;
+ }
+ else if(CompArgStr(p+1,"dangle", 6)) /*070525*/
+ {
+ Ldangle = 1;
+ }
+ else if( CompArgStr(p+1,"thetaeta", 5) /*070524*/
+ || CompArgStr(p+1,"etatheta", 3)) /*070524*/
+ {
+ Letatheta = 1;
+ }
+ else if( CompArgStr(p+1,"pointIDfields", 5)
+ || CompArgStr(p+1,"ptID", 2) )
+ {
+ i = i+1; /*number of pointID fields is in the next string*/
+ p = argv[i];
+ j=0;
+ k=0;
+ while(j<256)
+ {/*strobe out number*/
+ if( isdigit(p[j]) ) { numstr[k] = p[j]; k++; j++; }
+ else if(k==0) {/*no char yet*/ j++; }
+ else
+ {/*presume whole number is in*/
+ numstr[k]='\0'; /*end number string*/
+ sscanf(numstr,"%d",&NptIDfields);
+ j=999; /*end the while loop*/
+ }
+ }/*strobe out number*/
+ }
+ else if( CompArgStr(p+1,"angles", 5)
+ || CompArgStr(p+1,"anglefields", 5)
+ || CompArgStr(p+1,"nangles", 6) )
+ {
+ i = i+1; /*number of angle fields is in the next string*/
+ p = argv[i];
+ j=0;
+ k=0;
+ while(j<256)
+ {/*strobe out number*/
+ if( isdigit(p[j]) ) { numstr[k] = p[j]; k++; j++; }
+ else if(k==0) {/*no char yet*/ j++; }
+ else
+ {/*presume whole number is in*/
+ numstr[k]='\0'; /*end number string*/
+ sscanf(numstr,"%d",&Nanglefields);
+ j=999; /*end the while loop*/
+ }
+ }/*strobe out number*/
+ }
+ else if( CompArgStr(p+1,"hyper", 5)
+ || CompArgStr(p+1,"power", 5) )
+ {
+ i = i+1; /*hyperellipsoid power is in the next string*/
+ p = argv[i];
+ j=0;
+ k=0;
+ while(j<256)
+ {/*strobe out number*/
+ if( isdigit(p[j]) || p[j]=='.') { numstr[k] = p[j]; k++; j++; }
+ else if(k==0) {/*no char yet*/ j++; }
+ else
+ {/*presume whole number is in*/
+ numstr[k]='\0'; /*end number string*/
+ sscanf(numstr,"%lf",&power);
+ j=999; /*end the while loop*/
+ }
+ }/*strobe out number*/
+ }
+ }/*interpret flag*/
+ }/*flag*/
+ else
+ {/*presume an input file name*/
+ /*THIS IS NOT IMPLEMENTED: NO CODE TO OPEN A FILE !!!! */
+ strcpy(NameStr,argv[i]); /*copy name into input file Name*/
+ Lnewfile=1; /*file is present*/
+ }/*presume an input file name*/
+ }/*loop over arguments*/
+ /*070222 much of this not yet implemented*/
+ if( Lhelpout || Ltestout || Lchangesout || Lnewfile) {LOK = 0;}
+ else {LOK = 1;}
+ return(LOK);
+}
+/*___parsecommandline()______________________________________________________*/
+
diff --git a/suiteninit.h b/suiteninit.h
new file mode 100644
index 0000000..3cce410
--- /dev/null
+++ b/suiteninit.h
@@ -0,0 +1,396 @@
+/* suiteninit.h */
+/* suitename.h MAXBINS 14 1--12 named bins, bin 0 triaged, bin 13 incomplete*/
+/* suitename.h MAXCLST 16 practical, <observed, limit of clusters in a bin*/
+ /*clst indexed from 1: bin 33p had 10, index to 11, as of 070428 */
+#define MAXSAT 12 /*maximun number of all satellite clusters, 9 as of 070429*/
+
+#ifdef SUITENINIT
+#undef DECLARATIONS
+#define DEFINITIONS /*storage and initializations done for suiteninit.c*/
+#undef SUITENINIT
+#define SUITENINIT /*no prefix, so do definition */
+#else
+#undef DEFINITIONS
+#define DECLARATIONS /*just declare existance for everybody*/
+#undef SUITENINIT
+#define SUITENINIT extern /*extern prefix so just declaration*/
+#endif
+
+#ifdef DEFINITIONS
+const struct satinfo
+ {
+ char name[3];
+ /*satellite repacement widths (when non-zero) */
+ float satw[9]; /*satellite width when point between sat and dom clst*/
+ float domw[9]; /*dominant clst width for the inbetween case*/
+ /*count from 1 for 7 angle widths, use 9 for consistency*/
+ char doma[3]; /*dominant name -- bookkeeping 070506*/
+ }satinfo[MAXSAT] =
+ /*satellite widths -- inbetween -- dom widths*/
+ /* sat 0 1 s2 s3 4 s5 6 7 8 0 1 d2 d3 4 d5 6 7 8 dom*/
+ {"1m",0,0, 0, 0,0,32,0,0,0,0,0, 0, 0,0,64,0,0,0 ,"1a",
+ "1L",0,0,18, 0,0,18,0,0,0,0,0,70, 0,0,70,0,0,0 ,"1a",
+ "&a",0,0,20,20,0, 0,0,0,0,0,0,60,60,0, 0,0,0,0 ,"1a",
+ "1f",0,0, 0, 0,0,47,0,0,0,0,0, 0, 0,0,65,0,0,0 ,"1c",
+ "1[",0,0, 0, 0,0,34,0,0,0,0,0, 0, 0,0,56,0,0,0 ,"1b",
+ "4a",0,0,40,40,0, 0,0,0,0,0,0,50,50,0, 0,0,0,0 ,"0a",
+ "#a",0,0,26,26,0, 0,0,0,0,0,0,36,36,0, 0,0,0,0 ,"0a", /*070506*/
+ "0i",0,0, 0, 0,0,60,0,0,0,0,0, 0, 0,0,60,0,0,0 ,"6n",
+ "6j",0,0, 0, 0,0,60,0,0,0,0,0, 0, 0,0,60,0,0,0 ,"6n"};
+#endif /*DEFINITIONS*/
+
+#ifdef DECLARATIONS
+extern struct satinfo
+ {
+ char name[3];
+ /*satellite repacement widths (when non-zero) */
+ float satw[9]; /*satellite width when point between sat and dom clst*/
+ float domw[9]; /*dominant clst width for the inbetween case*/
+ /*count from 1 for 7 angle widths, use 9 for consistency*/
+ char doma[3]; /*dominant name -- bookkeeping 070506*/
+ } satinfo[MAXSAT];
+#endif /*DECLARATIONS*/
+
+ /*bin and clst declared for all files*/
+SUITENINIT char clusteraveragesversion[7];
+SUITENINIT struct clusterdefinition
+ {
+ char clustername[3]; /*2char designation of consensus names*/
+ int LOK; /*logical 0 or 1 for actual cluster */
+ char status[8]; /*certain OR wannabe, triaged,outlier,nothing,incompl*/
+ char clustercolor[12]; /*std kinemage color names, 12 char sufficient*/
+ char domsatness[4]; /*dom.inant, sat.ellite, ord.inary, out,tri,inc*/
+ const struct satelliteinfo* satptr;/*NULL except for satellite clusters 070428*/
+ float ang[9]; /*7 count from 1 with chi-1 as 0 and chi as 8*/
+ } clst[MAXCLST];
+
+SUITENINIT struct bindefinition
+ {
+ char binname[5]; /*4char designation of bin, trig,33 p, ... */
+ struct clusterdefinition clst[MAXCLST];
+ } bin[MAXBINS];
+
+#ifdef DEFINITIONS
+ /*bin and clst defined for suiteninit.c*/
+char clusteraveragesversion[7] = {"070506"};
+
+ /* NB: uses while(LOK): need 1,... contiguous clusters */
+ /* ?depend on compiler to zero trailing undefined arrays?*/
+ /* otherwise need to define trailing dummy LOK=0 cluster*/
+ /*BEWARE: of MAXCLST when adding clusters !! (suitename.h)*/
+/*angles: chi-1, delta ,epsilon, zeta , alpha, beta , gamma , delta ,chi */
+struct bindefinition bin[MAXBINS] =
+ {
+ {/*bin 0 */
+ "trig",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "triaged", "white ", "tri", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 1 */
+ "33 p",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "1a", 1, "certain", "yellowtint ", "dom", NULL,
+ 180, 081.495, 212.250, 288.831, 294.967, 173.990, 053.550, 081.035 ,180},
+ {/* 2 */ "1m", 1, "certain", "blue ", "sat", NULL,
+ 180, 083.513, 218.120, 291.593, 292.247, 222.300, 058.067, 086.093 ,180},
+ {/* 3 */ "1L", 1, "certain", "green ", "sat", NULL,
+ 180, 085.664, 245.014, 268.257, 303.879, 138.164, 061.950, 079.457 ,180},
+ {/* 4 */ "&a", 1, "certain", "cyan ", "sat", NULL,
+ 180, 082.112, 190.682, 264.945, 295.967, 181.839, 051.455, 081.512 ,180},
+ {/* 5 */ "7a", 1, "certain", "pink ", "ord", NULL,
+ 180, 083.414, 217.400, 222.006, 302.856, 160.719, 049.097, 082.444 ,180},
+ {/* 6 */ "3a", 1, "certain", "magenta ", "ord", NULL,
+ 180, 085.072, 216.324, 173.276, 289.320, 164.132, 045.876, 084.956 ,180},
+ {/* 7 */ "9a", 1, "certain", "hotpink ", "ord", NULL,
+ 180, 083.179, 210.347, 121.474, 288.568, 157.268, 049.347, 081.047 ,180},
+ {/* 8 */ "1g", 1, "certain", "sea ", "ord", NULL,
+ 180, 080.888, 218.636, 290.735, 167.447, 159.565, 051.326, 085.213 ,180},
+ {/* 9 */ "7d", 1, "certain", "purple ", "ord", NULL,
+ 180, 083.856, 238.750, 256.875, 069.562, 170.200, 052.800, 085.287 ,180},
+ {/* 10 */ "3d", 1, "certain", "peach ", "ord", NULL,
+ 180, 085.295, 244.085, 203.815, 065.880, 181.130, 054.680, 086.035 ,180},
+ {/* 11 */ "5d", 1, "certain", "yellow ", "ord", NULL,
+ 180, 079.671, 202.471, 063.064, 068.164, 143.450, 049.664, 082.757 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 2 */
+ "33 t",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "1e", 1, "certain", "red ", "ord", NULL,
+ 180, 080.514, 200.545, 280.510, 249.314, 082.662, 167.890, 085.507 ,180},
+ {/* 2 */ "1c", 1, "certain", "gold ", "dom", NULL,
+ 180, 080.223, 196.591, 291.299, 153.060, 194.379, 179.061, 083.648 ,180},
+ {/* 3 */ "1f", 1, "certain", "lime ", "sat", NULL,
+ 180, 081.395, 203.030, 294.445, 172.195, 138.540, 175.565, 084.470 ,180},
+ {/* 4 */ "5j", 1, "certain", "sky ", "ord", NULL,
+ 180, 087.417, 223.558, 080.175, 066.667, 109.150, 176.475, 083.833 ,180},
+ {/* 5 */ "5n", 1, "wannabe", "gray ", "ord", NULL,
+ 180, 086.055, 246.502, 100.392, 073.595, 213.752, 183.395, 085.483 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 3 */
+ "33 m",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 4 */
+ "32 p",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "1b", 1, "certain", "cyan ", "dom", NULL,
+ 180, 084.215, 215.014, 288.672, 300.420, 177.476, 058.307, 144.841 ,180},
+ {/* 2 */ "1[", 1, "certain", "pink ", "sat", NULL,
+ 180, 082.731, 220.463, 288.665, 296.983, 221.654, 054.213, 143.771 ,180},
+ {/* 3 */ "3b", 1, "certain", "lilac ", "ord", NULL,
+ 180, 084.700, 226.400, 168.336, 292.771, 177.629, 048.629, 147.950 ,180},
+ {/* 4 */ "1z", 1, "certain", "peach ", "ord", NULL,
+ 180, 083.358, 206.042, 277.567, 195.700, 161.600, 050.750, 145.258 ,180},
+ {/* 5 */ "5z", 1, "certain", "purple ", "ord", NULL,
+ 180, 082.614, 206.440, 052.524, 163.669, 148.421, 050.176, 147.590 ,180},
+ {/* 6 */ "7p", 1, "certain", "sea ", "ord", NULL,
+ 180, 084.285, 236.600, 220.400, 068.300, 200.122, 053.693, 145.730 ,180},
+ {/* 7 */ "5p", 1, "wannabe", "gray ", "ord", NULL,
+ 180, 084.457, 213.286, 069.086, 075.500, 156.671, 057.486, 147.686 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 5 */
+ "32 t",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "1t", 1, "certain", "red ", "ord", NULL,
+ 180, 081.200, 199.243, 288.986, 180.286, 194.743, 178.200, 147.386 ,180},
+ {/* 2 */ "5q", 1, "certain", "yellow ", "ord", NULL,
+ 180, 082.133, 204.933, 069.483, 063.417, 115.233, 176.283, 145.733 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 6 */
+ "32 m",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "1o", 1, "certain", "sky ", "ord", NULL,
+ 180, 083.977, 216.508, 287.192, 297.254, 225.154, 293.738, 150.677 ,180},
+ {/* 2 */ "7r", 1, "certain", "lilactint ", "ord", NULL,
+ 180, 084.606, 232.856, 248.125, 063.269, 181.975, 295.744, 149.744 ,180},
+ {/* 3 */ "5r", 1, "wannabe", "gray ", "ord", NULL,
+ 180, 083.000, 196.900, 065.350, 060.150, 138.425, 292.550, 154.275 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 7 */
+ "23 p",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "2a", 1, "certain", "cyan ", "ord", NULL,
+ 180, 145.399, 260.339, 288.756, 288.444, 192.733, 053.097, 084.067 ,180},
+ {/* 2 */ "4a", 1, "certain", "yellow ", "sat", NULL,
+ 180, 146.275, 259.783, 169.958, 298.450, 169.583, 050.908, 083.967 ,180},
+ {/* 3 */ "0a", 1, "certain", "green ", "dom", NULL,
+ 180, 149.286, 223.159, 139.421, 284.559, 158.107, 047.900, 084.424 ,180},
+ {/* 4 */ "#a", 1, "certain", "hotpink ", "sat", NULL,
+ 180, 148.006, 191.944, 146.231, 289.288, 150.781, 042.419, 084.956 ,180},
+ {/* 5 */ "4g", 1, "certain", "greentint ", "ord", NULL,
+ 180, 148.028, 256.922, 165.194, 204.961, 165.194, 049.383, 082.983 ,180},
+ {/* 6 */ "6g", 1, "certain", "gold ", "ord", NULL,
+ 180, 145.337, 262.869, 079.588, 203.863, 189.688, 058.000, 084.900 ,180},
+ {/* 7 */ "8d", 1, "certain", "red ", "ord", NULL,
+ 180, 148.992, 270.596, 240.892, 062.225, 176.271, 053.600, 087.262 ,180},
+ {/* 8 */ "4d", 1, "certain", "sky ", "ord", NULL,
+ 180, 149.822, 249.956, 187.678, 080.433, 198.133, 061.000, 089.378 ,180},
+ {/* 9 */ "6d", 1, "certain", "orange ", "ord", NULL,
+ 180, 146.922, 241.222, 088.894, 059.344, 160.683, 052.333, 083.417 ,180},
+ {/* 10 */ "2g", 1, "wannabe", "gray ", "ord", NULL,
+ 180, 141.900, 258.383, 286.517, 178.267, 165.217, 048.350, 084.783 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 8 */
+ "23 t",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "2h", 1, "certain", "sea ", "ord", NULL,
+ 180, 147.782, 260.712, 290.424, 296.200, 177.282, 175.594, 086.565 ,180},
+ {/* 2 */ "4n", 1, "certain", "peach ", "ord", NULL,
+ 180, 143.722, 227.256, 203.789, 073.856, 216.733, 194.444, 080.911 ,180},
+ {/* 3 */ "0i", 1, "certain", "lilactint ", "sat", NULL,
+ 180, 148.717, 274.683, 100.283, 080.600, 248.133, 181.817, 082.600 ,180},
+ {/* 4 */ "6n", 1, "certain", "lilac ", "dom", NULL,
+ 180, 150.311, 268.383, 084.972, 063.811, 191.483, 176.644, 085.600 ,180},
+ {/* 5 */ "6j", 1, "certain", "purple ", "sat", NULL,
+ 180, 141.633, 244.100, 066.056, 071.667, 122.167, 182.200, 083.622 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 9 */
+ "23 m",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "0k", 1, "wannabe", "gray ", "ord", NULL,
+ 180, 149.07, 249.78, 111.52, 278.37, 207.78, 287.82, 86.65 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 10 */
+ "22 p",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "2[", 1, "certain", "sea ", "ord", NULL,
+ 180, 146.383, 259.402, 291.275, 291.982, 210.048, 054.412, 147.760 ,180},
+ {/* 2 */ "4b", 1, "certain", "gold ", "ord", NULL,
+ 180, 145.256, 244.622, 162.822, 294.159, 171.630, 045.900, 145.804 ,180},
+ {/* 3 */ "0b", 1, "certain", "red ", "ord", NULL,
+ 180, 147.593, 248.421, 112.086, 274.943, 164.764, 056.843, 146.264 ,180},
+ {/* 4 */ "4p", 1, "certain", "purple ", "ord", NULL,
+ 180, 150.077, 260.246, 213.785, 071.900, 207.638, 056.715, 148.131 ,180},
+ {/* 5 */ "6p", 1, "certain", "sky ", "ord", NULL,
+ 180, 146.415, 257.831, 089.597, 067.923, 173.051, 055.513, 147.623 ,180},
+ {/* 6 */ "2z", 1, "wannabe", "gray ", "ord", NULL,
+ 180, 142.900, 236.550, 268.800, 180.783, 185.133, 054.467, 143.350 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 11 */
+ "22 t",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "4s", 1, "certain", "lime ", "ord", NULL,
+ 180, 149.863, 247.562, 170.488, 277.938, 084.425, 176.413, 148.087 ,180},
+ {/* 2 */ "2u", 1, "wannabe", "gray ", "ord", NULL,
+ 180, 143.940, 258.200, 298.240, 279.640, 183.680, 183.080, 145.120 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 12 */
+ "22 m",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "!!", 0, "outlier", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* 1 */ "2o", 1, "certain", "hotpink ", "ord", NULL,
+ 180, 147.342, 256.475, 295.508, 287.408, 194.525, 293.725, 150.458 ,180},
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ {/*bin 13 incomplete angles*/
+ "inc ",
+ {/*clst definitions:name, LOK, status, color, domsat, satinfo, angles*/
+ {/* 0 */ "__", 0, "incompl", "white ", "inc", NULL,
+ 0,0,0,0,0,0,0,0,0 },
+ {/* N */ "!!", 0, "nothing", "white ", "out", NULL,
+ 0,0,0,0,0,0,0,0,0 } /*trailing cluster with LOK==0*/
+ }
+ },
+ };
+#endif /*DEFINITIONS*/
+
+ /*axis weights (effective widths) */
+#ifdef DECLARATIONS
+ /*general cluster radial widths: */
+extern char clusterhalfwidthsversion[7];
+extern float deltamw, epsilonw, zetaw, alphaw, betaw, gammaw, deltaw;
+ /*narrower widths for 9 satellite clusters 070328*/
+extern float epsilonsatw, zetasatw, alphasatw, betasatw; /*070328*/
+#endif /*DECLARATIONS*/
+
+#ifdef DEFINITIONS
+ char clusterhalfwidthsversion[] = "070328";
+ float deltamw = 28;
+ float epsilonw = 60, epsilonsatw = 50; /*satw 070328*/
+ float zetaw = 55, zetasatw = 50; /*satw 070328*/
+ float alphaw = 50, alphasatw = 45; /*satw 070328*/
+ float betaw = 70, betasatw = 60; /*satw 070328*/
+ float gammaw = 35;
+ float deltaw = 28;
+#endif /*DEFINITIONS*/
+
+SUITENINIT int Lgeneralsatw; /*070328 modify general case satellite widths*/
+
+
+ /* triage filters (single axis limits) */
+#ifdef DECLARATIONS
+extern char axeslimitsversion[7];
+extern float epsilonmin, epsilonmax;
+extern float delta3min , delta3max ;
+extern float delta2min , delta2max ;
+extern float gammapmin , gammapmax ;
+extern float gammatmin , gammatmax ;
+extern float gammammin , gammammax ;
+extern float alphamin , alphamax ;
+extern float betamin , betamax ;
+extern float zetamin , zetamax ;
+#endif /*DECLARATIONS*/
+
+#ifdef DEFINITIONS
+ char axeslimitsversion[] = "070326";
+ float epsilonmin = 155, epsilonmax = 310; /*070130*/
+ float delta3min = 55, delta3max = 110;
+ float delta2min = 120, delta2max = 175;
+ float gammapmin = 20, gammapmax = 95; /*max 070326*/
+ float gammatmin = 140, gammatmax = 215; /*max 070326*/
+ float gammammin = 260, gammammax = 335; /*max 070326*/
+ float alphamin = 25, alphamax = 335;
+ float betamin = 50, betamax = 290;
+ float zetamin = 25, zetamax = 335;
+#endif /*DEFINITIONS*/
+
+ /*hyperellipsoid power default, override with -power #.# */
+#ifdef DECLARATIONS
+extern double power; /*hyperellipsoid power*/
+#endif /*DECLARATIONS*/
+
+#ifdef DEFINITIONS
+ double power = 3.0; /*3.0 070414; 2.5 070326; 2.0 earlier */
+#endif /*DEFINITIONS*/
+
+SUITENINIT int dominate[13], satellites[13][4];
+SUITENINIT float clusterav[13][MAXCLST][8];
+
+ /*flags*/
+SUITENINIT int Lsuitesin,Lresiduesin,NptIDfields,Nanglefields,Lnewfile;
+SUITENINIT int Lstringout,Lhelpout,Lchangesout,Lkinemageout;
+SUITENINIT int Lreportout,Ltestout;
+SUITENINIT int Lchart,Lsourout,Letatheta,Ldangle; /*070521,070524,070525*/
+SUITENINIT char NameStr[256];
+SUITENINIT int Lsequence, Loverlap, Loneline; /*070409*/
+SUITENINIT int Lwannabe; /*070429*/
+
+ /*prototypes*/
+int initializations(void); /*070325*/
+void assignweights(int, int, float*, float*);
+int parsecommandline(int*, char**);
+
diff --git a/suiteninpt.c b/suiteninpt.c
new file mode 100644
index 0000000..a4dcad9
--- /dev/null
+++ b/suiteninpt.c
@@ -0,0 +1,518 @@
+/* suiteninpt.c */
+
+#include "suitename.h"
+#define SUITENINPT
+#include "suiteninpt.h"
+#undef SUITENINPT
+
+#include "suiteninit.h"
+#include "suitenscrt.h"
+
+/****getresidue()*************************************************************/
+int getresidue(void)
+{
+ int LOK=0;
+ int j=0;
+
+ while(LOK == 0 && !LatEOF) /*==1 for valid residue line*/
+ {
+ LOK = Getoneinputline(); /* ==0 for comment or too-short line */
+ /*return global texts[] and itext */
+ if(LOK && (itext<=1 || texts[0]=='#')) {LOK = 0;} /* # dangle comment*/
+ }
+ if(LOK)
+ {
+ LOK = interpretresiduerecord();
+ /* ptID: : :alpha:beta:gamma:delta:epsilon:zeta */
+ /*loads ptID[NptIDfields], angle[6] */
+ if(LOK)
+ {
+ movenewtooldresidue();
+ clearnewresidue();
+ LOK = loadnewresidue();
+ }
+ }
+ return(LOK);
+}
+/*___getresidue()____________________________________________________________*/
+
+/****getsuite()***************************************************************/
+int getsuite(void)
+{
+ int LOK=0;
+
+ while(LOK == 0 && !LatEOF) /*==1 for valid suite line*/
+ {
+ LOK = Getoneinputline(); /* ==0 for comment or too-short line */
+ /*return global texts[] and itext */
+ if(LOK && (itext<=1 || texts[0]=='#')) {LOK = 0;} /* # dangle comment*/
+ }
+ if(LOK) /*body is 7D or 9D kinemage with {ptID}*/
+ {
+ LOK = interpretsuiterecord();
+ /* {ptID} [chi],deltam,epsilon,zeta,alpha,beta,gamma,delta,[chi] */
+ /* and loads suiteptr so do not need to loadsuite() */
+ }
+ return(LOK);
+}
+/*___getsuite()______________________________________________________________*/
+
+/****loadsuite()**************************************************************/
+int loadsuite(void)
+{
+ int j=0,k=0,n=0;
+
+ n=0;
+ for(j=1; j<=NptIDfields; j++)
+ {
+ for(k=0; k<32; k++)
+ {
+ if(newresidueptr->ptID[j][k] == '\0') {break;}
+ suiteptr->ptID[n++] = newresidueptr->ptID[j][k];
+ }
+ }
+ suiteptr->ptID[n] = '\0'; /*terminate ptID string*/
+ suiteptr->basechr[0] = newresidueptr->basechr[0]; /*070412*/
+ suiteptr->basechr[1] = '\0';
+ suiteptr->ang[1] = suiteptr->deltam = oldresidueptr->delta;
+ suiteptr->ang[2] = suiteptr->epsilon = oldresidueptr->epsilon;
+ suiteptr->ang[3] = suiteptr->zeta = oldresidueptr->zeta;
+ suiteptr->ang[4] = suiteptr->alpha = newresidueptr->alpha;
+ suiteptr->ang[5] = suiteptr->beta = newresidueptr->beta;
+ suiteptr->ang[6] = suiteptr->gamma = newresidueptr->gamma;
+ suiteptr->ang[7] = suiteptr->delta = newresidueptr->delta;
+
+ return(1);
+}
+/*___loadsuite()_____________________________________________________________*/
+
+/****movenewtooldresidue()****************************************************/
+int movenewtooldresidue(void)
+{
+ int j=0;
+
+ for(j=1; j<=9; j++)
+ {
+ strcpy(oldresidueptr->ptID[j],newresidueptr->ptID[j]);
+ }
+ oldresidueptr->basechr[0],newresidueptr->basechr[0]; /*070412*/
+ oldresidueptr->basechr[0] = '\0';
+ oldresidueptr->alpha = newresidueptr->alpha;
+ oldresidueptr->beta = newresidueptr->beta;
+ oldresidueptr->gamma = newresidueptr->gamma;
+ oldresidueptr->delta = newresidueptr->delta;
+ oldresidueptr->epsilon = newresidueptr->epsilon;
+ oldresidueptr->zeta = newresidueptr->zeta;
+ return(1);
+}
+/*___movenewtooldresidue()___________________________________________________*/
+
+/****printresidue()***********************************************************/
+void printresidue(char* type)
+{
+ int j=0;
+ struct residuestruct* theresidueptr;
+
+ if(strcmp(type,"old")==0) {theresidueptr = oldresidueptr;}
+ else {theresidueptr = newresidueptr;}
+ fprintf(stderr,"%s ",type);
+ for(j=1; j<=NptIDfields; j++)
+ {
+ fprintf(stderr,"%s",theresidueptr->ptID[j]);
+ }
+ fprintf(stderr," %7.2f, %7.2f, %7.2f, %7.2f, %7.2f, %7.2f\n"
+ ,theresidueptr->alpha
+ ,theresidueptr->beta
+ ,theresidueptr->gamma
+ ,theresidueptr->delta
+ ,theresidueptr->epsilon
+ ,theresidueptr->zeta);
+}
+/*___printresidue()__________________________________________________________*/
+
+/****clearnewresidue()********************************************************/
+int clearnewresidue(void)
+{
+ int j=0;
+
+ for(j=0; j<=9; j++)
+ {
+ newresidueptr->ptID[j][0] = '\0';
+ }
+ newresidueptr->basechr[0] = '\0'; /*070412*/
+ newresidueptr->basechr[1] = '\0';
+ newresidueptr->alpha = 9999.99;
+ newresidueptr->beta = 9999.99;
+ newresidueptr->gamma = 9999.99;
+ newresidueptr->delta = 9999.99;
+ newresidueptr->epsilon = 9999.99;
+ newresidueptr->zeta = 9999.99;
+ return(1);
+}
+/*___clearnewresidue()_______________________________________________________*/
+
+/****loadnewresidue()*********************************************************/
+int loadnewresidue(void)
+{
+ int j=0;
+
+ for(j=1; j<=NptIDfields; j++)
+ {
+ strcpy(newresidueptr->ptID[j],ptID[j]);
+ }
+ newresidueptr->basechr[0] = basechr[0]; /*070412*/
+ newresidueptr->basechr[1] = '\0';
+ for(j=1; j<=9; j++)
+ { /*work with angles 0 to 360, dang calc angles -180 to +180 */
+ if(angle[j] < 0)
+ {
+ angle[j] = angle[j] + 360;
+ }
+ }
+ newresidueptr->alpha = angle[1];
+ newresidueptr->beta = angle[2];
+ newresidueptr->gamma = angle[3];
+ newresidueptr->delta = angle[4];
+ newresidueptr->epsilon = angle[5];
+ newresidueptr->zeta = angle[6];
+ return(1);
+}
+/*___loadnewresidue()________________________________________________________*/
+
+/****interpretdanglerecord()**************************************************/
+int interpretdanglerecord(void)
+{
+ int i=0,j=0,k=0,n=0,ns=0,nan=0;
+ char numstr[256];
+
+ /*ptID: : : : :...:alpha:beta:gamma:delta:epsilon:zeta*/
+
+ n = 1; /*count fields from 1 */
+ ns = 0; /*first j of current field*/
+ k = 0; /*counter within a field*/
+
+ for(j=0 ; j<= itext; j++)
+ {/*loop through inputed line*/
+ if(texts[j] == ':' || j==itext)
+ {/* : */
+ {/*close nth field*/
+ if(n <= NptIDfields)
+ {/*ID fields*/
+ {
+ /*k not decremented, k is index of the : character*/
+ for(i=0; i<=k; i++)
+ {
+ ptID[n][i] = texts[ns+i];
+ }
+ if(n == NptIDfields)
+ {
+ ptID[n][k] = '\0'; /*overwrite last : character*/
+ /*so last char of last field is a Base name char*/
+ /*and this last field is the full 3char Base name*/
+ if(strlen(ptID[n]) == 3)
+ { /*interpret as Base name --> 1char 070412 */
+ if (strstr(NAListA, ptID[n])) {basechr[0] = 'A';}
+ else if(strstr(NAListG, ptID[n])) {basechr[0] = 'G';}
+ else if(strstr(NAListC, ptID[n])) {basechr[0] = 'C';}
+ else if(strstr(NAListU, ptID[n])) {basechr[0] = 'U';}
+ else if(strstr(NAListT, ptID[n])) {basechr[0] = 'T';}
+ else {basechr[0] = 'Y';}
+ }
+ else {basechr[0] = 'Z';}
+ basechr[1] = '\0';
+ }
+ else {ptID[n][k+1] = '\0';} /* not overwrite : character*/
+ }
+ /*reset for another field*/
+ {
+ k=0;
+ nan=0;
+ ns = j+1;
+ n++;
+ }
+ }/*ID fields*/
+ else
+ {/*angle coord fields*/
+ if(nan) {angle[n-NptIDfields] = 9999.99;}
+ else {angle[n-NptIDfields] = floatfromstr(numstr);}
+ k=0;
+ nan=0;
+ ns = j+1;
+ n++;
+ }
+ }/*close nth field*/
+ }/* : */
+ else
+ {/* input character , only actually use numstr for angle fields*/
+ numstr[k++] = texts[j];
+ numstr[k] = '\0'; /*keep string terminated*/
+ if(texts[j] == '?') {nan = 1;} /*NOT a number*/
+ }
+ }/*loop through inputed line*/
+ return(1);
+}
+/*___interpretdanglerecord()________________________________________________*/
+
+/****interpretresiduerecord()*************************************************/
+int interpretresiduerecord(void)
+{
+ int i=0,j=0,k=0,n=0,ns=0,nan=0;
+ char numstr[256];
+
+ /*ptID: : : : :...:alpha:beta:gamma:delta:epsilon:zeta*/
+
+ n = 1; /*count fields from 1 */
+ ns = 0; /*first j of current field*/
+ k = 0; /*counter within a field*/
+
+ for(j=0 ; j<= itext; j++)
+ {/*loop through inputed line*/
+ if(texts[j] == ':' || j==itext)
+ {/* : */
+ {/*close nth field*/
+ if(n <= NptIDfields)
+ {/*ID fields*/
+ {
+ /*k not decremented, k is index of the : character*/
+ for(i=0; i<=k; i++)
+ {
+ ptID[n][i] = texts[ns+i];
+ }
+ if(n == NptIDfields)
+ {
+ ptID[n][k] = '\0'; /*overwrite last : character*/
+ /*so last char of last field is a Base name char*/
+ /*and this last field is the full 3char Base name*/
+ if(strlen(ptID[n]) == 3)
+ { /*interpret as Base name --> 1char 070412 */
+ if (strstr(NAListA, ptID[n])) {basechr[0] = 'A';}
+ else if(strstr(NAListG, ptID[n])) {basechr[0] = 'G';}
+ else if(strstr(NAListC, ptID[n])) {basechr[0] = 'C';}
+ else if(strstr(NAListU, ptID[n])) {basechr[0] = 'U';}
+ else if(strstr(NAListT, ptID[n])) {basechr[0] = 'T';}
+ else {basechr[0] = 'Y';}
+ }
+ else {basechr[0] = 'Z';}
+ basechr[1] = '\0';
+ }
+ else {ptID[n][k+1] = '\0';} /* not overwrite : character*/
+ }
+ /*reset for another field*/
+ {
+ k=0;
+ nan=0;
+ ns = j+1;
+ n++;
+ }
+ }/*ID fields*/
+ else
+ {/*angle coord fields*/
+ if(nan) {angle[n-NptIDfields] = 9999.99;}
+ else {angle[n-NptIDfields] = floatfromstr(numstr);}
+ k=0;
+ nan=0;
+ ns = j+1;
+ n++;
+ }
+ }/*close nth field*/
+ }/* : */
+ else
+ {/* input character , only actually use numstr for angle fields*/
+ numstr[k++] = texts[j];
+ numstr[k] = '\0'; /*keep string terminated*/
+ if(texts[j] == '?') {nan = 1;} /*NOT a number*/
+ }
+ }/*loop through inputed line*/
+ return(1);
+}
+/*___interpretresiduerecord()________________________________________________*/
+
+/****interpretsuiterecord()*************************************************/
+int interpretsuiterecord(void)
+{ /*hack unprotected way to read well-formated kinemage pt records*/
+
+ int i=0,j=0,k=0,n=0,nan=0; /*nan 070525*/
+ char numstr[256];
+ int LptID = 0, iptID = 0;
+ char ptIDstr[256];
+ char basechr[2]; /*070412*/
+
+ for(j=0; j<256; j++){ptIDstr[j] = '\0';}
+ basechr[0] = 'X'; /*070412*/
+ basechr[1] = '\0';
+
+ /* {ptID} deltam,epsilon,zeta,alpha,beta,gamma,delta */
+
+ for(j=0 ; j<= itext; j++)
+ {/*loop through inputed line*/
+ if(texts[j] == '{') /* } balance curly braces */
+ {/*pointID */
+ LptID = 1;
+ iptID = 0;
+ }
+/*{*/ else if(texts[j] == '}') /* balance curly braces */
+ {
+ ptIDstr[iptID] = '\0'; /*end ptIDstr*/
+ LptID = 0;
+ basechr[0] = ptIDstr[iptID -1]; /*last char of kin ptID is base char*/
+ }
+ else if(LptID)
+ {
+ ptIDstr[iptID++] = texts[j];
+ }
+ else if( (k > 0 && texts[j] == ' ') || texts[j] == ',' || j==itext)
+ {/*white space ends a field*/
+ numstr[k] = '\0';
+ if(nan) {angle[n] = 9999.99;} /*070525*/
+ else {angle[n] = floatfromstr(numstr);} /*n starts at 0*/
+ if(angle[n] < 0) {angle[n] = 360 + angle[n];} /*scope 0 to 360 */
+ if(texts[j] == ' ' || texts[j] == ',') /*interior record white space*/
+ {/*expect another angle*/
+ k=0;
+ n++;
+ nan = 0; /*reset not-a-number flag 070525*/
+ }
+ }
+ else
+ {/* input character */
+ if(texts[j] != ' ') /*ignore leading blanks*/
+ if(texts[j] == '_' || texts[j] == '?' ){nan = 1;} /*070525*/
+ {numstr[k++] = texts[j];}
+ }
+ }/*loop through inputed line*/
+ /*presume suite kinemage record was intact and good...*/
+
+ strcpy(suiteptr->ptID,ptIDstr);
+
+ if(Nanglefields == 9) /*rearranged 070524 to preserve chim,chi (eta,theta)*/
+ {
+ i=1;
+ suiteptr->ang[0] = suiteptr->chim = angle[0];
+ suiteptr->ang[8] = suiteptr->chi = angle[7+i];
+ }
+ else
+ {
+ i=0;
+ suiteptr->ang[0] = suiteptr->chim = 180.0;
+ suiteptr->ang[8] = suiteptr->chi = 180.0;
+ }
+ suiteptr->ang[1] = suiteptr->deltam = angle[0+i];
+ suiteptr->ang[2] = suiteptr->epsilon = angle[1+i];
+ suiteptr->ang[3] = suiteptr->zeta = angle[2+i];
+ suiteptr->ang[4] = suiteptr->alpha = angle[3+i];
+ suiteptr->ang[5] = suiteptr->beta = angle[4+i];
+ suiteptr->ang[6] = suiteptr->gamma = angle[5+i];
+ suiteptr->ang[7] = suiteptr->delta = angle[6+i];
+ /*now DO NOT need to loadsuite() */
+}
+/*___interpretsuiterecord()________________________________________________*/
+
+/****Getoneinputline()********************************************************/
+int Getoneinputline(void) /*cribbed from PKININPT.c*/
+{
+ int c=0,ireturn=0; /*NOTE: normal return is from first part of while loop*/
+
+ for(itext=0; itext<256; itext++) {texts[itext] = '\0';}
+ /*this will avoid left over garbage at ends of short records*/
+ itext = 0; /*itext is a global, numbers inputed characters on each line*/
+ texts[0] = '\0';/*initially a NULL string*/
+
+ if(!Lhitend)
+ {/*bypass for EOF on previous line*/
+ while ((c = fgetc(fpin)) != EOF)
+ {
+ if (c == '\r' || c == '\n')
+ {
+ texts[itext] = '\0';
+
+ LatEOF = 0; /* not at EOF */
+ strcat(texts,EOLO);
+ if(itext < 2) {ireturn = 0;} /*ignore empty or very short lines*/
+ else ireturn = 1;
+ return(ireturn); /* break out of this subroutine */
+ }
+ else
+ {
+ texts[itext] = c;
+ if (itext > 254)
+ {
+ texts[itext+1] = '\0';
+ /*make array of characters into properly ended C string*/
+ itext = 0;
+
+ /* Warn the reader about line too long */
+ fprintf(stderr,"%s\n",texts);
+ fprintf(stderr,"above line is too long");
+ }
+ else itext++;
+ }
+ }/* loop while file not at EOF */
+ /* EOF : finish out anything in text buffer */
+ /*if line is long enough to be coords*/
+ if(itext > 50) /*enough characters to have coords even on this last line*/
+ {
+ ireturn = 1; /*line has content*/
+ LatEOF = 0; /*pretend not EOF, let next pass catch it*/
+ Lhitend = 1; /*but store info that EOF was hit*/
+ texts[itext] = '\0';
+ }
+ else
+ {
+ ireturn = 0; /*not a valid line of any sort*/
+ LatEOF = 1; /* EOF */
+ Lhitend = 1;
+ }
+ }/*bypass for EOF on previous line*/
+ else
+ {
+ LatEOF = 1; /* EOF from previous call now registered*/
+ }
+ return(ireturn);
+}
+/*___Getoneinputline()_______________________________________________________*/
+
+/*****floatfromstr()*********************************************************/
+float floatfromstr(char ins[256])
+{
+ int Lstart,n,m,OK;
+ char s[256];
+ float freturn;
+
+ /*970703 now only handles C-strings*/
+
+ freturn = 0.0;
+ Lstart = 1;
+ n = 0;
+ m = 0;
+ OK = 1;
+ if(ins[0] != '\0')
+ {/* not zero length C string */
+ while(OK)
+ {
+ /* start at position 0 of c str */
+ if(ins[n] == ' ' && Lstart) ;
+ else if(ins[n] == '0' || ins[n] == '1' || ins[n] == '2' ||
+ ins[n] == '3' || ins[n] == '4' || ins[n] == '5' ||
+ ins[n] == '6' || ins[n] == '7' || ins[n] == '8' ||
+ ins[n] == '9' || ins[n] == '.' || ins[n] == '-' )
+ {
+ s[m] = ins[n];
+ m++;
+ Lstart = 0;
+ }
+ else
+ {
+ s[m] = '\0';
+ OK = 0;
+ }
+ n++;
+ }
+
+/*c*/ sscanf(s,"%f",&freturn);
+ }
+ return(freturn);
+}
+/*___floatfromstr()_________________________________________________________*/
+
+
+
diff --git a/suiteninpt.h b/suiteninpt.h
new file mode 100644
index 0000000..66133d5
--- /dev/null
+++ b/suiteninpt.h
@@ -0,0 +1,34 @@
+/* suiteninpt.h */
+
+/*only suiteninpt.c defines SUITENINPT */
+
+#ifndef SUITENINPT
+extern char *NAListA,*NAListG,*NAListC,*NAListU,*NAListT;
+extern float angle[10];
+extern char ptID[10][32];
+extern char basechr[2];
+#else
+ char *NAListA = ":ADE: A:A : Ar:ATP:ADP:AMP:T6A:1MA:RIA: I:I :";
+ char *NAListG = ":GUA: G:G : Gr:GTP:GDP:GMP:GSP:1MG:2MG:M2G:OMG:\
+ YG: 7MG:YG :";
+ char *NAListC = ":CYT: C:C : Cr:CTP:CDP:CMP:5MC:OMC:";
+ char *NAListU = ":URA:URI: U: Ur:U :UTP:UDP:UMP:5MU:H2U:PSU:4SU:";
+ char *NAListT = ":THY: T:T : Tr:TTP:TDP:TMP:";
+ float angle[10];
+ char ptID[10][32];
+ char basechr[2];
+#endif
+
+int getresidue(void);
+int getsuite(void); /*070211 alternative to getresidue()*/
+int loadsuite(void);
+int movenewtooldresidue(void);
+void printresidue(char*);
+int clearnewresidue(void);
+int loadnewresidue(void);
+int interpretdanglerecord(void); /*070525*/
+int interpretresiduerecord(void);
+int interpretsuiterecord(void); /*070211*/
+int Getoneinputline(void);
+float floatfromstr(char[256]); /*from MAGEUTIL.c*/
+
diff --git a/suitenout.c b/suitenout.c
new file mode 100644
index 0000000..82fe6b7
--- /dev/null
+++ b/suitenout.c
@@ -0,0 +1,605 @@
+/* suitenout.c */
+
+#include "suitename.h"
+#define SUITENOUT
+#include "suitenout.h"
+#include "suitenhead.h" /* kinemageframe[] 070414*/
+#undef SUITENOUT
+#include "suitenscrt.h"
+#include "suiteninit.h"
+
+/****writesuite()*************************************************************/
+void writesuite(int ibin,int jclst,char* sour, float distance, float suiteness,char* ptmaster,char* ptcolor)
+{
+ int j=0,n=0;
+ /*static int nout=1; Lstringout residue/suite counter, suitenout.h 070421*/
+ char resstr[32];
+ char basestr[2]={'\0','\0'};
+ char clststr[4]={'\0','\0','\0','\0'};
+ static char lappedstr[256]={'\0'};
+ char reason[16]; /*used in report: reason for triage*/
+ char stray[16]; /*used in report: stray wannabe*/
+ char sourpuss[1]; /*070524*/
+ char* sourptr; /*070524*/
+
+ sourpuss[0] = '\0'; /*070524*/
+
+ if(Lkinemageout)
+ {/*kinemage showing clusters*/
+
+ if(Lsourout) {sourptr = sour;} /*070524*/
+ else {sourptr = sourpuss;}
+ sprintf(temps,"{%s %s %s:D==%5.3f:S==%5.3f: %s} %s%s ,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f",
+ bin[ibin].binname,
+ bin[ibin].clst[jclst].clustername,
+ sourptr,
+ distance,
+ suiteness,
+ suiteptr->ptID,
+ ptmaster,
+ ptcolor,
+ suiteptr->chim,
+ suiteptr->deltam,
+ suiteptr->epsilon,
+ suiteptr->zeta,
+ suiteptr->alpha,
+ suiteptr->beta,
+ suiteptr->gamma,
+ suiteptr->delta,
+ suiteptr->chi );
+
+ if(ibin > 12 || ibin < 0)
+ {
+ fprintf(stderr,"%s\n",temps); /*e.g. 13: angles not fully specified*/
+ }
+ else
+ {
+ if(Ltest){fprintf(stderr,"PUT %s\n",temps);}
+
+ putonetextblockline(&mainscratch,temps);
+ }
+ }
+ else if(Lstringout)
+ {/*3char string in order of input for all entries*/
+ if(Lsequence)
+ {
+ basestr[0] = suiteptr->basechr[0]; /*070412 found previously*/
+ }
+ else /*colon instead of single-character Base code 070409*/
+ {
+ basestr[0] = ':';
+ }
+
+ fprintf(fpout,"%s%s",bin[ibin].clst[jclst].clustername,basestr);
+
+ if(!Loneline) /*070409*/
+ {
+ if(Loverlap && nout >= 11)
+ {
+ sprintf(clststr,"%s%s",bin[ibin].clst[jclst].clustername,basestr);
+ j = n = 0;
+ while(lappedstr[j] != '\0') {j++;} /*find end of lappedstr*/
+ while((lappedstr[j++] = clststr[n++]) != '\0') ; /*copy on end*/
+ }
+ if(nout == 20)
+ {
+ fprintf(fpout," {%s}\n",suiteptr->ptID);
+ if(Loverlap)
+ {
+ fprintf(fpout,"%s",lappedstr);
+ lappedstr[0] = '\0';
+ nout = 11;
+ }
+ else
+ {
+ nout = 1;
+ }
+ }
+ else {nout++;}
+ }
+ }
+ else if(Lreportout)
+ {
+ /*report on all entries, even if suite is incomplete*/
+ reason[0] = '\0'; /*default to none*/
+ stray[0] = '\0'; /*default to none*/
+ if(Ltriage==EPSILONM) {sprintf(reason," epsilon-1");} /*070628*/
+ else if(Ltriage==DELTAM){sprintf(reason," delta-1");} /*070628*/
+ else if(Ltriage==DELTA) {sprintf(reason," delta");} /*070628*/
+ else if(Ltriage==GAMMA) {sprintf(reason," gamma");} /*070521*/
+ else if(Ltriage==BETA) {sprintf(reason," beta");} /*070521*/
+ else if(Ltriage==ALPHA) {sprintf(reason," alpha");} /*070521*/
+ else if(Ltriage==ZETAM) {sprintf(reason," zeta-1");} /*070628*/
+ else if(Lcomment){sprintf(reason,"%s",commentstr);} /*070628*/
+ if(Liswannabe){sprintf(stray," wannabe");} /*070525*/
+ fprintf(fpout,"%s %s %s %5.3f%s%s\n",
+ suiteptr->ptID,
+ bin[ibin].binname,
+ bin[ibin].clst[jclst].clustername,
+ suiteness,
+ reason,
+ stray /*070628*/
+ );
+
+ reportcountall++; /*everything that suitename brought in */
+
+ /*now accummulate sum and count for complete suites*/
+
+ if(ibin == 0)
+ {
+ triagecountall++; /*070328*/
+ }
+ else if(ibin >= 0 && ibin < 13) /*ibin==13 when angles not all defined*/
+ {
+ /*defineable suites, including triaged and outliers */
+ suitenesssumall = suitenesssumall + suiteness;
+ /*adding (float)zero won't hurt this sum*/
+ binnedsuitecountall++;
+ }
+ /*distribution of suiteness values...*/
+ /*j==0 pseudo clusters always have a suiteness == 0, so sum not changed*/
+ if(jclst == 0) /*augment the k==11 outlier place for this cluster*/
+ { /*outliers in bins 1 to 12, triages in bin 0, not defined in bin 13*/
+ /*jclst membership 4D distance < 1, suiteness > 0 if 7D distance > 1*/
+ /*outliers in jclst 0, suiteness can be == 0 for others if 7D dist>1 */
+ suitenesscnt[ibin][jclst][11]++;
+ }
+ else
+ {
+ suitenesssum[ibin][jclst] = suitenesssum[ibin][jclst] + suiteness;
+
+ /*3rd index for suiteness intervals: 10 at 10ths + extra at zero*/
+
+ if(suiteness == 0 ) {suitenesscnt[ibin][jclst][0]++;}
+ if(suiteness > 0 && suiteness < .1) {suitenesscnt[ibin][jclst][1]++;}
+ if(suiteness >= .1 && suiteness < .2) {suitenesscnt[ibin][jclst][2]++;}
+ if(suiteness >= .2 && suiteness < .3) {suitenesscnt[ibin][jclst][3]++;}
+ if(suiteness >= .3 && suiteness < .4) {suitenesscnt[ibin][jclst][4]++;}
+ if(suiteness >= .4 && suiteness < .5) {suitenesscnt[ibin][jclst][5]++;}
+ if(suiteness >= .5 && suiteness < .6) {suitenesscnt[ibin][jclst][6]++;}
+ if(suiteness >= .6 && suiteness < .7) {suitenesscnt[ibin][jclst][7]++;}
+ if(suiteness >= .7 && suiteness < .8) {suitenesscnt[ibin][jclst][8]++;}
+ if(suiteness >= .8 && suiteness < .9) {suitenesscnt[ibin][jclst][9]++;}
+ if(suiteness >= .9) {suitenesscnt[ibin][jclst][10]++;}
+ }
+ }
+}
+/*___writesuite()____________________________________________________________*/
+
+/****suitenessaverage()******************************************************/
+void suitenessaverage(int mode) /*mode for all, just Aform, etc. */
+{
+ int i=0,j=0,k=0;
+ int ibin=0,nbin=0,jclst=0,nclst=0,xbin = -1,xclst = -1;
+ double sum = 0;
+ int num[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
+ float average = 0;
+ int number = 0;
+ char comment[256];
+ int Ntriaged = 0; /*070328*/
+
+ if(mode == 0) /*all complete suites, all ways*/
+ { /*bin==13 has the incomplete pseudo-suites with incomplete angles*/
+ ibin = 1; nbin = 12; jclst = 0; nclst = 11;
+ xbin = -1; xclst = -1; /*exception when >= 0*/
+ /*ibin 0 contains triaged clusters, never use these*/
+
+ fprintf(fpout,"Found %d complete suites derived from %d entries\n"
+ ,binnedsuitecountall+triagecountall,reportcountall);
+ fprintf(fpout,"%d suites were triaged, leaving %d assigned to bins\n"
+ ,triagecountall,binnedsuitecountall); /*070328*/
+ sprintf(comment,"For all");
+
+ }
+ else if(mode == 1) /* A form 1,1*/
+ { /*bin==13 has the incomplete, pseudo-suites with incomplete angles*/
+ ibin = 1; nbin = 1; jclst = 1; nclst = 1;
+ /*no outliers (j==0)*/
+ xbin = -1; xclst = -1; /*exception for this clst in this bin when >= 0*/
+
+ sprintf(comment," A form (1a)");
+
+ }
+ else if(mode == 2) /* everything except A form, i.e. except 1,1*/
+ { /*bin==13 has the incomplete pseudo-suites with incomplete angles*/
+ ibin = 1; nbin = 12; jclst = 1; nclst = 11; /*only complete suite pts*/
+ /*no outliers (j==0)*/
+ xbin = 1; xclst = 1; /*exception when >= 0*/
+
+ sprintf(comment," non-1a has");
+
+ }
+ for(i=ibin; i<=nbin; i++)
+ {
+ for(j=jclst; j<=nclst; j++) /*some clusters not defined in some bins*/
+ {
+ if(i != xbin || (i == xbin && j != xclst))
+ {
+ sum = sum + suitenesssum[i][j];
+ for(k=0; k<12; k++)
+ {
+ num[k] = num[k] + suitenesscnt[i][j][k];
+ }
+ }
+ }
+ }
+
+ for(k=0; k<12; k++) { number = number + num[k]; }
+
+ if(number > 1){average = sum/number;}
+ else {average = 0;}
+
+ fprintf(fpout,"%s %d suites: average suiteness== %5.3f (power==%4.2f)\n"
+ ,comment,number,average,power);
+ if(mode == 0) {fprintf(fpout,"%6d suites are outliers\n",num[11]);}
+ fprintf(fpout,"%6d suites have suiteness == 0 \n",num[0]);
+ fprintf(fpout,"%6d suites have suiteness > 0 <.1\n",num[1]);
+ fprintf(fpout,"%6d suites have suiteness >=.1 <.2\n",num[2]);
+ fprintf(fpout,"%6d suites have suiteness >=.2 <.3\n",num[3]);
+ fprintf(fpout,"%6d suites have suiteness >=.3 <.4\n",num[4]);
+ fprintf(fpout,"%6d suites have suiteness >=.4 <.5\n",num[5]);
+ fprintf(fpout,"%6d suites have suiteness >=.5 <.6\n",num[6]);
+ fprintf(fpout,"%6d suites have suiteness >=.6 <.7\n",num[7]);
+ fprintf(fpout,"%6d suites have suiteness >=.7 <.8\n",num[8]);
+ fprintf(fpout,"%6d suites have suiteness >=.8 <.9\n",num[9]);
+ fprintf(fpout,"%6d suites have suiteness >=.9 \n",num[10]);
+}
+/*___suitenessaverage()______________________________________________________*/
+
+/****writeoutput()************************************************************/
+void writeoutput(void)
+{
+ char commentstr[128];
+
+ if(Lgeneralsatw)
+ {
+ sprintf(commentstr,
+ " special general case satellite widths, power = %4.2f",power);
+ }
+ else
+ {
+ sprintf(commentstr,
+ " all general case widths, power = %4.2f",power);
+ }
+ if(Lreportout && !Lchart)
+ {
+ fprintf(fpout,"%s\n",commentstr);
+ suitenessaverage(0); /* 0 mode reports on all suites */
+ if(clusterout[1][1] > 0) /*Aform 1a 070325*/
+ {
+ suitenessaverage(1); /* 1 mode reports on A form suites */
+ suitenessaverage(2); /* 2 mode reports on non-A suites */
+ }
+ }
+ if(Lkinemageout &&(L33out || L32out || L23out || L22out || Ltriageout))
+ {/*stuff for a kinemage*/
+ /*Ltriageout for intact suites that fail individual angle test(s) */
+ /*each populated bin gets a subgroup*/
+
+ kinemageheader(commentstr);
+ kinemagestuffer(janesviews); /*070421*/
+ kinemagestuffer(kinemageframe); /*070414, 070421*/
+
+ /*work through all possible bins and their suites in standard order*/
+ if(L33out)
+ {
+ fprintf(fpout,"@group {33} recessiveon dimension=9 wrap=360 select animate off\n");
+ binstuffout(1,3); /*bins in this group*/
+ }
+ if(L32out)
+ {
+ fprintf(fpout,"@group {32} recessiveon dimension=9 wrap=360 select animate off\n");
+ binstuffout(4,6); /*bins in this group*/
+ }
+ if(L23out)
+ {
+ fprintf(fpout,"@group {23} recessiveon dimension=9 wrap=360 select animate off\n");
+ binstuffout(7,9); /*bins in this group*/
+ }
+ if(L22out)
+ {
+ fprintf(fpout,"@group {22} recessiveon dimension=9 wrap=360 select animate off\n");
+ binstuffout(10,12); /*bins in this group*/
+ }
+ if(Ltriageout)
+ {
+ fprintf(fpout,"@group {triaged} dominant dimension=9 wrap=360 select off\n");
+ binstuffout(0,0); /*one bin (0th) in this group*/
+ }
+ }/*stuff for a kinemage*/
+ if(Lstringout)
+ {
+ if(nout != 1) {fprintf(fpout," {%s}\n",suiteptr->ptID);}
+ else {fprintf(fpout,"\n");} /*just final EOL*/
+ }
+}
+/*___writeoutput()___________________________________________________________*/
+
+/****binstuffout()************************************************************/
+void binstuffout(int nbin, int mbin)
+{
+ int i=0,j=0,ncnt=0;
+ char ctrl[10]; /* 7 actual characters in curly braces*/
+ char extras[32];
+
+ for(i=nbin; i<=mbin; i++)
+ {/*loop over the three bins in this delta delta group*/
+ if(binout[i])
+ {/*ith bin has points*/
+ fprintf(fpout,"@subgroup {%s} recessiveon \n",bin[i].binname);
+
+ j=1; /*zeroth cluster is for bin outliers, if any, do them later */
+ while(bin[i].clst[j].LOK) /*named clusters j>0 ... 070429*/
+ {/*loop over named clusters in this ith bin, NOT including outliers*/
+ if(clusterout[i][j])
+ {
+ if(strcmp(bin[i].clst[j].status,"wannabe")==0) /*070429*/
+ {
+ sprintf(extras," master= {wannabees}");
+ Lwannabeout = 1; /*redundant, already been set*/
+ }
+ else {extras[0] = '\0';}
+
+ fprintf(fpout,
+ "@balllist {%s %s} color= %s radius= 1 nohilite master= {data}%s\n"
+ ,bin[i].binname,bin[i].clst[j].clustername,bin[i].clst[j].clustercolor,extras);
+ sprintf(ctrl,"{%s %s}"
+ ,bin[i].binname,bin[i].clst[j].clustername);
+ ncnt = transferout(ctrl); /*gets just pts starting with ctrl*/
+
+ if(j>0) /*obselete, but is a safety*/
+ {/*belong to a named cluster (av & labels initially on 070414)*/
+ fprintf(fpout,
+ "@ringlist {%s %s} color= %s radius= 10 width= 1 nobutton master= {avsigma}%s\n"
+ ,bin[i].binname,bin[i].clst[j].clustername,bin[i].clst[j].clustercolor,extras);
+ fprintf(fpout,
+ "{%s %s} 180 %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f 180\n"
+ ,bin[i].binname,bin[i].clst[j].clustername
+ ,bin[i].clst[j].ang[1]
+ ,bin[i].clst[j].ang[2]
+ ,bin[i].clst[j].ang[3]
+ ,bin[i].clst[j].ang[4]
+ ,bin[i].clst[j].ang[5]
+ ,bin[i].clst[j].ang[6]
+ ,bin[i].clst[j].ang[7]);
+
+ fprintf(fpout,
+ "@labellist {%s %s} color= %s nobutton master= {labels}%s\n"
+ ,bin[i].binname,bin[i].clst[j].clustername,bin[i].clst[j].clustercolor,extras);
+ fprintf(fpout,
+ "{%s %s} 180 %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f 180\n"
+ ,bin[i].binname,bin[i].clst[j].clustername
+ ,bin[i].clst[j].ang[1]
+ ,bin[i].clst[j].ang[2]
+ ,bin[i].clst[j].ang[3]
+ ,bin[i].clst[j].ang[4]
+ ,bin[i].clst[j].ang[5]
+ ,bin[i].clst[j].ang[6]
+ ,bin[i].clst[j].ang[7]);
+ }/*belong to a named cluster*/
+ }/*members in i,j cluster*/
+ j++; /*increment cluster index for the while condition 070429*/
+ }/*loop over named clusters in this ith bin*/
+ j = 0; /*look for outliers... (set j==0 to reuse code from above)*/
+ if(clusterout[i][j]) /*outliers in this bin*/
+ {
+ extras[0] = '\0';
+ fprintf(fpout,
+ "@balllist {%s %s} color= %s radius= 1 nohilite master= {data}%s\n"
+ ,bin[i].binname,bin[i].clst[j].clustername,bin[i].clst[j].clustercolor,extras);
+ sprintf(ctrl,"{%s %s}"
+ ,bin[i].binname,bin[i].clst[j].clustername);
+ ncnt = transferout(ctrl); /*gets just pts starting with ctrl*/
+ }/*outliers in this bin*/
+ }/*ith bin has points*/
+ }/*loop over bins*/
+}
+/*___binstuffout()___________________________________________________________*/
+
+/****transferout()************************************************************/
+int transferout(char* ctrl)
+{
+ /*cribbed from PKINCOUT/transferout() 070210 */
+ /* for later flexibility, include some controls not now needed 070210 */
+
+ int LatEOF=0, LOK=0;
+ int j=0, iscrt=0, iexist=0;
+ char scrts[256];
+
+ rewindtextblock(&mainscratch);
+ LatEOF = 0;
+
+ while(!LatEOF)
+ {/*scan through scratch block*/
+ getonetextblockline(&mainscratch,temps);
+ if(temps[0] != '\0')
+ {/*entries still in scratch block*/
+ if( (temps[0]==ctrl[0]) /*check chars at beginning of ptID*/
+ &&(temps[1]==ctrl[1])
+ &&(temps[2]==ctrl[2])
+ &&(temps[3]==ctrl[3])
+ &&(temps[4]==ctrl[4])
+ &&(temps[5]==ctrl[5])
+ &&(temps[6]==ctrl[6])
+ &&(temps[7]==ctrl[7]) )
+ {
+ LOK = 1; /*this point belongs in this list*/
+ iscrt = 0;
+ if(Ltest){fprintf(stderr,"GOT %s\n",temps);}
+ }
+ else
+ {/*unrecognized, can't use this point in this list*/
+ LOK = 0;
+ }
+ if(LOK)
+ {/*this point belongs in this list*/
+ for( j=iscrt ; j<=255 ; j++) /*extract content from temps[] */
+ {
+ scrts[j-iscrt] = temps[j];
+ if(temps[j] == '\0') break;
+ }
+ iexist++; /*increase counter*/
+ /*suitename writeoutput has already written list header*/
+ /* so do not write this here when iexist==1 */
+
+ fprintf(fpout,"%s\n",scrts);
+
+ /*this point belongs in this list*/}
+ }/*entries still in scratch block*/
+ else
+ {/*reached end of scratch block*/
+ LatEOF = 1;
+ }
+ }
+ return(iexist);
+}
+/*___transferout()___________________________________________________________*/
+
+/****kinemageheader()*********************************************************/
+void kinemageheader(char* textstr)
+{
+ fprintf(fpout,"@text\n %s\n %s\n",version,textstr);
+ fprintf(fpout,"@kinemage 1\n");
+ fprintf(fpout,"@onewidth\n");
+ if(Letatheta) /*070524*/
+ {fprintf(fpout,"@dimension {theta} {delta-1} {epsilon-1} {zeta-1} {alpha} {beta} {gamma} {delta} {eta}\n");}
+ else
+ {fprintf(fpout,"@dimension {chi-1} {delta-1} {epsilon-1} {zeta-1} {alpha} {beta} {gamma} {delta} {chi}\n");}
+ fprintf(fpout,"@dimminmax 0.000 360.000 0.000 360.000 0.000 360.000 0.000 360.000 0.000 360.000 0.000 360.000 0.000 360.000 0.000 360.000 0.000 360.000\n");
+
+ if(LTepsilon) {fprintf(fpout,"@pointmaster 'E' {epsilon bad}\n");}
+ else if(LTdelta || LTdeltam)
+ {fprintf(fpout,"@pointmaster 'D' {delta bad}\n");}
+ else if(LTzeta || LTalpha || LTbeta || LTgamma)
+ {fprintf(fpout,"@pointmaster 'T' {various bad}\n");}
+ if(Loutlier) {fprintf(fpout,"@pointmaster 'O' {outliers}\n");}
+ if(Lwannabeout) {fprintf(fpout,"@master {wannabees}\n");}
+}
+/*___kinemageheader()________________________________________________________*/
+
+/****kinemagestuffer()********************************************************/
+void kinemagestuffer(char* kinemagestuff[])
+{
+ int more = 1, j=0, Nth=0;
+ char temps[256];
+
+ while(more)
+ {/*loop over all text for this call*/
+ for(j=0; j<255; j++) /*save a space for safety '\0' */
+ {/*load transfer string*/
+ temps[j] = kinemagestuff[Nth][j];
+ if(temps[j] == '\r')
+ {/*ASCII Carraige Return*/
+ temps[j] = EOL; /*platform specific End-Of-Line character*/
+ }
+ if(temps[j] == '\0'){ break;} /*separate end of text piece*/
+ }/*load transfer string*/
+ /*check for END before writing to stdout*/
+ if(temps[0] =='E' && temps[1] =='N' && temps[2] =='D'){more = 0;}
+ temps[j+1] = '\0'; /*safety if runs off end of temps str*/
+ if(more != 0) {fprintf(fpout,"%s",temps);}
+ Nth++; /*local, not static, so will get reset ==0 on new call*/
+ }/*loop over all text for this call*/
+}
+/*___kinemagestuffer()_______________________________________________________*/
+
+/****clearbinout()************************************************************/
+void clearbinout(void)
+{
+ int i=0,j=0;
+
+ for(i=1; i<MAXBINS; i++)
+ {
+ binout[i] = 0; /*set 1 if an entry is encountered*/
+ }
+}
+/*___clearbinout()___________________________________________________________*/
+
+/****clearclusterout()********************************************************/
+void clearclusterout(void)
+{ /* clear storage arrays, re suitenout.h */
+ int i=0,j=0,k=0;
+
+ for(i=0; i<MAXBINS; i++)
+ {
+ for(j=0; j<MAXCLST; j++)
+ {
+ clusterout[i][j] = 0; /*set 1 if an entry is encountered*/
+ suitenesssum[i][j] = 0;
+ for(k=0; k<12; k++) /*intervals: 10 10ths + extras at zero & 12*/
+ {
+ suitenesscnt[i][j][k] = 0;
+ }
+ }
+ }
+ suitenesssumall = 0;
+ binnedsuitecountall = 0;
+ triagecountall = 0;
+ reportcountall = 0;
+}
+/*___clearclusterout()_______________________________________________________*/
+
+/****usageout()***************************************************************/
+void usageout(void) /* -h -help */
+{
+ fprintf(stderr,"%s\n",version);
+ fprintf(stderr,"suitename -flags <stdin >stdout\n");
+ fprintf(stderr,"output flags: [ -report || -string || -kinemage ]\n");
+ fprintf(stderr,"default: -report -residuein \n");
+ fprintf(stderr,"input flags: [ -residuein || -suitein ]\n");
+ fprintf(stderr,"flags: [ -residuein [ -pointIDfields # ] ] default#==%d\n"
+ ,NptIDfields);
+ fprintf(stderr," OR ");
+ fprintf(stderr,"flags: [ -suitein [ -anglefields # ] ] default#==%d\n"
+ ,Nanglefields);
+ fprintf(stderr,"\n");
+ fprintf(stderr,"defaults: -residuein -pointIDfields %d\n",NptIDfields);
+ fprintf(stderr," as made by dangle \n");
+ fprintf(stderr,
+ "dangle \"alpha, beta, gamma, delta, epsilon, zeta\" in.pdb >out.dngl\n");
+ fprintf(stderr,
+ "label:model:chain:number:ins:type:alpha:beta:gamma:delta:epsilon:zeta\n");
+ fprintf(stderr,"-suitein presumes point records from a kinemage\n");
+ fprintf(stderr,"{pointID} 7 or 9 anglefields \n");
+ fprintf(stderr,
+ "{ptID} [chi] deltam epsilon zeta alpha beta gamma delta [chi] \n");
+ fprintf(stderr," Note that all other kinemage lines must be stripped off.\n");
+ fprintf(stderr,"-thetaeta kinemage labels theta,eta instead of chi-1,chi\n");
+ fprintf(stderr,"Note dangle trick to make theta,...,eta suites directly\n");
+ fprintf(stderr,"\n");
+ fprintf(stderr,"flag: -report [ -chart ]\n");
+ fprintf(stderr," suites in order of input, suiteness summary at end\n");
+ fprintf(stderr,"( -chart : NO summary at end, for MolProbity multichart\n");
+ fprintf(stderr,"\n");
+ fprintf(stderr,"flag: -string\n");
+ fprintf(stderr," 3 character per suite string in order of input\n");
+ fprintf(stderr," 20 per line, ptID of n*20th at end of line\n");
+ fprintf(stderr," flag: -nosequence\n");
+ fprintf(stderr," only suite names, no Base sequence character\n");
+ fprintf(stderr," flag: -oneline\n");
+ fprintf(stderr," string all one line, no point IDs\n");
+ fprintf(stderr," flag: -overlap\n");
+ fprintf(stderr," 20 per line: overlap 10 each line, 10 new per line\n");
+ fprintf(stderr,"\n");
+ fprintf(stderr,"flag: -kinemage\n");
+ fprintf(stderr," kinemage of clusters grouped by pucker,pucker ... \n");
+ fprintf(stderr," group {delta,delta},subgroup {gamma},list {cluster name}\n");
+ fprintf(stderr,"\n");
+ /*fprintf(stderr,"flag: -satellite\n"); DO NOT ADVERTISE THIS OPTION*/
+ /*fprintf(stderr," use special general case satellite widths\n");*/
+ fprintf(stderr," assigns to designated wannabe clusters, default: wannabe\n");
+ /*fprintf(stderr,"flag: -wannabe\n");*/
+ fprintf(stderr,"flag: -nowannabe to not assign them\n");
+ fprintf(stderr,"\n");
+ fprintf(stderr,"[ -power #.#] default# %4.2f multi-dimension distance calc\n"
+ ,power);
+ fprintf(stderr,"[ -test ] dump cluster centers, halfwidths,... to stderr\n");
+ fprintf(stderr,"cluster averages version: %s\n",clusteraveragesversion);
+ fprintf(stderr,"cluster half-widths version: %s\n",clusterhalfwidthsversion);
+ fprintf(stderr,"axes limits version: %s\n",axeslimitsversion);
+ fprintf(stderr,"suitename is not paying attention to chains...\n");
+ fprintf(stderr,"%s\n",version);
+}
+/*___usageout()______________________________________________________________*/
+
+
diff --git a/suitenout.h b/suitenout.h
new file mode 100644
index 0000000..3dc1141
--- /dev/null
+++ b/suitenout.h
@@ -0,0 +1,54 @@
+/* suitenout.h */
+
+#ifdef SUITENOUT
+#undef SUITENOUT
+#define SUITENOUT
+#else
+#define SUITENOUT extern
+#endif
+
+#define DELTAM 1 /*Ltriage reason flags 070628*/
+#define EPSILONM 2
+#define ZETAM 3
+#define ALPHA 4
+#define BETA 5
+#define GAMMA 6
+#define DELTA 7
+
+/*diagnostic flags*/
+SUITENOUT int Ltriage; /*reset for each suite, set to reason, e.g. DELTAM*/
+SUITENOUT int Liswannabe;
+SUITENOUT int Lcomment; /*for 7D distance forced outlier or closest assignment*/
+SUITENOUT char commentstr[16]; /*and Lcomment 070628*/
+SUITENOUT int Loutlier; /*accummulates*/
+SUITENOUT int LTdeltam,LTdelta,LTepsilon,LTzeta,LTalpha,LTbeta,LTgamma;
+ /* LT...flags accummulate for pointmaster definition 070628*/
+SUITENOUT int L33out,L32out,L23out,L22out,Ltriageout; /*groups*/
+SUITENOUT int binout[MAXBINS]; /*incl 1--12 named bins */ /*subgroups*/
+SUITENOUT int clusterout[MAXBINS][MAXCLST]; /*lists*/
+SUITENOUT double suitenesssum[MAXBINS][MAXCLST], suitenesssumall;
+SUITENOUT int suitenesscnt[MAXBINS][MAXCLST][12];
+ /*3rd index for suiteness intervals: 10 at 10ths + 2 extras */
+ /* extra at zero counts valid suites with suiteness == 0 */
+ /* e.g. 4D distance < 1 but 7D distance > 1 */
+ /* extra at 11 counts valid suites but triaged or outlier */
+SUITENOUT int binnedsuitecountall, reportcountall;
+SUITENOUT int triagecountall; /*070328*/
+SUITENOUT int Lwannabeout; /*wannabe in output flag 070429*/
+
+SUITENOUT char temps[256];
+
+static int nout=1; /*Lsringout residue/suite counter*/
+
+/*prototypes*/
+void writeoutput(void);
+void binstuffout(int, int);
+int transferout(char*);
+void kinemageheader(char*); /*070328 char* */
+void kinemagestuffer(char* kinemagestuff[]); /*070414, 070421*/
+void writesuite(int, int, char*, float, float, char*, char*);
+void clearbinout(void);
+void clearclusterout(void);
+void usageout(void);
+void suitenessaverage(int);
+
diff --git a/suitenscrt.c b/suitenscrt.c
new file mode 100644
index 0000000..803f2c0
--- /dev/null
+++ b/suitenscrt.c
@@ -0,0 +1,131 @@
+/* suitenscrt.c cribbed from PKINSCRT.c 070210 */
+
+#include "suitename.h"
+#define SCRATCH
+ /*that is, SCRATCH is blank, so suitenscrt.h will do initial declarations*/
+#include "suitenscrt.h"
+#undef SCRATCH
+
+/****inittextblock()**********************************************************/
+void inittextblock(textblock* tb)
+{
+ tb->begin = tb->end = tb->next = tb->cursor = NULL;
+}
+/*___inittextblock()_________________________________________________________*/
+
+/****rewindtextblock()********************************************************/
+void rewindtextblock(textblock* tb)
+{
+ tb->cursor = tb->begin; /*just move cursor back to beginning*/
+}
+/*___rewindtextblock()_______________________________________________________*/
+
+/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
+/****disposetextblock()*******************************************************/
+void disposetextblock(textblock* tb)
+{
+ if (tb->begin)
+ {
+ free(tb->begin); /*actually releases any allocated space*/
+ inittextblock(tb); /*just sets member pointers==0*/
+ }
+}
+/*___disposetextblock()______________________________________________________*/
+/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
+/****putonetextblockline()****************************************************/
+void putonetextblockline(textblock* tb, char* thestring)
+{
+ static char stringtemp[256];
+
+ /*store directly in giant character array, textblock */
+ if( (unsigned)(tb->end - tb->next) < strlen(thestring)+8 ) /*give some slack*/
+ {/*build more space*/
+ strcpy(stringtemp,thestring);/*leaving this routine forgets contents*/
+ buildtextblock(tb, 10000); /*PKINSCRT.c*/ /*try for (n) more */
+ strcpy(thestring,stringtemp);
+ }
+ if( (unsigned)(tb->end - tb->next) > strlen(thestring) ) /*insurance */
+ {
+ strcpy(tb->next,thestring);
+ tb->next += strlen(tb->next) + 1;
+ }
+}
+/*___putonetextblockline()___________________________________________________*/
+
+/****getonetextblockline()****************************************************/
+void getonetextblockline(textblock* tb, char* thestring)
+{
+ /*get one character string from textblock, giant character array*/
+ if(tb->cursor < tb->next) /*next available open space*/
+ {
+ strcpy(thestring,tb->cursor);
+ tb->cursor += strlen(tb->cursor) + 1;
+ }
+ else thestring[0] = '\0'; /*NULL string signel for end of data*/
+ return;
+}
+/*___getonetextblockline()___________________________________________________*/
+
+/****buildtextblock()*********************************************************/
+void buildtextblock(textblock* tb, size_t more)
+{
+ textblock tbtemp;
+ /*members: char *begin, *end, *next, *cursor */
+ size_t length,nextoffset;
+ int ifail, recycle, moretry;
+
+ tbtemp.begin = NULL;
+ tbtemp.end = NULL;
+ tbtemp.next = NULL;
+ tbtemp.cursor = NULL;
+
+ moretry = more;
+ recycle = 1;
+ while(recycle==1)
+ {/*recycle allocation trials*/
+ ifail = 0;
+ length = tb->end - tb->begin;
+ nextoffset = tb->next - tb->begin;
+ if(tb->begin)
+ {/*exists: realloc more space*/
+ length = tb->end - tb->begin;
+ tbtemp.begin=(char *)realloc(tb->begin,sizeof(char)*(length+more));
+ if(tbtemp.begin==NULL) ifail = 1;
+ }
+ else
+ {/*not previously built, malloc initial "more" space*/
+ length = 0;
+ nextoffset = 0;
+ tbtemp.begin = (char *)malloc(sizeof(char)*more);
+ if(tbtemp.begin==NULL) ifail = 1;
+ }
+ if(ifail)
+ {/*failed to do a reallocation, reduce request and try again*/
+ more = more/2;
+ if(more > 3) recycle = 1;
+ else recycle = 0;
+ }
+ else recycle = 0;
+ }/*recycle allocation trials*/
+
+ if(ifail==0)
+ {
+ tb->begin = tbtemp.begin; /*reassign pointer*/
+ tb->next = tb->begin + nextoffset; /*reset*/
+ tb->cursor = tb->next; /*current position*/
+ tb->end = tb->begin + sizeof(char)*(length+more);
+ }
+ if(Ltest||ifail)
+ {
+ if(ifail)
+ sprintf(alertstr,CRLF"+%d text block reallocation failed"CRLF
+ ", remains: %ld"
+ ,moretry,(tb->end - tb->begin));
+ else
+ sprintf(alertstr,CRLF"text block allocation now == %ld"CRLF
+ ,(tb->end - tb->begin));
+ fprintf(stderr,"%s",alertstr);
+ }
+}
+/*___buildtextblock()________________________________________________________*/
+
diff --git a/suitenscrt.h b/suitenscrt.h
new file mode 100644
index 0000000..f87a9a8
--- /dev/null
+++ b/suitenscrt.h
@@ -0,0 +1,32 @@
+/* suitenscrt.h see PKINSCRT.c */
+
+/*suitescrt.c defines SCRATCH as nothing ("") so really does the declarations*/
+/* if SCRATCH not defined, then it is defined as "extern" so only referenced*/
+
+#ifdef SCRATCH
+#undef SCRATCH
+#define SCRATCH
+#else
+#define SCRATCH extern
+#endif
+
+SCRATCH char alertstr[256];
+
+typedef struct{
+ char* begin;
+ char* end;
+ char* next;
+ char* cursor;
+} textblock;
+
+SCRATCH textblock mainscratch;
+
+/*prototypes*/
+void inittextblock(textblock*);
+void rewindtextblock(textblock*);
+void buildtextblock(textblock*, size_t);
+void disposetextblock(textblock*);
+void putonetextblockline(textblock*, char*);
+void getonetextblockline(textblock*, char*);
+
+
diff --git a/suitenutil.c b/suitenutil.c
new file mode 100644
index 0000000..01064f0
--- /dev/null
+++ b/suitenutil.c
@@ -0,0 +1,157 @@
+/* suitenutil.c */
+#include "suitename.h"
+#define SUITENUTIL
+#include "suitenutil.h"
+#undef SUITENUTIL
+
+#include "suiteninit.h"
+
+/****vector7ab()**************************************************************/
+void vector7ab(float* atob, float* a, float* b)
+{
+ int j=0,ncnt=1,ndim=7; /*could pass these values ... */
+
+ if(ncnt==1) {atob[0] = 0;} /*count from 1*/
+ for(j=ncnt; j<=ndim; j++)
+ {
+ atob[j] = b[j] - a[j];
+ }
+}
+/*___vector7ab()_____________________________________________________________*/
+
+/****hyperellipsoiddist()*****************************************************/
+float hyperellipsoiddist(int i, int j, int nang, float* warray)
+{
+ /*Piet Hein superellipse, hyperellipsoids */
+ /*library power function: */
+ /*http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_17.html*/
+ /*double pow (double base, double power)*/
+
+ int k=0,kmin=0,kmax=0,n=0;
+ double del=0,delpower=0,dpower=0;
+
+ /*power is global, can be specified on input: -power #.# */
+
+ if(nang == 4){kmin=2; kmax=5;}
+ else {kmin=1; kmax=7;}
+
+ dpower = 0;
+ for(k=kmin; k<=kmax; k++) /*evaluate distance to this i,j cluster*/
+ {
+ /* 1 2 3 4 5 6 7 */
+ /* deltam epsilon zeta alpha beta gamma delta */
+ /* X X X */
+ /* X not used in 4 angle distance calc*/
+ /*del = suiteptr->ang[k] - clusterav[i][j][k];*/ /*globals*/
+ del = suiteptr->ang[k] - bin[i].clst[j].ang[k]; /*globals*/
+ if(del < 0){del = -del;}
+ del = del/warray[k]; /*normalize, del < 1 inside the ellipsoid*/
+ delpower = 1;
+ /*for(n=1; n<=power; n++)*/
+ /*{delpower = del*delpower;}*/ /*this component*/
+ delpower = pow(del,power);
+ dpower = dpower + delpower; /*accummulate components*/
+ }
+ dpower = pow(dpower,1/power);
+/*
+fprintf(stderr,"suite: %s nangle==%d power== %f, distance== %f\n",suiteptr->ptID,nang,power,dpower);
+*/
+ return((float)dpower);
+}
+/*___hyperellipsoiddist()____________________________________________________*/
+
+/****dotproduct()*************************************************************/
+float dotproduct(float* first, float* secnd, int nang)
+{
+ int k=0,kmin=0,kmax=0;
+ float answer=0;
+
+ if(nang = 4){kmin=2; kmax=5;}
+ else {kmin=1; kmax=7;}
+
+ answer = 0;
+ for(k=kmin; k<=kmax; k++) /*evaluate distance to this i,j cluster*/
+ {
+ /* 1 2 3 4 5 6 7 */
+ /* deltam epsilon zeta alpha beta gamma delta */
+ /* X X X */
+ /* X not used in 4 angle calc*/
+
+ answer = answer + (first[k] * secnd[k]);
+ }
+ return(answer);
+}
+/*___dotproduct()____________________________________________________________*/
+
+/****resetcoordw()************************************************************/
+void resetcoordw(float* widptr, int ith, int jth, int Lspecial)
+{
+ widptr[1] = deltamw ;
+ widptr[6] = gammaw ;
+ widptr[7] = deltaw ;
+ if(Lspecial && satellites[ith][jth] > 0)
+ {
+ widptr[2] = epsilonsatw ;
+ widptr[3] = zetasatw ;
+ widptr[4] = alphasatw ;
+ widptr[5] = betasatw ;
+ }
+ else
+ {
+ widptr[2] = epsilonw ;
+ widptr[3] = zetaw ;
+ widptr[4] = alphaw ;
+ widptr[5] = betaw ;
+ }
+}
+/*___resetcoordw()___________________________________________________________*/
+
+/****confirmsuite()***********************************************************/
+int confirmsuite(void)
+{
+ if( suiteptr->deltam >= 0 && suiteptr->deltam <= 360
+ && suiteptr->epsilon >= 0 && suiteptr->epsilon <= 360
+ && suiteptr->zeta >= 0 && suiteptr->zeta <= 360
+ && suiteptr->alpha >= 0 && suiteptr->alpha <= 360
+ && suiteptr->beta >= 0 && suiteptr->beta <= 360
+ && suiteptr->gamma >= 0 && suiteptr->gamma <= 360
+ && suiteptr->delta >= 0 && suiteptr->delta <= 360
+ )
+ {return(1);}
+ else {return(0);}
+}
+/*___confirmsuite()__________________________________________________________*/
+
+/****CompArgStr()***********jmw/utility***************************************/
+int CompArgStr(char *str, char *arg, int min)
+{
+ /*requires exact (caseless) match up through min number of characters */
+ /* past that, must break or continue exactly matching to be valid*/
+
+ int i, max;
+ char s, a;
+
+ if (!str || !arg) return 0;
+
+ max = strlen(arg);
+
+ for(i=0; i<max; i++)
+ {
+ s = toupper(str[i]);
+ a = toupper(arg[i]);
+
+ if (i >= min && ( s == '\0' || s == ',' || s == '(' || s == '.'
+ || s == '+' || s == '-' || isdigit(s)))
+ {
+ break; /* good ending point */
+ }
+ else if (s != a)
+ {
+ i = 0; /* failed to match */
+ break;
+ }
+ }
+ return i;
+}
+/*___CompArgStr()____________________________________________________________*/
+
diff --git a/suitenutil.h b/suitenutil.h
new file mode 100644
index 0000000..b28903e
--- /dev/null
+++ b/suitenutil.h
@@ -0,0 +1,18 @@
+/* suitenutil.h */
+
+#ifdef SUITENUTIL
+#undef SUITENUTIL
+#define SUITENUTIL
+#else
+#define SUITENUTIL extern
+#endif
+
+/* prototypes: */
+
+void vector7ab(float*, float*, float*);
+float hyperellipsoiddist(int,int,int,float*);
+void resetcoordw(float*,int,int,int);
+float dotproduct(float*, float*,int);
+int confirmsuite(void);
+int CompArgStr(char*, char*, int);
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/suitename.git
More information about the debian-med-commit
mailing list