git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/msa@128017 bc3139a8-67e5-0310-9ffc-ced21a209358
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/msa@119986 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -36,8 +36,13 @@ |
36 | 36 |
#include <string.h> // strcmp, strstr |
37 | 37 |
#include <stdio.h> // printf |
38 | 38 |
#include <stdlib.h> // exit |
39 |
-//#include <math.h> // sqrt, pow |
|
39 |
+ |
|
40 |
+#ifdef WINMATHH |
|
41 |
+#include <math.h> // sqrt, pow |
|
42 |
+#else |
|
40 | 43 |
#include <cmath> // sqrt, pow |
44 |
+#endif |
|
45 |
+ |
|
41 | 46 |
#include <limits.h> // INT_MIN |
42 | 47 |
#include <float.h> // FLT_MIN |
43 | 48 |
#include <time.h> // clock |
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/msa@119484 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -36,7 +36,8 @@ |
36 | 36 |
#include <string.h> // strcmp, strstr |
37 | 37 |
#include <stdio.h> // printf |
38 | 38 |
#include <stdlib.h> // exit |
39 |
-#include <math.h> // sqrt, pow |
|
39 |
+//#include <math.h> // sqrt, pow |
|
40 |
+#include <cmath> // sqrt, pow |
|
40 | 41 |
#include <limits.h> // INT_MIN |
41 | 42 |
#include <float.h> // FLT_MIN |
42 | 43 |
#include <time.h> // clock |
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/msa@102514 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -918,11 +918,10 @@ hhalign(char **ppcFirstProf, int iFirstCnt, double *pdWeightsL, |
918 | 918 |
par.gapg = par.gapgV; |
919 | 919 |
par.gaph = par.gaphV; |
920 | 920 |
par.gapi = par.gapiV; |
921 |
- |
|
922 |
- par.gapExtension = rHhalignPara.gapExtension; |
|
923 |
- par.gapOpening = rHhalignPara.gapOpening; |
|
924 |
- |
|
925 | 921 |
} |
922 |
+ |
|
923 |
+ par.gapExtension = rHhalignPara.gapExtension; |
|
924 |
+ par.gapOpening = rHhalignPara.gapOpening; |
|
926 | 925 |
|
927 | 926 |
// Read input file (HMM, HHM, or alignment format), and add pseudocounts etc. |
928 | 927 |
q.cQT = 'q'; |
msa
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/msa@102253 bc3139a8-67e5-0310-9ffc-ced21a209358
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,1424 @@ |
1 |
+/* -*- mode: c; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
|
2 |
+ |
|
3 |
+/********************************************************************* |
|
4 |
+ * Clustal Omega - Multiple sequence alignment |
|
5 |
+ * |
|
6 |
+ * Copyright (C) 2010 University College Dublin |
|
7 |
+ * |
|
8 |
+ * Clustal-Omega is free software; you can redistribute it and/or |
|
9 |
+ * modify it under the terms of the GNU General Public License as |
|
10 |
+ * published by the Free Software Foundation; either version 2 of the |
|
11 |
+ * License, or (at your option) any later version. |
|
12 |
+ * |
|
13 |
+ * This file is part of Clustal-Omega. |
|
14 |
+ * |
|
15 |
+ ********************************************************************/ |
|
16 |
+ |
|
17 |
+/* |
|
18 |
+ * RCS $Id: hhalign.cpp 284 2013-06-12 10:10:11Z fabian $ |
|
19 |
+ */ |
|
20 |
+ |
|
21 |
+/* hhalign.C: |
|
22 |
+ * Align a multiple alignment to an alignment or HMM |
|
23 |
+ * Print out aligned input sequences in a3m format |
|
24 |
+ * Compile: g++ hhalign.C -o hhalign -I/usr/include/ -L/usr/lib -lpng -lz -O3 -fno-strict-aliasing |
|
25 |
+ * Compile with efence: g++ hhalign.C -o hhalign -I/usr/include/ -lefence -L/usr/lib -lpng -lz -O -g |
|
26 |
+ * |
|
27 |
+ * Error codes: 0: ok 1: file format error 2: file access error |
|
28 |
+ * 3: memory error 4: internal numeric error |
|
29 |
+ * 5: command line error |
|
30 |
+ */ |
|
31 |
+#undef PNG /* include options for making png files? |
|
32 |
+ (will need the png library) */ |
|
33 |
+#define MAIN |
|
34 |
+#include <iostream> // cin, cout, cerr |
|
35 |
+#include <fstream> // ofstream, ifstream |
|
36 |
+#include <string.h> // strcmp, strstr |
|
37 |
+#include <stdio.h> // printf |
|
38 |
+#include <stdlib.h> // exit |
|
39 |
+#include <math.h> // sqrt, pow |
|
40 |
+#include <limits.h> // INT_MIN |
|
41 |
+#include <float.h> // FLT_MIN |
|
42 |
+#include <time.h> // clock |
|
43 |
+#include <ctype.h> // islower, isdigit etc |
|
44 |
+ |
|
45 |
+using std::cout; |
|
46 |
+using std::cerr; |
|
47 |
+using std::endl; |
|
48 |
+using std::ios; |
|
49 |
+using std::ifstream; |
|
50 |
+using std::ofstream; |
|
51 |
+ |
|
52 |
+int iAux_GLOBAL; |
|
53 |
+ |
|
54 |
+#include "general.h" |
|
55 |
+#include "util-C.h" /* imax, fmax, iround, iceil, ifloor, strint, strscn, |
|
56 |
+ strcut, substr, uprstr, uprchr, Basename etc. */ |
|
57 |
+#include "list-C.h" // list data structure |
|
58 |
+#include "hash-C.h" // hash data structure |
|
59 |
+ |
|
60 |
+#include "hhdecl-C.h" // Constants, global variables, struct Parameters |
|
61 |
+#include "hhutil-C.h" /* MatchChr, InsertChr, aa2i, i2aa, log2, |
|
62 |
+ fast_log2, WriteToScreen, */ |
|
63 |
+#include "hhmatrices-C.h" // BLOSUM50, GONNET, HSDM |
|
64 |
+#include "hhhmm.h" // class HMM |
|
65 |
+#include "hhhit.h" // class Hit |
|
66 |
+#include "hhalignment.h" // class Alignment |
|
67 |
+#include "hhhalfalignment.h" // class HalfAlignment |
|
68 |
+#include "hhfullalignment.h" // class FullAlignment |
|
69 |
+#include "hhhitlist.h" // class Hit |
|
70 |
+#include "hhhmm-C.h" // class HMM |
|
71 |
+#include "hhalignment-C.h" // class Alignment |
|
72 |
+#include "hhhit-C.h" // class Hit |
|
73 |
+#include "hhhalfalignment-C.h" // class HalfAlignment |
|
74 |
+#include "hhfullalignment-C.h" // class FullAlignment |
|
75 |
+#include "hhhitlist-C.h" // class HitList |
|
76 |
+#include "hhfunc-C.h" // some functions common to hh programs |
|
77 |
+ |
|
78 |
+#ifdef PNG |
|
79 |
+#include "pngwriter.h" //PNGWriter (http://pngwriter.sourceforge.net/) |
|
80 |
+#include "pngwriter.cc" //PNGWriter (http://pngwriter.sourceforge.net/) |
|
81 |
+#endif |
|
82 |
+ |
|
83 |
+//////////////////////////////////////////////////////////////////////// |
|
84 |
+// Global variables |
|
85 |
+//////////////////////////////////////////////////////////////////////// |
|
86 |
+HMM *q; // Create query HMM with maximum of MAXRES match states |
|
87 |
+HMM *t; /* Create template HMM with maximum of MAXRES |
|
88 |
+ match states */ |
|
89 |
+Alignment *qali; /* (query alignment might be needed outside of hhfunc.C |
|
90 |
+ for -a option) */ |
|
91 |
+Hit hit; // Ceate new hit object pointed at by hit |
|
92 |
+HitList hitlist; /* list of hits with one Hit object for each |
|
93 |
+ pairwise comparison done */ |
|
94 |
+char aliindices[256]; /* hash containing indices of all alignments |
|
95 |
+ which to show in dot plot */ |
|
96 |
+char* dmapfile=NULL; /* where to write the coordinates for the HTML map file |
|
97 |
+ (to click the alignments) */ |
|
98 |
+char* alitabfile=NULL; // where to write pairs of aligned residues |
|
99 |
+char* strucfile=NULL; // where to read structure scores |
|
100 |
+char* pngfile=NULL; // pointer to pngfile |
|
101 |
+char* tcfile=NULL; // TCoffee output file name |
|
102 |
+float probmin_tc=0.05; /* 5% minimum posterior probability for printing |
|
103 |
+ pairs of residues for TCoffee */ |
|
104 |
+ |
|
105 |
+int dotW=10; // average score of dot plot over window [i-W..i+W] |
|
106 |
+float dotthr=0.5; // score threshold for dot plot |
|
107 |
+int dotscale=600; // size scale of dotplot |
|
108 |
+char dotali=0; // show no alignments in dotplot |
|
109 |
+float dotsat=0.3; // saturation of grid and alignments in dot plot |
|
110 |
+float pself=0.001; // maximum p-value of 2nd and following self-alignments |
|
111 |
+int Nstochali=0; // # of stochastically traced alignments in dot plot |
|
112 |
+float** Pstruc=NULL; /* structure matrix which can be multiplied to prob |
|
113 |
+ ratios from aa column comparisons in Forward() */ |
|
114 |
+float** Sstruc=NULL; /* structure matrix which can be added to log odds |
|
115 |
+ from aa column comparisons in Forward() */ |
|
116 |
+bool nucleomode = false; |
|
117 |
+ |
|
118 |
+//////////////////////////////////////////////////////////////////////////// |
|
119 |
+// Help functions |
|
120 |
+//////////////////////////////////////////////////////////////////////////// |
|
121 |
+/** |
|
122 |
+ * @brief general help function, not accessible in Clustal-Omega |
|
123 |
+ */ |
|
124 |
+#if 0 |
|
125 |
+void |
|
126 |
+help() |
|
127 |
+{ |
|
128 |
+ printf("\n"); |
|
129 |
+ printf("HHalign %s\n",VERSION_AND_DATE); |
|
130 |
+ printf("Align a query alignment/HMM to a template alignment/HMM by HMM-HMM alignment\n"); |
|
131 |
+ printf("If only one alignment/HMM is given it is compared to itself and the best\n"); |
|
132 |
+ printf("off-diagonal alignment plus all further non-overlapping alignments above \n"); |
|
133 |
+ printf("significance threshold are shown.\n"); |
|
134 |
+ printf("%s",REFERENCE); |
|
135 |
+ printf("%s",COPYRIGHT); |
|
136 |
+ printf("\n"); |
|
137 |
+ printf("Usage: %s -i query [-t template] [options] \n",program_name); |
|
138 |
+ printf(" -i <file> input query alignment (fasta/a2m/a3m) or HMM file (.hhm)\n"); |
|
139 |
+ printf(" -t <file> input template alignment (fasta/a2m/a3m) or HMM file (.hhm)\n"); |
|
140 |
+#ifdef PNG |
|
141 |
+ printf(" -png <file> write dotplot into PNG-file (default=none) \n"); |
|
142 |
+#endif |
|
143 |
+ printf("\n"); |
|
144 |
+ printf("Output options: \n"); |
|
145 |
+ printf(" -o <file> write output alignment to file\n"); |
|
146 |
+ printf(" -ofas <file> write alignments in FASTA, A2M (-oa2m) or A3M (-oa3m) format \n"); |
|
147 |
+ printf(" -a <file> write query alignment in a3m format to file (default=none)\n"); |
|
148 |
+ printf(" -aa <file> append query alignment in a3m format to file (default=none)\n"); |
|
149 |
+ printf(" -atab <file> write alignment as a table (with posteriors) to file (default=none)\n"); |
|
150 |
+ printf(" -v <int> verbose mode: 0:no screen output 1:only warings 2: verbose\n"); |
|
151 |
+ printf(" -seq [1,inf[ max. number of query/template sequences displayed (def=%i) \n",par.nseqdis); |
|
152 |
+ printf(" -nocons don't show consensus sequence in alignments (default=show) \n"); |
|
153 |
+ printf(" -nopred don't show predicted 2ndary structure in alignments (default=show) \n"); |
|
154 |
+ printf(" -nodssp don't show DSSP 2ndary structure in alignments (default=show) \n"); |
|
155 |
+ printf(" -aliw int number of columns per line in alignment list (def=%i)\n",par.aliwidth); |
|
156 |
+ printf(" -P <float> for self-comparison: max p-value of alignments (def=%.2g\n",pself); |
|
157 |
+ printf(" -p <float> minimum probability in summary and alignment list (def=%G) \n",par.p); |
|
158 |
+ printf(" -E <float> maximum E-value in summary and alignment list (def=%G) \n",par.E); |
|
159 |
+ printf(" -Z <int> maximum number of lines in summary hit list (def=%i) \n",par.Z); |
|
160 |
+ printf(" -z <int> minimum number of lines in summary hit list (def=%i) \n",par.z); |
|
161 |
+ printf(" -B <int> maximum number of alignments in alignment list (def=%i) \n",par.B); |
|
162 |
+ printf(" -b <int> minimum number of alignments in alignment list (def=%i) \n",par.b); |
|
163 |
+ printf(" -rank int specify rank of alignment to write with -a or -aa option (default=1)\n"); |
|
164 |
+ printf("\n"); |
|
165 |
+#ifdef PNG |
|
166 |
+ printf("Dotplot options:\n"); |
|
167 |
+ printf(" -dwin <int> average score in dotplot over window [i-W..i+W] (def=%i) \n",dotW); |
|
168 |
+ printf(" -dthr <float> score threshold for dotplot (default=%.2f) \n",dotthr); |
|
169 |
+ printf(" -dsca <int> if value <= 20: size of dot plot unit box in pixels \n"); |
|
170 |
+ printf(" if value > 20: maximum dot plot size in pixels (default=%i) \n",dotscale); |
|
171 |
+ printf(" -dali <list> show alignments with indices in <list> in dot plot \n"); |
|
172 |
+ printf(" <list> = <index1> ... <indexN> or <list> = all \n"); |
|
173 |
+ printf("\n"); |
|
174 |
+#endif |
|
175 |
+ printf("Filter input alignment (options can be combined): \n"); |
|
176 |
+ printf(" -id [0,100] maximum pairwise sequence identity (%%) (def=%i) \n",par.max_seqid); |
|
177 |
+ printf(" -diff [0,inf[ filter most diverse set of sequences, keeping at least this \n"); |
|
178 |
+ printf(" many sequences in each block of >50 columns (def=%i)\n",par.Ndiff); |
|
179 |
+ printf(" -cov [0,100] minimum coverage with query (%%) (def=%i) \n",par.coverage); |
|
180 |
+ printf(" -qid [0,100] minimum sequence identity with query (%%) (def=%i) \n",par.qid); |
|
181 |
+ printf(" -qsc [0,100] minimum score per column with query (def=%.1f)\n",par.qsc); |
|
182 |
+// printf(" -csc [0,100] minimum score per column with core alignment (def=%-.2f)\n",par.coresc); |
|
183 |
+// printf(" -qscc [0,100] minimum score per column of core sequence with query (def=%-.2f)\n",par.qsc_core); |
|
184 |
+ printf("\n"); |
|
185 |
+ printf("Input alignment format: \n"); |
|
186 |
+ printf(" -M a2m use A2M/A3M (default): upper case = Match; lower case = Insert;\n"); |
|
187 |
+ printf(" '-' = Delete; '.' = gaps aligned to inserts (may be omitted) \n"); |
|
188 |
+ printf(" -M first use FASTA: columns with residue in 1st sequence are match states\n"); |
|
189 |
+ printf(" -M [0,100] use FASTA: columns with fewer than X%% gaps are match states \n"); |
|
190 |
+ printf("\n"); |
|
191 |
+ printf("HMM-HMM alignment options: \n"); |
|
192 |
+ printf(" -glob/-loc global or local alignment mode (def=local) \n"); |
|
193 |
+ printf(" -alt <int> show up to this number of alternative alignments (def=%i) \n",par.altali); |
|
194 |
+ printf(" -vit use Viterbi algorithm for alignment instead of MAC algorithm \n"); |
|
195 |
+ printf(" -mac use Maximum Accuracy (MAC) alignment (default) \n"); |
|
196 |
+ printf(" -mact [0,1[ posterior probability threshold for MAC alignment (def=%.3f) \n",par.mact); |
|
197 |
+ printf(" A threshold value of 0.0 yields global alignments.\n"); |
|
198 |
+ printf(" -sto <int> use global stochastic sampling algorithm to sample this many alignments\n"); |
|
199 |
+ printf(" -excl <range> exclude query positions from the alignment, e.g. '1-33,97-168'\n"); |
|
200 |
+ printf(" -shift [-1,1] score offset (def=%-.3f) \n",par.shift); |
|
201 |
+ printf(" -corr [0,1] weight of term for pair correlations (def=%.2f) \n",par.corr); |
|
202 |
+ printf(" -ssm 0-4 0:no ss scoring [default=%i] \n",par.ssm); |
|
203 |
+ printf(" 1:ss scoring after alignment \n"); |
|
204 |
+ printf(" 2:ss scoring during alignment \n"); |
|
205 |
+ printf(" -ssw [0,1] weight of ss score (def=%-.2f) \n",par.ssw); |
|
206 |
+ printf("\n"); |
|
207 |
+ printf(" -def read default options from ./.hhdefaults or <home>/.hhdefault. \n"); |
|
208 |
+ printf("\n"); |
|
209 |
+ printf("Example: %s -i T0187.a3m -t d1hz4a_.hhm -png T0187pdb.png \n",program_name); |
|
210 |
+ cout<<endl; |
|
211 |
+// printf("More help: \n"); |
|
212 |
+// printf(" -h out output options \n"); |
|
213 |
+// printf(" -h hmm options for building HMM from multiple alignment \n"); |
|
214 |
+// printf(" -h gap options for setting gap penalties \n"); |
|
215 |
+// printf(" -h ali options for HMM-HMM alignment \n"); |
|
216 |
+// printf(" -h all all options \n"); |
|
217 |
+} |
|
218 |
+#endif |
|
219 |
+ |
|
220 |
+/** |
|
221 |
+ * @brief helpt for output, not accessible in Clustal-Omega |
|
222 |
+ */ |
|
223 |
+#if 0 |
|
224 |
+void |
|
225 |
+help_out() |
|
226 |
+{ |
|
227 |
+ printf("\n"); |
|
228 |
+ printf("Output options: \n"); |
|
229 |
+ printf(" -v verbose mode (default: show only warnings) \n"); |
|
230 |
+ printf(" -v 0 suppress all screen output \n"); |
|
231 |
+ printf(" -nocons don't show consensus sequence in alignments (default=show) \n"); |
|
232 |
+ printf(" -nopred don't show predicted 2ndary structure in alignments (default=show) \n"); |
|
233 |
+ printf(" -nodssp don't show DSSP SS 2ndary structure in alignments (default=show) \n"); |
|
234 |
+ printf(" -seq [1,inf[ max. number of query/template sequences displayed (def=%i) \n",par.nseqdis); |
|
235 |
+ printf(" -aliw [40,..[ number of columns per line in alignment list (def=%i)\n",par.aliwidth); |
|
236 |
+ printf(" -P <float> for self-comparison: max p-value of alignments (def=%.2g\n",pself); |
|
237 |
+ printf(" -p <float> minimum probability in summary and alignment list (def=%G) \n",par.p); |
|
238 |
+ printf(" -E <float> maximum E-value in summary and alignment list (def=%G) \n",par.E); |
|
239 |
+ printf(" -Z <int> maximum number of lines in summary hit list (def=%i) \n",par.Z); |
|
240 |
+ printf(" -z <int> minimum number of lines in summary hit list (def=%i) \n",par.z); |
|
241 |
+ printf(" -B <int> maximum number of alignments in alignment list (def=%i) \n",par.B); |
|
242 |
+ printf(" -b <int> minimum number of alignments in alignment list (def=%i) \n",par.b); |
|
243 |
+ printf(" -rank int specify rank of alignment to write with -a or -aa option (def=1)\n"); |
|
244 |
+ printf(" -tc <file> write a TCoffee library file for the pairwise comparison \n"); |
|
245 |
+ printf(" -tct [0,100] min. probobability of residue pairs for TCoffee (def=%i%%)\n",iround(100*probmin_tc)); |
|
246 |
+ printf("\n"); |
|
247 |
+#ifdef PNG |
|
248 |
+ printf("Dotplot options:\n"); |
|
249 |
+ printf(" -dwin int average score in dotplot over window [i-W..i+W] (def=%i) \n",dotW); |
|
250 |
+ printf(" -dthr float score threshold for dotplot (default=%.2f) \n",dotthr); |
|
251 |
+ printf(" -dsca int size of dot plot box in pixels (default=%i) \n",dotscale); |
|
252 |
+ printf(" -dali <list> show alignments with indices in <list> in dot plot\n"); |
|
253 |
+ printf(" <list> = <index1> ... <indexN> or <list> = all \n"); |
|
254 |
+ printf(" -dmap <file> print list of coordinates in png plot \n"); |
|
255 |
+#endif |
|
256 |
+} |
|
257 |
+#endif |
|
258 |
+ |
|
259 |
+/** |
|
260 |
+ * @brief help hit HMM options, not accessible in Clustal-Omega |
|
261 |
+ */ |
|
262 |
+#if 0 |
|
263 |
+void |
|
264 |
+help_hmm() |
|
265 |
+{ |
|
266 |
+ printf("\n"); |
|
267 |
+ printf("Options to filter input alignment (options can be combined): \n"); |
|
268 |
+ printf(" -id [0,100] maximum pairwise sequence identity (%%) (def=%i) \n",par.max_seqid); |
|
269 |
+ printf(" -diff [0,inf[ filter most diverse set of sequences, keeping at least this \n"); |
|
270 |
+ printf(" many sequences in each block of >50 columns (def=%i)\n",par.Ndiff); |
|
271 |
+ printf(" -cov [0,100] minimum coverage with query (%%) (def=%i) \n",par.coverage); |
|
272 |
+ printf(" -qid [0,100] minimum sequence identity with query (%%) (def=%i) \n",par.qid); |
|
273 |
+ printf(" -qsc [0,100] minimum score per column with query (def=%.1f)\n",par.qsc); |
|
274 |
+// printf(" -csc [0,100] minimum score per column with core alignment (def=%-.2f)\n",par.coresc); |
|
275 |
+// printf(" -qscc [0,100] minimum score per column of core sequence with query (def=%-.2f)\n",par.qsc_core); |
|
276 |
+ printf(" \n"); |
|
277 |
+ printf("HMM-building options: \n"); |
|
278 |
+ printf(" -M a2m use A2M/A3M (default): upper case = Match; lower case = Insert;\n"); |
|
279 |
+ printf(" '-' = Delete; '.' = gaps aligned to inserts (may be omitted) \n"); |
|
280 |
+ printf(" -M first use FASTA: columns with residue in 1st sequence are match states\n"); |
|
281 |
+ printf(" -M [0,100] use FASTA: columns with fewer than X%% gaps are match states \n"); |
|
282 |
+ printf(" -tags do NOT neutralize His-, C-myc-, FLAG-tags, and \n"); |
|
283 |
+ printf(" trypsin recognition sequence to background distribution \n"); |
|
284 |
+ printf(" \n"); |
|
285 |
+ printf("Pseudocount options: \n"); |
|
286 |
+ printf(" -Gonnet use the Gonnet substitution matrix (default) \n"); |
|
287 |
+ printf(" -Blosum50 use the Blosum50 substitution matrix \n"); |
|
288 |
+ printf(" -Blosum62 use the Blosum62 substitution matrix \n"); |
|
289 |
+ printf(" -HSDM use the structure-derived HSDM substitution matrix \n"); |
|
290 |
+ printf(" -pcm 0-3 Pseudocount mode (default=%-i) \n",par.pcm); |
|
291 |
+ printf(" tau = substitution matrix pseudocount admixture \n"); |
|
292 |
+ printf(" 0: no pseudo counts: tau = 0 \n"); |
|
293 |
+ printf(" 1: constant tau = a \n"); |
|
294 |
+ printf(" 2: divergence-dependent: tau = a/(1 + ((Neff-1)/b)^c) \n"); |
|
295 |
+ printf(" Neff=( (Neff_q^d+Neff_t^d)/2 )^(1/d) \n"); |
|
296 |
+ printf(" Neff_q = av number of different AAs per column in query \n"); |
|
297 |
+ printf(" 3: column-specific: tau = \'2\' * (Neff(i)/Neff)^(w*Neff/20)\n"); |
|
298 |
+ printf(" -pca [0,1] set a (overall admixture) (def=%-.1f) \n",par.pca); |
|
299 |
+ printf(" -pcb [1,inf[ set b (threshold for Neff) (def=%-.1f) \n",par.pcb); |
|
300 |
+ printf(" -pcc [0,3] set c (extinction exponent for tau(Neff)) (def=%-.1f) \n",par.pcc); |
|
301 |
+ printf(" -pcw [0,3] set w (weight of pos-specificity for pcs) (def=%-.1f) \n",par.pcw); |
|
302 |
+} |
|
303 |
+#endif |
|
304 |
+ |
|
305 |
+/** |
|
306 |
+ * @brief help with gap handling, not accessible in Clustal-Omega |
|
307 |
+ */ |
|
308 |
+#if 0 |
|
309 |
+void |
|
310 |
+help_gap() |
|
311 |
+{ |
|
312 |
+ printf("\n"); |
|
313 |
+ printf("Gap cost options: \n"); |
|
314 |
+ printf(" -gapb [0,inf[ transition pseudocount admixture (def=%-.2f) \n",par.gapb); |
|
315 |
+ printf(" -gapd [0,inf[ Transition pseudocount admixture for opening gap (default=%-.2f)\n",par.gapd); |
|
316 |
+ printf(" -gape [0,1.5] Transition pseudocount admixture for extending gap (def=%-.1f)\n",par.gape); |
|
317 |
+ printf(" -gapf ]0,inf] factor for increasing/reducing the gap open penalty for deletes (def=%-.2f)\n",par.gapf); |
|
318 |
+ printf(" -gapg ]0,inf] factor for increasing/reducing the gap open penalty for deletes (def=%-.2f)\n",par.gapg); |
|
319 |
+ printf(" -gaph ]0,inf] factor for increasing/reducing the gap extension penalty for deletes(def=%-.2f)\n",par.gaph); |
|
320 |
+ printf(" -gapi ]0,inf] factor for increasing/reducing the gap extension penalty for inserts(def=%-.2f)\n",par.gapi); |
|
321 |
+ printf(" -egq [0,inf[ penalty (bits) for end gaps aligned to query residues (def=%-.2f)\n",par.egq); |
|
322 |
+ printf(" -egt [0,inf[ penalty (bits) for end gaps aligned to template residues (def=%-.2f)\n",par.egt); |
|
323 |
+} |
|
324 |
+#endif |
|
325 |
+ |
|
326 |
+/** |
|
327 |
+ * @brief help with alignment options, not accessible in Clustal-Omega |
|
328 |
+ */ |
|
329 |
+#if 0 |
|
330 |
+void |
|
331 |
+help_ali() |
|
332 |
+{ |
|
333 |
+ printf("\n"); |
|
334 |
+ printf("Alignment options: \n"); |
|
335 |
+ printf(" -glob/-loc global or local alignment mode (def=global) \n"); |
|
336 |
+ printf(" -mac use Maximum Accuracy (MAC) alignment instead of Viterbi\n"); |
|
337 |
+ printf(" -mact [0,1] posterior prob threshold for MAC alignment (def=%.3f) \n",par.mact); |
|
338 |
+ printf(" -sto <int> use global stochastic sampling algorithm to sample this many alignments\n"); |
|
339 |
+ printf(" -sc <int> amino acid score (tja: template HMM at column j) (def=%i)\n",par.columnscore); |
|
340 |
+ printf(" 0 = log2 Sum(tja*qia/pa) (pa: aa background frequencies) \n"); |
|
341 |
+ printf(" 1 = log2 Sum(tja*qia/pqa) (pqa = 1/2*(pa+ta) ) \n"); |
|
342 |
+ printf(" 2 = log2 Sum(tja*qia/ta) (ta: av. aa freqs in template) \n"); |
|
343 |
+ printf(" 3 = log2 Sum(tja*qia/qa) (qa: av. aa freqs in query) \n"); |
|
344 |
+ printf(" -corr [0,1] weight of term for pair correlations (def=%.2f) \n",par.corr); |
|
345 |
+ printf(" -shift [-1,1] score offset (def=%-.3f) \n",par.shift); |
|
346 |
+ printf(" -r repeat identification: multiple hits not treated as independent\n"); |
|
347 |
+ printf(" -ssm 0-2 0:no ss scoring [default=%i] \n",par.ssm); |
|
348 |
+ printf(" 1:ss scoring after alignment \n"); |
|
349 |
+ printf(" 2:ss scoring during alignment \n"); |
|
350 |
+ printf(" -ssw [0,1] weight of ss score compared to column score (def=%-.2f) \n",par.ssw); |
|
351 |
+ printf(" -ssa [0,1] ss confusion matrix = (1-ssa)*I + ssa*psipred-confusion-matrix [def=%-.2f)\n",par.ssa); |
|
352 |
+} |
|
353 |
+#endif |
|
354 |
+ |
|
355 |
+/** |
|
356 |
+ * @brief general help menu, not accessible in Clustal-Omega |
|
357 |
+ */ |
|
358 |
+#if 0 |
|
359 |
+void |
|
360 |
+help_all() |
|
361 |
+{ |
|
362 |
+ help(); |
|
363 |
+ help_out(); |
|
364 |
+ help_hmm(); |
|
365 |
+ help_gap(); |
|
366 |
+ help_ali(); |
|
367 |
+ printf("\n"); |
|
368 |
+ printf("Default options can be specified in './.hhdefaults' or '~/.hhdefaults'\n"); |
|
369 |
+} |
|
370 |
+#endif |
|
371 |
+ |
|
372 |
+///////////////////////////////////////////////////////////////////////////// |
|
373 |
+//// Processing input options from command line and .hhdefaults file |
|
374 |
+///////////////////////////////////////////////////////////////////////////// |
|
375 |
+/** |
|
376 |
+ * @brief process arguments from commandline, not accessible from Clustal-Omega |
|
377 |
+ */ |
|
378 |
+#if 0 |
|
379 |
+void |
|
380 |
+ProcessArguments(int argc, char** argv) |
|
381 |
+{ |
|
382 |
+ //Processing command line input |
|
383 |
+ for (int i=1; i<argc; i++) |
|
384 |
+ { |
|
385 |
+ if (v>=4) cout<<i<<" "<<argv[i]<<endl; //PRINT |
|
386 |
+ if (!strcmp(argv[i],"-i")) |
|
387 |
+ { |
|
388 |
+ if (++i>=argc || argv[i][0]=='-') |
|
389 |
+ {help(); cerr<<endl<<"Error in "<<program_name<<": no query file following -i\n"; throw 4;} |
|
390 |
+ else strcpy(par.infile,argv[i]); |
|
391 |
+ } |
|
392 |
+ else if (!strcmp(argv[i],"-t")) |
|
393 |
+ { |
|
394 |
+ if (++i>=argc || argv[i][0]=='-') |
|
395 |
+ {help(); cerr<<endl<<"Error in "<<program_name<<": no template file following -d\n"; throw 4;} |
|
396 |
+ else strcpy(par.tfile,argv[i]); /* FS, ProcessArguments */ |
|
397 |
+ } |
|
398 |
+ else if (!strcmp(argv[i],"-o")) |
|
399 |
+ { |
|
400 |
+ if (++i>=argc) |
|
401 |
+ {help(); cerr<<endl<<"Error in "<<program_name<<": no filename following -o\n"; throw 4;} |
|
402 |
+ else strcpy(par.outfile,argv[i]); |
|
403 |
+ } |
|
404 |
+ else if (!strcmp(argv[i],"-ofas")) |
|
405 |
+ { |
|
406 |
+ par.outformat=1; |
|
407 |
+ if (++i>=argc || argv[i][0]=='-') |
|
408 |
+ {help() ; cerr<<endl<<"Error in "<<program_name<<": no output file following -o\n"; throw 4;} |
|
409 |
+ else strcpy(par.pairwisealisfile,argv[i]); |
|
410 |
+ } |
|
411 |
+ else if (!strcmp(argv[i],"-oa2m")) |
|
412 |
+ { |
|
413 |
+ par.outformat=2; |
|
414 |
+ if (++i>=argc || argv[i][0]=='-') |
|
415 |
+ {help() ; cerr<<endl<<"Error in "<<program_name<<": no output file following -o\n"; throw 4;} |
|
416 |
+ else strcpy(par.pairwisealisfile,argv[i]); |
|
417 |
+ } |
|
418 |
+ else if (!strcmp(argv[i],"-oa3m")) |
|
419 |
+ { |
|
420 |
+ par.outformat=3; |
|
421 |
+ if (++i>=argc || argv[i][0]=='-') |
|
422 |
+ {help() ; cerr<<endl<<"Error in "<<program_name<<": no output file following -o\n"; throw 4;} |
|
423 |
+ else strcpy(par.pairwisealisfile,argv[i]); |
|
424 |
+ } |
|
425 |
+ else if (!strcmp(argv[i],"-rank") && (i<argc-1)) par.hitrank=atoi(argv[++i]); |
|
426 |
+ else if (!strcmp(argv[i],"-Oa3m")) |
|
427 |
+ { |
|
428 |
+ par.append=0; |
|
429 |
+ if (++i>=argc || argv[i][0]=='-') |
|
430 |
+ {help() ; cerr<<endl<<"Error in "<<program_name<<": no output file following -Oa3m\n"; throw 4;} |
|
431 |
+ else strcpy(par.alnfile,argv[i]); |
|
432 |
+ } |
|
433 |
+ else if (!strcmp(argv[i],"-Aa3m")) |
|
434 |
+ { |
|
435 |
+ par.append=1; |
|
436 |
+ if (++i>=argc || argv[i][0]=='-') |
|
437 |
+ {help() ; cerr<<endl<<"Error in "<<program_name<<": no output file following -Aa3m\n"; throw 4;} |
|
438 |
+ else strcpy(par.alnfile,argv[i]); |
|
439 |
+ } |
|
440 |
+ else if (!strcmp(argv[i],"-Ohhm")) |
|
441 |
+ { |
|
442 |
+ par.append=0; |
|
443 |
+ if (++i>=argc || argv[i][0]=='-') |
|
444 |
+ {help() ; cerr<<endl<<"Error in "<<program_name<<": no output file following -Ohhm\n"; throw 4;} |
|
445 |
+ else strcpy(par.hhmfile,argv[i]); |
|
446 |
+ } |
|
447 |
+ else if (!strcmp(argv[i],"-Ahhm")) |
|
448 |
+ { |
|
449 |
+ par.append=1; |
|
450 |
+ if (++i>=argc || argv[i][0]=='-') |
|
451 |
+ {help() ; cerr<<endl<<"Error in "<<program_name<<": no output file following -Ahhm\n"; throw 4;} |
|
452 |
+ else strcpy(par.hhmfile,argv[i]); |
|
453 |
+ } |
|
454 |
+ else if (!strcmp(argv[i],"-Opsi")) |
|
455 |
+ { |
|
456 |
+ par.append=0; |
|
457 |
+ if (++i>=argc || argv[i][0]=='-') |
|
458 |
+ {help() ; cerr<<endl<<"Error in "<<program_name<<": no output file following -Opsi\n"; throw 4;} |
|
459 |
+ else strcpy(par.psifile,argv[i]); |
|
460 |
+ } |
|
461 |
+ else if (!strcmp(argv[i],"-Apsi")) |
|
462 |
+ { |
|
463 |
+ par.append=1; |
|
464 |
+ if (++i>=argc || argv[i][0]=='-') |
|
465 |
+ {help() ; cerr<<endl<<"Error in "<<program_name<<": no output file following -Apsi\n"; throw 4;} |
|
466 |
+ else strcpy(par.psifile,argv[i]); |
|
467 |
+ } |
|
468 |
+ else if (!strcmp(argv[i],"-png")) |
|
469 |
+ { |
|
470 |
+ if (++i>=argc) |
|
471 |
+ {help(); cerr<<endl<<"Error in "<<program_name<<": no filename following -png\n"; throw 4;} |
|
472 |
+ else |
|
473 |
+ { |
|
474 |
+ pngfile = new(char[strlen(argv[i])+1]); |
|
475 |
+ strcpy(pngfile,argv[i]); |
|
476 |
+ } |
|
477 |
+ } |
|
478 |
+ else if (!strcmp(argv[i],"-Struc")) |
|
479 |
+ { |
|
480 |
+ if (++i>=argc || argv[i][0]=='-') |
|
481 |
+ {help(); cerr<<endl<<"Error in "<<program_name<<": no query file following -Struc\n"; throw 4;} |
|
482 |
+ else |
|
483 |
+ { |
|
484 |
+ strucfile = new(char[strlen(argv[i])+1]); |
|
485 |
+ strcpy(strucfile,argv[i]); |
|
486 |
+ } |
|
487 |
+ } |
|
488 |
+ else if (!strcmp(argv[i],"-atab") || !strcmp(argv[i],"-Aliout")) |
|
489 |
+ { |
|
490 |
+ if (++i>=argc || argv[i][0]=='-') |
|
491 |
+ {help(); cerr<<endl<<"Error in "<<program_name<<": no query file following -Struc\n"; throw 4;} |
|
492 |
+ else |
|
493 |
+ { |
|
494 |
+ alitabfile = new(char[strlen(argv[i])+1]); |
|
495 |
+ strcpy(alitabfile,argv[i]); |
|
496 |
+ } |
|
497 |
+ } |
|
498 |
+ else if (!strcmp(argv[i],"-tc")) |
|
499 |
+ { |
|
500 |
+ if (++i>=argc || argv[i][0]=='-') |
|
501 |
+ {help() ; cerr<<endl<<"Error in "<<program_name<<": no output file following -Opsi\n"; throw 4;} |
|
502 |
+ else |
|
503 |
+ { |
|
504 |
+ tcfile = new(char[strlen(argv[i])+1]); |
|
505 |
+ strcpy(tcfile,argv[i]); |
|
506 |
+ } |
|
507 |
+ } |
|
508 |
+ else if (!strcmp(argv[i],"-h")|| !strcmp(argv[i],"--help")) |
|
509 |
+ { |
|
510 |
+ if (++i>=argc) {help(); throw 0;} |
|
511 |
+ if (!strcmp(argv[i],"out")) {help_out(); throw 0;} |
|
512 |
+ if (!strcmp(argv[i],"hmm")) {help_hmm(); throw 0;} |
|
513 |
+ if (!strcmp(argv[i],"gap")) {help_gap(); throw 0;} |
|
514 |
+ if (!strcmp(argv[i],"ali")) {help_ali(); throw 0;} |
|
515 |
+ if (!strcmp(argv[i],"all")) {help_all(); throw 0;} |
|
516 |
+ else {help(); throw 0;} |
|
517 |
+ } |
|
518 |
+ else if (!strcmp(argv[i],"-excl")) |
|
519 |
+ { |
|
520 |
+ if (++i>=argc) {help(); throw 4;} |
|
521 |
+ par.exclstr = new(char[strlen(argv[i])+1]); |
|
522 |
+ strcpy(par.exclstr,argv[i]); |
|
523 |
+ } |
|
524 |
+ else if (!strcmp(argv[i],"-v") && (i<argc-1) && argv[i+1][0]!='-' ) v=atoi(argv[++i]); |
|
525 |
+ else if (!strcmp(argv[i],"-v")) v=2; |
|
526 |
+ else if (!strcmp(argv[i],"-v0")) v=0; |
|
527 |
+ else if (!strcmp(argv[i],"-v1")) v=1; |
|
528 |
+ else if (!strcmp(argv[i],"-v2")) v=2; |
|
529 |
+ else if (!strcmp(argv[i],"-v3")) v=3; |
|
530 |
+ else if (!strcmp(argv[i],"-v4")) v=4; |
|
531 |
+ else if (!strcmp(argv[i],"-v5")) v=5; |
|
532 |
+ else if (!strcmp(argv[i],"-P") && (i<argc-1)) pself=atof(argv[++i]); |
|
533 |
+ else if (!strcmp(argv[i],"-p") && (i<argc-1)) par.p = atof(argv[++i]); |
|
534 |
+ else if (!strcmp(argv[i],"-e") && (i<argc-1)) par.E = atof(argv[++i]); |
|
535 |
+ else if (!strcmp(argv[i],"-E") && (i<argc-1)) par.E = atof(argv[++i]); |
|
536 |
+ else if (!strcmp(argv[i],"-b") && (i<argc-1)) par.b = atoi(argv[++i]); |
|
537 |
+ else if (!strcmp(argv[i],"-B") && (i<argc-1)) par.B = atoi(argv[++i]); |
|
538 |
+ else if (!strcmp(argv[i],"-z") && (i<argc-1)) par.z = atoi(argv[++i]); |
|
539 |
+ else if (!strcmp(argv[i],"-Z") && (i<argc-1)) par.Z = atoi(argv[++i]); |
|
540 |
+ else if (!strncmp(argv[i],"-nocons",7)) par.showcons=0; |
|
541 |
+ else if (!strncmp(argv[i],"-nopred",7)) par.showpred=0; |
|
542 |
+ else if (!strncmp(argv[i],"-nodssp",7)) par.showdssp=0; |
|
543 |
+ else if (!strncmp(argv[i],"-mark",7)) par.mark=1; |
|
544 |
+ else if (!strcmp(argv[i],"-seq") && (i<argc-1)) par.nseqdis=atoi(argv[++i]); |
|
545 |
+ else if (!strcmp(argv[i],"-aliw") && (i<argc-1)) par.aliwidth=atoi(argv[++i]); |
|
546 |
+ else if (!strcmp(argv[i],"-id") && (i<argc-1)) par.max_seqid=atoi(argv[++i]); |
|
547 |
+ else if (!strcmp(argv[i],"-tct") && (i<argc-1)) probmin_tc=atoi(argv[++i]); |
|
548 |
+ else if (!strcmp(argv[i],"-dwin") && (i<argc-1)) dotW=atoi(argv[++i]); |
|
549 |
+ else if (!strcmp(argv[i],"-dsca") && (i<argc-1)) dotscale=atoi(argv[++i]); |
|
550 |
+ else if (!strcmp(argv[i],"-dthr") && (i<argc-1)) dotthr=atof(argv[++i]); |
|
551 |
+ else if (!strcmp(argv[i],"-dali") && (i<argc-1)) |
|
552 |
+ { |
|
553 |
+ dotali=1; |
|
554 |
+ for (int index=0; index<256; index++) aliindices[index]=0; |
|
555 |
+ while (i+1<argc && argv[i+1][0]!='-') // adds index to hash aliindices |
|
556 |
+ { |
|
557 |
+ i++; |
|
558 |
+ if (strcmp(argv[i],"all")) aliindices[atoi(argv[i])]=1; |
|
559 |
+ else dotali=2; |
|
560 |
+ } |
|
561 |
+ } |
|
562 |
+ else if (!strcmp(argv[i],"-dmap")) |
|
563 |
+ { |
|
564 |
+ if (++i>=argc) |
|
565 |
+ {help(); cerr<<endl<<"Error in "<<program_name<<": no filename following -o\n"; throw 4;} |
|
566 |
+ else |
|
567 |
+ { |
|
568 |
+ dmapfile = new(char[strlen(argv[i])+1]); |
|
569 |
+ strcpy(dmapfile,argv[i]); |
|
570 |
+ } |
|
571 |
+ } |
|
572 |
+ else if (!strcmp(argv[i],"-dsat") && (i<argc-1)) dotsat=atof(argv[++i]); |
|
573 |
+ else if (!strcmp(argv[i],"-qid") && (i<argc-1)) par.qid=atoi(argv[++i]); |
|
574 |
+ else if (!strcmp(argv[i],"-qsc") && (i<argc-1)) par.qsc=atof(argv[++i]); |
|
575 |
+ else if (!strcmp(argv[i],"-cov") && (i<argc-1)) par.coverage=atoi(argv[++i]); |
|
576 |
+ else if (!strcmp(argv[i],"-diff") && (i<argc-1)) par.Ndiff=atoi(argv[++i]); |
|
577 |
+ else if (!strcmp(argv[i],"-qscc") && (i<argc-1)) par.qsc_core=atof(argv[++i]); |
|
578 |
+ else if (!strcmp(argv[i],"-csc") && (i<argc-1)) par.coresc=atof(argv[++i]); |
|
579 |
+ else if (!strcmp(argv[i],"-Gonnet")) par.matrix=0; |
|
580 |
+ else if (!strcmp(argv[i],"-HSDM")) par.matrix=1; |
|
581 |
+ else if (!strcmp(argv[i],"-BLOSUM50")) par.matrix=2; |
|
582 |
+ else if (!strcmp(argv[i],"-Blosum50")) par.matrix=2; |
|
583 |
+ else if (!strcmp(argv[i],"-B50")) par.matrix=2; |
|
584 |
+ else if (!strcmp(argv[i],"-BLOSUM62")) par.matrix=3; |
|
585 |
+ else if (!strcmp(argv[i],"-Blosum62")) par.matrix=3; |
|
586 |
+ else if (!strcmp(argv[i],"-B62")) par.matrix=3; |
|
587 |
+ else if (!strcmp(argv[i],"-pcm") && (i<argc-1)) par.pcm=atoi(argv[++i]); |
|
588 |
+ else if (!strcmp(argv[i],"-pca") && (i<argc-1)) par.pca=atof(argv[++i]); |
|
589 |
+ else if (!strcmp(argv[i],"-pcb") && (i<argc-1)) par.pcb=atof(argv[++i]); |
|
590 |
+ else if (!strcmp(argv[i],"-pcc") && (i<argc-1)) par.pcc=atof(argv[++i]); |
|
591 |
+ else if (!strcmp(argv[i],"-pcw") && (i<argc-1)) par.pcw=atof(argv[++i]); |
|
592 |
+ else if (!strcmp(argv[i],"-gapb") && (i<argc-1)) { par.gapb=atof(argv[++i]); if (par.gapb<=0.01) par.gapb=0.01;} |
|
593 |
+ else if (!strcmp(argv[i],"-gapd") && (i<argc-1)) par.gapd=atof(argv[++i]); |
|
594 |
+ else if (!strcmp(argv[i],"-gape") && (i<argc-1)) par.gape=atof(argv[++i]); |
|
595 |
+ else if (!strcmp(argv[i],"-gapf") && (i<argc-1)) par.gapf=atof(argv[++i]); |
|
596 |
+ else if (!strcmp(argv[i],"-gapg") && (i<argc-1)) par.gapg=atof(argv[++i]); |
|
597 |
+ else if (!strcmp(argv[i],"-gaph") && (i<argc-1)) par.gaph=atof(argv[++i]); |
|
598 |
+ else if (!strcmp(argv[i],"-gapi") && (i<argc-1)) par.gapi=atof(argv[++i]); |
|
599 |
+ else if (!strcmp(argv[i],"-egq") && (i<argc-1)) par.egq=atof(argv[++i]); |
|
600 |
+ else if (!strcmp(argv[i],"-egt") && (i<argc-1)) par.egt=atof(argv[++i]); |
|
601 |
+ else if (!strcmp(argv[i],"-ssgap")) par.ssgap=1; |
|
602 |
+ else if (!strcmp(argv[i],"-ssgapd") && (i<argc-1)) par.ssgapd=atof(argv[++i]); |
|
603 |
+ else if (!strcmp(argv[i],"-ssgape") && (i<argc-1)) par.ssgape=atof(argv[++i]); |
|
604 |
+ else if (!strcmp(argv[i],"-ssgapi") && (i<argc-1)) par.ssgapi=atoi(argv[++i]); |
|
605 |
+ else if (!strcmp(argv[i],"-ssm") && (i<argc-1)) par.ssm=atoi(argv[++i]); |
|
606 |
+ else if (!strcmp(argv[i],"-ssw") && (i<argc-1)) par.ssw=atof(argv[++i]); |
|
607 |
+ else if (!strcmp(argv[i],"-ssa") && (i<argc-1)) par.ssa=atof(argv[++i]); |
|
608 |
+ else if (!strncmp(argv[i],"-glo",3)) {par.loc=0; if (par.mact>0.3 && par.mact<0.301) {par.mact=0;} } |
|
609 |
+ else if (!strncmp(argv[i],"-loc",3)) par.loc=1; |
|
610 |
+ else if (!strncmp(argv[i],"-alt",4) && (i<argc-1)) par.altali=atoi(argv[++i]); |
|
611 |
+ else if (!strcmp(argv[i],"-map") || !strcmp(argv[i],"-MAP")) par.forward=2; |
|
612 |
+ else if (!strcmp(argv[i],"-mac") || !strcmp(argv[i],"-MAC")) par.forward=2; |
|
613 |
+ else if (!strcmp(argv[i],"-vit")) par.forward=0; |
|
614 |
+ else if (!strcmp(argv[i],"-sto") && (i<argc-1)) {Nstochali=atoi(argv[++i]); par.forward=1;} |
|
615 |
+ else if (!strcmp(argv[i],"-r")) par.repmode=1; |
|
616 |
+ else if (!strcmp(argv[i],"-M") && (i<argc-1)) |
|
617 |
+ if (!strcmp(argv[++i],"a2m") || !strcmp(argv[i],"a3m")) par.M=1; |
|
618 |
+ else if(!strcmp(argv[i],"first")) par.M=3; |
|
619 |
+ else if (argv[i][0]>='0' && argv[i][0]<='9') {par.Mgaps=atoi(argv[i]); par.M=2;} |
|
620 |
+ else cerr<<endl<<"WARNING: Ignoring unknown argument: -M "<<argv[i]<<"\n"; |
|
621 |
+ else if (!strcmp(argv[i],"-shift") && (i<argc-1)) par.shift=atof(argv[++i]); |
|
622 |
+ else if (!strcmp(argv[i],"-mact") && (i<argc-1)) {par.mact=atof(argv[++i]); par.forward=2;} |
|
623 |
+ else if (!strcmp(argv[i],"-wstruc") && (i<argc-1)) par.wstruc=atof(argv[++i]); |
|
624 |
+ else if (!strcmp(argv[i],"-opt") && (i<argc-1)) par.opt=atoi(argv[++i]); |
|
625 |
+ else if (!strcmp(argv[i],"-sc") && (i<argc-1)) par.columnscore=atoi(argv[++i]); |
|
626 |
+ else if (!strcmp(argv[i],"-corr") && (i<argc-1)) par.corr=atof(argv[++i]); |
|
627 |
+ else if (!strcmp(argv[i],"-def")) par.readdefaultsfile=1; |
|
628 |
+ else if (!strcmp(argv[i],"-ovlp") && (i<argc-1)) par.min_overlap=atoi(argv[++i]); |
|
629 |
+ else if (!strcmp(argv[i],"-tags")) par.notags=0; |
|
630 |
+ else if (!strcmp(argv[i],"-notags")) par.notags=1; |
|
631 |
+ else cerr<<endl<<"WARNING: Ignoring unknown option "<<argv[i]<<" ...\n"; |
|
632 |
+ if (v>=4) cout<<i<<" "<<argv[i]<<endl; //PRINT |
|
633 |
+ } // end of for-loop for command line input |
|
634 |
+} |
|
635 |
+#endif |
|
636 |
+ |
|
637 |
+ |
|
638 |
+ |
|
639 |
+ |
|
640 |
+///////////////////////////////////////////////////////////////////////////// |
|
641 |
+//// MAIN PROGRAM |
|
642 |
+///////////////////////////////////////////////////////////////////////////// |
|
643 |
+/** |
|
644 |
+ * |
|
645 |
+ * hhalign() |
|
646 |
+ * |
|
647 |
+ * @param[in,out] ppcFirstProf |
|
648 |
+ * first profile to be aligned |
|
649 |
+ * @param[in] iFirstCnt |
|
650 |
+ * number of sequences in 1st profile |
|
651 |
+ * @param[in,out] ppcSecndProf |
|
652 |
+ * second profile to be aligned |
|
653 |
+ * @param[in] iSecndCnt |
|
654 |
+ * number of sequences in 2nd profile |
|
655 |
+ * @param[out] dScore_p |
|
656 |
+ * score of alignment |
|
657 |
+ * @param[in] prHMM |
|
658 |
+ * HMM info of external HMM (background) |
|
659 |
+ * @param[in] pcPrealigned1 |
|
660 |
+ * (gapped) 1st sequence aligned to background HMM |
|
661 |
+ * @param[in] pcRepresent1 |
|
662 |
+ * (gapped) sequence representing background HMM aligned to 1st sequence |
|
663 |
+ * @param[in] pcPrealigned2 |
|
664 |
+ * (gapped) 2nd sequence aligned to background HMM |
|
665 |
+ * @param[in] pcRepresent2 |
|
666 |
+ * (gapped) sequence representing background HMM aligned to 2nd sequence |
|
667 |
+ * @param[in] rHhalignPara, |
|
668 |
+ * various parameters passed down from commandline |
|
669 |
+ * e.g., iMaxRamMB |
|
670 |
+ * @param[out] rHHscores |
|
671 |
+ * qualify goodness of alignment |
|
672 |
+ * |
|
673 |
+ * iFlag,zcAux,zcError are debugging arguments |
|
674 |
+ * |
|
675 |
+ * @return Non-zero on error |
|
676 |
+ */ |
|
677 |
+extern "C" int |
|
678 |
+hhalign(char **ppcFirstProf, int iFirstCnt, double *pdWeightsL, |
|
679 |
+ char **ppcSecndProf, int iSecndCnt, double *pdWeightsR, |
|
680 |
+ double *dScore_p, hmm_light *prHMM, |
|
681 |
+ char *pcPrealigned1, char *pcRepresent1, |
|
682 |
+ char *pcPrealigned2, char *pcRepresent2, |
|
683 |
+ hhalign_para rHhalignPara, hhalign_scores *rHHscores, |
|
684 |
+ int iFlag, int iVerbosity, |
|
685 |
+ char zcAux[], char zcError[]) { |
|
686 |
+ |
|
687 |
+ v = 3; |
|
688 |
+ |
|
689 |
+#ifdef CLUSTALO |
|
690 |
+ int iRetVal = RETURN_OK; |
|
691 |
+ iAux_GLOBAL = iFlag; |
|
692 |
+#ifndef CLUSTALO_NOFILE |
|
693 |
+ int argc = 0; |
|
694 |
+ char **argv = NULL; |
|
695 |
+ argv = (char **)malloc(argc*sizeof(char *)); |
|
696 |
+ for (int i = 0; i < argc; i++){ |
|
697 |
+ argv[i] = (char *)malloc(100); |
|
698 |
+ } |
|
699 |
+ strcpy(argv[0], "./hhalign"); |
|
700 |
+ strcpy(argv[1], "-t"); |
|
701 |
+ strcpy(argv[2], "hhalign.C"); |
|
702 |
+ strcpy(argv[3], "-i"); |
|
703 |
+ strcpy(argv[4], "hhalign.C"); |
|
704 |
+ strcpy(argv[5], "-ofas"); |
|
705 |
+ strcpy(argv[6], "out"); |
|
706 |
+#endif |
|
707 |
+#endif |
|
708 |
+ /*char* argv_conf[MAXOPT];*/ /* Input arguments from .hhdefaults file |
|
709 |
+ (first=1: argv_conf[0] is not used) */ |
|
710 |
+ /*int argc_conf;*/ // Number of arguments in argv_conf |
|
711 |
+ /*char inext[IDLEN]="";*/ // Extension of query input file (hhm or a3m) |
|
712 |
+ /*char text[IDLEN]="";*/ // Extension of template input file (hhm or a3m) |
|
713 |
+ /*int** ali=NULL;*/ // ali[i][j]=1 if (i,j) is part of an alignment |
|
714 |
+ /*int** alisto=NULL;*/ // ali[i][j]=1 if (i,j) is part of an alignment |
|
715 |
+ int Nali; /* number of normally backtraced alignments |
|
716 |
+ in dot plot */ |
|
717 |
+ |
|
718 |
+ SetDefaults(); |
|
719 |
+ strcpy(par.tfile,""); /* FS, Initialise Argument */ |
|
720 |
+ strcpy(par.alnfile,""); |
|
721 |
+ par.p=0.0 ; /* minimum threshold for inclusion in hit list |
|
722 |
+ and alignment listing */ |
|
723 |
+ par.E=1e6; /* maximum threshold for inclusion in hit list |
|
724 |
+ and alignment listing */ |
|
725 |
+ par.b=1; // min number of alignments |
|
726 |
+ par.B=100; // max number of alignments |
|
727 |
+ par.z=1; // min number of lines in hit list |
|
728 |
+ par.Z=100; // max number of lines in hit list |
|
729 |
+ par.append=0; /* append alignment to output file |
|
730 |
+ with -a option */ |
|
731 |
+ par.altali=1; /* find only ONE (possibly overlapping) |
|
732 |
+ subalignment */ |
|
733 |
+ par.hitrank=0; /* rank of hit to be printed as a3m alignment |
|
734 |
+ (default=0) */ |
|
735 |
+ par.outformat=3; // default output format for alignment is a3m |
|
736 |
+ hit.self=0; // no self-alignment |
|
737 |
+ par.forward=2; /* 0: Viterbi algorithm; |
|
738 |
+ 1: Viterbi+stochastic sampling; |
|
739 |
+ 2:Maximum Accuracy (MAC) algorithm */ |
|
740 |
+ |
|
741 |
+ // Make command line input globally available |
|
742 |
+#ifndef CLUSTALO_NOFILE |
|
743 |
+ par.argv=argv; |
|
744 |
+ par.argc=argc; |
|
745 |
+ RemovePathAndExtension(program_name,argv[0]); |
|
746 |
+#endif |
|
747 |
+ |
|
748 |
+#ifndef CLUSTALO_NOFILE |
|
749 |
+ /* Enable changing verbose mode before defaults file |
|
750 |
+ and command line are processed */ |
|
751 |
+ for (int i=1; i<argc; i++) |
|
752 |
+ { |
|
753 |
+ if (!strcmp(argv[i],"-def")) par.readdefaultsfile=1; |
|
754 |
+ else if (argc>1 && !strcmp(argv[i],"-v0")) v=0; |
|
755 |
+ else if (argc>1 && !strcmp(argv[i],"-v1")) v=1; |
|
756 |
+ else if (argc>2 && !strcmp(argv[i],"-v")) v=atoi(argv[i+1]); |
|
757 |
+ } |
|
758 |
+ |
|
759 |
+ // Read .hhdefaults file? |
|
760 |
+ if (par.readdefaultsfile) |
|
761 |
+ { |
|
762 |
+ // Process default otpions from .hhconfig file |
|
763 |
+ ReadDefaultsFile(argc_conf,argv_conf); |
|
764 |
+ ProcessArguments(argc_conf,argv_conf); |
|
765 |
+ } |
|
766 |
+#endif |
|
767 |
+ /* Process command line options |
|
768 |
+ (they override defaults from .hhdefaults file) */ |
|
769 |
+#ifndef CLUSTALO_NOFILE |
|
770 |
+ ProcessArguments(argc,argv); |
|
771 |
+#endif |
|
772 |
+ |
|
773 |
+ |
|
774 |
+#ifdef CLUSTALO |
|
775 |
+ int iAuxLen1 = strlen(ppcFirstProf[0]); |
|
776 |
+ int iAuxLen2 = strlen(ppcSecndProf[0]); |
|
777 |
+ if ( (0 == iAuxLen1) || (0 == iAuxLen2) ){ /* problem with empty profiles, FS, r249 -> r250 */ |
|
778 |
+ sprintf(zcError, "%s:%s:%d: strlen(prof1)=%d, strlen(prof2)=%d -- Nothing to align!\n", |
|
779 |
+ __FUNCTION__, __FILE__, __LINE__, iAuxLen1, iAuxLen2); |
|
780 |
+ iRetVal = RETURN_UNKNOWN; |
|
781 |
+ /* Note: at this stage cannot do 'goto this_is_the_end;' |
|
782 |
+ because would cross initialisation of several variables */ |
|
783 |
+ return iRetVal; |
|
784 |
+ } |
|
785 |
+ par.maxResLen = iAuxLen1 > iAuxLen2 ? iAuxLen1 : iAuxLen2; |
|
786 |
+ const int ciGoodMeasureSeq = 10; |
|
787 |
+ par.maxResLen += ciGoodMeasureSeq; |
|
788 |
+ par.maxColCnt = iAuxLen1 + iAuxLen2 + ciGoodMeasureSeq; |
|
789 |
+ //par.max_seqid=iFirstCnt+iSecndCnt+3; /* -id */ |
|
790 |
+ par.max_seqid=DEFAULT_FILTER; /* -id */ |
|
791 |
+ par.loc=0; par.mact=0; /* -glob */ |
|
792 |
+ par.nseqdis=iFirstCnt+iSecndCnt; /* -seq */ |
|
793 |
+ par.showcons=0; /* -nocons */ |
|
794 |
+ par.showdssp=0; /* -nodssp */ |
|
795 |
+ par.Mgaps=100; /* -M */ |
|
796 |
+ par.M=2; /* -M */ |
|
797 |
+ par.pdWg1=pdWeightsL; /* tree wg */ |
|
798 |
+ par.pdWg2=pdWeightsR; /* tree wg */ |
|
799 |
+ v = 0; /* -v0 */ |
|
800 |
+ /* NOTE: *qali declared globally but only created here, |
|
801 |
+ pass in number of sequences to get rid of statically |
|
802 |
+ defined MAXSEQ (FS) |
|
803 |
+ */ |
|
804 |
+ Alignment qali(iFirstCnt+iSecndCnt); |
|
805 |
+ HMM q(iFirstCnt+iSecndCnt); |
|
806 |
+ HMM t(iFirstCnt+iSecndCnt); |
|
807 |
+ //initialize |
|
808 |
+ static char const empty[] = ""; |
|
809 |
+ strcpy(q.file, empty); |
|
810 |
+ strcpy(t.file, empty); |
|
811 |
+ strcpy(t.sfam, empty); |
|
812 |
+ strcpy(q.sfam, empty); |
|
813 |
+ strcpy(q.fold, empty); |
|
814 |
+ strcpy(t.fold, empty); |
|
815 |
+ strcpy(t.cl, empty); |
|
816 |
+ strcpy(q.cl, empty); |
|
817 |
+#endif |
|
818 |
+ |
|
819 |
+ |
|
820 |
+#ifndef CLUSTALO_NOFILE |
|
821 |
+ // Check command line input and default values |
|
822 |
+ if (!*par.infile) |
|
823 |
+ {help(); cerr<<endl<<"Error in "<<program_name<<": no query alignment file given (-i file)\n"; throw 4;} |
|
824 |
+ if (par.forward==2 && par.loc==0) |
|
825 |
+ { |
|
826 |
+ if (par.mact<0.301 || par.mact>0.300) |
|
827 |
+ if (v>=1) fprintf(stderr,"REMARK: in -mac -global mode -mact is forced to 0\n"); |
|