File: Error.c

package info (click to toggle)
theseus 3.3.0-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 91,384 kB
  • sloc: ansic: 41,744; makefile: 267; sh: 121
file content (235 lines) | stat: -rw-r--r-- 12,515 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
/*
    Theseus - maximum likelihood superpositioning of macromolecular structures

    Copyright (C) 2004-2015 Douglas L. Theobald

    This file is part of THESEUS.

    THESEUS is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as
    published by the Free Software Foundation, either version 3 of
    the License, or (at your option) any later version.

    THESEUS is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public
    License along with THESEUS in the file 'COPYING'. If not, see
    <http://www.gnu.org/licenses/>.

    -/_|:|_|_\-
*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <gsl/gsl_version.h>
#include "termcol.h"
#include "Error.h"

extern void
ilaver_(int *vers_major, int *vers_minor, int *vers_patch);

static void
Expert1(void)
{
    printf("\n");
    printf(" Expert options:\n");
    printf("         {%s2%s} = Maximum Likelihood                                           \n", tc_GREEN, tc_NC);
    printf("    -g  hierarchical model for variances                                        \n");
    printf("          0 = none (may not converge)                                           \n");
    printf("         {%s1%s} = inverse gamma distribution                                   \n", tc_GREEN, tc_NC);
    printf("    -J  print very expert options                                               \n");
    printf("    -o  reference file to superimpose on,                                       \n");
    printf("         all rotations are relative to the first model in this file             \n");
    printf("    -p  requested relative precision for convergence  {%s1e-7%s}                \n", tc_GREEN, tc_NC);
    printf("    -t  ndf, degrees of freedom for scaled inverse chi2                         \n");
    printf("    -Z  don't orient final superposition along principal axes                   \n");
    printf("    -z  n  fixed shape parameter for inverse gamma distribution                 \n");
}


static void
Expert2(void)
{
    fputc('\n', stdout);
    printf(" Very expert options (i.e. unsupported, caveat emptor):\n");
    printf("    -0  don't calculate translations                                            \n");
    printf("    -1  don't calculate rotations                                               \n");
    printf("    -2  convert Lele file to PDB format                                         \n");
    printf("    -3  n:n  scale and shape params for inverse gamma for random variances      \n");
    printf("    -4  n:n:n  radius of gyration for Gaussian generated atoms                  \n");
    printf("    -5  TenBerge algorithm for mean                                             \n");
    printf("    -6  write Bob Edgar's SSM (structure similarity matrix)                     \n");
    printf("    -B  read and write binary coordinate files                                  \n");
    printf("          1 = read a PDB file, write a binary of it and quit                    \n");
    printf("          2 = read a binary, superimpose, and write a PDB                       \n");
    printf("          3 = read a PDB file, superimpose, and write a binary                  \n");
    printf("          4 = read a binary, superimpose, and write a binary                    \n");
    printf("    -c  use ML atomic covariance weighting (fit correlations, slower)           \n");
    printf("    -e  embedding algorithm for initializing the average structure              \n");
    printf("          0 = none; use randomly chosen model                                   \n");
    printf("    -G  full 3D coordinate PCA (vector PCA is default)                          \n");
    printf("    -H  write 3D coordinate PCA morph files (for use with CNS/XPLOR)            \n");
    printf("    -j  # of landmarks for random coords generation                             \n");
    printf("    -K  n  number of mixtures for mixture Gaussian                              \n");
    printf("    -N  do a \"null run\" -- no superposition                                   \n");
    printf("    -O  Olve's segID file                                                       \n");
    printf("    -Q  n  scale all coordinates by this factor                                 \n");
    printf("    -R0 randomly translate and rotate before superpositioning                   \n");
    printf("    -T  n  number of threads                                                    \n");
    printf("    -U  print logL for each iteration                                           \n");
    printf("    -u  calculate bias-corrected average structure                              \n");
    printf("    -W  wordy/verbose                                                           \n");
    printf("    -X  seed the algorithm with the superposition in the file                   \n");
    printf("    -x  no iterations in inner loop (superimposing to average)                  \n");
    printf("    -y  don't calculate the average structure                                   \n");
    printf("    -Y  print extra stats, gyration radii, Durbin-Watson autocorrelation        \n");
}


void
Usage(int expert)
{
//    int vers_major, vers_minor, vers_patch;

//    ilaver_(&vers_major, &vers_minor, &vers_patch);

    PrintTheseusPre();
    printf("  Usage:                                                                        \n");
    printf("    theseus [options] <pdb files>                                               \n\n");

    printf("  Algorithm options:                                                            \n");
    printf("    -a  atoms to include in superposition                                       \n");
    printf("          %s0%s = alpha carbons and phosphorous atoms                           \n", tc_GREEN, tc_NC);
    printf("          1 = backbone                                                          \n");
    printf("          2 = all                                                               \n");
    printf("          3 = alpha and beta carbons                                            \n");
    printf("          4 = all heavy atoms (all but hydrogens)                               \n");
    printf("            or                                                                  \n");
    printf("        a colon-delimited string specifying the atom-types PDB-style            \n");
    printf("        e.g., -a ' CA  : N  '                                                   \n");
    printf("        selects the alpha carbons and backone nitrogens                         \n");
    printf("    -f  only read the first model of a multi-model PDB file                     \n");
    printf("    -i  maximum iterations {%s200%s}                                            \n", tc_GREEN, tc_NC);
    printf("    -l  superimpose with conventional least squares method                      \n");
    printf("    -s  residues to select (e.g. -s15-45:50-55) {%sall%s}                       \n", tc_GREEN, tc_NC);
    printf("    -S  residues to exclude (e.g. -S15-45:50-55) {%snone%s}                     \n", tc_GREEN, tc_NC);
    printf("    -%sv%s  use ML variance weighting (no correlations)                         \n", tc_GREEN, tc_NC);

    printf("\n Input/output options: \n");
    printf("    --amber  for reading AMBER8 formatted PDB files                             \n");
    printf("    -A  sequence alignment file to use as a guide (CLUSTAL or A2M format)       \n");
    printf("    -E  print expert options                                                    \n");
    printf("    -F  print FASTA files of the sequences in PDB files and quit                \n");
    printf("    -h  help/usage                                                              \n");
    printf("    -I  just calculate statistics for input file (don't superposition)          \n");
    printf("    -M  file that maps sequences in the alignment file to PDB files             \n");
    printf("    -r  root name for output files {%stheseus%s}                                \n", tc_GREEN, tc_NC);
    printf("    -V  version                                                                 \n");

    printf("\n Principal components analysis: \n");
    printf("    -C  use covariance matrix for PCA (correlation matrix is default)           \n");
    printf("    -P  # of principal components to calculate {%s0%s}                          \n", tc_GREEN, tc_NC);

    printf("\n Morphometrics: \n");
    printf("    -d  calculate scale factors (for morphometrics)                             \n");
    printf("    -q  read and write Rohlf TPS morphometric landmark files                    \n");

    if (expert)
        Expert1();

    if (expert == 2)
        Expert2();

    printf("\n");
    printf(" Citations: \n");
    printf("   Douglas L. Theobald and Phillip A. Steindel (2012) \n");
    printf("   \"Optimal simultaneous superpositioning of multiple structures with missing\n");
    printf("   data.\"\n");
    printf("   Bioinformatics 28(15):1972-1979\n");
    printf("\n");
    printf("   Douglas L. Theobald and Deborah S. Wuttke (2008) \n");
    printf("   \"Accurate structural correlations from maximum likelihood superpositions.\"\n");
    printf("   PLOS Computational Biology, 4(2):e43\n");
    printf("\n");
/*    printf("   Douglas L. Theobald and Deborah S. Wuttke (2006) \n");
    printf("   \"Empirical Bayes models for regularizing maximum likelihood estimation in\n");
    printf("   the matrix Gaussian Procrustes problem.\"\n");
    printf("   PNAS 103(49):18521-18527\n");
    printf("\n");
    printf("   Douglas L. Theobald and Deborah S. Wuttke (2006) \n");
    printf("   \"THESEUS: Maximum likelihood superpositioning and analysis of molecular\n");
    printf("   structures.\"\n");
    printf("   Bioinformatics 22(17):2171-2172\n");
    printf("\n"); */
    printf("   http://www.theseus3d.org/\n");
    printf("   Compiled with GSL version %s\n", GSL_VERSION);
    //printf("   Compiled with LAPACK version %d.%d.%d\n", vers_major, vers_minor, vers_patch);
    printf("I===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-==I\n");
    printf("                            %s<  END THESEUS %s  >%s \n\n\n",
           tc_RED, VERSION, tc_NC);
    fflush(NULL);
}


void
PrintTheseusPre(void)
{
    printf("\n\n");
    printf("                            %s< BEGIN THESEUS %s >%s \n", tc_RED, VERSION, tc_NC);
    printf("I===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-=I\n");
    printf("I                %sTHESEUS%s: Maximum likelihood multiple superpositioning        I\n", tc_CYAN, tc_NC);
    printf("I=-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===I\n");
}


void
PrintTheseusTag(void)
{
    printf("    Done. \n");
    printf("I===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-===-==I\n");
    printf("                            %s<  END THESEUS %s  >%s \n\n\n",
           tc_RED, VERSION, tc_NC);
    fflush(NULL);
}


#if defined(__clang__)
    /* Clang/LLVM. ---------------------------------------------- */

#elif defined(__ICC) || defined(__INTEL_COMPILER)
    /* Intel ICC/ICPC. ------------------------------------------ */

#elif defined(__GNUC__) || defined(__GNUG__)
    /* GNU GCC/G++. --------------------------------------------- */

#elif defined(__HP_cc) || defined(__HP_aCC)
    /* Hewlett-Packard C/aC++. ---------------------------------- */

#elif defined(__IBMC__) || defined(__IBMCPP__)
    /* IBM XL C/C++. -------------------------------------------- */

#elif defined(_MSC_VER)
    /* Microsoft Visual Studio. --------------------------------- */

#elif defined(__PGI)
    /* Portland Group PGCC/PGCPP. ------------------------------- */

#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
    /* Oracle Solaris Studio. ----------------------------------- */

#endif


void
Version(void)
{
    printf("\n  THESEUS version %s compiled on %s %s\n  by user %s with machine \"%s\" \n\n",
           VERSION, __DATE__, __TIME__, getenv("USER"), getenv("HOST"));
    printf("  Compiled with GSL version %s\n\n", GSL_VERSION);
    fflush(NULL);
}