Imported Upstream version 2.4.0
Andreas Tille
8 years ago
0 | ||
1 | 2.3.0 -> 2.4.0 | |
2 | o Fixed many thread safety bugs | |
3 | o Fixed bugs with large files over 4GB | |
4 | o Modified client to work with multiple servers | |
5 | o Fixed server to handle SIGPIPE | |
6 | o Added support for FOSN input (can be files, directories or servers) | |
7 | o Fixed bug with --wordambiguity and --wordjump (with normal FSM) | |
8 | o Added %pS to --ryo (percent self score over equivalenced regions) | |
9 | ||
10 | 2.2.0 -> 2.3.0 | |
11 | o Fixed several bugs with thread safety for exonerate-server | |
12 | o Fixed bug with custom genetic codes not working | |
13 | o Fixed bug with overflow of seedrepeat horizon in hspset | |
14 | o Added passing of wordlimit params to server | |
15 | o Implemented --cores option for multi-threaded alignment | |
16 | o Added identity and similarity score for GFF genes and exons | |
17 | o Increased default FSM memory limit to 256Mb | |
18 | o Added --revcomp option to disable searching of reverse complement | |
19 | o Fixed bug with compact-FSM (VFSM) based database searching | |
20 | o Added --wordambiguity option for searching ambiguous reference seqs | |
21 | o Fixed bug with esd2esi and .esd files >2Gb | |
22 | ||
0 | 23 | 2.1.0 -> 2.2.0 |
1 | 24 | o Fixed bug with esd2esi when softmasking is off |
2 | o Replaced GMemChunk due to caching problems with glib-2 | |
25 | o Removed all GMemChunk usage due to caching problems with glib-2 | |
3 | 26 | o Fixed various minor memory leaks |
4 | 27 | |
5 | 28 | 2.0.0 -> 2.1.0 |
336 | 359 | o Converted est2genome model to use PSSM splice site prediction |
337 | 360 | o Fixed C4_Model_select() to avoid copying redundant calcs |
338 | 361 | |
362 | ||
363 | ||
339 | 364 | -- |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
678 | 678 | host_cpu |
679 | 679 | host_vendor |
680 | 680 | host_os |
681 | custom_guint64_format | |
681 | 682 | source_root_dir |
682 | 683 | PKG_CONFIG |
683 | 684 | GLIB_CONFIG |
1939 | 1940 | |
1940 | 1941 | PACKAGE=exonerate |
1941 | 1942 | |
1942 | VERSION=2.2.0 | |
1943 | VERSION=2.4.0 | |
1943 | 1944 | |
1944 | 1945 | if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then |
1945 | 1946 | { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 |
4120 | 4121 | # AVOID autoconf WARNINGS ABOUT --datarootdir |
4121 | 4122 | |
4122 | 4123 | |
4124 | custom_guint64_format="llu" | |
4125 | ||
4123 | 4126 | # TRY TO GET TO BUILD ON ALL PLATFORMS BY DEFAULT |
4124 | 4127 | echo ""$host |
4125 | 4128 | case $host in |
4137 | 4140 | CC="cc" |
4138 | 4141 | GCC= # No longer true (prevents GCC specific CFLAGS being set) |
4139 | 4142 | CFLAGS="-O3 -arch ev6 -fast" |
4140 | C4_CC="$CC" | |
4141 | C4_CFLAGS="$CFLAGS" | |
4142 | 4143 | ;; |
4143 | 4144 | *-irix*) |
4144 | 4145 | echo "Customising build for IRIX" |
4150 | 4151 | C4_AR_INIT="cq" |
4151 | 4152 | C4_AR_APPEND="q" |
4152 | 4153 | ;; |
4154 | x86_64-*) | |
4155 | echo "Customising build for X86_64" | |
4156 | custom_guint64_format="lu" | |
4157 | ;; | |
4158 | *) | |
4159 | echo "*** Unknown build platform: $host ***" | |
4160 | ;; | |
4153 | 4161 | esac |
4162 | ||
4163 | ||
4154 | 4164 | |
4155 | 4165 | # SET SOURCE_ROOT_DIR (REQUIRED FOR viterbi.h) |
4156 | 4166 | source_root_dir=`pwd` |
4520 | 4530 | # model_extra_programs="bootstrapper" |
4521 | 4531 | codegen_extra_sources="" |
4522 | 4532 | codegen_extra_ldadd="`pwd`/src/c4/viterbi.o \ |
4523 | `pwd`/src/c4/scheduler.o" | |
4533 | `pwd`/src/sdp/scheduler.o" | |
4524 | 4534 | else |
4525 | 4535 | echo "error: must be yes or no:" |
4526 | 4536 | echo " --enable-compiledmodels:$enable_compiledmodels" |
4568 | 4578 | if test "$enable_pthreads" = yes; then |
4569 | 4579 | echo "Using PTHREADS" |
4570 | 4580 | CFLAGS="$CFLAGS -DUSE_PTHREADS" |
4571 | LDFLAGS="$LDFLAGS -lpthread" | |
4581 | # for g_thread_init() | |
4582 | g_thread_init_ldflags=`pkg-config --libs gthread-2.0` | |
4583 | LDFLAGS="$LDFLAGS $g_thread_init_ldflags -lpthread" | |
4572 | 4584 | elif test "$enable_pthreads" = no; then |
4573 | 4585 | echo "Not using pthreads" |
4574 | 4586 | else |
5300 | 5312 | host_cpu!$host_cpu$ac_delim |
5301 | 5313 | host_vendor!$host_vendor$ac_delim |
5302 | 5314 | host_os!$host_os$ac_delim |
5315 | custom_guint64_format!$custom_guint64_format$ac_delim | |
5303 | 5316 | source_root_dir!$source_root_dir$ac_delim |
5304 | 5317 | PKG_CONFIG!$PKG_CONFIG$ac_delim |
5305 | 5318 | GLIB_CONFIG!$GLIB_CONFIG$ac_delim |
5313 | 5326 | LTLIBOBJS!$LTLIBOBJS$ac_delim |
5314 | 5327 | _ACEOF |
5315 | 5328 | |
5316 | if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 77; then | |
5329 | if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 78; then | |
5317 | 5330 | break |
5318 | 5331 | elif $ac_last_try; then |
5319 | 5332 | { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 |
4 | 4 | # ( Borrowed some config tricks from gtk+, gnet, xscreensaver, mutt ) |
5 | 5 | |
6 | 6 | AC_INIT(src/sequence/sequence.c) |
7 | AM_INIT_AUTOMAKE(exonerate,2.2.0) | |
7 | AM_INIT_AUTOMAKE(exonerate,2.4.0) | |
8 | 8 | AC_PROG_CC |
9 | 9 | AC_PROG_INSTALL |
10 | 10 | AC_PROG_MAKE_SET |
25 | 25 | |
26 | 26 | # AVOID autoconf WARNINGS ABOUT --datarootdir |
27 | 27 | AC_SUBST(datarootdir) |
28 | ||
29 | custom_guint64_format="llu" | |
28 | 30 | |
29 | 31 | # TRY TO GET TO BUILD ON ALL PLATFORMS BY DEFAULT |
30 | 32 | echo ""$host |
43 | 45 | CC="cc" |
44 | 46 | GCC= # No longer true (prevents GCC specific CFLAGS being set) |
45 | 47 | CFLAGS="-O3 -arch ev6 -fast" |
46 | C4_CC="$CC" | |
47 | C4_CFLAGS="$CFLAGS" | |
48 | 48 | ;; |
49 | 49 | *-irix*) |
50 | 50 | echo "Customising build for IRIX" |
56 | 56 | C4_AR_INIT="cq" |
57 | 57 | C4_AR_APPEND="q" |
58 | 58 | ;; |
59 | x86_64-*) | |
60 | echo "Customising build for X86_64" | |
61 | custom_guint64_format="lu" | |
62 | ;; | |
63 | *) | |
64 | echo "*** Unknown build platform: $host ***" | |
65 | ;; | |
59 | 66 | esac |
67 | ||
68 | AC_SUBST(custom_guint64_format) | |
60 | 69 | |
61 | 70 | # SET SOURCE_ROOT_DIR (REQUIRED FOR viterbi.h) |
62 | 71 | source_root_dir=`pwd` |
244 | 253 | # model_extra_programs="bootstrapper" |
245 | 254 | codegen_extra_sources="" |
246 | 255 | codegen_extra_ldadd="`pwd`/src/c4/viterbi.o \ |
247 | `pwd`/src/c4/scheduler.o" | |
256 | `pwd`/src/sdp/scheduler.o" | |
248 | 257 | else |
249 | 258 | echo "error: must be yes or no:" |
250 | 259 | echo " --enable-compiledmodels:[$enable_compiledmodels]" |
288 | 297 | if test "$enable_pthreads" = yes; then |
289 | 298 | echo "Using PTHREADS" |
290 | 299 | CFLAGS="$CFLAGS -DUSE_PTHREADS" |
291 | LDFLAGS="$LDFLAGS -lpthread" | |
300 | # for g_thread_init() | |
301 | g_thread_init_ldflags=`pkg-config --libs gthread-2.0` | |
302 | LDFLAGS="$LDFLAGS $g_thread_init_ldflags -lpthread" | |
292 | 303 | elif test "$enable_pthreads" = no; then |
293 | 304 | echo "Not using pthreads" |
294 | 305 | else |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
135 | 135 | Specify the target sequences required. Also, must be in a FASTA |
136 | 136 | format file. As with the query sequences, single or multiple target |
137 | 137 | sequences and files may be supplied. |
138 | .B NEW: | |
139 | the target filename may by replace by a server name and port number | |
138 | The target filename may by replace by a server name and port number | |
140 | 139 | in the form of |
141 | 140 | .B hostname:port |
142 | 141 | when using |
144 | 143 | See the man page for |
145 | 144 | .B exonerate-server |
146 | 145 | for more information on running exonerate in client:server mode. |
147 | ||
146 | .B NEW(v2.4.0): | |
147 | multiple servers may now be used. These will be queried in parallel | |
148 | if you have set the | |
149 | .B --cores | |
150 | option. | |
151 | .B NEW(v2.4.0): | |
152 | If an input file is not a FASTA format file, | |
153 | it is assumed to contain a list of other fasta files, | |
154 | directories or servers (one per line). | |
148 | 155 | .\" |
149 | 156 | .TP |
150 | 157 | .B "-Q | \--querytype" <dna | protein> |
221 | 228 | This is very memory efficient and fast when both sequences |
222 | 229 | are chromosome-sized, but currently does not currently permit the use |
223 | 230 | of a word neighbourhood (ie. exactly matching seeds only). |
231 | .\" | |
232 | .TP | |
233 | .B "\--revcomp" <boolean> | |
234 | Include comparison of the reverse complement of the query and target | |
235 | where possible. By default, this option is enabled, | |
236 | but when you know the gene is definitely on the forward strand | |
237 | of the query and target, | |
238 | this option can halve the time taken to compute alignments. | |
224 | 239 | .\" |
225 | 240 | .TP |
226 | 241 | .B "\--forcescan" <none | query | target> |
245 | 260 | .\" |
246 | 261 | .TP |
247 | 262 | .B "\--customserver" <command> |
248 | .B NEW: | |
249 | 263 | When using exonerate in client:server mode with a non-standard |
250 | 264 | server, this command allows you to send a custom command to the |
251 | 265 | server. This command is sent by the client (exonerate) |
254 | 268 | .B exonerate-server |
255 | 269 | man page for more information on running exonerate in client:server mode. |
256 | 270 | .\" |
257 | ||
258 | .RE | |
271 | .TP | |
272 | .B "\--cores" <number> | |
273 | The number of cores/CPUs/threads that should be used. | |
274 | On a multi-core or multi-CPU machine, increasing this ammount | |
275 | allows alignment computations to run in parallel on separate CPUs/cores. | |
276 | NB. Generally, it is better to parallelise the analysis | |
277 | by splitting it up into separate jobs, but this option may prove | |
278 | useful for problems such as interactive single-gene queries. | |
279 | .\" | |
280 | ||
259 | 281 | .SH FASTA DATABASE OPTIONS |
260 | 282 | .TP |
261 | 283 | .B "\--fastasuffix" <extension> |
347 | 369 | .\" |
348 | 370 | .TP |
349 | 371 | .B protein2dna:bestfit |
350 | .B NEW: | |
351 | 372 | This is a bestfit version of the protein2dna model, |
352 | 373 | with which the entire protein is included in the alignment. |
353 | 374 | It is currently only available when using exhaustive alignment. |
361 | 382 | .\" |
362 | 383 | .TP |
363 | 384 | .B protein2genome:bestfit |
364 | .B NEW: | |
365 | 385 | This is a bestfit version of the protein2genome model, |
366 | 386 | with which the entire protein is included in the alignment. |
367 | 387 | It is currently only available when using exhaustive alignment. |
599 | 619 | Equivalenced {total,id,similarity,mismatches} |
600 | 620 | (ie. %em == (%et - %ei)) |
601 | 621 | .TP |
602 | .B %p[is] | |
603 | Percent {id,similarity} | |
622 | .B %p[isS] | |
623 | Percent {id,similarity,Self} | |
604 | 624 | over the equivalenced portions of the alignment. |
605 | (ie. %pi == 100*(%ei / %et)) | |
625 | (ie. %pi == 100*(%ei / %et)). | |
626 | Percent Self is the score over the equivalenced portions | |
627 | of the alignment as a percentage of the self comparison score | |
628 | of the query sequence. | |
606 | 629 | .TP |
607 | 630 | .B %g |
608 | 631 | Gene orientation ('+' = forward, '-' = reverse, '.' = unknown) |
916 | 939 | query sequences, and makes the search run faster, but it also |
917 | 940 | damages search sensitivity when high values are set. |
918 | 941 | .\" |
942 | .TP | |
943 | .B "\--wordambiguity" <limit> | |
944 | This option may be used to allow alignment seeds containing | |
945 | IUPAC ambiguity symbols. | |
946 | The limit is the maximum number of ambiguous words | |
947 | allowed at a single position. If this limit is reached | |
948 | then the position is not used for alignment seeding. | |
949 | Using this option may slow down a search. | |
950 | For large datasets, | |
951 | it is recommended to use | |
952 | .B esd2esi --wordambiguity | |
953 | instead, as then the speed overhead is only incurred | |
954 | during indexing, rather than during the database searching itself. | |
955 | NB. This option only works for IUPAC symbols in the target sequence. | |
956 | Query words containing IUPAC symbols are (currently) excluded from seeding. | |
957 | .\" | |
919 | 958 | .SH AFFINE MODEL OPTIONS |
920 | 959 | .TP |
921 | 960 | .B "\-o | \--gapopen" <penalty> |
980 | 1019 | .SH TRANSLATION OPTIONS |
981 | 1020 | .TP |
982 | 1021 | .B "\--geneticcode" <code> |
983 | .B NEW: | |
984 | 1022 | Specify an alternative genetic code. The default code (1) is the standard |
985 | 1023 | genetic code. Other genetic codes may be specified by in shorthand or |
986 | 1024 | longhand form. |
1080 | 1118 | .\" |
1081 | 1119 | .TP |
1082 | 1120 | .B "\--seedrepeat" <count> |
1083 | .B NEW: | |
1084 | 1121 | The seedrepeat parameter sets the number of seeds which must be found |
1085 | 1122 | on the same diagonal or reading frame before HSP extension will occur. |
1086 | 1123 | Increasing the value for |
1150 | 1187 | .\" |
1151 | 1188 | .TP |
1152 | 1189 | .B "\--geneseedrepeat" <count> |
1153 | .B NEW: | |
1154 | 1190 | The geneseedrepeat parameter is like the seedrepeat parameter, |
1155 | 1191 | but is only applied when looking for the geneseed hsps. |
1156 | 1192 | Using a larger value for |
1183 | 1219 | .B "\--splice3" <path> |
1184 | 1220 | .TP |
1185 | 1221 | .B "\--splice5" <path> |
1186 | .B NEW: | |
1187 | 1222 | Provide a file containing a custom PSSM (position specific score matrix) |
1188 | 1223 | for prediction of the intron splice sites. |
1189 | 1224 |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
21 | 21 | $(top_srcdir)/src/sequence/translate.o \ |
22 | 22 | $(top_srcdir)/src/general/argument.o \ |
23 | 23 | $(top_srcdir)/src/general/lineparse.o \ |
24 | $(top_srcdir)/src/general/threadref.o \ | |
24 | 25 | -lm |
25 | 26 | |
26 | 27 | C4_OBJ = $(top_srcdir)/src/c4/c4.o \ |
53 | 54 | hpair_test_LDADD = $(top_srcdir)/src/struct/slist.o \ |
54 | 55 | $(top_srcdir)/src/struct/pqueue.o \ |
55 | 56 | $(top_srcdir)/src/struct/recyclebin.o \ |
57 | $(top_srcdir)/src/struct/rangetree.o \ | |
56 | 58 | $(top_srcdir)/src/comparison/hspset.o \ |
57 | 59 | $(top_srcdir)/src/comparison/wordhood.o \ |
58 | $(top_srcdir)/src/struct/rangetree.o \ | |
59 | 60 | $(ALIGNMENT_OBJ) |
60 | 61 | |
61 | 62 | sar_test_SOURCES = sar.test.c sar.c heuristic.c |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
86 | 87 | |
87 | 88 | noinst_HEADERS = heuristic.h bsdp.h hpair.h sar.h |
88 | 89 | |
89 | SEQUENCE_OBJ = $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o -lm | |
90 | SEQUENCE_OBJ = $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o $(top_srcdir)/src/general/threadref.o -lm | |
90 | 91 | |
91 | 92 | |
92 | 93 | C4_OBJ = $(top_srcdir)/src/c4/c4.o $(top_srcdir)/src/c4/alignment.o $(top_srcdir)/src/c4/optimal.o $(top_srcdir)/src/c4/codegen.o $(top_srcdir)/src/c4/region.o $(top_srcdir)/src/c4/layout.o $(top_srcdir)/src/c4/viterbi.o $(top_srcdir)/src/c4/subopt.o $(top_srcdir)/src/c4/cgutil.o |
104 | 105 | |
105 | 106 | |
106 | 107 | hpair_test_SOURCES = hpair.test.c hpair.c heuristic.c bsdp.c sar.c |
107 | hpair_test_LDADD = $(top_srcdir)/src/struct/slist.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/struct/rangetree.o $(ALIGNMENT_OBJ) | |
108 | hpair_test_LDADD = $(top_srcdir)/src/struct/slist.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/wordhood.o $(ALIGNMENT_OBJ) | |
108 | 109 | |
109 | 110 | |
110 | 111 | sar_test_SOURCES = sar.test.c sar.c heuristic.c |
140 | 141 | $(top_srcdir)/src/sequence/splice.o \ |
141 | 142 | $(top_srcdir)/src/sequence/translate.o \ |
142 | 143 | $(top_srcdir)/src/general/argument.o \ |
143 | $(top_srcdir)/src/general/lineparse.o | |
144 | $(top_srcdir)/src/general/lineparse.o \ | |
145 | $(top_srcdir)/src/general/threadref.o | |
144 | 146 | heuristic_test_LDFLAGS = |
145 | 147 | bsdp_test_OBJECTS = bsdp.test.o bsdp.o |
146 | 148 | bsdp_test_DEPENDENCIES = $(top_srcdir)/src/general/argument.o \ |
149 | 151 | hpair_test_OBJECTS = hpair.test.o hpair.o heuristic.o bsdp.o sar.o |
150 | 152 | hpair_test_DEPENDENCIES = $(top_srcdir)/src/struct/slist.o \ |
151 | 153 | $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o \ |
154 | $(top_srcdir)/src/struct/rangetree.o \ | |
152 | 155 | $(top_srcdir)/src/comparison/hspset.o \ |
153 | 156 | $(top_srcdir)/src/comparison/wordhood.o \ |
154 | $(top_srcdir)/src/struct/rangetree.o \ | |
155 | 157 | $(top_srcdir)/src/comparison/match.o \ |
156 | 158 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
157 | 159 | $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/c4/c4.o \ |
165 | 167 | $(top_srcdir)/src/sequence/splice.o \ |
166 | 168 | $(top_srcdir)/src/sequence/translate.o \ |
167 | 169 | $(top_srcdir)/src/general/argument.o \ |
168 | $(top_srcdir)/src/general/lineparse.o | |
170 | $(top_srcdir)/src/general/lineparse.o \ | |
171 | $(top_srcdir)/src/general/threadref.o | |
169 | 172 | hpair_test_LDFLAGS = |
170 | 173 | sar_test_OBJECTS = sar.test.o sar.o heuristic.o |
171 | 174 | sar_test_DEPENDENCIES = $(top_srcdir)/src/struct/slist.o \ |
184 | 187 | $(top_srcdir)/src/sequence/splice.o \ |
185 | 188 | $(top_srcdir)/src/sequence/translate.o \ |
186 | 189 | $(top_srcdir)/src/general/argument.o \ |
187 | $(top_srcdir)/src/general/lineparse.o | |
190 | $(top_srcdir)/src/general/lineparse.o \ | |
191 | $(top_srcdir)/src/general/threadref.o | |
188 | 192 | sar_test_LDFLAGS = |
189 | 193 | CFLAGS = @CFLAGS@ |
190 | 194 | COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
2 | 2 | * BSDP : Bounded Sparse Dynamic Programming * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * BSDP: Bounded Sparse Dynamic Programming * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * BSDP : Bounded Sparse Dynamic Programming * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for heuristics * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for heuristics * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for heuristics * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for heuristic pairs * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for heuristic pairs * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for heuristic pairs * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - sub-alignment regions * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - sub-alignment regions * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - sub-alignment regions * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
18 | 18 | region_test_SOURCES = region.test.c region.c |
19 | 19 | |
20 | 20 | c4_test_SOURCES = c4.test.c c4.c region.c |
21 | c4_test_LDADD = $(top_srcdir)/src/struct/matrix.o | |
21 | c4_test_LDADD = $(top_srcdir)/src/struct/matrix.o \ | |
22 | $(top_srcdir)/src/general/threadref.o | |
22 | 23 | |
23 | 24 | SEQUENCE_OBJ = $(top_srcdir)/src/struct/sparsecache.o \ |
24 | 25 | $(top_srcdir)/src/struct/matrix.o \ |
33 | 34 | ALIGNMENT_OBJ = $(top_srcdir)/src/comparison/match.o \ |
34 | 35 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
35 | 36 | $(top_srcdir)/src/sequence/submat.o \ |
37 | $(top_srcdir)/src/general/threadref.o \ | |
36 | 38 | $(SEQUENCE_OBJ) |
37 | 39 | alignment_test_SOURCES = alignment.test.c alignment.c c4.c region.c |
38 | 40 | alignment_test_LDADD = $(ALIGNMENT_OBJ) |
41 | 43 | codegen_test_LDADD = $(top_srcdir)/src/general/argument.o |
42 | 44 | |
43 | 45 | cgutil_test_SOURCES = cgutil.test.c cgutil.c codegen.c c4.c region.c |
44 | cgutil_test_LDADD = $(top_srcdir)/src/general/argument.o \ | |
45 | $(top_srcdir)/src/struct/matrix.o | |
46 | cgutil_test_LDADD = $(top_srcdir)/src/general/argument.o \ | |
47 | $(top_srcdir)/src/struct/matrix.o \ | |
48 | $(top_srcdir)/src/general/threadref.o | |
46 | 49 | |
47 | 50 | viterbi_test_SOURCES = viterbi.test.c viterbi.c c4.c region.c \ |
48 | 51 | alignment.c codegen.c layout.c subopt.c \ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
91 | 92 | region_test_SOURCES = region.test.c region.c |
92 | 93 | |
93 | 94 | c4_test_SOURCES = c4.test.c c4.c region.c |
94 | c4_test_LDADD = $(top_srcdir)/src/struct/matrix.o | |
95 | c4_test_LDADD = $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/general/threadref.o | |
96 | ||
95 | 97 | |
96 | 98 | SEQUENCE_OBJ = $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o -lm |
97 | 99 | |
98 | 100 | |
99 | ALIGNMENT_OBJ = $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/sequence/submat.o $(SEQUENCE_OBJ) | |
101 | ALIGNMENT_OBJ = $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/general/threadref.o $(SEQUENCE_OBJ) | |
100 | 102 | |
101 | 103 | alignment_test_SOURCES = alignment.test.c alignment.c c4.c region.c |
102 | 104 | alignment_test_LDADD = $(ALIGNMENT_OBJ) |
105 | 107 | codegen_test_LDADD = $(top_srcdir)/src/general/argument.o |
106 | 108 | |
107 | 109 | cgutil_test_SOURCES = cgutil.test.c cgutil.c codegen.c c4.c region.c |
108 | cgutil_test_LDADD = $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/struct/matrix.o | |
110 | cgutil_test_LDADD = $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/general/threadref.o | |
109 | 111 | |
110 | 112 | |
111 | 113 | viterbi_test_SOURCES = viterbi.test.c viterbi.c c4.c region.c alignment.c codegen.c layout.c subopt.c cgutil.c |
147 | 149 | region_test_DEPENDENCIES = |
148 | 150 | region_test_LDFLAGS = |
149 | 151 | c4_test_OBJECTS = c4.test.o c4.o region.o |
150 | c4_test_DEPENDENCIES = $(top_srcdir)/src/struct/matrix.o | |
152 | c4_test_DEPENDENCIES = $(top_srcdir)/src/struct/matrix.o \ | |
153 | $(top_srcdir)/src/general/threadref.o | |
151 | 154 | c4_test_LDFLAGS = |
152 | 155 | alignment_test_OBJECTS = alignment.test.o alignment.o c4.o region.o |
153 | 156 | alignment_test_DEPENDENCIES = $(top_srcdir)/src/comparison/match.o \ |
154 | 157 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
155 | 158 | $(top_srcdir)/src/sequence/submat.o \ |
159 | $(top_srcdir)/src/general/threadref.o \ | |
156 | 160 | $(top_srcdir)/src/struct/sparsecache.o \ |
157 | 161 | $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o \ |
158 | 162 | $(top_srcdir)/src/sequence/alphabet.o \ |
172 | 176 | $(top_srcdir)/src/comparison/match.o \ |
173 | 177 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
174 | 178 | $(top_srcdir)/src/sequence/submat.o \ |
179 | $(top_srcdir)/src/general/threadref.o \ | |
175 | 180 | $(top_srcdir)/src/struct/sparsecache.o \ |
176 | 181 | $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o \ |
177 | 182 | $(top_srcdir)/src/sequence/alphabet.o \ |
191 | 196 | $(top_srcdir)/src/comparison/match.o \ |
192 | 197 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
193 | 198 | $(top_srcdir)/src/sequence/submat.o \ |
199 | $(top_srcdir)/src/general/threadref.o \ | |
194 | 200 | $(top_srcdir)/src/struct/sparsecache.o \ |
195 | 201 | $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o \ |
196 | 202 | $(top_srcdir)/src/sequence/alphabet.o \ |
207 | 213 | $(top_srcdir)/src/comparison/match.o \ |
208 | 214 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
209 | 215 | $(top_srcdir)/src/sequence/submat.o \ |
216 | $(top_srcdir)/src/general/threadref.o \ | |
210 | 217 | $(top_srcdir)/src/struct/sparsecache.o \ |
211 | 218 | $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o \ |
212 | 219 | $(top_srcdir)/src/sequence/alphabet.o \ |
221 | 228 | subopt_test_LDFLAGS = |
222 | 229 | cgutil_test_OBJECTS = cgutil.test.o cgutil.o codegen.o c4.o region.o |
223 | 230 | cgutil_test_DEPENDENCIES = $(top_srcdir)/src/general/argument.o \ |
224 | $(top_srcdir)/src/struct/matrix.o | |
231 | $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/general/threadref.o | |
225 | 232 | cgutil_test_LDFLAGS = |
226 | 233 | CFLAGS = @CFLAGS@ |
227 | 234 | COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
2 | 2 | * C4 dynamic programming library - alignment code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
537 | 537 | register gint i, j; |
538 | 538 | register gint curr_query_pos = query_pos, |
539 | 539 | curr_target_pos = target_pos; |
540 | static gchar seq_string[4], match_string[4], gap_string[4]; | |
540 | register gchar *seq_string = g_new(gchar, 4), | |
541 | *match_string = g_new(gchar, 4), | |
542 | *gap_string = g_new(gchar, 4); | |
541 | 543 | register Alphabet_Type emitted_alphabet_type; |
542 | 544 | register gchar tr_codon, *tr_codon_name; |
543 | 545 | register gboolean is_translating |
597 | 599 | curr_query_pos += advance_query; |
598 | 600 | curr_target_pos += advance_target; |
599 | 601 | } |
602 | g_free(seq_string); | |
603 | g_free(match_string); | |
604 | g_free(gap_string); | |
600 | 605 | return; |
601 | 606 | } |
602 | 607 | /* Display gap:[- N] codon[<-> NNN] frameshift [-*N] |
1415 | 1420 | /* Reports the %id over the equivalenced regions of the alignment |
1416 | 1421 | */ |
1417 | 1422 | |
1423 | static gint Alignment_get_equivalenced_matching_region(Alignment *alignment, | |
1424 | Sequence *query, Sequence *target, | |
1425 | Translate *translate, gboolean report_id, | |
1426 | gpointer user_data, gint exon_query_start, gint exon_query_end){ | |
1427 | register gint i, j, match = 0; | |
1428 | register AlignmentOperation *ao; | |
1429 | register gint query_pos = alignment->region->query_start, | |
1430 | target_pos = alignment->region->target_start; | |
1431 | register gchar qy_symbol, tg_symbol; | |
1432 | for(i = 0; i < alignment->operation_list->len; i++){ | |
1433 | ao = alignment->operation_list->pdata[i]; | |
1434 | if(ao->transition->label == C4_Label_MATCH){ | |
1435 | for(j = 0; j < ao->length; j++){ | |
1436 | if(query_pos > exon_query_end) | |
1437 | return match; | |
1438 | if(query_pos >= exon_query_start){ | |
1439 | qy_symbol = Alignment_match_get_symbol(query, query_pos, | |
1440 | ao->transition->advance_query, | |
1441 | translate); | |
1442 | tg_symbol = Alignment_match_get_symbol(target, | |
1443 | target_pos, | |
1444 | ao->transition->advance_target, | |
1445 | translate); | |
1446 | if(report_id){ | |
1447 | if(toupper(qy_symbol) == toupper(tg_symbol)) | |
1448 | match++; | |
1449 | } else { /* report similarity */ | |
1450 | if(C4_Calc_score(ao->transition->calc, query_pos, | |
1451 | target_pos, user_data) > 0) | |
1452 | match++; | |
1453 | } | |
1454 | } | |
1455 | query_pos += ao->transition->advance_query; | |
1456 | target_pos += ao->transition->advance_target; | |
1457 | } | |
1458 | } else { | |
1459 | query_pos += (ao->transition->advance_query | |
1460 | * ao->length); | |
1461 | target_pos += (ao->transition->advance_target | |
1462 | * ao->length); | |
1463 | } | |
1464 | } | |
1465 | return match; | |
1466 | } | |
1467 | /* Reports the %id over the equivalenced regions of the alignment | |
1468 | */ | |
1469 | ||
1418 | 1470 | static gint Alignment_get_equivalenced_total(Alignment *alignment){ |
1419 | 1471 | register gint i, total = 0; |
1420 | 1472 | register AlignmentOperation *ao; |
1426 | 1478 | return total; |
1427 | 1479 | } |
1428 | 1480 | |
1481 | static gint Alignment_get_equivalenced_total_region(Alignment *alignment, | |
1482 | gint exon_query_start, gint exon_query_end){ | |
1483 | register gint i, j, total = 0; | |
1484 | register gint query_pos = alignment->region->query_start, | |
1485 | target_pos = alignment->region->target_start; | |
1486 | register AlignmentOperation *ao; | |
1487 | for(i = 0; i < alignment->operation_list->len; i++){ | |
1488 | ao = alignment->operation_list->pdata[i]; | |
1489 | if(ao->transition->label == C4_Label_MATCH){ | |
1490 | for(j = 0; j < ao->length; j++){ | |
1491 | if(query_pos > exon_query_end) | |
1492 | return total; | |
1493 | if(query_pos >= exon_query_start) | |
1494 | total++; | |
1495 | query_pos += ao->transition->advance_query; | |
1496 | target_pos += ao->transition->advance_target; | |
1497 | } | |
1498 | } else { | |
1499 | query_pos += (ao->transition->advance_query | |
1500 | * ao->length); | |
1501 | target_pos += (ao->transition->advance_target | |
1502 | * ao->length); | |
1503 | } | |
1504 | } | |
1505 | return total; | |
1506 | } | |
1507 | /* FIXME: optimisation: should use gene object to avoid full alignment pass | |
1508 | */ | |
1509 | ||
1510 | static gfloat Alignment_get_percent_score_region(Alignment *alignment, | |
1511 | Sequence *query, Sequence *target, | |
1512 | Translate *translate, gboolean report_id, gpointer user_data, | |
1513 | gint exon_query_start, gint exon_query_end){ | |
1514 | return (((gfloat)Alignment_get_equivalenced_matching_region(alignment, | |
1515 | query, target, translate, report_id, user_data, | |
1516 | exon_query_start, exon_query_end)) | |
1517 | / ((gfloat)Alignment_get_equivalenced_total_region(alignment, | |
1518 | exon_query_start, exon_query_end)))*100; | |
1519 | } | |
1520 | /* FIXME: should also count split codons */ | |
1521 | ||
1429 | 1522 | static gfloat Alignment_get_percent_score(Alignment *alignment, |
1430 | 1523 | Sequence *query, Sequence *target, |
1431 | 1524 | Translate *translate, gboolean report_id, |
1434 | 1527 | query, target, translate, report_id, user_data)) |
1435 | 1528 | / ((gfloat)Alignment_get_equivalenced_total(alignment)))*100; |
1436 | 1529 | } |
1530 | /* FIXME: should also count split codons */ | |
1531 | ||
1532 | static gint Alignment_get_match_score(Alignment *alignment, | |
1533 | Sequence *query, Sequence *target, | |
1534 | gpointer user_data){ | |
1535 | register gint i, j; | |
1536 | register AlignmentOperation *ao; | |
1537 | register C4_Score score = 0; | |
1538 | register gint query_pos = alignment->region->query_start, | |
1539 | target_pos = alignment->region->target_start; | |
1540 | for(i = 0; i < alignment->operation_list->len; i++){ | |
1541 | ao = alignment->operation_list->pdata[i]; | |
1542 | for(j = 0; j < ao->length; j++){ | |
1543 | if(ao->transition->label == C4_Label_MATCH){ | |
1544 | score += C4_Calc_score(ao->transition->calc, query_pos, | |
1545 | target_pos, user_data); | |
1546 | } | |
1547 | query_pos += ao->transition->advance_query; | |
1548 | target_pos += ao->transition->advance_target; | |
1549 | } | |
1550 | } | |
1551 | g_message("MATCH SCORE [%d]", score); | |
1552 | return score; | |
1553 | } | |
1554 | ||
1555 | static gint Alignment_get_self_match_score(Alignment *alignment, | |
1556 | Sequence *query, Sequence *target, | |
1557 | gpointer self_data){ | |
1558 | register gint i, j; | |
1559 | register AlignmentOperation *ao; | |
1560 | register C4_Score score = 0; | |
1561 | register gint query_pos = alignment->region->query_start; | |
1562 | for(i = 0; i < alignment->operation_list->len; i++){ | |
1563 | ao = alignment->operation_list->pdata[i]; | |
1564 | for(j = 0; j < ao->length; j++){ | |
1565 | if(ao->transition->label == C4_Label_MATCH){ | |
1566 | /* Use self_data to find self-comparison scores */ | |
1567 | score += C4_Calc_score(ao->transition->calc, query_pos, | |
1568 | query_pos, self_data); | |
1569 | } | |
1570 | query_pos += ao->transition->advance_query; | |
1571 | } | |
1572 | } | |
1573 | g_message("SELF MATCH SCORE [%d]", score); | |
1574 | return score; | |
1575 | } | |
1576 | ||
1577 | static gfloat Alignment_get_percent_self(Alignment *alignment, | |
1578 | Sequence *query, Sequence *target, | |
1579 | Translate *translate, gpointer user_data, gpointer self_data){ | |
1580 | return (((gfloat)Alignment_get_match_score(alignment, | |
1581 | query, target, user_data)) | |
1582 | / ((gfloat)Alignment_get_self_match_score(alignment, query, target, | |
1583 | self_data)))*100; | |
1584 | } | |
1585 | /* Returns score as a percentage of maximum possible | |
1586 | * over the equivalenced transitions | |
1587 | */ | |
1437 | 1588 | |
1438 | 1589 | /**/ |
1439 | 1590 | |
1611 | 1762 | Alignment_RYO_TOKEN_RANK, |
1612 | 1763 | Alignment_RYO_TOKEN_PERCENT_ID, |
1613 | 1764 | Alignment_RYO_TOKEN_PERCENT_SIMILARITY, |
1765 | Alignment_RYO_TOKEN_PERCENT_SELF, | |
1614 | 1766 | Alignment_RYO_TOKEN_GENE_ORIENTATION, |
1615 | 1767 | Alignment_RYO_TOKEN_EQUIVALENCED_TOTAL, |
1616 | 1768 | Alignment_RYO_TOKEN_EQUIVALENCED_IDENTCAL, |
1902 | 2054 | case 's': |
1903 | 2055 | Alignment_RYO_add_token(token_list, |
1904 | 2056 | Alignment_RYO_TOKEN_PERCENT_SIMILARITY, |
2057 | FALSE); | |
2058 | break; | |
2059 | case 'S': | |
2060 | Alignment_RYO_add_token(token_list, | |
2061 | Alignment_RYO_TOKEN_PERCENT_SELF, | |
1905 | 2062 | FALSE); |
1906 | 2063 | break; |
1907 | 2064 | default: |
1990 | 2147 | * %s score |
1991 | 2148 | * %m model_name |
1992 | 2149 | * %r rank |
1993 | * %p[is] percent {id,similarity} | |
2150 | * %p[isS] percent {id,similarity,self} | |
1994 | 2151 | * %e[tid] equivalenced {total,identical,similar} |
1995 | 2152 | * %g gene_orientation |
1996 | 2153 | * %S sugar block |
2203 | 2360 | |
2204 | 2361 | static void Alignment_RYO_token_list_print(GPtrArray *token_list, |
2205 | 2362 | Alignment *alignment, Sequence *query, Sequence *target, |
2206 | Translate *translate, gint rank, gpointer user_data, FILE *fp){ | |
2363 | Translate *translate, gint rank, | |
2364 | gpointer user_data, gpointer self_data, FILE *fp){ | |
2207 | 2365 | register gint i, j, pto_start = -1; |
2208 | 2366 | register Alignment_RYO_ComplexToken *rct; |
2209 | 2367 | register Sequence *seq, *subseq; |
2322 | 2480 | fprintf(fp, "%2.2f", Alignment_get_percent_score( |
2323 | 2481 | alignment, query, target, |
2324 | 2482 | translate, FALSE, user_data)); |
2483 | break; | |
2484 | case Alignment_RYO_TOKEN_PERCENT_SELF: | |
2485 | fprintf(fp, "%2.2f", Alignment_get_percent_self( | |
2486 | alignment, query, target, | |
2487 | translate, user_data, self_data)); | |
2325 | 2488 | break; |
2326 | 2489 | case Alignment_RYO_TOKEN_GENE_ORIENTATION: |
2327 | 2490 | fprintf(fp, "%c", |
2445 | 2608 | |
2446 | 2609 | void Alignment_display_ryo(Alignment *alignment, |
2447 | 2610 | Sequence *query, Sequence *target, gchar *format, |
2448 | Translate *translate, gint rank, gpointer user_data, FILE *fp){ | |
2611 | Translate *translate, gint rank, | |
2612 | gpointer user_data, gpointer self_data, FILE *fp){ | |
2449 | 2613 | register GPtrArray *token_list = Alignment_RYO_tokenise(format); |
2450 | 2614 | Alignment_RYO_token_list_print(token_list, alignment, |
2451 | 2615 | query, target, translate, rank, |
2452 | user_data, fp); | |
2616 | user_data, self_data, fp); | |
2453 | 2617 | Alignment_RYO_token_list_destroy(token_list); |
2454 | 2618 | return; |
2455 | 2619 | } |
2590 | 2754 | static void Alignment_display_gff_exon(Alignment *alignment, |
2591 | 2755 | Sequence *query, |
2592 | 2756 | Sequence *target, |
2757 | Translate *translate, | |
2593 | 2758 | gboolean report_on_query, |
2594 | 2759 | gint query_pos, |
2595 | 2760 | gint target_pos, |
2598 | 2763 | gint exon_query_gap, |
2599 | 2764 | gint exon_target_gap, |
2600 | 2765 | gint exon_query_frameshift, |
2601 | gint exon_target_frameshift, FILE *fp){ | |
2766 | gint exon_target_frameshift, | |
2767 | gpointer user_data, FILE *fp){ | |
2602 | 2768 | register GPtrArray *attribute_list = g_ptr_array_new(); |
2603 | 2769 | g_ptr_array_add(attribute_list, |
2604 | 2770 | g_strdup_printf("insertions %d", |
2608 | 2774 | g_strdup_printf("deletions %d", |
2609 | 2775 | report_on_query?exon_target_gap |
2610 | 2776 | :exon_query_gap)); |
2777 | g_ptr_array_add(attribute_list, | |
2778 | g_strdup_printf("identity %2.2f", | |
2779 | Alignment_get_percent_score_region(alignment, | |
2780 | query, target, translate, TRUE, user_data, | |
2781 | exon_query_start, query_pos))); | |
2782 | g_ptr_array_add(attribute_list, | |
2783 | g_strdup_printf("similarity %2.2f", | |
2784 | Alignment_get_percent_score_region(alignment, | |
2785 | query, target, translate, FALSE, user_data, | |
2786 | exon_query_start, query_pos))); | |
2611 | 2787 | if(report_on_query){ |
2612 | 2788 | if(exon_query_frameshift) |
2613 | 2789 | g_ptr_array_add(attribute_list, |
2666 | 2842 | } |
2667 | 2843 | |
2668 | 2844 | static void Alignment_display_gff_gene(Alignment *alignment, |
2669 | Sequence *query, Sequence *target, gboolean report_on_query, | |
2670 | gint result_id, FILE *fp){ | |
2845 | Sequence *query, Sequence *target, Translate *translate, | |
2846 | gboolean report_on_query, | |
2847 | gint result_id, gpointer user_data, FILE *fp){ | |
2671 | 2848 | register gint i; |
2672 | 2849 | register gint query_pos = alignment->region->query_start, |
2673 | 2850 | target_pos = alignment->region->target_start; |
2691 | 2868 | report_on_query?target->id:query->id)); |
2692 | 2869 | g_ptr_array_add(attribute_list, |
2693 | 2870 | g_strdup_printf("gene_orientation %c", gene_orientation)); |
2871 | g_ptr_array_add(attribute_list, | |
2872 | g_strdup_printf("identity %2.2f", | |
2873 | Alignment_get_percent_score(alignment, | |
2874 | query, target, translate, TRUE, user_data))); | |
2875 | g_ptr_array_add(attribute_list, | |
2876 | g_strdup_printf("similarity %2.2f", | |
2877 | Alignment_get_percent_score(alignment, | |
2878 | query, target, translate, FALSE, user_data))); | |
2694 | 2879 | Alignment_display_gff_line(alignment, query, target, report_on_query, |
2695 | 2880 | "gene", |
2696 | 2881 | alignment->region->query_start, |
2769 | 2954 | exon_query_start, exon_target_start, |
2770 | 2955 | query_pos, target_pos, fp); |
2771 | 2956 | Alignment_display_gff_exon(alignment, |
2772 | query, target, report_on_query, | |
2957 | query, target, translate, report_on_query, | |
2773 | 2958 | query_pos, target_pos, |
2774 | 2959 | exon_query_start, exon_target_start, |
2775 | 2960 | exon_query_gap, exon_target_gap, |
2776 | 2961 | exon_query_frameshift, |
2777 | exon_target_frameshift, fp); | |
2962 | exon_target_frameshift, user_data, fp); | |
2778 | 2963 | in_exon = FALSE; |
2779 | 2964 | } |
2780 | 2965 | attribute_list = g_ptr_array_new(); |
2810 | 2995 | exon_query_start, exon_target_start, |
2811 | 2996 | query_pos, target_pos, fp); |
2812 | 2997 | Alignment_display_gff_exon(alignment, |
2813 | query, target, report_on_query, | |
2998 | query, target, translate, report_on_query, | |
2814 | 2999 | query_pos, target_pos, |
2815 | 3000 | exon_query_start, exon_target_start, |
2816 | 3001 | exon_query_gap, exon_target_gap, |
2817 | 3002 | exon_query_frameshift, |
2818 | exon_target_frameshift, fp); | |
3003 | exon_target_frameshift, user_data, fp); | |
2819 | 3004 | in_exon = FALSE; |
2820 | 3005 | } |
2821 | 3006 | if(gene_orientation == '+'){ |
2894 | 3079 | } |
2895 | 3080 | } |
2896 | 3081 | Alignment_display_gff_exon(alignment, |
2897 | query, target, report_on_query, | |
3082 | query, target, translate, report_on_query, | |
2898 | 3083 | query_pos, target_pos, |
2899 | 3084 | exon_query_start, exon_target_start, |
2900 | 3085 | exon_query_gap, exon_target_gap, |
2901 | exon_query_frameshift, exon_target_frameshift, fp); | |
3086 | exon_query_frameshift, exon_target_frameshift, user_data, fp); | |
2902 | 3087 | } |
2903 | 3088 | return; |
2904 | 3089 | } |
2973 | 3158 | |
2974 | 3159 | void Alignment_display_gff(Alignment *alignment, |
2975 | 3160 | Sequence *query, Sequence *target, |
3161 | Translate *translate, | |
2976 | 3162 | gboolean report_on_query, |
2977 | 3163 | gboolean report_on_genomic, |
2978 | gint result_id, FILE *fp){ | |
3164 | gint result_id, gpointer user_data, FILE *fp){ | |
2979 | 3165 | fprintf(fp, "# --- START OF GFF DUMP ---\n#\n"); |
2980 | 3166 | Alignment_display_gff_header(alignment, query, target, |
2981 | 3167 | report_on_query, fp); |
2982 | 3168 | if(report_on_genomic){ |
2983 | Alignment_display_gff_gene(alignment, query, target, | |
2984 | report_on_query, result_id, fp); | |
3169 | Alignment_display_gff_gene(alignment, query, target, translate, | |
3170 | report_on_query, result_id, user_data, fp); | |
2985 | 3171 | } |
2986 | 3172 | Alignment_display_gff_similarity(alignment, query, target, |
2987 | 3173 | report_on_query, result_id, fp); |
2 | 2 | * C4 dynamic programming library - alignment code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
75 | 75 | |
76 | 76 | void Alignment_display_gff(Alignment *alignment, |
77 | 77 | Sequence *query, Sequence *target, |
78 | Translate *translate, | |
78 | 79 | gboolean report_on_query, |
79 | 80 | gboolean report_on_genomic, |
80 | gint result_id, FILE *fp); | |
81 | gint result_id, gpointer user_data, FILE *fp); | |
81 | 82 | |
82 | 83 | void Alignment_display_ryo(Alignment *alignment, |
83 | 84 | Sequence *query, Sequence *target, gchar *format, |
84 | Translate *translate, gint rank, gpointer user_data, FILE *fp); | |
85 | Translate *translate, gint rank, | |
86 | gpointer user_data, gpointer self_data, FILE *fp); | |
85 | 87 | |
86 | 88 | /**/ |
87 | 89 |
2 | 2 | * C4 dynamic programming library - alignment code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for models * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
519 | 519 | model->exit_func = NULL; |
520 | 520 | model->exit_macro = NULL; |
521 | 521 | /**/ |
522 | model->ref_count = 1; | |
522 | model->thread_ref = ThreadRef_create(); | |
523 | 523 | model->is_open = TRUE; |
524 | 524 | /**/ |
525 | 525 | model->state_list = g_ptr_array_new(); |
559 | 559 | void C4_Model_destroy(C4_Model *model){ |
560 | 560 | register gint i; |
561 | 561 | g_assert(model); |
562 | if(--model->ref_count) | |
562 | if(ThreadRef_destroy(model->thread_ref)) | |
563 | 563 | return; |
564 | 564 | g_free(model->name); |
565 | 565 | C4_Model_destroy_string_list(model->global_code_list); |
596 | 596 | C4_Model *C4_Model_share(C4_Model *model){ |
597 | 597 | g_assert(model); |
598 | 598 | g_assert(!model->is_open); |
599 | model->ref_count++; | |
599 | ThreadRef_share(model->thread_ref); | |
600 | 600 | return model; |
601 | 601 | } |
602 | 602 |
2 | 2 | * C4 dynamic programming library - code for models * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
22 | 22 | #include <glib.h> |
23 | 23 | |
24 | 24 | #include "region.h" |
25 | #include "threadref.h" | |
25 | 26 | |
26 | 27 | typedef gint C4_Score; |
27 | 28 | #define C4_IMPOSSIBLY_LOW_SCORE -987654321 |
176 | 177 | gchar *init_macro; /* If NULL, use init_func */ |
177 | 178 | C4_PrepFunc exit_func; /* If NULL, no initialisation */ |
178 | 179 | gchar *exit_macro; /* If NULL, use exit_func */ |
179 | gint ref_count; | |
180 | ThreadRef *thread_ref; | |
180 | 181 | gboolean is_open; |
181 | 182 | GPtrArray *state_list; |
182 | 183 | GPtrArray *transition_list; |
2 | 2 | * C4 dynamic programming library - code for models * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Utilities to facilitate code generation DP implementations * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Utilities to facilitate code generation DP implementations * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Utilities to facilitate code generation DP implementations * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Code generation module for C4 * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Code generation module for C4 * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Code generation module for C4 * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - DP layout code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - DP layout code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - optimal alignment code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for optimal pairs * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for optimal pairs * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for optimal pairs * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - optimal alignment code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - optimal alignment code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - DP layout code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for regions * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for regions * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - code for regions * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - suboptimal alignments * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - suboptimal alignments * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - suboptimal alignments * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - the Viterbi implementation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - the Viterbi implementation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - the Viterbi implementation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
28 | 28 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
29 | 29 | $(top_srcdir)/src/struct/pqueue.o \ |
30 | 30 | $(top_srcdir)/src/struct/recyclebin.o \ |
31 | $(top_srcdir)/src/general/threadref.o \ | |
31 | 32 | $(SEQUENCE_OBJ) |
32 | 33 | |
33 | 34 | pcr_test_SOURCES = pcr.test.c pcr.c wordhood.c |
44 | 45 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
45 | 46 | $(top_srcdir)/src/struct/recyclebin.o \ |
46 | 47 | $(top_srcdir)/src/struct/pqueue.o \ |
48 | $(top_srcdir)/src/general/threadref.o \ | |
47 | 49 | $(SEQUENCE_OBJ) |
48 | 50 | |
49 | 51 | match_test_SOURCES = match.test.c match.c |
59 | 61 | $(top_srcdir)/src/struct/fsm.o \ |
60 | 62 | $(top_srcdir)/src/struct/vfsm.o \ |
61 | 63 | $(top_srcdir)/src/struct/pqueue.o \ |
64 | $(top_srcdir)/src/general/threadref.o \ | |
62 | 65 | $(SEQUENCE_OBJ) |
63 | 66 | |
64 | 67 | # Files to clear away |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
94 | 95 | wordhood_test_LDADD = $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(SEQUENCE_OBJ) |
95 | 96 | |
96 | 97 | hspset_test_SOURCES = hspset.test.c hspset.c match.c wordhood.c |
97 | hspset_test_LDADD = $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(SEQUENCE_OBJ) | |
98 | hspset_test_LDADD = $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/general/threadref.o $(SEQUENCE_OBJ) | |
98 | 99 | |
99 | 100 | |
100 | 101 | pcr_test_SOURCES = pcr.test.c pcr.c wordhood.c |
103 | 104 | |
104 | 105 | comparison_test_SOURCES = comparison.test.c comparison.c hspset.c match.c wordhood.c |
105 | 106 | |
106 | comparison_test_LDADD = $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/pqueue.o $(SEQUENCE_OBJ) | |
107 | comparison_test_LDADD = $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/general/threadref.o $(SEQUENCE_OBJ) | |
107 | 108 | |
108 | 109 | |
109 | 110 | match_test_SOURCES = match.test.c match.c |
112 | 113 | |
113 | 114 | seeder_test_SOURCES = seeder.test.c seeder.c wordhood.c hspset.c match.c comparison.c |
114 | 115 | |
115 | seeder_test_LDADD = $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/fsm.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/pqueue.o $(SEQUENCE_OBJ) | |
116 | seeder_test_LDADD = $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/fsm.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/general/threadref.o $(SEQUENCE_OBJ) | |
116 | 117 | |
117 | 118 | |
118 | 119 | # Files to clear away |
142 | 143 | hspset_test_DEPENDENCIES = $(top_srcdir)/src/sequence/submat.o \ |
143 | 144 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
144 | 145 | $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o \ |
146 | $(top_srcdir)/src/general/threadref.o \ | |
145 | 147 | $(top_srcdir)/src/struct/sparsecache.o \ |
146 | 148 | $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o \ |
147 | 149 | $(top_srcdir)/src/sequence/alphabet.o \ |
167 | 169 | comparison_test_DEPENDENCIES = $(top_srcdir)/src/sequence/submat.o \ |
168 | 170 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
169 | 171 | $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/pqueue.o \ |
172 | $(top_srcdir)/src/general/threadref.o \ | |
170 | 173 | $(top_srcdir)/src/struct/sparsecache.o \ |
171 | 174 | $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o \ |
172 | 175 | $(top_srcdir)/src/sequence/alphabet.o \ |
192 | 195 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
193 | 196 | $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/fsm.o \ |
194 | 197 | $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/pqueue.o \ |
198 | $(top_srcdir)/src/general/threadref.o \ | |
195 | 199 | $(top_srcdir)/src/struct/sparsecache.o \ |
196 | 200 | $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o \ |
197 | 201 | $(top_srcdir)/src/sequence/alphabet.o \ |
2 | 2 | * Comparison : A module for pairwise sequence comparisons * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
35 | 35 | HSP_Param *codon_hsp_param, |
36 | 36 | gboolean swap_param){ |
37 | 37 | register Comparison_Param *param = g_new(Comparison_Param, 1); |
38 | param->ref_count = 1; | |
38 | param->thread_ref = NULL; | |
39 | 39 | param->query_type = query_type; |
40 | 40 | param->target_type = target_type; |
41 | 41 | param->dna_hsp_param = Comparison_Param_get_hsp_param(dna_hsp_param, |
63 | 63 | dna_hsp_param, protein_hsp_param, |
64 | 64 | codon_hsp_param, TRUE); |
65 | 65 | param->mirror->mirror = param; |
66 | param->mirror->thread_ref = param->thread_ref = ThreadRef_create(); | |
66 | 67 | return param; |
67 | } | |
68 | ||
69 | static gint Comparison_Param_ref_count(Comparison_Param *param){ | |
70 | g_assert(param); | |
71 | g_assert(param->mirror); | |
72 | return param->ref_count + param->mirror->ref_count; | |
73 | 68 | } |
74 | 69 | |
75 | 70 | static void Comparison_Param_destroy_without_mirror( |
88 | 83 | |
89 | 84 | void Comparison_Param_destroy(Comparison_Param *param){ |
90 | 85 | g_assert(param); |
91 | param->ref_count--; | |
92 | if(Comparison_Param_ref_count(param) > 1) /* Allow for mirror */ | |
86 | if(ThreadRef_destroy(param->thread_ref)) | |
93 | 87 | return; |
94 | 88 | Comparison_Param_destroy_without_mirror(param->mirror); |
95 | 89 | Comparison_Param_destroy_without_mirror(param); |
98 | 92 | |
99 | 93 | Comparison_Param *Comparison_Param_share(Comparison_Param *param){ |
100 | 94 | g_assert(param); |
101 | param->ref_count++; | |
95 | ThreadRef_share(param->thread_ref); | |
102 | 96 | return param; |
103 | 97 | } |
104 | 98 | |
131 | 125 | g_assert(param); |
132 | 126 | g_assert(query); |
133 | 127 | g_assert(target); |
134 | comparison->ref_count = 1; | |
128 | comparison->thread_ref = ThreadRef_create(); | |
135 | 129 | comparison->param = Comparison_Param_share(param); |
136 | 130 | comparison->query = Sequence_share(query); |
137 | 131 | comparison->target = Sequence_share(target); |
138 | comparison->dna_hspset = param->dna_hsp_param | |
132 | ThreadRef_lock(comparison->param->thread_ref); | |
133 | comparison->dna_hspset = comparison->param->dna_hsp_param | |
139 | 134 | ? HSPset_create(query, target, |
140 | 135 | param->dna_hsp_param) |
141 | 136 | : NULL; |
147 | 142 | ? HSPset_create(query, target, |
148 | 143 | param->codon_hsp_param) |
149 | 144 | : NULL; |
145 | ThreadRef_unlock(comparison->param->thread_ref); | |
150 | 146 | return comparison; |
151 | 147 | } |
152 | 148 | |
153 | 149 | Comparison *Comparison_share(Comparison *comparison){ |
154 | comparison->ref_count++; | |
150 | ThreadRef_share(comparison->thread_ref); | |
155 | 151 | return comparison; |
156 | 152 | } |
157 | 153 | |
158 | 154 | void Comparison_destroy(Comparison *comparison){ |
159 | 155 | g_assert(comparison); |
160 | if(--comparison->ref_count) | |
156 | if(ThreadRef_destroy(comparison->thread_ref)) | |
161 | 157 | return; |
162 | 158 | Comparison_Param_destroy(comparison->param); |
163 | 159 | Sequence_destroy(comparison->query); |
216 | 212 | |
217 | 213 | void Comparison_swap(Comparison *comparison){ |
218 | 214 | register Sequence *query; |
219 | g_assert(comparison->ref_count == 1); | |
215 | g_assert(ThreadRef_get_count(comparison->thread_ref) == 1); | |
220 | 216 | /* Mirror parameters */ |
221 | 217 | comparison->param = Comparison_Param_share(comparison->param->mirror); |
222 | 218 | Comparison_Param_destroy(comparison->param->mirror); |
241 | 237 | void Comparison_revcomp(Comparison *comparison){ |
242 | 238 | register Sequence *rc_query = Sequence_revcomp(comparison->query), |
243 | 239 | *rc_target = Sequence_revcomp(comparison->target); |
244 | g_assert(comparison->ref_count == 1); | |
240 | g_assert(ThreadRef_get_count(comparison->thread_ref) == 1); | |
245 | 241 | g_assert(comparison->dna_hspset); |
246 | 242 | g_assert(!comparison->protein_hspset); |
247 | 243 | g_assert(!comparison->codon_hspset); |
2 | 2 | * Comparison : A module for pairwise sequence comparisons * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
26 | 26 | #include "translate.h" |
27 | 27 | #include "submat.h" |
28 | 28 | #include "hspset.h" |
29 | #include "threadref.h" | |
29 | 30 | |
30 | 31 | typedef struct Comparison_Param { |
31 | gint ref_count; | |
32 | ThreadRef *thread_ref; | |
32 | 33 | Alphabet_Type query_type; |
33 | 34 | Alphabet_Type target_type; |
34 | 35 | HSP_Param *dna_hsp_param; |
49 | 50 | /**/ |
50 | 51 | |
51 | 52 | typedef struct { |
52 | gint ref_count; | |
53 | ThreadRef *thread_ref; | |
53 | 54 | Comparison_Param *param; |
54 | 55 | Sequence *query; |
55 | 56 | Sequence *target; |
63 | 64 | Comparison *Comparison_share(Comparison *comparison); |
64 | 65 | void Comparison_destroy(Comparison *comparison); |
65 | 66 | void Comparison_print(Comparison *comparison); |
66 | HSPset_ArgumentSet *Comparison_Param_get_HSPSet_Argument_Set(Comparison_Param *param); | |
67 | HSPset_ArgumentSet *Comparison_Param_get_HSPSet_Argument_Set( | |
68 | Comparison_Param *param); | |
67 | 69 | |
68 | 70 | gboolean Comparison_has_hsps(Comparison *comparison); |
69 | 71 | void Comparison_finalise(Comparison *comparison); |
2 | 2 | * Comparison : A module for pairwise sequence comparisons * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for HSP sets (high-scoring segment pairs) * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
65 | 65 | /**/ |
66 | 66 | ArgumentSet_add_option(as, 0, "dnawordlimit", "score", |
67 | 67 | "Score limit for dna word neighbourhood", "0", |
68 | Argument_parse_int, &has.dna_wordlimit); | |
68 | Argument_parse_int, &has.dna_word_limit); | |
69 | 69 | ArgumentSet_add_option(as, 0, "proteinwordlimit", "score", |
70 | 70 | "Score limit for protein word neighbourhood", "4", |
71 | Argument_parse_int, &has.protein_wordlimit); | |
71 | Argument_parse_int, &has.protein_word_limit); | |
72 | 72 | ArgumentSet_add_option(as, 0, "codonwordlimit", "score", |
73 | 73 | "Score limit for codon word neighbourhood", "4", |
74 | Argument_parse_int, &has.codon_wordlimit); | |
74 | Argument_parse_int, &has.codon_word_limit); | |
75 | 75 | /**/ |
76 | 76 | ArgumentSet_add_option(as, '\0', "geneseed", "threshold", |
77 | 77 | "Geneseed Threshold", "0", |
141 | 141 | |
142 | 142 | /**/ |
143 | 143 | |
144 | static void HSP_Param_refresh_wordhood(HSP_Param *hsp_param){ | |
145 | register WordHood_Alphabet *wha = NULL; | |
146 | register Submat *submat; | |
147 | if(hsp_param->wordhood) | |
148 | WordHood_destroy(hsp_param->wordhood); | |
149 | if(hsp_param->has->use_wordhood_dropoff && (!hsp_param->wordlimit)){ | |
150 | hsp_param->wordhood = NULL; | |
151 | } else { | |
152 | submat = (hsp_param->match->type == Match_Type_DNA2DNA) | |
153 | ? hsp_param->match->mas->dna_submat | |
154 | : hsp_param->match->mas->protein_submat; | |
155 | wha = WordHood_Alphabet_create_from_Submat( | |
156 | (gchar*)hsp_param->match->comparison_alphabet->member, | |
157 | (gchar*)hsp_param->match->comparison_alphabet->member, | |
158 | submat, FALSE); | |
159 | g_assert(wha); | |
160 | hsp_param->wordhood = WordHood_create(wha, hsp_param->wordlimit, | |
161 | hsp_param->has->use_wordhood_dropoff); | |
162 | WordHood_Alphabet_destroy(wha); | |
163 | } | |
164 | return; | |
165 | } | |
166 | /* FIXME: optimisation: do not free/recreate wordhood when unnecessary */ | |
167 | ||
168 | void HSP_Param_set_dna_word_limit(HSP_Param *hsp_param, | |
169 | gint dna_word_limit){ | |
170 | if(hsp_param->match->type == Match_Type_DNA2DNA){ | |
171 | hsp_param->wordlimit = dna_word_limit; | |
172 | HSP_Param_refresh_wordhood(hsp_param); | |
173 | } | |
174 | return; | |
175 | } | |
176 | ||
177 | void HSP_Param_set_protein_word_limit(HSP_Param *hsp_param, | |
178 | gint protein_word_limit){ | |
179 | if((hsp_param->match->type == Match_Type_PROTEIN2PROTEIN) | |
180 | || (hsp_param->match->type == Match_Type_PROTEIN2DNA) | |
181 | || (hsp_param->match->type == Match_Type_DNA2PROTEIN)){ | |
182 | hsp_param->wordlimit = protein_word_limit; | |
183 | HSP_Param_refresh_wordhood(hsp_param); | |
184 | } | |
185 | return; | |
186 | } | |
187 | ||
188 | void HSP_Param_set_codon_word_limit(HSP_Param *hsp_param, | |
189 | gint codon_word_limit){ | |
190 | if(hsp_param->match->type == Match_Type_CODON2CODON){ | |
191 | hsp_param->threshold = codon_word_limit; | |
192 | HSP_Param_refresh_wordhood(hsp_param); | |
193 | } | |
194 | return; | |
195 | } | |
196 | ||
197 | /**/ | |
198 | ||
144 | 199 | void HSP_Param_set_dna_hsp_dropoff(HSP_Param *hsp_param, |
145 | 200 | gint dna_hsp_dropoff){ |
146 | 201 | if(hsp_param->match->type == Match_Type_DNA2DNA) |
180 | 235 | |
181 | 236 | HSP_Param *HSP_Param_create(Match *match, gboolean use_horizon){ |
182 | 237 | register HSP_Param *hsp_param = g_new(HSP_Param, 1); |
183 | register WordHood_Alphabet *wha = NULL; | |
184 | register Submat *submat; | |
185 | hsp_param->ref_count = 1; | |
238 | hsp_param->thread_ref = ThreadRef_create(); | |
186 | 239 | hsp_param->has = HSPset_ArgumentSet_create(NULL); |
187 | 240 | hsp_param->match = match; |
188 | 241 | hsp_param->seed_repeat = hsp_param->has->seed_repeat; |
191 | 244 | hsp_param->dropoff = hsp_param->has->dna_hsp_dropoff; |
192 | 245 | hsp_param->threshold = hsp_param->has->dna_hsp_threshold; |
193 | 246 | HSP_Param_set_wordlen(hsp_param, hsp_param->has->dna_wordlen); |
194 | hsp_param->wordlimit = hsp_param->has->dna_wordlimit; | |
247 | hsp_param->wordlimit = hsp_param->has->dna_word_limit; | |
195 | 248 | break; |
196 | 249 | case Match_Type_PROTEIN2PROTEIN: /*fallthrough*/ |
197 | 250 | case Match_Type_PROTEIN2DNA: /*fallthrough*/ |
200 | 253 | hsp_param->threshold |
201 | 254 | = hsp_param->has->protein_hsp_threshold; |
202 | 255 | HSP_Param_set_wordlen(hsp_param, hsp_param->has->protein_wordlen); |
203 | hsp_param->wordlimit = hsp_param->has->protein_wordlimit; | |
256 | hsp_param->wordlimit = hsp_param->has->protein_word_limit; | |
204 | 257 | break; |
205 | 258 | case Match_Type_CODON2CODON: |
206 | 259 | hsp_param->dropoff = hsp_param->has->codon_hsp_dropoff; |
207 | 260 | hsp_param->threshold = hsp_param->has->codon_hsp_threshold; |
208 | 261 | HSP_Param_set_wordlen(hsp_param, hsp_param->has->codon_wordlen); |
209 | hsp_param->wordlimit = hsp_param->has->codon_wordlimit; | |
262 | hsp_param->wordlimit = hsp_param->has->codon_word_limit; | |
210 | 263 | g_assert(!(hsp_param->wordlen % 3)); |
211 | 264 | break; |
212 | 265 | default: |
214 | 267 | break; |
215 | 268 | } |
216 | 269 | hsp_param->use_horizon = use_horizon; |
217 | if(hsp_param->has->use_wordhood_dropoff && (!hsp_param->wordlimit)){ | |
218 | hsp_param->wordhood = NULL; | |
219 | } else { | |
220 | submat = (match->type == Match_Type_DNA2DNA) | |
221 | ? match->mas->dna_submat | |
222 | : match->mas->protein_submat; | |
223 | wha = WordHood_Alphabet_create_from_Submat( | |
224 | (gchar*)match->comparison_alphabet->member, | |
225 | (gchar*)match->comparison_alphabet->member, submat, FALSE); | |
226 | g_assert(wha); | |
227 | hsp_param->wordhood = WordHood_create(wha, hsp_param->wordlimit, | |
228 | hsp_param->has->use_wordhood_dropoff); | |
229 | WordHood_Alphabet_destroy(wha); | |
230 | } | |
270 | #ifdef USE_PTHREADS | |
271 | pthread_mutex_init(&hsp_param->hsp_recycle_lock, NULL); | |
272 | #endif /* USE_PTHREADS */ | |
273 | hsp_param->hsp_recycle = RecycleBin_create("HSP", sizeof(HSP), 64); | |
274 | hsp_param->wordhood = NULL; | |
275 | HSP_Param_refresh_wordhood(hsp_param); | |
231 | 276 | return hsp_param; |
232 | 277 | } |
233 | 278 | |
234 | 279 | void HSP_Param_destroy(HSP_Param *hsp_param){ |
235 | 280 | g_assert(hsp_param); |
236 | if(--hsp_param->ref_count) | |
281 | if(ThreadRef_destroy(hsp_param->thread_ref)) | |
237 | 282 | return; |
238 | 283 | if(hsp_param->wordhood) |
239 | 284 | WordHood_destroy(hsp_param->wordhood); |
285 | #ifdef USE_PTHREADS | |
286 | pthread_mutex_lock(&hsp_param->hsp_recycle_lock); | |
287 | #endif /* USE_PTHREADS */ | |
288 | RecycleBin_destroy(hsp_param->hsp_recycle); | |
289 | #ifdef USE_PTHREADS | |
290 | pthread_mutex_unlock(&hsp_param->hsp_recycle_lock); | |
291 | pthread_mutex_destroy(&hsp_param->hsp_recycle_lock); | |
292 | #endif /* USE_PTHREADS */ | |
240 | 293 | g_free(hsp_param); |
241 | 294 | return; |
242 | 295 | } |
243 | 296 | |
244 | 297 | HSP_Param *HSP_Param_share(HSP_Param *hsp_param){ |
245 | 298 | g_assert(hsp_param); |
246 | hsp_param->ref_count++; | |
299 | ThreadRef_share(hsp_param->thread_ref); | |
247 | 300 | return hsp_param; |
248 | 301 | } |
249 | 302 | |
252 | 305 | return HSP_Param_create(Match_swap(hsp_param->match), |
253 | 306 | hsp_param->use_horizon); |
254 | 307 | } |
255 | ||
256 | static RecycleBin *global_hsp_recycle_bin = NULL; | |
257 | 308 | |
258 | 309 | HSPset *HSPset_create(Sequence *query, Sequence *target, |
259 | 310 | HSP_Param *hsp_param){ |
265 | 316 | hsp_set->target = Sequence_share(target); |
266 | 317 | hsp_set->param = HSP_Param_share(hsp_param); |
267 | 318 | /**/ |
268 | if(global_hsp_recycle_bin){ | |
269 | hsp_set->hsp_recycle = RecycleBin_share(global_hsp_recycle_bin); | |
270 | } else { | |
271 | global_hsp_recycle_bin = RecycleBin_create("HSP", sizeof(HSP), 64); | |
272 | hsp_set->hsp_recycle = global_hsp_recycle_bin; | |
273 | } | |
274 | 319 | if(hsp_param->use_horizon){ |
275 | 320 | hsp_set->horizon = (gint****)Matrix4d_create( |
276 | 1 + ((hsp_param->seed_repeat > 1)?1:0), | |
321 | 1 + ((hsp_param->seed_repeat > 1)?2:0), | |
277 | 322 | query->len, |
278 | 323 | hsp_param->match->query->advance, |
279 | 324 | hsp_param->match->target->advance, |
294 | 339 | hsp_set->is_empty = TRUE; |
295 | 340 | return hsp_set; |
296 | 341 | } |
342 | /* horizon[score(,repeat_count,diag)] | |
343 | * [query_len] | |
344 | * [query_advance] | |
345 | * [target_advance] | |
346 | */ | |
297 | 347 | |
298 | 348 | /**/ |
299 | 349 | |
321 | 371 | HSP_destroy(hsp); |
322 | 372 | } |
323 | 373 | g_ptr_array_free(hsp_set->hsp_list, TRUE); |
324 | if(hsp_set->hsp_recycle->ref_count == 1) /* last active hsp_set */ | |
325 | global_hsp_recycle_bin = NULL; | |
326 | RecycleBin_destroy(hsp_set->hsp_recycle); | |
327 | 374 | if(hsp_set->horizon) |
328 | 375 | g_free(hsp_set->horizon); |
329 | 376 | g_free(hsp_set); |
519 | 566 | } |
520 | 567 | HSP_Display_print_ruler(hd, hd->top->len-pos, pos, TRUE); |
521 | 568 | g_print(" query:[%.*s]\n [%.*s]\ntarget:[%.*s]\n", |
522 | hd->top->len-pos, hd->top->str+pos, | |
523 | hd->mid->len-pos, hd->mid->str+pos, | |
524 | hd->low->len-pos, hd->low->str+pos); | |
569 | (gint)(hd->top->len-pos), hd->top->str+pos, | |
570 | (gint)(hd->mid->len-pos), hd->mid->str+pos, | |
571 | (gint)(hd->low->len-pos), hd->low->str+pos); | |
525 | 572 | HSP_Display_print_ruler(hd, hd->top->len-pos, pos, FALSE); |
526 | 573 | g_print("\n"); |
527 | 574 | return; |
765 | 812 | return; |
766 | 813 | } |
767 | 814 | /* The score cannot be allowed to drop below zero in the HSP, |
768 | * as this can result in overlapping HSPs in some circurmstances. | |
815 | * as this can result in overlapping HSPs in some circumstances. | |
769 | 816 | */ |
770 | 817 | |
771 | 818 | static HSP *HSP_create(HSP *nh){ |
772 | register HSP *hsp = RecycleBin_alloc(nh->hsp_set->hsp_recycle); | |
819 | register HSP *hsp; | |
820 | #ifdef USE_PTHREADS | |
821 | pthread_mutex_lock(&nh->hsp_set->param->hsp_recycle_lock); | |
822 | #endif /* USE_PTHREADS */ | |
823 | hsp = RecycleBin_alloc(nh->hsp_set->param->hsp_recycle); | |
824 | #ifdef USE_PTHREADS | |
825 | pthread_mutex_unlock(&nh->hsp_set->param->hsp_recycle_lock); | |
826 | #endif /* USE_PTHREADS */ | |
773 | 827 | hsp->hsp_set = nh->hsp_set; |
774 | 828 | hsp->query_start = nh->query_start; |
775 | 829 | hsp->target_start = nh->target_start; |
781 | 835 | |
782 | 836 | void HSP_destroy(HSP *hsp){ |
783 | 837 | register HSPset *hsp_set = hsp->hsp_set; |
784 | RecycleBin_recycle(hsp_set->hsp_recycle, hsp); | |
838 | #ifdef USE_PTHREADS | |
839 | pthread_mutex_lock(&hsp_set->param->hsp_recycle_lock); | |
840 | #endif /* USE_PTHREADS */ | |
841 | RecycleBin_recycle(hsp_set->param->hsp_recycle, hsp); | |
842 | #ifdef USE_PTHREADS | |
843 | pthread_mutex_unlock(&hsp_set->param->hsp_recycle_lock); | |
844 | #endif /* USE_PTHREADS */ | |
785 | 845 | return; |
786 | 846 | } |
787 | 847 | |
884 | 944 | /**/ |
885 | 945 | g_assert(section_pos >= 0); |
886 | 946 | g_assert(section_pos < hsp_set->query->len); |
947 | /* Clear if diag has changed */ | |
948 | if(hsp_set->param->seed_repeat > 1){ | |
949 | if(hsp_set->horizon[2][section_pos][query_frame][target_frame] | |
950 | != (diag_pos + hsp_set->query->len)){ | |
951 | hsp_set->horizon[0][section_pos][query_frame][target_frame] = 0; | |
952 | hsp_set->horizon[1][section_pos][query_frame][target_frame] = 0; | |
953 | hsp_set->horizon[2][section_pos][query_frame][target_frame] | |
954 | = diag_pos + hsp_set->query->len; | |
955 | } | |
956 | } | |
887 | 957 | /* Check whether we have seen this HSP already */ |
888 | 958 | if(target_start < hsp_set->horizon[0] |
889 | 959 | [section_pos] |
962 | 1032 | horizon[0][query_frame][target_frame] = 0; |
963 | 1033 | horizon[2][query_frame][target_frame] = 0; |
964 | 1034 | } |
1035 | /* FIXME: seedrepeat overflow here */ | |
965 | 1036 | if(++horizon[2][query_frame][target_frame] < hsp_set->param->seed_repeat) |
966 | 1037 | return; |
967 | 1038 | horizon[2][query_frame][target_frame] = 0; |
2 | 2 | * Library for HSP sets (high-scoring segment pairs) * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
31 | 31 | #include "matrix.h" |
32 | 32 | #include "wordhood.h" |
33 | 33 | #include "recyclebin.h" |
34 | #include "threadref.h" | |
34 | 35 | |
35 | 36 | typedef struct { |
36 | 37 | gint filter_threshold; |
49 | 50 | gint protein_hsp_threshold; |
50 | 51 | gint codon_hsp_threshold; |
51 | 52 | /**/ |
52 | gint dna_wordlimit; | |
53 | gint protein_wordlimit; | |
54 | gint codon_wordlimit; | |
53 | gint dna_word_limit; | |
54 | gint protein_word_limit; | |
55 | gint codon_word_limit; | |
55 | 56 | /**/ |
56 | 57 | gint geneseed_threshold; |
57 | 58 | gint geneseed_repeat; |
136 | 137 | #define HSPset_is_empty(hspset) ((hspset)->is_empty) |
137 | 138 | |
138 | 139 | typedef struct HSP_Param { |
139 | gint ref_count; | |
140 | ThreadRef *thread_ref; | |
140 | 141 | HSPset_ArgumentSet *has; |
141 | 142 | Match *match; |
142 | 143 | gint wordlen; |
147 | 148 | WordHood *wordhood; |
148 | 149 | gboolean use_horizon; |
149 | 150 | gint seed_repeat; |
151 | RecycleBin *hsp_recycle; | |
152 | #ifdef USE_PTHREADS | |
153 | pthread_mutex_t hsp_recycle_lock; | |
154 | #endif /* USE_PTHREADS */ | |
150 | 155 | } HSP_Param; |
151 | 156 | |
152 | 157 | HSP_Param *HSP_Param_create(Match *match, gboolean use_horizon); |
159 | 164 | void HSP_Param_set_dna_hsp_threshold(HSP_Param *hsp_param, |
160 | 165 | gint dna_hsp_threshold); |
161 | 166 | void HSP_Param_set_protein_hsp_threshold(HSP_Param *hsp_param, |
162 | gint dna_hsp_threshold); | |
167 | gint protein_hsp_threshold); | |
163 | 168 | void HSP_Param_set_codon_hsp_threshold(HSP_Param *hsp_param, |
164 | gint dna_hsp_threshold); | |
169 | gint protein_hsp_threshold); | |
170 | /**/ | |
171 | void HSP_Param_set_dna_word_limit(HSP_Param *hsp_param, | |
172 | gint dna_word_limit); | |
173 | void HSP_Param_set_protein_word_limit(HSP_Param *hsp_param, | |
174 | gint protein_word_limit); | |
175 | void HSP_Param_set_codon_word_limit(HSP_Param *hsp_param, | |
176 | gint codon_word_limit); | |
165 | 177 | /**/ |
166 | 178 | void HSP_Param_set_dna_hsp_dropoff(HSP_Param *hsp_param, |
167 | 179 | gint dna_hsp_dropoff); |
180 | 192 | Sequence *query; |
181 | 193 | Sequence *target; |
182 | 194 | HSP_Param *param; |
183 | RecycleBin *hsp_recycle; | |
184 | 195 | gint ****horizon; |
185 | 196 | GPtrArray *hsp_list; |
186 | 197 | /**/ |
2 | 2 | * Library for HSP sets (high-scoring segment pairs) * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Match : A module for pairwise symbol comparison * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
36 | 36 | Match_ArgumentSet *Match_ArgumentSet_create(Argument *arg){ |
37 | 37 | register ArgumentSet *as; |
38 | 38 | static Match_ArgumentSet mas = {0}; |
39 | if(!mas.translate){ | |
40 | mas.translate = Translate_create(FALSE); | |
41 | /* FIXME this should be freed somewhere */ | |
42 | } | |
43 | 39 | if(arg){ |
44 | 40 | as = ArgumentSet_create("Symbol Comparison Options"); |
45 | 41 | ArgumentSet_add_option(as, 0, "softmaskquery", NULL, |
59 | 55 | Argument_absorb_ArgumentSet(arg, as); |
60 | 56 | Argument_add_cleanup(arg, Match_Argument_cleanup, NULL); |
61 | 57 | /**/ |
58 | } else { | |
59 | if(!mas.translate){ | |
60 | mas.translate = Translate_create(FALSE); | |
61 | /* FIXME this should be freed somewhere */ | |
62 | } | |
62 | 63 | } |
63 | 64 | return &mas; |
64 | 65 | } |
2 | 2 | * Match : A module for pairwise symbol comparison * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Match : A module for pairwise symbol comparison * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for PCR simulation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for PCR simulation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for PCR simulation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Seeder : A module for seeding pairwise alignments * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
24 | 24 | (*(type*)((char*)(instance) + (offset))) |
25 | 25 | #endif /* OFFSET_ITEM */ |
26 | 26 | |
27 | #ifndef Swap | |
28 | #define Swap(x,y,temp) ((temp)=(x),(x)=(y),(y)=(temp)) | |
29 | #endif /* Swap */ | |
30 | ||
27 | 31 | Seeder_ArgumentSet *Seeder_ArgumentSet_create(Argument *arg){ |
28 | 32 | register ArgumentSet *as; |
29 | 33 | static Seeder_ArgumentSet sas; |
30 | 34 | if(arg){ |
31 | 35 | as = ArgumentSet_create("Alignment Seeding Options"); |
32 | 36 | ArgumentSet_add_option(as, 'M', "fsmmemory", "Mb", |
33 | "Memory limit for FSM scanning", "64", | |
37 | "Memory limit for FSM scanning", "256", | |
34 | 38 | Argument_parse_int, &sas.fsm_memory_limit); |
35 | 39 | ArgumentSet_add_option(as, '\0', "forcefsm", "fsm type", |
36 | 40 | "Force FSM type ( normal | compact )", "none", |
38 | 42 | ArgumentSet_add_option(as, 0, "wordjump", NULL, |
39 | 43 | "Jump between query words", "1", |
40 | 44 | Argument_parse_int, &sas.word_jump); |
45 | ArgumentSet_add_option(as, 0, "wordambiguity", NULL, | |
46 | "Number of ambiguous words to expand", "1", | |
47 | Argument_parse_int, &sas.word_ambiguity); | |
41 | 48 | Argument_absorb_ArgumentSet(arg, as); |
42 | 49 | } |
43 | 50 | return &sas; |
301 | 308 | gpointer user_data){ |
302 | 309 | register Seeder *seeder = g_new0(Seeder, 1); |
303 | 310 | seeder->sas = Seeder_ArgumentSet_create(NULL); |
311 | if(seeder->sas->word_ambiguity < 1) | |
312 | g_error("Word ambiguity cannot be less than one."); | |
313 | if(seeder->sas->word_ambiguity > 1){ | |
314 | if(comparison_param->protein_hsp_param) | |
315 | g_error("Protein ambuiguity symbols not implemented"); | |
316 | g_warning("setting --wordambiguity in exonerate will be SLOW."); | |
317 | g_warning("... use esd2esi --wordambiguity and exonerate-server instead"); | |
318 | } | |
304 | 319 | seeder->is_prepared = FALSE; |
305 | 320 | seeder->verbosity = verbosity; |
306 | 321 | seeder->report_func = report_func; |
412 | 427 | } |
413 | 428 | |
414 | 429 | void Seeder_memory_info(Seeder *seeder){ |
415 | g_message("Seeder Total = %dMb", Seeder_memory_usage(seeder)>>20); | |
430 | g_message("Seeder Total = %dMb", (gint)(Seeder_memory_usage(seeder)>>20)); | |
416 | 431 | g_assert(seeder); |
417 | 432 | if(seeder->seeder_fsm) |
418 | 433 | g_message(" -> FSM memory = %dMb", |
419 | Seeder_FSM_memory_usage(seeder->seeder_fsm)>>20); | |
434 | (gint)(Seeder_FSM_memory_usage(seeder->seeder_fsm)>>20)); | |
420 | 435 | else |
421 | 436 | g_message(" -> VFSM memory = %dMb", |
422 | Seeder_VFSM_memory_usage(seeder->seeder_vfsm)>>20); | |
437 | (gint)(Seeder_VFSM_memory_usage(seeder->seeder_vfsm)>>20)); | |
423 | 438 | g_message(" -> QueryInfo memory = %dMb", |
424 | (seeder->query_info_list->len | |
439 | (gint)(seeder->query_info_list->len | |
425 | 440 | *(sizeof(gpointer)+sizeof(Seeder_QueryInfo)))>>20); |
426 | 441 | g_message(" -> Recycle_Wordinfo Memory = %dMb", |
427 | RecycleBin_memory_usage(seeder->recycle_wordinfo)>>20); | |
442 | (gint)(RecycleBin_memory_usage(seeder->recycle_wordinfo)>>20)); | |
428 | 443 | g_message(" -> Recycle_Seed Memory = %dMb", |
429 | RecycleBin_memory_usage(seeder->recycle_seed)>>20); | |
444 | (gint)(RecycleBin_memory_usage(seeder->recycle_seed)>>20)); | |
430 | 445 | g_message(" -> Recycle_Neighbour Memory = %dMb", |
431 | RecycleBin_memory_usage(seeder->recycle_neighbour)>>20); | |
446 | (gint)(RecycleBin_memory_usage(seeder->recycle_neighbour)>>20)); | |
432 | 447 | g_message(" -> Recycle_Context Memory = %dMb", |
433 | RecycleBin_memory_usage(seeder->recycle_context)>>20); | |
448 | (gint)(RecycleBin_memory_usage(seeder->recycle_context)>>20)); | |
434 | 449 | return; |
435 | 450 | } |
436 | 451 | |
514 | 529 | } else { |
515 | 530 | leaf = VFSM_state2leaf(vfsm, state); |
516 | 531 | word_info = seeder->seeder_vfsm->leaf[leaf]; |
517 | if(!word_info) | |
532 | if(!word_info){ | |
518 | 533 | word_info = Seeder_WordInfo_create(seeder); |
534 | seeder->seeder_vfsm->leaf[leaf] = word_info; | |
535 | } | |
519 | 536 | } |
520 | 537 | g_assert(word_info); |
521 | 538 | if(frame) |
674 | 691 | return; |
675 | 692 | } |
676 | 693 | |
677 | static void Seeder_VFSM_traverse(Seeder *seeder, gchar *seq, | |
678 | Seeder_TargetInfo *target_info){ | |
694 | static void Seeder_VFSM_traverse_single(Seeder *seeder, gchar *seq, | |
695 | Seeder_TargetInfo *target_info){ | |
679 | 696 | register gint i, ch; |
680 | 697 | register VFSM_Int state = 0, leaf; |
681 | 698 | register VFSM *vfsm = seeder->seeder_vfsm->vfsm; |
699 | 716 | return; |
700 | 717 | } |
701 | 718 | |
719 | static void Seeder_VFSM_traverse_ambig(Seeder *seeder, gchar *seq, | |
720 | Seeder_TargetInfo *target_info){ | |
721 | register gint i, j, k, ch; | |
722 | register VFSM_Int state, next_state, leaf; | |
723 | register VFSM *vfsm = seeder->seeder_vfsm->vfsm; | |
724 | register Seeder_WordInfo *word_info; | |
725 | register gchar *ambig; | |
726 | register VFSM_Int *temp_state_list, | |
727 | *curr_state_list = g_new0(VFSM_Int, | |
728 | seeder->sas->word_ambiguity), | |
729 | *next_state_list = g_new0(VFSM_Int, | |
730 | seeder->sas->word_ambiguity); | |
731 | register gint curr_state_list_len = 1, next_state_list_len = 0; | |
732 | g_assert(vfsm); | |
733 | for(i = 0; seq[i]; i++){ | |
734 | ch = toupper(seq[i]); /* FIXME: filter properly */ | |
735 | if((!(ambig = Alphabet_nt2ambig(ch))) | |
736 | || ((strlen(ambig) * curr_state_list_len) | |
737 | > seeder->sas->word_ambiguity)){ | |
738 | next_state_list_len = 0; | |
739 | curr_state_list_len = 1; | |
740 | curr_state_list[0] = 0; | |
741 | continue; | |
742 | } | |
743 | for(j = 0; j < curr_state_list_len; j++){ | |
744 | state = curr_state_list[j]; | |
745 | for(k = 0; ambig[k]; k++){ | |
746 | g_assert(vfsm->index[(guchar)ambig[k]]); | |
747 | next_state = VFSM_change_state_M(vfsm, | |
748 | state, (guchar)ambig[k]); | |
749 | /* FIXME: use POW2 versions where applicable */ | |
750 | if(next_state_list_len | |
751 | && ((next_state == next_state_list[0]) | |
752 | || (next_state == next_state_list[next_state_list_len-1]))) | |
753 | break; | |
754 | next_state_list[next_state_list_len++] = next_state; | |
755 | if(VFSM_state_is_leaf(vfsm, next_state)){ | |
756 | leaf = VFSM_state2leaf(vfsm, next_state); | |
757 | word_info = seeder->seeder_vfsm->leaf[leaf]; | |
758 | if(word_info) | |
759 | Seeder_FSM_traverse_func(i, word_info, target_info); | |
760 | } | |
761 | } | |
762 | } | |
763 | curr_state_list_len = next_state_list_len; | |
764 | next_state_list_len = 0; | |
765 | Swap(next_state_list, curr_state_list, temp_state_list); | |
766 | } | |
767 | g_free(curr_state_list); | |
768 | g_free(next_state_list); | |
769 | return; | |
770 | } | |
771 | ||
772 | static void Seeder_VFSM_traverse(Seeder *seeder, gchar *seq, | |
773 | Seeder_TargetInfo *target_info){ | |
774 | if(seeder->sas->word_ambiguity > 1) | |
775 | Seeder_VFSM_traverse_ambig(seeder, seq, target_info); | |
776 | else | |
777 | Seeder_VFSM_traverse_single(seeder, seq, target_info); | |
778 | return; | |
779 | } | |
780 | ||
702 | 781 | static void Seeder_prepare(Seeder *seeder){ |
703 | 782 | g_assert(!seeder->is_prepared); |
704 | 783 | if(seeder->seeder_fsm) |
705 | 784 | FSM_compile(seeder->seeder_fsm->fsm); |
706 | 785 | seeder->is_prepared = TRUE; |
786 | return; | |
787 | } | |
788 | ||
789 | static void Seeder_FSM_traverse_ambig(Seeder *seeder, gchar *seq, | |
790 | FSM_Traverse_Func ftf, gpointer user_data){ | |
791 | register FSM *f = seeder->seeder_fsm->fsm; | |
792 | register FSM_Node *n, *next_state; | |
793 | register gint c; | |
794 | register gchar *ambig; | |
795 | register gint i, j, k; | |
796 | register FSM_Node **temp_state_list, | |
797 | **curr_state_list = g_new0(FSM_Node*, | |
798 | seeder->sas->word_ambiguity), | |
799 | **next_state_list = g_new0(FSM_Node*, | |
800 | seeder->sas->word_ambiguity); | |
801 | register gint curr_state_list_len = 1, next_state_list_len = 0; | |
802 | g_assert(f->is_compiled); | |
803 | curr_state_list[0] = f->root; | |
804 | for(i = 0; seq[i]; i++){ | |
805 | if((!(ambig = Alphabet_nt2ambig(seq[i]))) | |
806 | || ((strlen(ambig) * curr_state_list_len) | |
807 | > seeder->sas->word_ambiguity)){ | |
808 | next_state_list_len = 0; | |
809 | curr_state_list_len = 1; | |
810 | curr_state_list[0] = f->root; | |
811 | continue; | |
812 | } | |
813 | for(j = 0; j < curr_state_list_len; j++){ | |
814 | n = curr_state_list[j]; | |
815 | for(k = 0; ambig[k]; k++){ | |
816 | c = f->traversal_filter[(guchar)ambig[k]]; | |
817 | if(n[c].data) | |
818 | ftf(i, n[c].data, user_data); | |
819 | next_state = n[c].next; | |
820 | if(next_state_list_len | |
821 | && ((next_state == next_state_list[0]) | |
822 | || (next_state == | |
823 | next_state_list[next_state_list_len-1]))){ | |
824 | break; | |
825 | } | |
826 | next_state_list[next_state_list_len++] = next_state; | |
827 | } | |
828 | } | |
829 | curr_state_list_len = next_state_list_len; | |
830 | next_state_list_len = 0; | |
831 | /* g_message("set curr [%d]", curr_state_list_len); */ | |
832 | Swap(next_state_list, curr_state_list, temp_state_list); | |
833 | } | |
834 | g_free(curr_state_list); | |
835 | g_free(next_state_list); | |
836 | return; | |
837 | } | |
838 | /* Slow (ambiguous) version of FSM_traverse */ | |
839 | /* FIXME: optimisation: remove strlen() etc */ | |
840 | ||
841 | static void Seeder_FSM_traverse(Seeder *seeder, gchar *seq, FSM_Traverse_Func ftf, | |
842 | gpointer user_data){ | |
843 | if(seeder->sas->word_ambiguity > 1) | |
844 | Seeder_FSM_traverse_ambig(seeder, seq, ftf, user_data); | |
845 | else | |
846 | FSM_traverse(seeder->seeder_fsm->fsm, seq, ftf, user_data); | |
707 | 847 | return; |
708 | 848 | } |
709 | 849 | |
734 | 874 | seq = Sequence_get_str(target_masked); |
735 | 875 | Sequence_destroy(target_masked); |
736 | 876 | if(seeder->seeder_fsm) |
737 | FSM_traverse(seeder->seeder_fsm->fsm, seq, | |
738 | Seeder_FSM_traverse_func, &target_info); | |
877 | Seeder_FSM_traverse(seeder, seq, | |
878 | Seeder_FSM_traverse_func, &target_info); | |
739 | 879 | else |
740 | 880 | Seeder_VFSM_traverse(seeder, seq, &target_info); |
741 | 881 | g_free(seq); |
746 | 886 | seq = Sequence_get_str(target_masked); |
747 | 887 | Sequence_destroy(target_masked); |
748 | 888 | if(seeder->seeder_fsm){ |
749 | FSM_traverse(seeder->seeder_fsm->fsm, seq, | |
750 | Seeder_FSM_traverse_func, &target_info); | |
889 | Seeder_FSM_traverse(seeder, seq, | |
890 | Seeder_FSM_traverse_func, &target_info); | |
751 | 891 | } else { |
752 | 892 | Seeder_VFSM_traverse(seeder, seq, &target_info); |
753 | 893 | } |
2 | 2 | * Seeder : A module for seeding pairwise alignments * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
31 | 31 | gsize fsm_memory_limit; |
32 | 32 | gchar *force_fsm; |
33 | 33 | gint word_jump; |
34 | gint word_ambiguity; | |
34 | 35 | } Seeder_ArgumentSet; |
35 | 36 | |
36 | 37 | Seeder_ArgumentSet *Seeder_ArgumentSet_create(Argument *arg); |
2 | 2 | * Seeder : A module for seeding pairwise alignments * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for word-neighbourhood generation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for word-neighbourhood generation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for word-neighbourhood generation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
0 | 0 | |
1 | 1 | TESTS = fastadb.test fastapipe.test dataset.test index.test |
2 | # seqfmi.test | |
2 | 3 | noinst_PROGRAMS = $(TESTS) |
3 | 4 | |
4 | 5 | INCLUDES = -I$(top_srcdir)/src/sequence \ |
5 | 6 | -I$(top_srcdir)/src/struct \ |
6 | 7 | -I$(top_srcdir)/src/general \ |
7 | -I$(top_srcdir)/src/comparison | |
8 | -I$(top_srcdir)/src/comparison \ | |
9 | -DCUSTOM_GUINT64_FORMAT="\"@custom_guint64_format@\"" | |
8 | 10 | |
9 | 11 | noinst_HEADERS = fastadb.h fastapipe.h dataset.h index.h |
12 | # seqfmi.h | |
10 | 13 | |
11 | 14 | SEQUENCE_OBJ = $(top_srcdir)/src/struct/sparsecache.o \ |
12 | 15 | $(top_srcdir)/src/struct/matrix.o \ |
35 | 38 | index_test_SOURCES = index.test.c index.c |
36 | 39 | index_test_LDADD = fastadb.o dataset.o \ |
37 | 40 | $(top_srcdir)/src/general/compoundfile.o \ |
41 | $(top_srcdir)/src/general/threadref.o \ | |
38 | 42 | $(top_srcdir)/src/struct/bitarray.o \ |
39 | 43 | $(top_srcdir)/src/struct/vfsm.o \ |
40 | 44 | $(top_srcdir)/src/struct/pqueue.o \ |
49 | 53 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
50 | 54 | $(SEQUENCE_OBJ) |
51 | 55 | |
56 | # seqfmi_test_SOURCES = seqfmi.test.c seqfmi.c | |
57 | # seqfmi_test_LDADD = fastadb.o \ | |
58 | # $(top_srcdir)/src/general/compoundfile.o \ | |
59 | # $(top_srcdir)/src/struct/fmindex.o \ | |
60 | # $(top_srcdir)/src/struct/bitarray.o \ | |
61 | # $(top_srcdir)/src/struct/pqueue.o \ | |
62 | # $(top_srcdir)/src/struct/recyclebin.o \ | |
63 | # $(top_srcdir)/src/struct/huffman.o \ | |
64 | # $(SEQUENCE_OBJ) | |
65 | ||
52 | 66 | # Files to clear away |
53 | 67 | |
54 | 68 | MAINTAINERCLEANFILES = Makefile.in |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
78 | 79 | use_pthreads = @use_pthreads@ |
79 | 80 | |
80 | 81 | TESTS = fastadb.test fastapipe.test dataset.test index.test |
82 | # seqfmi.test | |
81 | 83 | noinst_PROGRAMS = $(TESTS) |
82 | 84 | |
83 | INCLUDES = -I$(top_srcdir)/src/sequence -I$(top_srcdir)/src/struct -I$(top_srcdir)/src/general -I$(top_srcdir)/src/comparison | |
85 | INCLUDES = -I$(top_srcdir)/src/sequence -I$(top_srcdir)/src/struct -I$(top_srcdir)/src/general -I$(top_srcdir)/src/comparison -DCUSTOM_GUINT64_FORMAT="\"@custom_guint64_format@\"" | |
84 | 86 | |
85 | 87 | |
86 | 88 | noinst_HEADERS = fastadb.h fastapipe.h dataset.h index.h |
89 | # seqfmi.h | |
87 | 90 | |
88 | 91 | SEQUENCE_OBJ = $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o -lm |
89 | 92 | |
100 | 103 | |
101 | 104 | |
102 | 105 | index_test_SOURCES = index.test.c index.c |
103 | index_test_LDADD = fastadb.o dataset.o $(top_srcdir)/src/general/compoundfile.o $(top_srcdir)/src/struct/bitarray.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/struct/splaytree.o $(top_srcdir)/src/struct/noitree.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(SEQUENCE_OBJ) | |
104 | ||
106 | index_test_LDADD = fastadb.o dataset.o $(top_srcdir)/src/general/compoundfile.o $(top_srcdir)/src/general/threadref.o $(top_srcdir)/src/struct/bitarray.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/struct/splaytree.o $(top_srcdir)/src/struct/noitree.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(SEQUENCE_OBJ) | |
107 | ||
108 | ||
109 | # seqfmi_test_SOURCES = seqfmi.test.c seqfmi.c | |
110 | # seqfmi_test_LDADD = fastadb.o \ | |
111 | # $(top_srcdir)/src/general/compoundfile.o \ | |
112 | # $(top_srcdir)/src/struct/fmindex.o \ | |
113 | # $(top_srcdir)/src/struct/bitarray.o \ | |
114 | # $(top_srcdir)/src/struct/pqueue.o \ | |
115 | # $(top_srcdir)/src/struct/recyclebin.o \ | |
116 | # $(top_srcdir)/src/struct/huffman.o \ | |
117 | # $(SEQUENCE_OBJ) | |
105 | 118 | |
106 | 119 | # Files to clear away |
107 | 120 | |
151 | 164 | index_test_OBJECTS = index.test.o index.o |
152 | 165 | index_test_DEPENDENCIES = fastadb.o dataset.o \ |
153 | 166 | $(top_srcdir)/src/general/compoundfile.o \ |
167 | $(top_srcdir)/src/general/threadref.o \ | |
154 | 168 | $(top_srcdir)/src/struct/bitarray.o $(top_srcdir)/src/struct/vfsm.o \ |
155 | 169 | $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o \ |
156 | 170 | $(top_srcdir)/src/struct/rangetree.o \ |
2 | 2 | * Library for manipulation of exonerate dataset files * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
22 | 22 | /**/ |
23 | 23 | |
24 | 24 | #define DATASET_HEADER_MAGIC (('e' << 16)|('s' << 8)|('d')) |
25 | #define DATASET_HEADER_VERSION 2 | |
25 | #define DATASET_HEADER_VERSION 3 | |
26 | 26 | |
27 | 27 | static Dataset_Header *Dataset_Header_create(Alphabet_Type alphabet_type, |
28 | 28 | gboolean softmask_input){ |
300 | 300 | + dataset_sequence_memory; |
301 | 301 | } |
302 | 302 | |
303 | void Dataset_info(Dataset *dataset){ | |
304 | g_print("Sequence Dataset:\n" | |
305 | "----------------\n" | |
306 | " version: %d\n" | |
307 | " type: %s, %s\n" | |
308 | " total size: %d Mb\n" | |
309 | " number of sequences: %lld\n" | |
310 | " longest sequence: %lld\n\n", | |
311 | (gint)dataset->header->version, | |
312 | (dataset->header->type & 1)?"DNA":"PROTEIN", | |
313 | (dataset->header->type & 2)?"masked":"unmasked", | |
314 | (gint)(dataset->header->total_db_len >> 20), | |
315 | dataset->header->number_of_seqs, | |
316 | dataset->header->max_seq_len); | |
317 | return; | |
318 | } | |
319 | ||
303 | 320 | void Dataset_destroy(Dataset *dataset){ |
304 | 321 | register gint i; |
305 | 322 | register Dataset_Sequence *seq; |
377 | 394 | } |
378 | 395 | |
379 | 396 | static void Dataset_read_seq_data(Dataset *dataset, FILE *fp){ |
380 | register gint i, j = 0, ipos, dpos; | |
397 | register gint64 i, j = 0, ipos, dpos; | |
381 | 398 | register Dataset_Sequence *ds; |
382 | register gint len = dataset->header->seq_info_offset | |
383 | - dataset->header->seq_data_offset; | |
399 | register guint64 len = dataset->header->seq_info_offset | |
400 | - dataset->header->seq_data_offset; | |
384 | 401 | register gchar *buf = g_new(gchar, len+1); |
385 | 402 | if(!fread(buf, sizeof(gchar), len, fp)) |
386 | 403 | g_error("Problem reading seq data"); |
2 | 2 | * Library for manipulation of exonerate dataset files * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
96 | 96 | gboolean softmask_input); |
97 | 97 | Dataset *Dataset_share(Dataset *dataset); |
98 | 98 | void Dataset_destroy(Dataset *dataset); |
99 | void Dataset_info(Dataset *dataset); | |
99 | 100 | gsize Dataset_memory_usage(Dataset *dataset); |
100 | 101 | gboolean Dataset_check_filetype(gchar *path); |
101 | 102 | /* Returns TRUE when magic number is correct for this filetype */ |
2 | 2 | * Library for manipulation of FASTA format databases * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for manipulation of FASTA format databases * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
201 | 201 | return fdb; |
202 | 202 | } |
203 | 203 | |
204 | FastaDB *FastaDB_dup(FastaDB *fdb){ | |
205 | register FastaDB *nfdb = g_new(FastaDB, 1); | |
206 | nfdb->ref_count = 1; | |
207 | nfdb->alphabet = Alphabet_create(fdb->alphabet->type, | |
208 | fdb->alphabet->is_soft_masked); | |
209 | nfdb->cf = CompoundFile_dup(fdb->cf); | |
210 | nfdb->out_buffer_alloc = FASTADB_OUT_BUFFER_CHUNK_SIZE; | |
211 | nfdb->out_buffer = g_malloc(sizeof(gchar)*nfdb->out_buffer_alloc); | |
212 | nfdb->line_length = -1; | |
213 | FastaDB_rewind(nfdb); | |
214 | return nfdb; | |
215 | } | |
216 | ||
204 | 217 | void FastaDB_close(FastaDB *fdb){ |
205 | 218 | g_assert(fdb); |
206 | 219 | if(--fdb->ref_count) |
236 | 249 | } |
237 | 250 | return CompoundFile_ftell(fdb->cf)-1; |
238 | 251 | } |
252 | ||
253 | gboolean FastaDB_file_is_fasta(gchar *path){ | |
254 | register FILE *fp = fopen(path, "r"); | |
255 | register gint ch; | |
256 | register gboolean result = FALSE; | |
257 | if(!fp) | |
258 | g_error("Could not open file [%s]", path); | |
259 | while(((ch = getc(fp)) != EOF)){ | |
260 | if(isspace(ch)) | |
261 | continue; | |
262 | else | |
263 | if(ch == '>'){ /* Assume is fasta format */ | |
264 | result = TRUE; | |
265 | break; | |
266 | } | |
267 | else | |
268 | break; | |
269 | } | |
270 | fclose(fp); | |
271 | return result; | |
272 | } | |
273 | /* Assumes a file is fasta format | |
274 | * if the first non-whitespace character is '>' | |
275 | */ | |
239 | 276 | |
240 | 277 | gboolean FastaDB_is_finished(FastaDB *fdb){ |
241 | 278 | g_assert(fdb); |
2 | 2 | * Library for manipulation of FASTA format databases * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
72 | 72 | Alphabet *alphabet, gint chunk_id, gint chunk_total); |
73 | 73 | FastaDB *FastaDB_open(gchar *path, Alphabet *alphabet); |
74 | 74 | FastaDB *FastaDB_share(FastaDB *fdb); |
75 | FastaDB *FastaDB_dup(FastaDB *fdb); /* For use in a separate thread */ | |
75 | 76 | void FastaDB_close(FastaDB *fdb); |
76 | 77 | void FastaDB_rewind(FastaDB *fdb); |
77 | 78 | gboolean FastaDB_is_finished(FastaDB *fdb); |
82 | 83 | FastaDB_Seq *FastaDB_next(FastaDB *fdb, FastaDB_Mask mask); |
83 | 84 | CompoundFile_Pos FastaDB_find_next_start(FastaDB *fdb, |
84 | 85 | CompoundFile_Pos pos); |
86 | ||
87 | gboolean FastaDB_file_is_fasta(gchar *path); | |
88 | /* Returns true if first non-whitespace character in file is '>' */ | |
85 | 89 | |
86 | 90 | typedef struct { |
87 | 91 | FastaDB *source; |
2 | 2 | * Library for manipulation of FASTA format databases * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for All-vs-All Fasta Database Comparisons * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
20 | 20 | FastaPipe_Boundary_Func term_func, |
21 | 21 | FastaPipe_NextSeq_Func query_func, |
22 | 22 | FastaPipe_NextSeq_Func target_func, |
23 | FastaDB_Mask mask, gboolean translate_both){ | |
23 | FastaDB_Mask mask, gboolean translate_both, | |
24 | gboolean use_revcomp){ | |
24 | 25 | register FastaPipe *fasta_pipe = g_new(FastaPipe, 1); |
25 | 26 | g_assert(init_func); |
26 | 27 | g_assert(prep_func); |
36 | 37 | fasta_pipe->target_func = target_func; |
37 | 38 | fasta_pipe->mask = mask; |
38 | 39 | fasta_pipe->is_full = FALSE; |
39 | fasta_pipe->revcomp_query | |
40 | = (query_fdb->alphabet->type == Alphabet_Type_DNA); | |
41 | fasta_pipe->revcomp_target | |
42 | = (((query_fdb->alphabet->type == Alphabet_Type_PROTEIN) | |
43 | && (target_fdb->alphabet->type == Alphabet_Type_DNA)) | |
44 | || translate_both); | |
40 | if(use_revcomp){ | |
41 | fasta_pipe->revcomp_query | |
42 | = (query_fdb->alphabet->type == Alphabet_Type_DNA); | |
43 | fasta_pipe->revcomp_target | |
44 | = (((query_fdb->alphabet->type == Alphabet_Type_PROTEIN) | |
45 | && (target_fdb->alphabet->type == Alphabet_Type_DNA)) | |
46 | || translate_both); | |
47 | } else { | |
48 | fasta_pipe->revcomp_query = FALSE; | |
49 | fasta_pipe->revcomp_target = FALSE; | |
50 | } | |
45 | 51 | fasta_pipe->prev_query = NULL; |
46 | 52 | fasta_pipe->prev_target = NULL; |
47 | 53 | return fasta_pipe; |
2 | 2 | * Library for All-vs-All Fasta Database Comparisons * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
49 | 49 | FastaPipe_Boundary_Func term_func, |
50 | 50 | FastaPipe_NextSeq_Func query_func, |
51 | 51 | FastaPipe_NextSeq_Func target_func, |
52 | FastaDB_Mask mask, gboolean translate_both); | |
52 | FastaDB_Mask mask, gboolean translate_both, | |
53 | gboolean use_revcomp); | |
53 | 54 | /* query_func can return TRUE to finish loading current pipeline |
54 | 55 | * target_func can return TRUE to finish processing of the pipeline |
55 | 56 | */ |
2 | 2 | * Library for All-vs-All Fasta Database Comparisons * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
67 | 67 | fasta_pipe = FastaPipe_create(query_fdb, target_fdb, |
68 | 68 | test_init_func, test_prep_func, test_term_func, |
69 | 69 | test_query_func, test_target_func, FastaDB_Mask_ALL, |
70 | FALSE); | |
70 | FALSE, TRUE); | |
71 | 71 | Alphabet_destroy(alphabet); |
72 | 72 | while(FastaPipe_process(fasta_pipe, &count)){ |
73 | 73 | g_message("Processing pipeline"); |
2 | 2 | * Library for manipulation of exonerate index files * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
25 | 25 | #include "noitree.h" |
26 | 26 | |
27 | 27 | #define INDEX_HEADER_MAGIC (('e' << 16)|('s' << 8)|('i')) |
28 | #define INDEX_HEADER_VERSION 2 | |
28 | #define INDEX_HEADER_VERSION 3 | |
29 | 29 | |
30 | 30 | static off_t Index_ftell(FILE *fp){ |
31 | 31 | return ftello(fp); |
37 | 37 | static off_t Index_fseek(FILE *fp, off_t offset, int whence){ |
38 | 38 | return fseeko(fp, offset, whence); |
39 | 39 | } |
40 | /* FIXME: need alternatives in absence of ftello() | |
40 | /* FIXME: need alternatives in absence of fseeko() | |
41 | 41 | * lseek(fileno(fp), offset, whence); ?? |
42 | 42 | */ |
43 | 43 | |
77 | 77 | |
78 | 78 | static Index_Header *Index_Header_create(gint dataset_path_len, |
79 | 79 | gboolean is_translated, |
80 | gint word_length, gint word_jump, | |
80 | gint word_length, | |
81 | gint word_jump, | |
82 | gint word_ambiguity, | |
81 | 83 | gint saturate_threshold){ |
82 | 84 | register Index_Header *index_header = g_new0(Index_Header, 1); |
83 | 85 | index_header->magic = INDEX_HEADER_MAGIC; |
87 | 89 | /**/ |
88 | 90 | index_header->word_length = word_length; |
89 | 91 | index_header->word_jump = word_jump; |
92 | index_header->word_ambiguity = word_ambiguity; | |
90 | 93 | index_header->saturate_threshold = saturate_threshold; |
91 | 94 | return index_header; |
92 | 95 | } |
99 | 102 | #if 0 |
100 | 103 | static void Index_Header_info(Index_Header *index_header){ |
101 | 104 | g_message("Index_Header:\n" |
102 | " magic [%d]\n" | |
103 | " version [%d]\n" | |
104 | " type [%d]\n" | |
105 | " dataset_path_len [%d]\n" | |
105 | " magic [%lld]\n" | |
106 | " version [%lld]\n" | |
107 | " type [%lld]\n" | |
108 | " dataset_path_len [%lld]\n" | |
106 | 109 | "\n" |
107 | " word_length [%d]\n" | |
108 | " word_jump [%d]\n" | |
109 | " saturate_threshold [%d]\n", | |
110 | (gint)index_header->magic, | |
111 | (gint)index_header->version, | |
112 | (gint)index_header->type, | |
113 | (gint)index_header->dataset_path_len, | |
114 | (gint)index_header->word_length, | |
115 | (gint)index_header->word_jump, | |
116 | (gint)index_header->saturate_threshold); | |
110 | " word_length [%lld]\n" | |
111 | " word_jump [%lld]\n" | |
112 | " word_ambiguity [%lld]\n" | |
113 | " saturate_threshold [%lld]\n", | |
114 | index_header->magic, | |
115 | index_header->version, | |
116 | index_header->type, | |
117 | index_header->dataset_path_len, | |
118 | index_header->word_length, | |
119 | index_header->word_jump, | |
120 | index_header->word_ambiguity, | |
121 | index_header->saturate_threshold); | |
117 | 122 | return; |
118 | 123 | } |
119 | 124 | #endif /* 0 */ |
127 | 132 | /**/ |
128 | 133 | BitArray_write_int(index_header->word_length, fp); |
129 | 134 | BitArray_write_int(index_header->word_jump, fp); |
135 | BitArray_write_int(index_header->word_ambiguity, fp); | |
130 | 136 | BitArray_write_int(index_header->saturate_threshold, fp); |
131 | 137 | /**/ |
132 | 138 | return; |
145 | 151 | /**/ |
146 | 152 | index_header->word_length = BitArray_read_int(fp); |
147 | 153 | index_header->word_jump = BitArray_read_int(fp); |
154 | index_header->word_ambiguity = BitArray_read_int(fp); | |
148 | 155 | index_header->saturate_threshold = BitArray_read_int(fp); |
149 | 156 | /* Index_Header_info(index_header); */ |
150 | 157 | return index_header; |
185 | 192 | gint seq_pos, gint leaf_id, |
186 | 193 | gpointer user_data); |
187 | 194 | |
188 | static void Index_visit_seq_words(Index *index, Index_Strand *index_strand, | |
195 | static void Index_visit_seq_words_single(Index *index, Index_Strand *index_strand, | |
189 | 196 | gint seq_id, Sequence *seq, |
190 | 197 | Index_WordVisit_Func iwvf, gint frame, |
191 | 198 | gpointer user_data){ |
210 | 217 | } |
211 | 218 | } |
212 | 219 | g_free(str); |
220 | return; | |
221 | } | |
222 | /* FIXME: needs to work with softmasked sequences */ | |
223 | ||
224 | #ifndef Swap | |
225 | #define Swap(x,y,temp) ((temp)=(x),(x)=(y),(y)=(temp)) | |
226 | #endif /* Swap */ | |
227 | ||
228 | static void Index_visit_seq_words_ambig(Index *index, Index_Strand *index_strand, | |
229 | gint seq_id, Sequence *seq, | |
230 | Index_WordVisit_Func iwvf, gint frame, | |
231 | gpointer user_data){ | |
232 | register gint i, j, k, jump_ctr = 0, pos; | |
233 | register gchar *ambig, *str = Sequence_get_str(seq); | |
234 | register VFSM_Int state, next_state, leaf; | |
235 | register VFSM_Int *temp_state_list, | |
236 | *curr_state_list = g_new0(VFSM_Int, | |
237 | index->header->word_ambiguity), | |
238 | *next_state_list = g_new0(VFSM_Int, | |
239 | index->header->word_ambiguity); | |
240 | register gint curr_state_list_len = 1, next_state_list_len = 0; | |
241 | for(i = 0; str[i]; i++){ | |
242 | if(jump_ctr--) | |
243 | continue; | |
244 | jump_ctr = index->header->word_jump - 1; | |
245 | if((!(ambig = Alphabet_nt2ambig(str[i]))) | |
246 | || ((strlen(ambig) * curr_state_list_len) | |
247 | > index->header->word_ambiguity)){ | |
248 | next_state_list_len = 0; /* Clear next state list */ | |
249 | curr_state_list_len = 1; /* Set single null state */ | |
250 | curr_state_list[0] = 0; | |
251 | continue; | |
252 | } | |
253 | for(j = 0; j < curr_state_list_len; j++){ | |
254 | state = curr_state_list[j]; | |
255 | for(k = 0; ambig[k]; k++){ | |
256 | g_assert(index->vfsm->index[(guchar)ambig[k]]); | |
257 | next_state = VFSM_change_state_M(index->vfsm, | |
258 | state, (guchar)ambig[k]); | |
259 | if(next_state_list_len | |
260 | && ((next_state == next_state_list[0]) | |
261 | || (next_state == next_state_list[next_state_list_len-1]))) | |
262 | break; | |
263 | next_state_list[next_state_list_len++] = next_state; | |
264 | if(VFSM_state_is_leaf(index->vfsm, next_state)){ | |
265 | leaf = VFSM_state2leaf(index->vfsm, next_state); | |
266 | pos = i-(index->vfsm->depth-1); | |
267 | if(frame) | |
268 | pos = (pos * 3) + frame - 1; | |
269 | iwvf(index, index_strand, seq_id, pos, leaf, user_data); | |
270 | } | |
271 | } | |
272 | } | |
273 | curr_state_list_len = next_state_list_len; | |
274 | next_state_list_len = 0; | |
275 | Swap(next_state_list, curr_state_list, temp_state_list); | |
276 | } | |
277 | g_free(str); | |
278 | g_free(curr_state_list); | |
279 | g_free(next_state_list); | |
280 | return; | |
281 | } | |
282 | /* FIXME: needs to work with softmasked sequences */ | |
283 | /* FIXME: optimisation: remove strlen() call */ | |
284 | ||
285 | static void Index_visit_seq_words(Index *index, Index_Strand *index_strand, | |
286 | gint seq_id, Sequence *seq, | |
287 | Index_WordVisit_Func iwvf, gint frame, | |
288 | gpointer user_data){ | |
289 | if(index->header->word_ambiguity > 1) | |
290 | Index_visit_seq_words_ambig(index, index_strand, seq_id, seq, | |
291 | iwvf, frame, user_data); | |
292 | else | |
293 | Index_visit_seq_words_single(index, index_strand, seq_id, seq, | |
294 | iwvf, frame, user_data); | |
213 | 295 | return; |
214 | 296 | } |
215 | 297 | /* FIXME: needs to work with softmasked sequences */ |
291 | 373 | removed_instances += index_strand->word_table[i]; |
292 | 374 | index_strand->word_table[i] = -1; |
293 | 375 | } |
294 | g_message("Removed [%lld] words, [%lld] instances", | |
376 | g_message("Removed [%" CUSTOM_GUINT64_FORMAT | |
377 | "] words, [%" CUSTOM_GUINT64_FORMAT "] instances", | |
295 | 378 | removed_words, removed_instances); |
296 | 379 | return; |
297 | 380 | } |
662 | 745 | return; |
663 | 746 | } |
664 | 747 | |
665 | Index *Index_create(Dataset *dataset, gboolean is_translated, | |
666 | gint word_length, gint word_jump, gint saturate_threshold, | |
748 | Index *Index_create(Dataset *dataset, gboolean is_translated, gint word_length, | |
749 | gint word_jump, gint word_ambiguity, gint saturate_threshold, | |
667 | 750 | gchar *index_path, gchar *dataset_path, gint memory_limit){ |
668 | 751 | register Index *index = g_new0(Index, 1); |
669 | 752 | register gchar *member; |
683 | 766 | index->dataset = Dataset_share(dataset); |
684 | 767 | index->header = Index_Header_create(strlen(dataset_path), |
685 | 768 | is_translated, word_length, |
686 | word_jump, saturate_threshold); | |
769 | word_jump, word_ambiguity, | |
770 | saturate_threshold); | |
687 | 771 | if(is_translated){ |
688 | 772 | alphabet = Alphabet_create(Alphabet_Type_PROTEIN, FALSE); |
689 | 773 | member = (gchar*)alphabet->member; |
777 | 861 | pthread_mutex_destroy(&index->index_mutex); |
778 | 862 | #endif /* USE_PTHREADS */ |
779 | 863 | g_free(index); |
864 | return; | |
865 | } | |
866 | ||
867 | void Index_info(Index *index){ | |
868 | g_print("Sequence Index:\n" | |
869 | "--------------\n" | |
870 | " version: %d\n" | |
871 | " type: %s\n" | |
872 | " word length: %d\n" | |
873 | " word jump: %d\n" | |
874 | " word ambiguity: %d\n" | |
875 | " saturate threshold: %d\n\n", | |
876 | (gint)index->header->version, | |
877 | (index->header->type & 1) ? "translated" : "normal", | |
878 | (gint)index->header->word_length, | |
879 | (gint)index->header->word_jump, | |
880 | (gint)index->header->word_ambiguity, | |
881 | (gint)index->header->saturate_threshold); | |
780 | 882 | return; |
781 | 883 | } |
782 | 884 |
2 | 2 | * Library for manipulation of exonerate index files * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
59 | 59 | /**/ |
60 | 60 | guint64 word_length; |
61 | 61 | guint64 word_jump; |
62 | guint64 word_ambiguity; | |
62 | 63 | guint64 saturate_threshold; |
63 | 64 | } Index_Header; |
64 | 65 | |
116 | 117 | |
117 | 118 | /**/ |
118 | 119 | |
119 | Index *Index_create(Dataset *dataset, gboolean is_translated, | |
120 | gint word_length, gint word_jump, gint saturate_threshold, | |
120 | Index *Index_create(Dataset *dataset, gboolean is_translated, gint word_length, | |
121 | gint word_jump, gint word_ambiguity, gint saturate_threshold, | |
121 | 122 | gchar *index_path, gchar *dataset_path, gint memory_limit); |
122 | 123 | Index *Index_share(Index *index); |
123 | 124 | void Index_destroy(Index *index); |
125 | void Index_info(Index *index); | |
124 | 126 | Index *Index_open(gchar *path); |
125 | 127 | guint64 Index_memory_usage(Index *index); |
126 | 128 | void Index_preload_index(Index *index); |
149 | 151 | } |
150 | 152 | #endif /* __cplusplus */ |
151 | 153 | |
152 | #endif /* INCLUDED_DATASET_H */ | |
154 | #endif /* INCLUDED_INDEX_H */ | |
153 | 155 |
2 | 2 | * Library for manipulation of FASTA format databases * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
0 | 0 | |
1 | TESTS = argument.test lineparse.test compoundfile.test socket.test | |
1 | TESTS = argument.test lineparse.test compoundfile.test socket.test \ | |
2 | jobqueue.test threadref.test | |
2 | 3 | noinst_PROGRAMS = $(TESTS) |
3 | 4 | |
4 | noinst_HEADERS = argument.h lineparse.h compoundfile.h socket.h | |
5 | noinst_HEADERS = argument.h lineparse.h compoundfile.h socket.h \ | |
6 | jobqueue.h threadref.h | |
5 | 7 | |
6 | INCLUDES = -DSOURCE_ROOT_DIR="\"@source_root_dir@\"" | |
8 | INCLUDES = -DSOURCE_ROOT_DIR="\"@source_root_dir@\"" \ | |
9 | -DCUSTOM_GUINT64_FORMAT="\"@custom_guint64_format@\"" \ | |
10 | -I$(top_srcdir)/src/struct | |
7 | 11 | |
8 | 12 | argument_test_SOURCES = argument.test.c argument.c |
9 | 13 | lineparse_test_SOURCES = lineparse.test.c lineparse.c |
10 | 14 | compoundfile_test_SOURCES = compoundfile.test.c compoundfile.c |
11 | 15 | socket_test_SOURCES = socket.test.c socket.c |
16 | jobqueue_test_SOURCES = jobqueue.test.c jobqueue.c | |
17 | jobqueue_test_LDADD = $(top_srcdir)/src/struct/pqueue.o \ | |
18 | $(top_srcdir)/src/struct/recyclebin.o | |
19 | threadref_test_SOURCES = threadref.test.c threadref.c | |
20 | threadref_test_LDADD = -lpthread | |
12 | 21 | |
13 | 22 | # Files to clear away |
14 | 23 |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
77 | 78 | source_root_dir = @source_root_dir@ |
78 | 79 | use_pthreads = @use_pthreads@ |
79 | 80 | |
80 | TESTS = argument.test lineparse.test compoundfile.test socket.test | |
81 | TESTS = argument.test lineparse.test compoundfile.test socket.test jobqueue.test threadref.test | |
82 | ||
81 | 83 | noinst_PROGRAMS = $(TESTS) |
82 | 84 | |
83 | noinst_HEADERS = argument.h lineparse.h compoundfile.h socket.h | |
84 | ||
85 | INCLUDES = -DSOURCE_ROOT_DIR="\"@source_root_dir@\"" | |
85 | noinst_HEADERS = argument.h lineparse.h compoundfile.h socket.h jobqueue.h threadref.h | |
86 | ||
87 | ||
88 | INCLUDES = -DSOURCE_ROOT_DIR="\"@source_root_dir@\"" -DCUSTOM_GUINT64_FORMAT="\"@custom_guint64_format@\"" -I$(top_srcdir)/src/struct | |
89 | ||
86 | 90 | |
87 | 91 | argument_test_SOURCES = argument.test.c argument.c |
88 | 92 | lineparse_test_SOURCES = lineparse.test.c lineparse.c |
89 | 93 | compoundfile_test_SOURCES = compoundfile.test.c compoundfile.c |
90 | 94 | socket_test_SOURCES = socket.test.c socket.c |
95 | jobqueue_test_SOURCES = jobqueue.test.c jobqueue.c | |
96 | jobqueue_test_LDADD = $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o | |
97 | ||
98 | threadref_test_SOURCES = threadref.test.c threadref.c | |
99 | threadref_test_LDADD = -lpthread | |
91 | 100 | |
92 | 101 | # Files to clear away |
93 | 102 | |
117 | 126 | socket_test_LDADD = $(LDADD) |
118 | 127 | socket_test_DEPENDENCIES = |
119 | 128 | socket_test_LDFLAGS = |
129 | jobqueue_test_OBJECTS = jobqueue.test.o jobqueue.o | |
130 | jobqueue_test_DEPENDENCIES = $(top_srcdir)/src/struct/pqueue.o \ | |
131 | $(top_srcdir)/src/struct/recyclebin.o | |
132 | jobqueue_test_LDFLAGS = | |
133 | threadref_test_OBJECTS = threadref.test.o threadref.o | |
134 | threadref_test_DEPENDENCIES = | |
135 | threadref_test_LDFLAGS = | |
120 | 136 | CFLAGS = @CFLAGS@ |
121 | 137 | COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
122 | 138 | CCLD = $(CC) |
130 | 146 | |
131 | 147 | TAR = tar |
132 | 148 | GZIP_ENV = --best |
133 | SOURCES = $(argument_test_SOURCES) $(lineparse_test_SOURCES) $(compoundfile_test_SOURCES) $(socket_test_SOURCES) | |
134 | OBJECTS = $(argument_test_OBJECTS) $(lineparse_test_OBJECTS) $(compoundfile_test_OBJECTS) $(socket_test_OBJECTS) | |
149 | SOURCES = $(argument_test_SOURCES) $(lineparse_test_SOURCES) $(compoundfile_test_SOURCES) $(socket_test_SOURCES) $(jobqueue_test_SOURCES) $(threadref_test_SOURCES) | |
150 | OBJECTS = $(argument_test_OBJECTS) $(lineparse_test_OBJECTS) $(compoundfile_test_OBJECTS) $(socket_test_OBJECTS) $(jobqueue_test_OBJECTS) $(threadref_test_OBJECTS) | |
135 | 151 | |
136 | 152 | all: all-redirect |
137 | 153 | .SUFFIXES: |
187 | 203 | socket.test: $(socket_test_OBJECTS) $(socket_test_DEPENDENCIES) |
188 | 204 | @rm -f socket.test |
189 | 205 | $(LINK) $(socket_test_LDFLAGS) $(socket_test_OBJECTS) $(socket_test_LDADD) $(LIBS) |
206 | ||
207 | jobqueue.test: $(jobqueue_test_OBJECTS) $(jobqueue_test_DEPENDENCIES) | |
208 | @rm -f jobqueue.test | |
209 | $(LINK) $(jobqueue_test_LDFLAGS) $(jobqueue_test_OBJECTS) $(jobqueue_test_LDADD) $(LIBS) | |
210 | ||
211 | threadref.test: $(threadref_test_OBJECTS) $(threadref_test_DEPENDENCIES) | |
212 | @rm -f threadref.test | |
213 | $(LINK) $(threadref_test_LDFLAGS) $(threadref_test_OBJECTS) $(threadref_test_LDADD) $(LIBS) | |
190 | 214 | |
191 | 215 | tags: TAGS |
192 | 216 |
2 | 2 | * Library for command line argument processing * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
172 | 172 | g_print("Built on %s\n", __DATE__); |
173 | 173 | if(strlen(branch) >= 10) |
174 | 174 | g_print("Branch: %.*s\n", (gint)(strlen(branch)-9), branch+7); |
175 | else | |
176 | g_print("Branch: unnamed branch\n"); | |
177 | 175 | return; |
178 | 176 | } |
179 | 177 | |
301 | 299 | */ |
302 | 300 | |
303 | 301 | int main(int argc, char **argv){ |
304 | register Argument *arg = Argument_create(argc, argv); | |
302 | register Argument *arg; | |
305 | 303 | register gint retval; |
304 | #ifdef USE_PTHREADS | |
305 | if(!g_thread_supported()) | |
306 | g_thread_init(NULL); | |
307 | #endif /* USE_PTHREADS */ | |
308 | arg = Argument_create(argc, argv); | |
306 | 309 | g_log_set_handler(NULL, G_LOG_LEVEL_ERROR|G_LOG_FLAG_FATAL, |
307 | 310 | Argument_error_handler, arg); |
308 | 311 | g_assert(Argument_assertion_warning()); |
2 | 2 | * Library for command line argument processing * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for command line argument processing * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for reading large and/or split files. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
157 | 157 | CompoundFile *CompoundFile_share(CompoundFile *cf){ |
158 | 158 | cf->ref_count++; |
159 | 159 | return cf; |
160 | } | |
161 | ||
162 | static GPtrArray *CompoundFile_get_path_list(CompoundFile *cf){ | |
163 | register gint i; | |
164 | register gchar *path; | |
165 | register GPtrArray *path_list = g_ptr_array_new(); | |
166 | register CompoundFile_Element *element; | |
167 | for(i = 0; i < cf->element_list->len; i++){ | |
168 | element = cf->element_list->pdata[i]; | |
169 | path = g_strdup(element->path); | |
170 | g_ptr_array_add(path_list, path); | |
171 | } | |
172 | return path_list; | |
173 | } | |
174 | ||
175 | CompoundFile *CompoundFile_dup(CompoundFile *cf){ | |
176 | register CompoundFile *ncf; | |
177 | register CompoundFile_Location *nstart = NULL, *nstop = NULL; | |
178 | register gint i; | |
179 | register gchar *path; | |
180 | register GPtrArray *path_list = CompoundFile_get_path_list(cf); | |
181 | g_assert(path_list); | |
182 | ncf = CompoundFile_create(path_list, FALSE); | |
183 | if(cf->start_limit) | |
184 | nstart = CompoundFile_Location_create(ncf, | |
185 | cf->start_limit->pos, | |
186 | cf->start_limit->element_id); | |
187 | if(cf->stop_limit) | |
188 | nstop = CompoundFile_Location_create(ncf, | |
189 | cf->stop_limit->pos, | |
190 | cf->stop_limit->element_id); | |
191 | CompoundFile_set_limits(ncf, nstart, nstop); | |
192 | if(nstart) | |
193 | CompoundFile_Location_destroy(nstart); | |
194 | if(nstop) | |
195 | CompoundFile_Location_destroy(nstop); | |
196 | for(i = 0; i < path_list->len; i++){ | |
197 | path = path_list->pdata[i]; | |
198 | g_free(path); | |
199 | } | |
200 | g_ptr_array_free(path_list, TRUE); | |
201 | return ncf; | |
160 | 202 | } |
161 | 203 | |
162 | 204 | gchar *CompoundFile_current_path(CompoundFile *cf){ |
343 | 385 | CompoundFile_Location_destroy(cf->start_limit); |
344 | 386 | if(cf->stop_limit) |
345 | 387 | CompoundFile_Location_destroy(cf->stop_limit); |
346 | cf->start_limit = CompoundFile_Location_share(start); | |
347 | cf->stop_limit = CompoundFile_Location_share(stop); | |
388 | if(start) | |
389 | cf->start_limit = CompoundFile_Location_share(start); | |
390 | if(stop) | |
391 | cf->stop_limit = CompoundFile_Location_share(stop); | |
348 | 392 | CompoundFile_rewind(cf); |
349 | 393 | return; |
350 | 394 | } |
2 | 2 | * Library for reading large and/or split files. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
24 | 24 | |
25 | 25 | #include <sys/types.h> /* For lseek() and off_t */ |
26 | 26 | #include <unistd.h> /* For lseek() and off_t */ |
27 | #include <inttypes.h> /* For PRIuPTR */ | |
27 | 28 | |
28 | 29 | #ifdef USE_PTHREADS |
29 | 30 | #include <pthread.h> |
44 | 45 | |
45 | 46 | typedef off_t CompoundFile_Pos; |
46 | 47 | |
47 | #if _FILE_OFFSET_BITS==64 | |
48 | #define CompoundFile_Pos_format "%lld" | |
49 | #else /* Assume _FILE_OFFSET_BITS==32 */ | |
50 | #define CompoundFile_Pos_format "%ld" | |
51 | #endif /* _FILE_OFFSET_BITS */ | |
52 | ||
48 | #if __STDC_VERSION__ >= 199901L | |
53 | 49 | #define CompoundFile_Pos_print(fp, pos) \ |
54 | CompoundFile_Pragma fprintf((fp), CompoundFile_Pos_format, (pos)) | |
50 | CompoundFile_Pragma fprintf((fp), "%jd", (intmax_t)(pos)) | |
51 | typedef intmax_t CompoundFile_Pos_scan_type; | |
55 | 52 | #define CompoundFile_Pos_scan(src, dst) \ |
56 | CompoundFile_Pragma sscanf((src), CompoundFile_Pos_format, (dst)) | |
53 | CompoundFile_Pragma sscanf((src), "%jd", (intmax_t*)(dst)) | |
54 | #else /* __STDC_VERSION__ */ | |
55 | #define CompoundFile_Pos_print(fp, pos) \ | |
56 | CompoundFile_Pragma fprintf((fp), "%lld", (long long int)(pos)) | |
57 | typedef long long int CompoundFile_Pos_scan_type; | |
58 | #define CompoundFile_Pos_scan(src, dst) \ | |
59 | CompoundFile_Pragma sscanf((src), "%lld", (dst)) | |
60 | #endif /* __STDC_VERSION__ */ | |
57 | 61 | |
58 | 62 | typedef struct { |
59 | 63 | gchar *path; |
80 | 84 | gboolean sort_on_file_size); |
81 | 85 | void CompoundFile_destroy(CompoundFile *cf); |
82 | 86 | CompoundFile *CompoundFile_share(CompoundFile *cf); |
87 | CompoundFile *CompoundFile_dup(CompoundFile *cf); | |
83 | 88 | gchar *CompoundFile_current_path(CompoundFile *cf); |
84 | 89 | |
85 | 90 | #define CompoundFile_buffer_is_empty(cf) \ |
2 | 2 | * Library for reading large and/or split files * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
0 | /****************************************************************\ | |
1 | * * | |
2 | * Library for Queueing Multi-Threaded Jobs * | |
3 | * * | |
4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | * * | |
7 | * This source code is distributed under the terms of the * | |
8 | * GNU General Public License, version 3. See the file COPYING * | |
9 | * or http://www.gnu.org/licenses/gpl.txt for details * | |
10 | * * | |
11 | * If you use this code, please keep this notice intact. * | |
12 | * * | |
13 | \****************************************************************/ | |
14 | ||
15 | #include "jobqueue.h" | |
16 | #include <unistd.h> /* For usleep() */ | |
17 | ||
18 | #ifdef USE_PTHREADS | |
19 | static JobQueue_Task *JobQueue_Task_create(JobQueue_Func job_func, | |
20 | gpointer job_data, gint priority){ | |
21 | register JobQueue_Task *task = g_new(JobQueue_Task, 1); | |
22 | task->job_func = job_func; | |
23 | task->job_data = job_data; | |
24 | task->priority = priority; | |
25 | return task; | |
26 | } | |
27 | ||
28 | static void JobQueue_Task_destroy(JobQueue_Task *task){ | |
29 | g_free(task); | |
30 | return; | |
31 | } | |
32 | ||
33 | static void *JobQueue_thread_func(void *data){ | |
34 | register JobQueue *jq = data; | |
35 | register JobQueue_Task *task; | |
36 | do { | |
37 | pthread_mutex_lock(&jq->queue_lock); | |
38 | task = PQueue_pop(jq->pq); | |
39 | if(task){ | |
40 | jq->running_count++; | |
41 | pthread_mutex_unlock(&jq->queue_lock); | |
42 | task->job_func(task->job_data); | |
43 | JobQueue_Task_destroy(task); | |
44 | pthread_mutex_lock(&jq->queue_lock); | |
45 | jq->running_count--; | |
46 | pthread_mutex_unlock(&jq->queue_lock); | |
47 | } else { | |
48 | pthread_mutex_unlock(&jq->queue_lock); | |
49 | usleep(1000); /* wait before checking job queue again */ | |
50 | } | |
51 | } while(!jq->is_complete); | |
52 | return NULL; | |
53 | } | |
54 | ||
55 | static gboolean JobQueue_Task_compare(gpointer low, gpointer high, | |
56 | gpointer user_data){ | |
57 | register JobQueue_Task *low_task = (JobQueue_Task*)low, | |
58 | *high_task = (JobQueue_Task*)high; | |
59 | return low_task->priority < high_task->priority; | |
60 | } | |
61 | #endif /* USE_PTHREADS */ | |
62 | ||
63 | JobQueue *JobQueue_create(gint thread_total){ | |
64 | register JobQueue *jq = g_new(JobQueue, 1); | |
65 | #ifdef USE_PTHREADS | |
66 | register gint i; | |
67 | jq->is_complete = FALSE; | |
68 | jq->thread_total = thread_total; | |
69 | jq->running_count = 0; | |
70 | pthread_mutex_init(&jq->queue_lock, NULL); | |
71 | jq->thread = g_new0(pthread_t, thread_total); | |
72 | jq->pq_set = PQueueSet_create(); | |
73 | jq->pq = PQueue_create(jq->pq_set, JobQueue_Task_compare, NULL); | |
74 | for(i = 0; i < thread_total; i++) | |
75 | pthread_create(&jq->thread[i], NULL, JobQueue_thread_func, jq); | |
76 | #endif /* USE_PTHREADS */ | |
77 | return jq; | |
78 | } | |
79 | ||
80 | static void JobQueue_Task_free_func(gpointer data, gpointer user_data){ | |
81 | register JobQueue_Task *task = data; | |
82 | JobQueue_Task_destroy(task); | |
83 | return; | |
84 | } | |
85 | ||
86 | void JobQueue_destroy(JobQueue *jq){ | |
87 | #ifdef USE_PTHREADS | |
88 | g_assert(!PQueue_total(jq->pq)); | |
89 | PQueue_destroy(jq->pq, JobQueue_Task_free_func, NULL); | |
90 | PQueueSet_destroy(jq->pq_set); | |
91 | pthread_mutex_destroy(&jq->queue_lock); | |
92 | g_free(jq->thread); | |
93 | #endif /* USE_PTHREADS */ | |
94 | g_free(jq); | |
95 | return; | |
96 | } | |
97 | ||
98 | void JobQueue_submit(JobQueue *jq, JobQueue_Func job_func, | |
99 | gpointer job_data, gint priority){ | |
100 | #ifdef USE_PTHREADS | |
101 | register JobQueue_Task *task; | |
102 | g_assert(jq); | |
103 | pthread_mutex_lock(&jq->queue_lock); | |
104 | task = JobQueue_Task_create(job_func, job_data, priority); | |
105 | PQueue_push(jq->pq, task); | |
106 | pthread_mutex_unlock(&jq->queue_lock); | |
107 | #else /* USE_PTHREADS */ | |
108 | jq->job_func(job_data); /* when no threads available, just run the job */ | |
109 | #endif /* USE_PTHREADS */ | |
110 | return; | |
111 | } | |
112 | /* waits until less than (thread_total * 2) jobs are queued | |
113 | */ | |
114 | ||
115 | void JobQueue_complete(JobQueue *jq){ | |
116 | #ifdef USE_PTHREADS | |
117 | register gint i, job_total; | |
118 | do { /* wait for job queue to empty */ | |
119 | pthread_mutex_lock(&jq->queue_lock); | |
120 | job_total = PQueue_total(jq->pq) + jq->running_count; | |
121 | pthread_mutex_unlock(&jq->queue_lock); | |
122 | usleep(1000); /* wait before checking if queue is empty again */ | |
123 | } while(job_total); | |
124 | jq->is_complete = TRUE; | |
125 | /* wait for threads to finish */ | |
126 | for(i = 0; i < jq->thread_total; i++) | |
127 | pthread_join(jq->thread[i], NULL); | |
128 | #endif /* USE_PTHREADS */ | |
129 | return; | |
130 | } | |
131 | /* waits until the queue is empty and no jobs are running, | |
132 | * to catch any jobs which are added to the queue by runnning jobs | |
133 | */ | |
134 | ||
135 | /**/ | |
136 |
0 | /****************************************************************\ | |
1 | * * | |
2 | * Library for Queueing Multi-Threaded Jobs * | |
3 | * * | |
4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | * * | |
7 | * This source code is distributed under the terms of the * | |
8 | * GNU General Public License, version 3. See the file COPYING * | |
9 | * or http://www.gnu.org/licenses/gpl.txt for details * | |
10 | * * | |
11 | * If you use this code, please keep this notice intact. * | |
12 | * * | |
13 | \****************************************************************/ | |
14 | ||
15 | #ifndef INCLUDED_JOBQUEUE_H | |
16 | #define INCLUDED_JOBQUEUE_H | |
17 | ||
18 | #ifdef __cplusplus | |
19 | extern "C" { | |
20 | #endif /* __cplusplus */ | |
21 | ||
22 | #include <glib.h> | |
23 | ||
24 | #ifdef USE_PTHREADS | |
25 | #include <pthread.h> | |
26 | #endif /* USE_PTHREADS */ | |
27 | ||
28 | #include "pqueue.h" | |
29 | ||
30 | typedef void (*JobQueue_Func)(gpointer job_data); | |
31 | ||
32 | typedef struct JobQueue_Task { | |
33 | JobQueue_Func job_func; | |
34 | gpointer job_data; | |
35 | gint priority; | |
36 | } JobQueue_Task; | |
37 | ||
38 | typedef struct { | |
39 | #ifdef USE_PTHREADS | |
40 | gboolean is_complete; | |
41 | gint thread_total; | |
42 | gint running_count; | |
43 | pthread_mutex_t queue_lock; | |
44 | pthread_t *thread; | |
45 | PQueue *pq; | |
46 | PQueueSet *pq_set; | |
47 | #endif /* USE_PTHREADS */ | |
48 | } JobQueue; | |
49 | ||
50 | JobQueue *JobQueue_create(gint thread_total); | |
51 | void JobQueue_destroy(JobQueue *jq); | |
52 | void JobQueue_submit(JobQueue *jq, JobQueue_Func job_func, | |
53 | gpointer job_data, gint priority); | |
54 | void JobQueue_complete(JobQueue *jq); | |
55 | ||
56 | /* Lower priority jobs are run first */ | |
57 | ||
58 | #ifdef __cplusplus | |
59 | } | |
60 | #endif /* __cplusplus */ | |
61 | ||
62 | #endif /* INCLUDED_JOBQUEUE_H */ | |
63 | ||
64 | ||
65 | /**/ | |
66 |
0 | /****************************************************************\ | |
1 | * * | |
2 | * Library for Queueing Multi-Threaded Jobs * | |
3 | * * | |
4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | * * | |
7 | * This source code is distributed under the terms of the * | |
8 | * GNU General Public License, version 3. See the file COPYING * | |
9 | * or http://www.gnu.org/licenses/gpl.txt for details * | |
10 | * * | |
11 | * If you use this code, please keep this notice intact. * | |
12 | * * | |
13 | \****************************************************************/ | |
14 | ||
15 | #include <unistd.h> /* For usleep() */ | |
16 | #include "jobqueue.h" | |
17 | ||
18 | static void test_run_func(gpointer job_data){ | |
19 | register gchar *name = job_data; | |
20 | g_message("running job [%s]", name); | |
21 | usleep(1000000); /* test job length */ | |
22 | return; | |
23 | } | |
24 | ||
25 | int main(void){ | |
26 | register gint i; | |
27 | register JobQueue *jq = JobQueue_create(2); | |
28 | gchar *test_str[10] = {"one", "two", "three", "four", "five", | |
29 | "six", "seven", "eight", "nine", "ten"}; | |
30 | ||
31 | /* Initialise threads as not using Argument library */ | |
32 | #ifdef USE_PTHREADS | |
33 | if(!g_thread_supported()) | |
34 | g_thread_init(NULL); | |
35 | #endif /* USE_PTHREADS */ | |
36 | ||
37 | for(i = 0; i < 10; i++) | |
38 | JobQueue_submit(jq, test_run_func, test_str[i], 0); | |
39 | JobQueue_complete(jq); | |
40 | JobQueue_destroy(jq); | |
41 | return 0; | |
42 | } | |
43 |
2 | 2 | * Library for basic line-by-line parsing of text files. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for basic line-by-line parsing of text files. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for basic line-by-line parsing of text files. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Simple client-server code library * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
55 | 55 | struct sockaddr_in server; |
56 | 56 | struct hostent *hp = gethostbyname(host); |
57 | 57 | register gchar *reply; |
58 | #ifdef USE_PTHREADS | |
59 | pthread_mutex_init(&client->connection_mutex, NULL); | |
60 | #endif /* USE_PTHREADS */ | |
58 | 61 | if(!hp){ |
59 | perror("lookup up hostname"); | |
62 | perror("looking up hostname"); | |
60 | 63 | exit(1); |
61 | 64 | } |
62 | 65 | client->connection = SocketConnection_create(host, port); |
102 | 105 | } |
103 | 106 | |
104 | 107 | static gchar *SocketConnection_read(gint sock){ |
105 | register gint i, len, line_complete = 0, line_expect = 1; | |
108 | register gint i, len = 0, line_complete = 0, line_expect = 1; | |
106 | 109 | register gchar *reply; |
107 | 110 | register GString *string = g_string_sized_new(Socket_BUFSIZE); |
108 | 111 | register gboolean line_count_given = FALSE; |
124 | 127 | g_error("linecount: must be > 1"); |
125 | 128 | } |
126 | 129 | if(line_complete > line_expect){ |
127 | if(line_count_given) | |
130 | if(line_count_given){ | |
128 | 131 | g_error("Received [%d] socket message lines, but expected [%d]", |
129 | 132 | line_complete, line_count_given); |
130 | else | |
133 | } else { | |
131 | 134 | g_error("Multiline socket messages must use linecount:"); |
135 | } | |
132 | 136 | } |
133 | 137 | g_string_append(string, buffer); |
134 | 138 | } while(line_complete < line_expect); |
170 | 174 | } |
171 | 175 | |
172 | 176 | gchar *SocketClient_send(SocketClient *client, gchar *msg){ |
177 | register gchar *reply; | |
178 | #ifdef USE_PTHREADS | |
179 | pthread_mutex_lock(&client->connection_mutex); | |
180 | #endif /* USE_PTHREADS */ | |
173 | 181 | Socket_send(client->connection->sock, msg, "writing client message"); |
174 | return SocketConnection_read(client->connection->sock); | |
182 | reply = SocketConnection_read(client->connection->sock); | |
183 | g_assert(reply); | |
184 | #ifdef USE_PTHREADS | |
185 | pthread_mutex_unlock(&client->connection_mutex); | |
186 | #endif /* USE_PTHREADS */ | |
187 | return reply; | |
175 | 188 | } |
176 | 189 | |
177 | 190 | void SocketClient_destroy(SocketClient *client){ |
178 | 191 | SocketConnection_destroy(client->connection); |
192 | #ifdef USE_PTHREADS | |
193 | pthread_mutex_destroy(&client->connection_mutex); | |
194 | #endif /* USE_PTHREADS */ | |
179 | 195 | g_free(client); |
180 | 196 | return; |
181 | 197 | } |
195 | 211 | static void SocketServer_shutdown(int signum){ |
196 | 212 | g_message("Server shutting down"); |
197 | 213 | exit(0); |
214 | return; | |
215 | } | |
216 | ||
217 | static void SocketServer_broken_pipe(int signum){ | |
218 | g_message("Server detected broken pipe - closing thread"); | |
219 | pthread_exit(NULL); | |
198 | 220 | return; |
199 | 221 | } |
200 | 222 | |
244 | 266 | register gboolean ok = TRUE; |
245 | 267 | gchar *reply; |
246 | 268 | do { |
269 | #ifdef USE_PTHREADS | |
270 | pthread_mutex_lock(&server->connection_mutex); | |
271 | #endif /* USE_PTHREADS */ | |
247 | 272 | msg = SocketConnection_read(msgsock); |
273 | #ifdef USE_PTHREADS | |
274 | pthread_mutex_unlock(&server->connection_mutex); | |
275 | #endif /* USE_PTHREADS */ | |
248 | 276 | reply = NULL; |
249 | 277 | if(!msg) |
250 | 278 | break; |
252 | 280 | server->user_data); |
253 | 281 | g_free(msg); |
254 | 282 | if(reply){ |
283 | #ifdef USE_PTHREADS | |
284 | pthread_mutex_lock(&server->connection_mutex); | |
285 | #endif /* USE_PTHREADS */ | |
255 | 286 | Socket_send(msgsock, reply, "writing reply"); |
287 | #ifdef USE_PTHREADS | |
288 | pthread_mutex_unlock(&server->connection_mutex); | |
289 | #endif /* USE_PTHREADS */ | |
256 | 290 | g_free(reply); |
291 | } else { | |
292 | g_error("no reply from server"); | |
257 | 293 | } |
258 | 294 | } while(ok); |
259 | 295 | if(server->connection_close_func) |
264 | 300 | #ifdef USE_PTHREADS |
265 | 301 | static void *SocketServer_pthread_func(void* data){ |
266 | 302 | register SocketServer_pthread_Data *sspd = (SocketServer_pthread_Data*)data; |
303 | signal(SIGPIPE, SocketServer_broken_pipe); | |
267 | 304 | SocketServer_process_connection(sspd->server, sspd->msgsock); |
268 | 305 | pthread_mutex_lock(&sspd->server->connection_mutex); |
269 | 306 | g_message("cleaning up connection [%d]", global_connection_count); |
278 | 315 | |
279 | 316 | gboolean SocketServer_listen(SocketServer *server){ |
280 | 317 | register int msgsock; |
281 | register gint i; | |
282 | 318 | struct sockaddr_in client_addr; |
283 | 319 | socklen_t client_len = sizeof(struct sockaddr_in); |
284 | 320 | #ifdef USE_PTHREADS |
321 | register gint i; | |
285 | 322 | pthread_attr_t pt_attr; |
286 | 323 | pthread_attr_init(&pt_attr); |
287 | 324 | pthread_attr_setdetachstate(&pt_attr, PTHREAD_CREATE_DETACHED); |
350 | 387 | return; |
351 | 388 | } |
352 | 389 | |
390 |
2 | 2 | * Simple client-server code library * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
44 | 44 | |
45 | 45 | typedef struct { |
46 | 46 | SocketConnection *connection; |
47 | #ifdef USE_PTHREADS | |
48 | pthread_mutex_t connection_mutex; | |
49 | #endif /* USE_PTHREADS */ | |
47 | 50 | } SocketClient; |
48 | 51 | |
49 | 52 | #ifdef USE_PTHREADS |
2 | 2 | * Simple client-server code library * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
0 | /****************************************************************\ | |
1 | * * | |
2 | * Basic library for thread-safe reference counting. * | |
3 | * * | |
4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | * * | |
7 | * This source code is distributed under the terms of the * | |
8 | * GNU General Public License, version 3. See the file COPYING * | |
9 | * or http://www.gnu.org/licenses/gpl.txt for details * | |
10 | * * | |
11 | * If you use this code, please keep this notice intact. * | |
12 | * * | |
13 | \****************************************************************/ | |
14 | ||
15 | #include "threadref.h" | |
16 | ||
17 | ThreadRef *ThreadRef_create(void){ | |
18 | register ThreadRef *threadref = g_new(ThreadRef, 1); | |
19 | threadref->ref_count = 1; | |
20 | #ifdef USE_PTHREADS | |
21 | pthread_mutex_init(&threadref->ref_lock, NULL); | |
22 | #endif /* USE_PTHREADS */ | |
23 | return threadref; | |
24 | } | |
25 | ||
26 | ThreadRef *ThreadRef_destroy(ThreadRef *threadref){ | |
27 | ThreadRef_lock(threadref); | |
28 | if(--threadref->ref_count){ | |
29 | ThreadRef_unlock(threadref); | |
30 | return threadref; | |
31 | } | |
32 | ThreadRef_unlock(threadref); | |
33 | #ifdef USE_PTHREADS | |
34 | pthread_mutex_destroy(&threadref->ref_lock); | |
35 | #endif /* USE_PTHREADS */ | |
36 | g_free(threadref); | |
37 | return NULL; | |
38 | } | |
39 | ||
40 | ThreadRef *ThreadRef_share(ThreadRef *threadref){ | |
41 | ThreadRef_lock(threadref); | |
42 | threadref->ref_count++; | |
43 | ThreadRef_unlock(threadref); | |
44 | return threadref; | |
45 | } | |
46 | ||
47 | gint ThreadRef_get_count(ThreadRef *threadref){ | |
48 | register gint ref_count; | |
49 | ThreadRef_lock(threadref); | |
50 | ref_count = threadref->ref_count; | |
51 | ThreadRef_unlock(threadref); | |
52 | return ref_count; | |
53 | } | |
54 | ||
55 | void ThreadRef_lock(ThreadRef *threadref){ | |
56 | #ifdef USE_PTHREADS | |
57 | pthread_mutex_lock(&threadref->ref_lock); | |
58 | #endif /* USE_PTHREADS */ | |
59 | return; | |
60 | } | |
61 | ||
62 | void ThreadRef_unlock(ThreadRef *threadref){ | |
63 | #ifdef USE_PTHREADS | |
64 | pthread_mutex_unlock(&threadref->ref_lock); | |
65 | #endif /* USE_PTHREADS */ | |
66 | return; | |
67 | } | |
68 |
0 | /****************************************************************\ | |
1 | * * | |
2 | * Basic library for thread-safe reference counting. * | |
3 | * * | |
4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | * * | |
7 | * This source code is distributed under the terms of the * | |
8 | * GNU General Public License, version 3. See the file COPYING * | |
9 | * or http://www.gnu.org/licenses/gpl.txt for details * | |
10 | * * | |
11 | * If you use this code, please keep this notice intact. * | |
12 | * * | |
13 | \****************************************************************/ | |
14 | ||
15 | #ifndef INCLUDED_THREADREF_H | |
16 | #define INCLUDED_THREADREF_H | |
17 | ||
18 | #ifdef __cplusplus | |
19 | extern "C" { | |
20 | #endif /* __cplusplus */ | |
21 | ||
22 | #include <glib.h> | |
23 | ||
24 | #ifdef USE_PTHREADS | |
25 | #include <pthread.h> | |
26 | #endif /* USE_PTHREADS */ | |
27 | ||
28 | ||
29 | typedef struct { | |
30 | gint ref_count; | |
31 | #ifdef USE_PTHREADS | |
32 | pthread_mutex_t ref_lock; | |
33 | #endif /* USE_PTHREADS */ | |
34 | } ThreadRef; | |
35 | ||
36 | ThreadRef *ThreadRef_create(void); | |
37 | ThreadRef *ThreadRef_destroy(ThreadRef *threadref); | |
38 | ThreadRef *ThreadRef_share(ThreadRef *threadref); | |
39 | gint ThreadRef_get_count(ThreadRef *threadref); | |
40 | void ThreadRef_lock(ThreadRef *threadref); | |
41 | void ThreadRef_unlock(ThreadRef *threadref); | |
42 | ||
43 | #ifdef __cplusplus | |
44 | } | |
45 | #endif /* __cplusplus */ | |
46 | ||
47 | #endif /* INCLUDED_THREADREF_H */ | |
48 |
0 | /****************************************************************\ | |
1 | * * | |
2 | * Basic library for thread-safe reference counting. * | |
3 | * * | |
4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | * * | |
7 | * This source code is distributed under the terms of the * | |
8 | * GNU General Public License, version 3. See the file COPYING * | |
9 | * or http://www.gnu.org/licenses/gpl.txt for details * | |
10 | * * | |
11 | * If you use this code, please keep this notice intact. * | |
12 | * * | |
13 | \****************************************************************/ | |
14 | ||
15 | #include <stdio.h> | |
16 | #include "threadref.h" | |
17 | ||
18 | int main(void){ | |
19 | register ThreadRef *tr = ThreadRef_create(), *tr2; | |
20 | tr2 = ThreadRef_share(tr); | |
21 | ThreadRef_destroy(tr2); | |
22 | ThreadRef_lock(tr); | |
23 | ThreadRef_unlock(tr); | |
24 | ThreadRef_destroy(tr); | |
25 | return 0; | |
26 | } | |
27 |
59 | 59 | $(top_srcdir)/src/model/modeltype.o \ |
60 | 60 | $(top_srcdir)/src/general/argument.o \ |
61 | 61 | $(top_srcdir)/src/general/lineparse.o \ |
62 | $(top_srcdir)/src/general/jobqueue.o \ | |
62 | 63 | $(top_srcdir)/src/comparison/match.o \ |
63 | 64 | $(top_srcdir)/src/sequence/submat.o \ |
64 | 65 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
70 | 71 | $(top_srcdir)/src/comparison/wordhood.o \ |
71 | 72 | $(top_srcdir)/src/struct/sparsecache.o \ |
72 | 73 | $(top_srcdir)/src/general/compoundfile.o \ |
74 | $(top_srcdir)/src/general/threadref.o \ | |
73 | 75 | $(C4_OBJECTS) |
74 | 76 | |
75 | 77 | bsam_test_SOURCES = bsam.test.c bsam.c |
76 | 78 | bsam_test_LDADD = $(top_srcdir)/src/general/argument.o \ |
77 | 79 | $(top_srcdir)/src/general/lineparse.o \ |
80 | $(top_srcdir)/src/general/threadref.o \ | |
78 | 81 | $(top_srcdir)/src/comparison/hspset.o \ |
79 | 82 | $(top_srcdir)/src/comparison/comparison.o \ |
80 | 83 | $(top_srcdir)/src/comparison/match.o \ |
104 | 107 | $(top_srcdir)/src/struct/sparsecache.o \ |
105 | 108 | $(top_srcdir)/src/general/compoundfile.o \ |
106 | 109 | $(top_srcdir)/src/general/socket.o \ |
110 | $(top_srcdir)/src/general/threadref.o \ | |
107 | 111 | $(C4_OBJECTS) |
108 | 112 | |
109 | 113 | # Files to clear away |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
85 | 86 | |
86 | 87 | noinst_HEADERS = gam.h analysis.h bsam.h |
87 | 88 | |
88 | C4_OBJECTS = $(top_srcdir)/src/c4/c4.o $(top_srcdir)/src/c4/codegen.o $(top_srcdir)/src/c4/cgutil.o $(top_srcdir)/src/c4/opair.o $(top_srcdir)/src/c4/alignment.o $(top_srcdir)/src/c4/optimal.o $(top_srcdir)/src/c4/viterbi.o $(top_srcdir)/src/c4/layout.o $(top_srcdir)/src/c4/region.o $(top_srcdir)/src/c4/subopt.o $(top_srcdir)/src/bsdp/bsdp.o $(top_srcdir)/src/bsdp/sar.o $(top_srcdir)/src/bsdp/heuristic.o $(top_srcdir)/src/bsdp/hpair.o $(top_srcdir)/src/sdp/boundary.o $(top_srcdir)/src/sdp/sdp.o $(top_srcdir)/src/sdp/scheduler.o $(top_srcdir)/src/sdp/straceback.o $(top_srcdir)/src/sdp/lookahead.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/struct/slist.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/model/affine.o $(top_srcdir)/src/model/est2genome.o $(top_srcdir)/src/model/ner.o $(top_srcdir)/src/model/protein2dna.o $(top_srcdir)/src/model/protein2genome.o $(top_srcdir)/src/model/coding2coding.o $(top_srcdir)/src/model/coding2genome.o $(top_srcdir)/src/model/cdna2genome.o $(top_srcdir)/src/model/genome2genome.o $(top_srcdir)/src/model/ungapped.o $(top_srcdir)/src/model/intron.o $(top_srcdir)/src/model/frameshift.o $(top_srcdir)/src/model/phase.o $(top_srcdir)/src/model/modeltype.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o -lm | |
89 | C4_OBJECTS = $(top_srcdir)/src/c4/c4.o $(top_srcdir)/src/c4/codegen.o $(top_srcdir)/src/c4/cgutil.o $(top_srcdir)/src/c4/opair.o $(top_srcdir)/src/c4/alignment.o $(top_srcdir)/src/c4/optimal.o $(top_srcdir)/src/c4/viterbi.o $(top_srcdir)/src/c4/layout.o $(top_srcdir)/src/c4/region.o $(top_srcdir)/src/c4/subopt.o $(top_srcdir)/src/bsdp/bsdp.o $(top_srcdir)/src/bsdp/sar.o $(top_srcdir)/src/bsdp/heuristic.o $(top_srcdir)/src/bsdp/hpair.o $(top_srcdir)/src/sdp/boundary.o $(top_srcdir)/src/sdp/sdp.o $(top_srcdir)/src/sdp/scheduler.o $(top_srcdir)/src/sdp/straceback.o $(top_srcdir)/src/sdp/lookahead.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/struct/slist.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/model/affine.o $(top_srcdir)/src/model/est2genome.o $(top_srcdir)/src/model/ner.o $(top_srcdir)/src/model/protein2dna.o $(top_srcdir)/src/model/protein2genome.o $(top_srcdir)/src/model/coding2coding.o $(top_srcdir)/src/model/coding2genome.o $(top_srcdir)/src/model/cdna2genome.o $(top_srcdir)/src/model/genome2genome.o $(top_srcdir)/src/model/ungapped.o $(top_srcdir)/src/model/intron.o $(top_srcdir)/src/model/frameshift.o $(top_srcdir)/src/model/phase.o $(top_srcdir)/src/model/modeltype.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o $(top_srcdir)/src/general/jobqueue.o $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o -lm | |
89 | 90 | |
90 | 91 | |
91 | 92 | gam_test_SOURCES = gam.test.c gam.c |
92 | gam_test_LDADD = $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/comparison.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/general/compoundfile.o $(C4_OBJECTS) | |
93 | gam_test_LDADD = $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/comparison.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/general/compoundfile.o $(top_srcdir)/src/general/threadref.o $(C4_OBJECTS) | |
93 | 94 | |
94 | 95 | |
95 | 96 | bsam_test_SOURCES = bsam.test.c bsam.c |
96 | bsam_test_LDADD = $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/comparison.o $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/struct/dejavu.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/matrix.o -lm | |
97 | bsam_test_LDADD = $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o $(top_srcdir)/src/general/threadref.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/comparison.o $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/struct/dejavu.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/matrix.o -lm | |
97 | 98 | |
98 | 99 | analysis_test_SOURCES = analysis.test.c analysis.c gam.c bsam.c |
99 | analysis_test_LDADD = $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/comparison/seeder.o $(top_srcdir)/src/comparison/comparison.o $(top_srcdir)/src/database/fastapipe.o $(top_srcdir)/src/database/fastadb.o $(top_srcdir)/src/struct/dejavu.o $(top_srcdir)/src/struct/fsm.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/general/compoundfile.o $(top_srcdir)/src/general/socket.o $(C4_OBJECTS) | |
100 | analysis_test_LDADD = $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/comparison/seeder.o $(top_srcdir)/src/comparison/comparison.o $(top_srcdir)/src/database/fastapipe.o $(top_srcdir)/src/database/fastadb.o $(top_srcdir)/src/struct/dejavu.o $(top_srcdir)/src/struct/fsm.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/general/compoundfile.o $(top_srcdir)/src/general/socket.o $(top_srcdir)/src/general/threadref.o $(C4_OBJECTS) | |
100 | 101 | |
101 | 102 | |
102 | 103 | # Files to clear away |
116 | 117 | $(top_srcdir)/src/comparison/comparison.o \ |
117 | 118 | $(top_srcdir)/src/comparison/wordhood.o \ |
118 | 119 | $(top_srcdir)/src/struct/sparsecache.o \ |
119 | $(top_srcdir)/src/general/compoundfile.o $(top_srcdir)/src/c4/c4.o \ | |
120 | $(top_srcdir)/src/general/compoundfile.o \ | |
121 | $(top_srcdir)/src/general/threadref.o $(top_srcdir)/src/c4/c4.o \ | |
120 | 122 | $(top_srcdir)/src/c4/codegen.o $(top_srcdir)/src/c4/cgutil.o \ |
121 | 123 | $(top_srcdir)/src/c4/opair.o $(top_srcdir)/src/c4/alignment.o \ |
122 | 124 | $(top_srcdir)/src/c4/optimal.o $(top_srcdir)/src/c4/viterbi.o \ |
145 | 147 | $(top_srcdir)/src/model/modeltype.o \ |
146 | 148 | $(top_srcdir)/src/general/argument.o \ |
147 | 149 | $(top_srcdir)/src/general/lineparse.o \ |
150 | $(top_srcdir)/src/general/jobqueue.o \ | |
148 | 151 | $(top_srcdir)/src/comparison/match.o \ |
149 | 152 | $(top_srcdir)/src/sequence/submat.o \ |
150 | 153 | $(top_srcdir)/src/sequence/codonsubmat.o |
159 | 162 | $(top_srcdir)/src/struct/fsm.o $(top_srcdir)/src/struct/vfsm.o \ |
160 | 163 | $(top_srcdir)/src/struct/sparsecache.o \ |
161 | 164 | $(top_srcdir)/src/general/compoundfile.o \ |
162 | $(top_srcdir)/src/general/socket.o $(top_srcdir)/src/c4/c4.o \ | |
165 | $(top_srcdir)/src/general/socket.o \ | |
166 | $(top_srcdir)/src/general/threadref.o $(top_srcdir)/src/c4/c4.o \ | |
163 | 167 | $(top_srcdir)/src/c4/codegen.o $(top_srcdir)/src/c4/cgutil.o \ |
164 | 168 | $(top_srcdir)/src/c4/opair.o $(top_srcdir)/src/c4/alignment.o \ |
165 | 169 | $(top_srcdir)/src/c4/optimal.o $(top_srcdir)/src/c4/viterbi.o \ |
188 | 192 | $(top_srcdir)/src/model/modeltype.o \ |
189 | 193 | $(top_srcdir)/src/general/argument.o \ |
190 | 194 | $(top_srcdir)/src/general/lineparse.o \ |
195 | $(top_srcdir)/src/general/jobqueue.o \ | |
191 | 196 | $(top_srcdir)/src/comparison/match.o \ |
192 | 197 | $(top_srcdir)/src/sequence/submat.o \ |
193 | 198 | $(top_srcdir)/src/sequence/codonsubmat.o |
195 | 200 | bsam_test_OBJECTS = bsam.test.o bsam.o |
196 | 201 | bsam_test_DEPENDENCIES = $(top_srcdir)/src/general/argument.o \ |
197 | 202 | $(top_srcdir)/src/general/lineparse.o \ |
203 | $(top_srcdir)/src/general/threadref.o \ | |
198 | 204 | $(top_srcdir)/src/comparison/hspset.o \ |
199 | 205 | $(top_srcdir)/src/comparison/comparison.o \ |
200 | 206 | $(top_srcdir)/src/comparison/match.o \ |
2 | 2 | * Analysis module for exonerate * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
16 | 16 | #include "ungapped.h" |
17 | 17 | #include "compoundfile.h" |
18 | 18 | #include "hspset.h" |
19 | #include "lineparse.h" | |
19 | 20 | |
20 | 21 | #include <stdlib.h> /* For atoi() */ |
21 | 22 | #include <unistd.h> /* For sleep() */ |
22 | 23 | #include <string.h> /* For strcmp() */ |
23 | 24 | #include <ctype.h> /* For isdigit() */ |
25 | ||
26 | #include <sys/types.h> /* For stat() */ | |
27 | #include <sys/stat.h> /* For stat() */ | |
28 | #include <unistd.h> /* For stat() */ | |
24 | 29 | |
25 | 30 | Analysis_ArgumentSet *Analysis_ArgumentSet_create(Argument *arg){ |
26 | 31 | register ArgumentSet *as; |
33 | 38 | ArgumentSet_add_option(as, 'B', "bigseq", NULL, |
34 | 39 | "Allow rapid comparison between big sequences", "FALSE", |
35 | 40 | Argument_parse_boolean, &aas.use_bigseq); |
41 | ArgumentSet_add_option(as, 'r', "revcomp", NULL, | |
42 | "Also search reverse complement of query and target", "TRUE", | |
43 | Argument_parse_boolean, &aas.use_revcomp); | |
36 | 44 | ArgumentSet_add_option(as, '\0', "forcescan", "[q|t]", |
37 | 45 | "Force FSM scan on query or target sequences", "none", |
38 | 46 | Argument_parse_string, &aas.force_scan); |
44 | 52 | ArgumentSet_add_option(as, 0, "customserver", "command", |
45 | 53 | "Custom command to send non-standard server", "NULL", |
46 | 54 | Argument_parse_string, &aas.custom_server_command); |
55 | ArgumentSet_add_option(as, 'c', "cores", "number", | |
56 | "Number of cores/CPUs/threads for alignment computation", "1", | |
57 | Argument_parse_int, &aas.thread_count); | |
47 | 58 | Argument_absorb_ArgumentSet(arg, as); |
48 | 59 | } |
49 | 60 | return &aas; |
50 | 61 | } |
51 | 62 | |
52 | 63 | /**/ |
64 | ||
65 | typedef struct { | |
66 | GAM *gam; | |
67 | Comparison *comparison; | |
68 | } Analysis_HeuristicJob; | |
69 | ||
70 | static Analysis_HeuristicJob *Analysis_HeuristicJob_create(GAM *gam, | |
71 | Comparison *comparison){ | |
72 | register Analysis_HeuristicJob *ahj = g_new(Analysis_HeuristicJob, 1); | |
73 | ahj->gam = GAM_share(gam); | |
74 | ahj->comparison = Comparison_share(comparison); | |
75 | return ahj; | |
76 | } | |
77 | ||
78 | static void Analysis_HeuristicJob_destroy(Analysis_HeuristicJob *ahj){ | |
79 | Comparison_destroy(ahj->comparison); | |
80 | GAM_destroy(ahj->gam); | |
81 | g_free(ahj); | |
82 | return; | |
83 | } | |
84 | ||
85 | static void Analysis_HeuristicJob_run(gpointer data){ | |
86 | register Analysis_HeuristicJob *ahj = data; | |
87 | register GAM_Result *gam_result | |
88 | = GAM_Result_heuristic_create(ahj->gam, ahj->comparison); | |
89 | if(gam_result){ | |
90 | GAM_Result_submit(gam_result); | |
91 | GAM_Result_destroy(gam_result); | |
92 | } | |
93 | Analysis_HeuristicJob_destroy(ahj); | |
94 | return; | |
95 | } | |
53 | 96 | |
54 | 97 | static void Analysis_report_func(Comparison *comparison, |
55 | 98 | gpointer user_data){ |
56 | 99 | register Analysis *analysis = user_data; |
57 | 100 | register GAM_Result *gam_result; |
101 | register Analysis_HeuristicJob *ahj; | |
58 | 102 | g_assert(Comparison_has_hsps(comparison)); |
59 | 103 | if(analysis->scan_query){ |
60 | 104 | /* Swap back query and target after a query scan */ |
69 | 113 | Comparison_revcomp(comparison); |
70 | 114 | } |
71 | 115 | if(Model_Type_is_gapped(analysis->gam->gas->type)){ |
72 | gam_result = GAM_Result_heuristic_create(analysis->gam, | |
73 | comparison); | |
116 | ahj = Analysis_HeuristicJob_create(analysis->gam, comparison); | |
117 | #ifdef USE_PTHREADS | |
118 | g_assert(analysis->job_queue); | |
119 | /* FIXME: need to use priority here */ | |
120 | JobQueue_submit(analysis->job_queue, Analysis_HeuristicJob_run, ahj, 2); | |
121 | #else /* USE_PTHREADS */ | |
122 | Analysis_HeuristicJob_run(ahj); | |
123 | #endif /* USE_PTHREADS */ | |
74 | 124 | } else { |
75 | 125 | gam_result = GAM_Result_ungapped_create(analysis->gam, |
76 | 126 | comparison); |
77 | } | |
78 | if(gam_result){ | |
79 | GAM_Result_submit(gam_result); | |
80 | GAM_Result_destroy(gam_result); | |
127 | if(gam_result){ | |
128 | GAM_Result_submit(gam_result); | |
129 | GAM_Result_destroy(gam_result); | |
130 | } | |
81 | 131 | } |
82 | 132 | return; |
83 | 133 | } |
107 | 157 | /* Called after query pipeline analysis */ |
108 | 158 | |
109 | 159 | static gboolean Analysis_FastaPipe_Pair_query_func(FastaDB_Seq *fdbs, |
110 | gpointer user_data){ | |
160 | gpointer user_data){ | |
111 | 161 | register Analysis *analysis = user_data; |
112 | 162 | g_assert(!analysis->curr_query); |
113 | 163 | /* |
138 | 188 | |
139 | 189 | /**/ |
140 | 190 | |
191 | typedef struct { | |
192 | GAM *gam; | |
193 | Sequence *query; | |
194 | Sequence *target; | |
195 | } Analysis_ExhaustiveJob; | |
196 | ||
197 | static Analysis_ExhaustiveJob *Analysis_ExhaustiveJob_create(GAM *gam, | |
198 | Sequence *query, Sequence *target){ | |
199 | register Analysis_ExhaustiveJob *aej = g_new(Analysis_ExhaustiveJob, 1); | |
200 | aej->gam = GAM_share(gam); | |
201 | aej->query = Sequence_share(query); | |
202 | aej->target = Sequence_share(target); | |
203 | return aej; | |
204 | } | |
205 | ||
206 | static void Analysis_ExhaustiveJob_destroy(Analysis_ExhaustiveJob *aej){ | |
207 | GAM_destroy(aej->gam); | |
208 | Sequence_destroy(aej->query); | |
209 | Sequence_destroy(aej->target); | |
210 | g_free(aej); | |
211 | return; | |
212 | } | |
213 | ||
214 | static void Analysis_ExhaustiveJob_run(gpointer data){ | |
215 | register Analysis_ExhaustiveJob *aej = data; | |
216 | register GAM_Result *gam_result; | |
217 | gam_result = GAM_Result_exhaustive_create(aej->gam, | |
218 | aej->query, aej->target); | |
219 | if(gam_result){ | |
220 | GAM_Result_submit(gam_result); | |
221 | GAM_Result_destroy(gam_result); | |
222 | } | |
223 | Analysis_ExhaustiveJob_destroy(aej); | |
224 | return; | |
225 | } | |
226 | ||
141 | 227 | static void Analysis_Pair_compare(Analysis *analysis, |
142 | 228 | FastaDB_Seq *fdbs){ |
143 | register GAM_Result *gam_result; | |
229 | register Analysis_ExhaustiveJob *aej; | |
144 | 230 | if(analysis->aas->use_exhaustive){ |
145 | gam_result = GAM_Result_exhaustive_create(analysis->gam, | |
146 | analysis->curr_query->seq, fdbs->seq); | |
147 | if(gam_result){ | |
148 | GAM_Result_submit(gam_result); | |
149 | GAM_Result_destroy(gam_result); | |
150 | } | |
231 | aej = Analysis_ExhaustiveJob_create(analysis->gam, | |
232 | analysis->curr_query->seq, | |
233 | fdbs->seq); | |
234 | #ifdef USE_PTHREADS | |
235 | g_assert(analysis->job_queue); | |
236 | JobQueue_submit(analysis->job_queue, Analysis_ExhaustiveJob_run, aej, 1); | |
237 | #else /* USE_PTHREADS */ | |
238 | Analysis_ExhaustiveJob_run(aej); | |
239 | #endif /* USE_PTHREADS */ | |
151 | 240 | } else { |
152 | 241 | Analysis_BSAM_compare(analysis, analysis->curr_query, fdbs); |
153 | 242 | } |
154 | 243 | return; |
155 | 244 | } |
245 | ||
246 | /**/ | |
156 | 247 | |
157 | 248 | static gboolean Analysis_FastaPipe_Pair_target_func(FastaDB_Seq *fdbs, |
158 | 249 | gpointer user_data){ |
419 | 510 | g_free(msg); |
420 | 511 | g_free(reply); |
421 | 512 | /**/ |
513 | msg = g_strdup_printf("set param dnawordlimit %d", | |
514 | has->dna_word_limit); | |
515 | reply = Analysis_Client_send(aclient, msg, "ok:", FALSE); | |
516 | g_free(msg); | |
517 | g_free(reply); | |
518 | /**/ | |
519 | msg = g_strdup_printf("set param proteinwordlimit %d", | |
520 | has->protein_word_limit); | |
521 | reply = Analysis_Client_send(aclient, msg, "ok:", FALSE); | |
522 | g_free(msg); | |
523 | g_free(reply); | |
524 | /**/ | |
525 | msg = g_strdup_printf("set param codonwordlimit %d", | |
526 | has->codon_word_limit); | |
527 | reply = Analysis_Client_send(aclient, msg, "ok:", FALSE); | |
528 | g_free(msg); | |
529 | g_free(reply); | |
530 | /**/ | |
422 | 531 | msg = g_strdup_printf("set param dnahspdropoff %d", |
423 | 532 | has->dna_hsp_dropoff); |
424 | 533 | reply = Analysis_Client_send(aclient, msg, "ok:", FALSE); |
461 | 570 | g_free(msg); |
462 | 571 | g_free(reply); |
463 | 572 | /**/ |
573 | return; | |
574 | } | |
575 | ||
576 | static void Analysis_Client_info(Analysis_Client *aclient){ | |
464 | 577 | return; |
465 | 578 | } |
466 | 579 | |
472 | 585 | if(!sc) |
473 | 586 | return NULL; |
474 | 587 | aclient = g_new(Analysis_Client, 1); |
588 | aclient->ref_count = 1; | |
475 | 589 | aclient->sc = sc; |
476 | 590 | aclient->verbosity = verbosity; |
477 | 591 | aclient->probe_fdb = NULL; |
507 | 621 | g_free(dbinfo); |
508 | 622 | aclient->curr_query = NULL; |
509 | 623 | aclient->seq_cache = g_new0(Sequence*, aclient->num_seqs); |
624 | Analysis_Client_info(aclient); | |
625 | return aclient; | |
626 | } | |
627 | ||
628 | static Analysis_Client *Analysis_Client_share(Analysis_Client *aclient){ | |
629 | aclient->ref_count++; | |
510 | 630 | return aclient; |
511 | 631 | } |
512 | 632 | |
513 | 633 | static void Analysis_Client_destroy(Analysis_Client *aclient){ |
514 | 634 | register gint i; |
515 | 635 | register Sequence *seq; |
636 | if(--aclient->ref_count) | |
637 | return; | |
516 | 638 | if(aclient->curr_query) |
517 | 639 | Sequence_destroy(aclient->curr_query); |
518 | 640 | for(i = 0; i < aclient->num_seqs; i++){ |
532 | 654 | static void Analysis_Client_set_probe_fdb(Analysis_Client *aclient, |
533 | 655 | FastaDB *probe_fdb){ |
534 | 656 | g_assert(!aclient->probe_fdb); |
535 | aclient->probe_fdb = FastaDB_share(probe_fdb); | |
657 | aclient->probe_fdb = FastaDB_dup(probe_fdb); | |
536 | 658 | return; |
537 | 659 | } |
538 | 660 | |
591 | 713 | static Analysis_Client_Key *Analysis_Client_Key_create(Analysis_Client *aclient, |
592 | 714 | gint target_id, gint seq_len){ |
593 | 715 | register Analysis_Client_Key *key = g_new(Analysis_Client_Key, 1); |
594 | key->aclient = aclient; | |
716 | key->aclient = Analysis_Client_share(aclient); | |
595 | 717 | key->target_id = target_id; |
596 | 718 | key->seq_len = seq_len; |
597 | 719 | return key; |
598 | 720 | } |
599 | 721 | |
600 | 722 | static void Analysis_Client_Key_destroy(Analysis_Client_Key *key){ |
723 | Analysis_Client_destroy(key->aclient); | |
601 | 724 | g_free(key); |
602 | 725 | return; |
603 | 726 | } |
847 | 970 | Analysis *analysis, |
848 | 971 | Sequence *query, |
849 | 972 | gboolean swap_chains, |
850 | gboolean revcomp_target){ | |
973 | gboolean revcomp_target, | |
974 | gint priority){ | |
851 | 975 | Analysis_Client_set_query(aclient, query); |
852 | 976 | Analysis_Client_get_hsp_sets(aclient, analysis, swap_chains, revcomp_target); |
853 | 977 | /* Revcomp query if DNA */ |
860 | 984 | } |
861 | 985 | |
862 | 986 | static void Analysis_Client_process(Analysis_Client *aclient, Analysis *analysis, |
863 | gboolean swap_chains){ | |
987 | gboolean swap_chains, gint priority){ | |
864 | 988 | register FastaDB_Seq *fdbs; |
865 | 989 | /* FIXME: need to check for appropriate database type */ |
866 | 990 | while((fdbs = FastaDB_next(aclient->probe_fdb, FastaDB_Mask_ALL))){ |
867 | 991 | Analysis_Client_process_query(aclient, analysis, fdbs->seq, |
868 | swap_chains, FALSE); | |
992 | swap_chains, FALSE, priority); | |
869 | 993 | /* Revcomp target if protein vs DNA or translate_both */ |
870 | 994 | if(((aclient->curr_query->alphabet->type == Alphabet_Type_PROTEIN) |
871 | 995 | && (aclient->server_alphabet->type == Alphabet_Type_DNA)) |
872 | 996 | || analysis->gam->translate_both){ |
873 | 997 | Analysis_Client_revcomp_target(aclient); |
874 | 998 | Analysis_Client_process_query(aclient, analysis, |
875 | fdbs->seq, swap_chains, TRUE); | |
999 | fdbs->seq, swap_chains, TRUE, | |
1000 | priority); | |
876 | 1001 | Analysis_Client_revcomp_target(aclient); |
877 | 1002 | } |
878 | 1003 | FastaDB_Seq_destroy(fdbs); |
881 | 1006 | } |
882 | 1007 | |
883 | 1008 | /**/ |
1009 | ||
1010 | static Analysis_Server *Analysis_Server_create(Analysis_Builder *ab, | |
1011 | gchar *name, gint priority){ | |
1012 | register Analysis_Server *as = g_new(Analysis_Server, 1); | |
1013 | as->name = g_strdup(name); | |
1014 | as->ab = ab; | |
1015 | as->priority = priority; | |
1016 | return as; | |
1017 | } | |
1018 | ||
1019 | static void Analysis_Server_destroy(Analysis_Server *as){ | |
1020 | g_free(as->name); | |
1021 | g_free(as); | |
1022 | return; | |
1023 | } | |
1024 | ||
1025 | /**/ | |
1026 | ||
1027 | static Analysis_Builder *Analysis_Builder_create(GPtrArray *path_list, | |
1028 | Analysis *analysis, | |
1029 | gint verbosity){ | |
1030 | register Analysis_Builder *ab; | |
1031 | register gint i; | |
1032 | register Analysis_Client *ac; | |
1033 | register Analysis_Server *as; | |
1034 | g_assert(path_list->len); | |
1035 | ac = Analysis_Client_create(path_list->pdata[0], analysis->verbosity); | |
1036 | if(!ac) | |
1037 | return NULL; | |
1038 | /**/ | |
1039 | ab = g_new(Analysis_Builder, 1); | |
1040 | ab->verbosity = verbosity; | |
1041 | ab->server_list = g_ptr_array_new(); | |
1042 | ab->server_type = ac->server_alphabet->type; | |
1043 | ab->probe_fdb = NULL; | |
1044 | ab->analysis = analysis; | |
1045 | Analysis_Client_destroy(ac); | |
1046 | for(i = 0; i < path_list->len; i++){ | |
1047 | as = Analysis_Server_create(ab, path_list->pdata[i], i); | |
1048 | g_ptr_array_add(ab->server_list, as); | |
1049 | } | |
1050 | return ab; | |
1051 | } | |
1052 | ||
1053 | static void Analysis_Builder_destroy(Analysis_Builder *ab){ | |
1054 | register gint i; | |
1055 | register Analysis_Server *as; | |
1056 | for(i = 0; i < ab->server_list->len; i++){ | |
1057 | as = ab->server_list->pdata[i]; | |
1058 | Analysis_Server_destroy(as); | |
1059 | } | |
1060 | g_ptr_array_free(ab->server_list, TRUE); | |
1061 | if(ab->probe_fdb) | |
1062 | FastaDB_close(ab->probe_fdb); | |
1063 | g_free(ab); | |
1064 | return; | |
1065 | } | |
1066 | ||
1067 | static void Analysis_Server_run(gpointer data){ | |
1068 | register Analysis_Server *server = data; | |
1069 | register Analysis_Client *client | |
1070 | = Analysis_Client_create(server->name, | |
1071 | server->ab->analysis->verbosity); | |
1072 | if(!client) | |
1073 | g_error("Could not connect to server [%s]", server->name); | |
1074 | Analysis_Client_set_param(client, server->ab->analysis->gam); | |
1075 | Analysis_Client_set_probe_fdb(client, server->ab->probe_fdb); | |
1076 | Analysis_Client_process(client, server->ab->analysis, | |
1077 | server->ab->swap_chains, server->priority); | |
1078 | /**/ | |
1079 | Analysis_Client_destroy(client); | |
1080 | return; | |
1081 | } | |
1082 | ||
1083 | static void Analysis_Builder_process(Analysis_Builder *ab, | |
1084 | Analysis *analysis, gboolean swap_chains){ | |
1085 | register gint i; | |
1086 | register Analysis_Server *as; | |
1087 | ab->swap_chains = swap_chains; | |
1088 | for(i = 0; i < ab->server_list->len; i++){ | |
1089 | as = ab->server_list->pdata[i]; | |
1090 | #ifdef USE_PTHREADS | |
1091 | g_assert(analysis->job_queue); | |
1092 | JobQueue_submit(analysis->job_queue, Analysis_Server_run, as, i); | |
1093 | #else /* USE_PTHREADS */ | |
1094 | Analysis_Server_run(as); | |
1095 | #endif /* USE_PTHREADS */ | |
1096 | } | |
1097 | return; | |
1098 | } | |
1099 | ||
1100 | static void Analysis_Builder_set_probe_fdb(Analysis_Builder *ab, | |
1101 | FastaDB *probe_fdb){ | |
1102 | g_assert(!ab->probe_fdb); | |
1103 | ab->probe_fdb = FastaDB_share(probe_fdb); | |
1104 | return; | |
1105 | } | |
1106 | ||
1107 | /**/ | |
1108 | ||
1109 | static void Analysis_path_list_destroy(GPtrArray *path_list){ | |
1110 | register gint i; | |
1111 | register gchar *path; | |
1112 | for(i = 0; i < path_list->len; i++){ | |
1113 | path = path_list->pdata[i]; | |
1114 | g_free(path); | |
1115 | } | |
1116 | g_ptr_array_free(path_list, TRUE); | |
1117 | return; | |
1118 | } | |
1119 | ||
1120 | static GPtrArray *Analysis_FOSN_expand_path_list(GPtrArray *path_list){ | |
1121 | register gint i; | |
1122 | register gchar *path, *npath; | |
1123 | struct stat buf; | |
1124 | register gboolean expanded_list = FALSE; | |
1125 | register GPtrArray *npath_list = g_ptr_array_new(); | |
1126 | register FILE *fp; | |
1127 | register LineParse *lp; | |
1128 | for(i = 0; i < path_list->len; i++){ | |
1129 | path = path_list->pdata[i]; | |
1130 | if((stat(path, &buf)) /* Cannot read file (ie. servername) */ | |
1131 | || (S_ISDIR(buf.st_mode)) /* Is directory */ | |
1132 | || (FastaDB_file_is_fasta(path))){ /* 1st non-whitespace char is '>' */ | |
1133 | npath = g_strdup(path); | |
1134 | g_ptr_array_add(npath_list, npath); | |
1135 | } else { /* Assume to be fosn */ | |
1136 | fp = fopen(path, "r"); | |
1137 | if(!fp) | |
1138 | g_error("Could not open FOSN file [%s]", path); | |
1139 | lp = LineParse_create(fp); | |
1140 | while(LineParse_line(lp) != EOF){ | |
1141 | g_strstrip(lp->line->str); /* strip whitespace */ | |
1142 | if(lp->line->str[0]){ | |
1143 | npath = g_strdup(lp->line->str); | |
1144 | g_ptr_array_add(npath_list, npath); | |
1145 | expanded_list = TRUE; | |
1146 | } | |
1147 | } | |
1148 | LineParse_destroy(lp); | |
1149 | fclose(fp); | |
1150 | } | |
1151 | } | |
1152 | if(!expanded_list){ | |
1153 | for(i = 0; i < npath_list->len; i++){ | |
1154 | npath = npath_list->pdata[i]; | |
1155 | g_free(npath); | |
1156 | } | |
1157 | g_ptr_array_free(npath_list, TRUE); | |
1158 | return NULL; | |
1159 | } | |
1160 | return npath_list; | |
1161 | } | |
1162 | /* If members of the path list are files | |
1163 | * where the first non-whitespace character is not '>', | |
1164 | * it is assumed to be a FOSN, and parsed to expand the path_list. | |
1165 | */ | |
884 | 1166 | |
885 | 1167 | Analysis *Analysis_create( |
886 | 1168 | GPtrArray *query_path_list, Alphabet_Type query_type, |
898 | 1180 | *codon_hsp_param; |
899 | 1181 | register Match_ArgumentSet *mas = Match_ArgumentSet_create(NULL); |
900 | 1182 | register gboolean use_horizon; |
1183 | register GPtrArray *expanded_query_path_list = NULL, | |
1184 | *expanded_target_path_list = NULL; | |
901 | 1185 | g_assert(query_path_list); |
902 | 1186 | g_assert(target_path_list); |
903 | 1187 | g_assert(query_path_list->len); |
904 | 1188 | g_assert(target_path_list->len); |
905 | 1189 | analysis->aas = Analysis_ArgumentSet_create(NULL); |
906 | ||
907 | 1190 | analysis->verbosity = verbosity; |
908 | /**/ | |
909 | if(query_path_list->len == 1) | |
910 | analysis->query_ac | |
911 | = Analysis_Client_create((gchar*)query_path_list->pdata[0], | |
912 | verbosity); | |
913 | if(target_path_list->len == 1) | |
914 | analysis->target_ac | |
915 | = Analysis_Client_create((gchar*)target_path_list->pdata[0], | |
916 | verbosity); | |
1191 | analysis->job_queue = JobQueue_create(analysis->aas->thread_count); | |
1192 | /* Expand FOSN paths */ | |
1193 | expanded_query_path_list = Analysis_FOSN_expand_path_list( | |
1194 | query_path_list); | |
1195 | expanded_target_path_list = Analysis_FOSN_expand_path_list( | |
1196 | target_path_list); | |
1197 | if(expanded_query_path_list) | |
1198 | query_path_list = expanded_query_path_list; | |
1199 | if(expanded_target_path_list) | |
1200 | target_path_list = expanded_target_path_list; | |
1201 | /**/ | |
1202 | analysis->query_builder = Analysis_Builder_create(query_path_list, | |
1203 | analysis, verbosity); | |
1204 | analysis->target_builder = Analysis_Builder_create(target_path_list, | |
1205 | analysis, verbosity); | |
917 | 1206 | /**/ |
918 | 1207 | if(query_type == Alphabet_Type_UNKNOWN){ |
919 | if(analysis->query_ac){ | |
920 | query_type = analysis->query_ac->server_alphabet->type; | |
1208 | if(analysis->query_builder){ | |
1209 | query_type = analysis->query_builder->server_type; | |
921 | 1210 | } else { |
922 | 1211 | query_type = FastaDB_guess_type( |
923 | 1212 | (gchar*)query_path_list->pdata[0]); |
927 | 1216 | } |
928 | 1217 | } |
929 | 1218 | if(target_type == Alphabet_Type_UNKNOWN){ |
930 | if(analysis->target_ac){ | |
931 | target_type = analysis->target_ac->server_alphabet->type; | |
1219 | if(analysis->target_builder){ | |
1220 | target_type = analysis->target_builder->server_type; | |
932 | 1221 | } else { |
933 | 1222 | target_type = FastaDB_guess_type( |
934 | 1223 | (gchar*)target_path_list->pdata[0]); |
952 | 1241 | analysis->aas->use_exhaustive, |
953 | 1242 | verbosity); |
954 | 1243 | /**/ |
955 | if(analysis->query_ac) | |
956 | Analysis_Client_set_param(analysis->query_ac, analysis->gam); | |
957 | if(analysis->target_ac) | |
958 | Analysis_Client_set_param(analysis->target_ac, analysis->gam); | |
959 | /**/ | |
960 | 1244 | Analysis_find_matches(analysis, &dna_match, &protein_match, |
961 | 1245 | &codon_match); |
962 | 1246 | match = dna_match; |
965 | 1249 | if(!match) |
966 | 1250 | match = codon_match; |
967 | 1251 | g_assert(match); |
968 | if(!analysis->query_ac) | |
1252 | if(!analysis->query_builder) | |
969 | 1253 | query_fdb = FastaDB_open_list_with_limit(query_path_list, |
970 | 1254 | match->query->alphabet, query_chunk_id, query_chunk_total); |
971 | if(!analysis->target_ac) | |
1255 | if(!analysis->target_builder) | |
972 | 1256 | target_fdb = FastaDB_open_list_with_limit(target_path_list, |
973 | 1257 | match->target->alphabet, target_chunk_id, target_chunk_total); |
974 | 1258 | if(analysis->aas->use_exhaustive){ |
975 | if(analysis->query_ac || analysis->target_ac) /* FIXME: ni */ | |
1259 | if(analysis->query_builder || analysis->target_builder) /* FIXME: ni */ | |
976 | 1260 | g_error("Exhaustive alignment against server not implemented"); |
977 | 1261 | analysis->fasta_pipe = FastaPipe_create( |
978 | 1262 | query_fdb, target_fdb, |
982 | 1266 | Analysis_FastaPipe_Pair_query_func, |
983 | 1267 | Analysis_FastaPipe_Pair_target_func, |
984 | 1268 | FastaDB_Mask_ALL, |
985 | analysis->gam->translate_both); | |
1269 | analysis->gam->translate_both, | |
1270 | analysis->aas->use_revcomp); | |
986 | 1271 | analysis->curr_query = NULL; |
987 | 1272 | } else { /* Not exhaustive */ |
988 | 1273 | use_horizon = (analysis->aas->use_bigseq |
989 | || analysis->query_ac | |
990 | || analysis->target_ac)?FALSE:TRUE; | |
1274 | || analysis->query_builder | |
1275 | || analysis->target_builder)?FALSE:TRUE; | |
991 | 1276 | dna_hsp_param = dna_match |
992 | 1277 | ? HSP_Param_create(dna_match, use_horizon) |
993 | 1278 | : NULL; |
1025 | 1310 | = analysis->gam->gas->threshold; |
1026 | 1311 | } |
1027 | 1312 | /* Don't need HSP horizon for bigseq comparison */ |
1028 | if(analysis->query_ac || analysis->target_ac){ | |
1029 | if(analysis->query_ac && analysis->target_ac) | |
1313 | if(analysis->query_builder || analysis->target_builder){ | |
1314 | if(analysis->query_builder && analysis->target_builder) | |
1030 | 1315 | g_error("Server vs server comparison not impelemented"); |
1031 | 1316 | analysis->fasta_pipe = NULL; |
1032 | if(analysis->query_ac){ | |
1033 | Analysis_Client_set_probe_fdb(analysis->query_ac, target_fdb); | |
1317 | if(analysis->query_builder){ | |
1318 | Analysis_Builder_set_probe_fdb(analysis->query_builder, | |
1319 | target_fdb); | |
1034 | 1320 | } else { |
1035 | g_assert(analysis->target_ac); | |
1036 | Analysis_Client_set_probe_fdb(analysis->target_ac, query_fdb); | |
1321 | g_assert(analysis->target_builder); | |
1322 | Analysis_Builder_set_probe_fdb(analysis->target_builder, | |
1323 | query_fdb); | |
1037 | 1324 | } |
1038 | 1325 | } else { |
1039 | 1326 | if(analysis->aas->use_bigseq){ |
1048 | 1335 | Analysis_FastaPipe_Pair_query_func, |
1049 | 1336 | Analysis_FastaPipe_Pair_target_func, |
1050 | 1337 | FastaDB_Mask_ALL, |
1051 | analysis->gam->translate_both); | |
1338 | analysis->gam->translate_both, | |
1339 | analysis->aas->use_revcomp); | |
1052 | 1340 | analysis->curr_query = NULL; |
1053 | 1341 | } else { /* Use Seeder */ |
1054 | 1342 | analysis->scan_query = Analysis_decide_scan_query(query_fdb, |
1075 | 1363 | Analysis_FastaPipe_Seeder_term_func, |
1076 | 1364 | Analysis_FastaPipe_Seeder_query_func, |
1077 | 1365 | Analysis_FastaPipe_Seeder_target_func, |
1078 | FastaDB_Mask_ALL, analysis->gam->translate_both); | |
1366 | FastaDB_Mask_ALL, analysis->gam->translate_both, | |
1367 | analysis->aas->use_revcomp); | |
1079 | 1368 | } |
1080 | 1369 | } |
1081 | 1370 | } |
1084 | 1373 | if(target_fdb) |
1085 | 1374 | FastaDB_close(target_fdb); |
1086 | 1375 | /**/ |
1376 | if(expanded_query_path_list) | |
1377 | Analysis_path_list_destroy(expanded_query_path_list); | |
1378 | if(expanded_target_path_list) | |
1379 | Analysis_path_list_destroy(expanded_target_path_list); | |
1087 | 1380 | return analysis; |
1088 | 1381 | } |
1089 | 1382 | |
1090 | 1383 | void Analysis_destroy(Analysis *analysis){ |
1384 | JobQueue_destroy(analysis->job_queue); | |
1091 | 1385 | if(analysis->fasta_pipe) |
1092 | 1386 | FastaPipe_destroy(analysis->fasta_pipe); |
1093 | 1387 | if(analysis->curr_query) |
1098 | 1392 | BSAM_destroy(analysis->bsam); |
1099 | 1393 | if(analysis->comparison_param) |
1100 | 1394 | Comparison_Param_destroy(analysis->comparison_param); |
1395 | /* | |
1101 | 1396 | if(analysis->query_ac) |
1102 | 1397 | Analysis_Client_destroy(analysis->query_ac); |
1103 | 1398 | if(analysis->target_ac) |
1104 | 1399 | Analysis_Client_destroy(analysis->target_ac); |
1400 | */ | |
1401 | if(analysis->query_builder) | |
1402 | Analysis_Builder_destroy(analysis->query_builder); | |
1403 | if(analysis->target_builder) | |
1404 | Analysis_Builder_destroy(analysis->target_builder); | |
1105 | 1405 | GAM_destroy(analysis->gam); |
1106 | 1406 | g_free(analysis); |
1107 | 1407 | return; |
1108 | 1408 | } |
1109 | 1409 | |
1110 | 1410 | void Analysis_process(Analysis *analysis){ |
1111 | if(analysis->query_ac){ | |
1112 | Analysis_Client_process(analysis->query_ac, analysis, TRUE); | |
1113 | } else if(analysis->target_ac){ | |
1114 | Analysis_Client_process(analysis->target_ac, analysis, FALSE); | |
1411 | if(analysis->query_builder){ | |
1412 | Analysis_Builder_process(analysis->query_builder, analysis, TRUE); | |
1413 | } else if(analysis->target_builder){ | |
1414 | Analysis_Builder_process(analysis->target_builder, analysis, FALSE); | |
1115 | 1415 | } else { |
1116 | 1416 | while(FastaPipe_process(analysis->fasta_pipe, analysis)); |
1117 | 1417 | } |
1418 | if(analysis->job_queue) | |
1419 | JobQueue_complete(analysis->job_queue); | |
1118 | 1420 | GAM_report(analysis->gam); |
1119 | 1421 | return; |
1120 | 1422 | } |
2 | 2 | * Analysis module for exonerate * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
29 | 29 | #include "seeder.h" |
30 | 30 | #include "comparison.h" |
31 | 31 | #include "socket.h" |
32 | #include "jobqueue.h" | |
32 | 33 | |
33 | 34 | typedef struct { |
34 | 35 | gboolean use_exhaustive; |
35 | 36 | gboolean use_bigseq; |
37 | gboolean use_revcomp; | |
36 | 38 | gchar *force_scan; |
37 | 39 | gint saturate_threshold; |
38 | 40 | gchar *custom_server_command; |
41 | gint thread_count; | |
39 | 42 | } Analysis_ArgumentSet; |
40 | 43 | |
41 | 44 | Analysis_ArgumentSet *Analysis_ArgumentSet_create(Argument *arg); |
43 | 46 | /**/ |
44 | 47 | |
45 | 48 | typedef struct { |
46 | SocketClient *sc; | |
47 | 49 | gint verbosity; |
50 | gint ref_count; | |
48 | 51 | Alphabet *server_alphabet; |
49 | 52 | gboolean is_masked; |
50 | 53 | guint64 num_seqs; |
51 | 54 | guint64 max_seq_len; |
52 | 55 | guint64 total_seq_len; |
53 | 56 | /**/ |
57 | SocketClient *sc; | |
54 | 58 | FastaDB *probe_fdb; |
55 | 59 | Sequence *curr_query; |
56 | 60 | Sequence **seq_cache; |
57 | 61 | } Analysis_Client; |
58 | 62 | |
59 | 63 | typedef struct { |
64 | gchar *name; | |
65 | gint priority; /* used for job queues */ | |
66 | struct Analysis_Builder *ab; | |
67 | } Analysis_Server; | |
68 | ||
69 | typedef struct Analysis_Builder { | |
70 | gint verbosity; | |
71 | FastaDB *probe_fdb; | |
72 | GPtrArray *server_list; /* Contains Analysis_Server objects */ | |
73 | Alphabet_Type server_type; | |
74 | struct Analysis *analysis; | |
75 | gboolean swap_chains; | |
76 | } Analysis_Builder; | |
77 | ||
78 | typedef struct Analysis { | |
60 | 79 | FastaPipe *fasta_pipe; |
61 | 80 | GAM *gam; |
62 | 81 | BSAM *bsam; |
66 | 85 | gboolean scan_query; |
67 | 86 | Comparison_Param *comparison_param; |
68 | 87 | gint verbosity; |
88 | /* | |
69 | 89 | Analysis_Client *query_ac; |
70 | 90 | Analysis_Client *target_ac; |
91 | */ | |
92 | Analysis_Builder *query_builder; | |
93 | Analysis_Builder *target_builder; | |
94 | JobQueue *job_queue; | |
71 | 95 | } Analysis; |
72 | 96 | |
73 | 97 | Analysis *Analysis_create( |
2 | 2 | * Analysis module for exonerate * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * BSAM: Big Sequence Alignment Manager * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * BSAM: Big Sequence Alignment Manager * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * BSAM: Big Sequence Alignment Manager * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * GAM: Gapped Alignment Manager * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
161 | 161 | |
162 | 162 | static void GAM_display_alignment(GAM *gam, |
163 | 163 | Alignment *alignment, Sequence *query, Sequence *target, |
164 | gint result_id, gint rank, gpointer user_data, FILE *fp); | |
165 | ||
166 | #if 0 | |
167 | static FILE *GAM_bestn_tmp_file = NULL; | |
168 | ||
169 | static void GAM_StoredResult_print(const gchar *string){ | |
170 | g_assert(GAM_bestn_tmp_file); | |
171 | fprintf(GAM_bestn_tmp_file, "%s", string); | |
172 | return; | |
173 | } | |
174 | #endif /* 0 */ | |
164 | gint result_id, gint rank, | |
165 | gpointer user_data, gpointer self_data, FILE *fp); | |
175 | 166 | |
176 | 167 | static GAM_StoredResult *GAM_StoredResult_create(GAM *gam, |
177 | 168 | Sequence *query, Sequence *target, |
178 | Alignment *alignment, gpointer user_data){ | |
169 | Alignment *alignment, | |
170 | gpointer user_data, gpointer self_data){ | |
179 | 171 | register GAM_StoredResult *gsr = g_new(GAM_StoredResult, 1); |
180 | /* register GPrintFunc prev_print_func; */ | |
181 | 172 | gsr->score = alignment->score; |
182 | 173 | gsr->pos = ftell(gam->bestn_tmp_file); |
183 | /* | |
184 | GAM_bestn_tmp_file = gam->bestn_tmp_file; | |
185 | prev_print_func = g_set_print_handler(GAM_StoredResult_print); | |
186 | */ | |
187 | 174 | GAM_display_alignment(gam, alignment, query, target, |
188 | 0, -1, user_data, gam->bestn_tmp_file); | |
189 | /* g_set_print_handler(prev_print_func); */ | |
175 | 0, -1, user_data, self_data, gam->bestn_tmp_file); | |
190 | 176 | gsr->len = ftell(gam->bestn_tmp_file) |
191 | 177 | - gsr->pos; |
192 | 178 | return gsr; |
267 | 253 | gam_result->query, |
268 | 254 | gam_result->target, |
269 | 255 | alignment, |
270 | gam_result->user_data); | |
256 | gam_result->user_data, | |
257 | gam_result->self_data); | |
271 | 258 | PQueue_push(gqr->pq, gsr); |
272 | 259 | return; |
273 | 260 | } |
336 | 323 | /**/ |
337 | 324 | |
338 | 325 | static gboolean GAM_QueryResult_report_traverse_func(gpointer data, |
339 | gpointer user_data){ | |
326 | gpointer user_data){ | |
340 | 327 | register GAM_StoredResult *gsr = data; |
341 | 328 | register GPtrArray *result_list = user_data; |
342 | 329 | g_ptr_array_add(result_list, gsr); |
423 | 410 | register GAM *gam = g_new0(GAM, 1); |
424 | 411 | register gint i; |
425 | 412 | register C4_Span *span; |
426 | gam->ref_count = 1; | |
413 | gam->thread_ref = ThreadRef_create(); | |
427 | 414 | gam->dna_submat = Submat_share(dna_submat); |
428 | 415 | gam->protein_submat = Submat_share(protein_submat); |
429 | 416 | gam->translate = Translate_share(translate); |
430 | 417 | gam->gas = GAM_ArgumentSet_create(NULL); |
431 | 418 | if(use_exhaustive && gam->gas->use_subopt) |
432 | 419 | g_warning("Exhaustively generating suboptimal alignments" |
433 | " will be VERY SLOW"); | |
420 | " will be VERY SLOW: use -S no"); | |
434 | 421 | gam->query_type = query_type; |
435 | 422 | gam->target_type = target_type; |
436 | 423 | if(gam->gas->best_n){ |
445 | 432 | gam->model = Model_Type_get_model(gam->gas->type, |
446 | 433 | query_type, target_type); |
447 | 434 | if((!use_exhaustive) && (!C4_Model_is_local(gam->model))) |
448 | g_error("Cannot perform heuristic alignment using non-local model"); | |
435 | g_error("Cannot perform heuristic alignments using non-local models: use -E"); | |
449 | 436 | gam->match_list = GAM_build_match_list(gam->model); |
450 | 437 | if(use_exhaustive){ |
451 | 438 | gam->optimal = Optimal_create(gam->model, NULL, |
479 | 466 | if(gam->max_target_span < span->max_target) |
480 | 467 | gam->max_target_span = span->max_target; |
481 | 468 | } |
469 | #ifdef USE_PTHREADS | |
470 | pthread_mutex_init(&gam->gam_lock, NULL); | |
471 | #endif /* USE_PTHREADS */ | |
482 | 472 | return gam; |
483 | 473 | } |
484 | 474 | |
485 | 475 | GAM *GAM_share(GAM *gam){ |
486 | 476 | g_assert(gam); |
487 | gam->ref_count++; | |
477 | ThreadRef_share(gam->thread_ref); | |
488 | 478 | return gam; |
489 | 479 | } |
490 | 480 | |
556 | 546 | |
557 | 547 | void GAM_destroy(GAM *gam){ |
558 | 548 | g_assert(gam); |
559 | if(--gam->ref_count) | |
549 | if(ThreadRef_destroy(gam->thread_ref)) | |
560 | 550 | return; |
551 | #ifdef USE_PTHREADS | |
552 | pthread_mutex_destroy(&gam->gam_lock); | |
553 | #endif /* USE_PTHREADS */ | |
561 | 554 | g_assert(gam->model); |
562 | 555 | g_ptr_array_free(gam->match_list, TRUE); |
563 | 556 | C4_Model_destroy(gam->model); |
638 | 631 | gam_result->target = Sequence_share(target); |
639 | 632 | gam_result->user_data = Model_Type_create_data(gam->gas->type, |
640 | 633 | query, target); |
634 | gam_result->self_data = Model_Type_create_data(gam->gas->type, | |
635 | query, query); | |
641 | 636 | gam_result->subopt = SubOpt_create(query->len, target->len); |
642 | 637 | return gam_result; |
643 | 638 | } |
1107 | 1102 | /* Keep HSPs marked as keep */ |
1108 | 1103 | hsp_id = GAM_Result_geneseed_select(comparison->dna_hspset, |
1109 | 1104 | gsd.fwd_keep, gsd.rev_keep, hsp_id); |
1110 | hsp_id = GAM_Result_geneseed_select(comparison->protein_hspset, gsd.fwd_keep, gsd.rev_keep, hsp_id); | |
1105 | hsp_id = GAM_Result_geneseed_select(comparison->protein_hspset, | |
1106 | gsd.fwd_keep, gsd.rev_keep, hsp_id); | |
1111 | 1107 | hsp_id = GAM_Result_geneseed_select(comparison->codon_hspset, |
1112 | 1108 | gsd.fwd_keep, gsd.rev_keep, hsp_id); |
1113 | 1109 | /**/ |
1151 | 1147 | /* Raise score threshold to geneseed |
1152 | 1148 | * to prevent low-scoring subopt alignments. |
1153 | 1149 | */ |
1150 | GAM_lock(gam); | |
1154 | 1151 | if(gam->gas->threshold < has->geneseed_threshold) |
1155 | 1152 | gam->gas->threshold = has->geneseed_threshold; |
1153 | GAM_unlock(gam); | |
1156 | 1154 | GAM_Result_geneseed_filter(gam, comparison); |
1157 | 1155 | } |
1158 | 1156 | if(!Comparison_has_hsps(comparison)) |
1178 | 1176 | Sequence *target){ |
1179 | 1177 | register Alignment *alignment; |
1180 | 1178 | register C4_Score threshold; |
1181 | register GAM_Result *gam_result = GAM_Result_create(gam, | |
1182 | query, target); | |
1179 | register GAM_Result *gam_result; | |
1183 | 1180 | register OPair *opair; |
1184 | 1181 | g_assert(gam->optimal); |
1182 | GAM_lock(gam); | |
1183 | Sequence_lock(query); | |
1184 | Sequence_lock(target); | |
1185 | gam_result = GAM_Result_create(gam, query, target); | |
1186 | Sequence_unlock(query); | |
1187 | Sequence_unlock(target); | |
1185 | 1188 | opair = OPair_create(gam->optimal, gam_result->subopt, |
1186 | 1189 | query->len, target->len, gam_result->user_data); |
1190 | GAM_unlock(gam); | |
1187 | 1191 | if(gam->verbosity > 1) |
1188 | 1192 | g_message("Exhaustive alignment of [%s] [%s]", |
1189 | query->id, target->id); | |
1193 | query->id, target->id); | |
1190 | 1194 | /**/ |
1191 | 1195 | do { |
1196 | GAM_lock(gam); | |
1192 | 1197 | threshold = GAM_get_query_threshold(gam, query); |
1198 | GAM_unlock(gam); | |
1193 | 1199 | alignment = OPair_next_path(opair, threshold); |
1194 | 1200 | if(!alignment) |
1195 | 1201 | break; |
1223 | 1229 | } |
1224 | 1230 | Model_Type_destroy_data(gam_result->gam->gas->type, |
1225 | 1231 | gam_result->user_data); |
1232 | Model_Type_destroy_data(gam_result->gam->gas->type, | |
1233 | gam_result->self_data); | |
1226 | 1234 | Sequence_destroy(gam_result->query); |
1227 | 1235 | Sequence_destroy(gam_result->target); |
1236 | GAM_lock(gam_result->gam); | |
1228 | 1237 | GAM_destroy(gam_result->gam); |
1229 | 1238 | SubOpt_destroy(gam_result->subopt); |
1239 | GAM_unlock(gam_result->gam); | |
1230 | 1240 | g_free(gam_result); |
1231 | 1241 | return; |
1232 | 1242 | } |
1233 | 1243 | |
1234 | 1244 | static void GAM_display_alignment(GAM *gam, Alignment *alignment, |
1235 | 1245 | Sequence *query, Sequence *target, |
1236 | gint result_id, gint rank, gpointer user_data, FILE *fp){ | |
1246 | gint result_id, gint rank, | |
1247 | gpointer user_data, gpointer self_data, FILE *fp){ | |
1237 | 1248 | if(gam->gas->show_alignment) |
1238 | 1249 | Alignment_display(alignment, query, target, |
1239 | 1250 | gam->dna_submat, gam->protein_submat, |
1245 | 1256 | if(gam->gas->show_vulgar) |
1246 | 1257 | Alignment_display_vulgar(alignment, query, target, fp); |
1247 | 1258 | if(gam->gas->show_query_gff) |
1248 | Alignment_display_gff(alignment, query, target, | |
1249 | TRUE, FALSE, result_id, fp); | |
1259 | Alignment_display_gff(alignment, query, target, gam->translate, | |
1260 | TRUE, FALSE, result_id, user_data, fp); | |
1250 | 1261 | if(gam->gas->show_target_gff) |
1251 | Alignment_display_gff(alignment, query, target, FALSE, | |
1252 | Model_Type_has_genomic_target(gam->gas->type), result_id, fp); | |
1262 | Alignment_display_gff(alignment, query, target, gam->translate, | |
1263 | FALSE, Model_Type_has_genomic_target(gam->gas->type), | |
1264 | result_id, user_data, fp); | |
1253 | 1265 | if(gam->gas->ryo) |
1254 | 1266 | Alignment_display_ryo(alignment, query, target, |
1255 | 1267 | gam->gas->ryo, gam->translate, rank, |
1256 | user_data, fp); | |
1268 | user_data, self_data, fp); | |
1257 | 1269 | fflush(fp); |
1258 | 1270 | return; |
1259 | 1271 | } |
1266 | 1278 | alignment = gam_result->alignment_list->pdata[i]; |
1267 | 1279 | GAM_display_alignment(gam_result->gam, alignment, |
1268 | 1280 | gam_result->query, gam_result->target, |
1269 | i+1, 0, gam_result->user_data, stdout); | |
1281 | i+1, 0, gam_result->user_data, gam_result->self_data, stdout); | |
1270 | 1282 | } |
1271 | 1283 | return; |
1272 | 1284 | } |
1274 | 1286 | void GAM_Result_submit(GAM_Result *gam_result){ |
1275 | 1287 | register GAM_QueryResult *gqr; |
1276 | 1288 | g_assert(gam_result); |
1289 | GAM_lock(gam_result->gam); | |
1277 | 1290 | if(gam_result->gam->gas->best_n){ |
1278 | 1291 | gqr = g_tree_lookup(gam_result->gam->bestn_tree, |
1279 | 1292 | gam_result->query->id); |
1289 | 1302 | } else { |
1290 | 1303 | GAM_Result_display(gam_result); |
1291 | 1304 | } |
1305 | GAM_unlock(gam_result->gam); | |
1306 | return; | |
1307 | } | |
1308 | ||
1309 | void GAM_lock(GAM *gam){ | |
1310 | #ifdef USE_PTHREADS | |
1311 | pthread_mutex_lock(&gam->gam_lock); | |
1312 | #endif /* USE_PTHREADS */ | |
1313 | return; | |
1314 | } | |
1315 | ||
1316 | void GAM_unlock(GAM *gam){ | |
1317 | #ifdef USE_PTHREADS | |
1318 | pthread_mutex_unlock(&gam->gam_lock); | |
1319 | #endif /* USE_PTHREADS */ | |
1292 | 1320 | return; |
1293 | 1321 | } |
1294 | 1322 |
2 | 2 | * GAM: Gapped Alignment Manager * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
21 | 21 | |
22 | 22 | #include <glib.h> |
23 | 23 | |
24 | #ifdef USE_PTHREADS | |
25 | #include <pthread.h> | |
26 | #endif /* USE_PTHREADS */ | |
27 | ||
24 | 28 | #include "sequence.h" |
25 | 29 | #include "c4.h" |
26 | 30 | #include "heuristic.h" |
35 | 39 | #include "comparison.h" |
36 | 40 | #include "sdp.h" |
37 | 41 | #include "subopt.h" |
42 | #include "threadref.h" | |
38 | 43 | |
39 | 44 | typedef enum { |
40 | 45 | GAM_Refinement_NONE, |
83 | 88 | } GAM_QueryInfo; |
84 | 89 | |
85 | 90 | typedef struct { |
86 | gint ref_count; | |
91 | ThreadRef *thread_ref; | |
87 | 92 | Alphabet_Type query_type; |
88 | 93 | Alphabet_Type target_type; |
89 | 94 | C4_Model *model; |
105 | 110 | PQueueSet *pqueue_set; |
106 | 111 | gint max_query_span; |
107 | 112 | gint max_target_span; |
113 | #ifdef USE_PTHREADS | |
114 | pthread_mutex_t gam_lock; | |
115 | #endif /* USE_PTHREADS */ | |
108 | 116 | } GAM; |
109 | 117 | |
110 | 118 | GAM *GAM_create(Alphabet_Type query_type, Alphabet_Type target_type, |
122 | 130 | Sequence *target; |
123 | 131 | GPtrArray *alignment_list; |
124 | 132 | gpointer user_data; |
133 | gpointer self_data; | |
125 | 134 | SubOpt *subopt; |
126 | 135 | } GAM_Result; |
127 | 136 | |
141 | 150 | void GAM_Result_destroy(GAM_Result *gam_result); |
142 | 151 | void GAM_Result_submit(GAM_Result *gam_result); |
143 | 152 | |
153 | void GAM_lock(GAM *gam); | |
154 | void GAM_unlock(GAM *gam); | |
155 | ||
144 | 156 | #ifdef __cplusplus |
145 | 157 | } |
146 | 158 | #endif /* __cplusplus */ |
2 | 2 | * GAM: Gapped Alignment Manager * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
25 | 25 | $(top_srcdir)/src/sequence/translate.o \ |
26 | 26 | $(top_srcdir)/src/general/argument.o \ |
27 | 27 | $(top_srcdir)/src/general/lineparse.o \ |
28 | $(top_srcdir)/src/general/threadref.o \ | |
28 | 29 | -lm |
29 | 30 | |
30 | 31 | ALIGNMENT_OBJ = $(top_srcdir)/src/comparison/match.o \ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
85 | 86 | INCLUDES = -I$(top_srcdir)/src/c4 -I$(top_srcdir)/src/bsdp -I$(top_srcdir)/src/sdp -I$(top_srcdir)/src/sequence -I$(top_srcdir)/src/general -I$(top_srcdir)/src/comparison -I$(top_srcdir)/src/struct -DSOURCE_ROOT_DIR="\"@source_root_dir@\"" -DGLIB_CFLAGS="\"@glib_cflags@\"" |
86 | 87 | |
87 | 88 | |
88 | SEQUENCE_OBJ = $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o -lm | |
89 | SEQUENCE_OBJ = $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o $(top_srcdir)/src/general/threadref.o -lm | |
89 | 90 | |
90 | 91 | |
91 | 92 | ALIGNMENT_OBJ = $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/sequence/submat.o $(SEQUENCE_OBJ) |
186 | 187 | $(top_srcdir)/src/sequence/splice.o \ |
187 | 188 | $(top_srcdir)/src/sequence/translate.o \ |
188 | 189 | $(top_srcdir)/src/general/argument.o \ |
189 | $(top_srcdir)/src/general/lineparse.o | |
190 | $(top_srcdir)/src/general/lineparse.o \ | |
191 | $(top_srcdir)/src/general/threadref.o | |
190 | 192 | edit_distance_test_LDFLAGS = |
191 | 193 | affine_test_OBJECTS = affine.test.o affine.o ungapped.o |
192 | 194 | affine_test_DEPENDENCIES = $(top_srcdir)/src/struct/slist.o \ |
205 | 207 | $(top_srcdir)/src/sequence/splice.o \ |
206 | 208 | $(top_srcdir)/src/sequence/translate.o \ |
207 | 209 | $(top_srcdir)/src/general/argument.o \ |
208 | $(top_srcdir)/src/general/lineparse.o | |
210 | $(top_srcdir)/src/general/lineparse.o \ | |
211 | $(top_srcdir)/src/general/threadref.o | |
209 | 212 | affine_test_LDFLAGS = |
210 | 213 | protein2dna_test_OBJECTS = protein2dna.test.o protein2dna.o affine.o \ |
211 | 214 | ungapped.o frameshift.o |
225 | 228 | $(top_srcdir)/src/sequence/splice.o \ |
226 | 229 | $(top_srcdir)/src/sequence/translate.o \ |
227 | 230 | $(top_srcdir)/src/general/argument.o \ |
228 | $(top_srcdir)/src/general/lineparse.o | |
231 | $(top_srcdir)/src/general/lineparse.o \ | |
232 | $(top_srcdir)/src/general/threadref.o | |
229 | 233 | protein2dna_test_LDFLAGS = |
230 | 234 | ner_test_OBJECTS = ner.test.o ner.o affine.o ungapped.o |
231 | 235 | ner_test_DEPENDENCIES = $(top_srcdir)/src/struct/slist.o \ |
244 | 248 | $(top_srcdir)/src/sequence/splice.o \ |
245 | 249 | $(top_srcdir)/src/sequence/translate.o \ |
246 | 250 | $(top_srcdir)/src/general/argument.o \ |
247 | $(top_srcdir)/src/general/lineparse.o | |
251 | $(top_srcdir)/src/general/lineparse.o \ | |
252 | $(top_srcdir)/src/general/threadref.o | |
248 | 253 | ner_test_LDFLAGS = |
249 | 254 | est2genome_test_OBJECTS = est2genome.test.o est2genome.o affine.o \ |
250 | 255 | ungapped.o intron.o |
264 | 269 | $(top_srcdir)/src/sequence/splice.o \ |
265 | 270 | $(top_srcdir)/src/sequence/translate.o \ |
266 | 271 | $(top_srcdir)/src/general/argument.o \ |
267 | $(top_srcdir)/src/general/lineparse.o | |
272 | $(top_srcdir)/src/general/lineparse.o \ | |
273 | $(top_srcdir)/src/general/threadref.o | |
268 | 274 | est2genome_test_LDFLAGS = |
269 | 275 | ungapped_test_OBJECTS = ungapped.test.o ungapped.o |
270 | 276 | ungapped_test_DEPENDENCIES = $(top_srcdir)/src/struct/slist.o \ |
283 | 289 | $(top_srcdir)/src/sequence/splice.o \ |
284 | 290 | $(top_srcdir)/src/sequence/translate.o \ |
285 | 291 | $(top_srcdir)/src/general/argument.o \ |
286 | $(top_srcdir)/src/general/lineparse.o | |
292 | $(top_srcdir)/src/general/lineparse.o \ | |
293 | $(top_srcdir)/src/general/threadref.o | |
287 | 294 | ungapped_test_LDFLAGS = |
288 | 295 | intron_test_OBJECTS = intron.test.o intron.o |
289 | 296 | intron_test_DEPENDENCIES = $(top_srcdir)/src/struct/slist.o \ |
302 | 309 | $(top_srcdir)/src/sequence/splice.o \ |
303 | 310 | $(top_srcdir)/src/sequence/translate.o \ |
304 | 311 | $(top_srcdir)/src/general/argument.o \ |
305 | $(top_srcdir)/src/general/lineparse.o | |
312 | $(top_srcdir)/src/general/lineparse.o \ | |
313 | $(top_srcdir)/src/general/threadref.o | |
306 | 314 | intron_test_LDFLAGS = |
307 | 315 | protein2genome_test_OBJECTS = protein2genome.test.o protein2genome.o \ |
308 | 316 | protein2dna.o ungapped.o intron.o affine.o frameshift.o phase.o |
322 | 330 | $(top_srcdir)/src/sequence/splice.o \ |
323 | 331 | $(top_srcdir)/src/sequence/translate.o \ |
324 | 332 | $(top_srcdir)/src/general/argument.o \ |
325 | $(top_srcdir)/src/general/lineparse.o | |
333 | $(top_srcdir)/src/general/lineparse.o \ | |
334 | $(top_srcdir)/src/general/threadref.o | |
326 | 335 | protein2genome_test_LDFLAGS = |
327 | 336 | coding2coding_test_OBJECTS = coding2coding.test.o coding2coding.o \ |
328 | 337 | affine.o ungapped.o frameshift.o |
342 | 351 | $(top_srcdir)/src/sequence/splice.o \ |
343 | 352 | $(top_srcdir)/src/sequence/translate.o \ |
344 | 353 | $(top_srcdir)/src/general/argument.o \ |
345 | $(top_srcdir)/src/general/lineparse.o | |
354 | $(top_srcdir)/src/general/lineparse.o \ | |
355 | $(top_srcdir)/src/general/threadref.o | |
346 | 356 | coding2coding_test_LDFLAGS = |
347 | 357 | frameshift_test_OBJECTS = frameshift.test.o frameshift.o |
348 | 358 | frameshift_test_DEPENDENCIES = $(top_srcdir)/src/struct/slist.o \ |
361 | 371 | $(top_srcdir)/src/sequence/splice.o \ |
362 | 372 | $(top_srcdir)/src/sequence/translate.o \ |
363 | 373 | $(top_srcdir)/src/general/argument.o \ |
364 | $(top_srcdir)/src/general/lineparse.o | |
374 | $(top_srcdir)/src/general/lineparse.o \ | |
375 | $(top_srcdir)/src/general/threadref.o | |
365 | 376 | frameshift_test_LDFLAGS = |
366 | 377 | coding2genome_test_OBJECTS = coding2genome.test.o coding2genome.o \ |
367 | 378 | coding2coding.o affine.o ungapped.o frameshift.o intron.o phase.o |
381 | 392 | $(top_srcdir)/src/sequence/splice.o \ |
382 | 393 | $(top_srcdir)/src/sequence/translate.o \ |
383 | 394 | $(top_srcdir)/src/general/argument.o \ |
384 | $(top_srcdir)/src/general/lineparse.o | |
395 | $(top_srcdir)/src/general/lineparse.o \ | |
396 | $(top_srcdir)/src/general/threadref.o | |
385 | 397 | coding2genome_test_LDFLAGS = |
386 | 398 | cdna2genome_test_OBJECTS = cdna2genome.test.o cdna2genome.o affine.o \ |
387 | 399 | ungapped.o frameshift.o intron.o phase.o coding2coding.o \ |
402 | 414 | $(top_srcdir)/src/sequence/splice.o \ |
403 | 415 | $(top_srcdir)/src/sequence/translate.o \ |
404 | 416 | $(top_srcdir)/src/general/argument.o \ |
405 | $(top_srcdir)/src/general/lineparse.o | |
417 | $(top_srcdir)/src/general/lineparse.o \ | |
418 | $(top_srcdir)/src/general/threadref.o | |
406 | 419 | cdna2genome_test_LDFLAGS = |
407 | 420 | genome2genome_test_OBJECTS = genome2genome.test.o genome2genome.o \ |
408 | 421 | coding2coding.o affine.o ungapped.o frameshift.o intron.o phase.o \ |
423 | 436 | $(top_srcdir)/src/sequence/splice.o \ |
424 | 437 | $(top_srcdir)/src/sequence/translate.o \ |
425 | 438 | $(top_srcdir)/src/general/argument.o \ |
426 | $(top_srcdir)/src/general/lineparse.o | |
439 | $(top_srcdir)/src/general/lineparse.o \ | |
440 | $(top_srcdir)/src/general/threadref.o | |
427 | 441 | genome2genome_test_LDFLAGS = |
428 | 442 | phase_test_OBJECTS = phase.test.o phase.o intron.o |
429 | 443 | phase_test_DEPENDENCIES = $(top_srcdir)/src/struct/slist.o \ |
442 | 456 | $(top_srcdir)/src/sequence/splice.o \ |
443 | 457 | $(top_srcdir)/src/sequence/translate.o \ |
444 | 458 | $(top_srcdir)/src/general/argument.o \ |
445 | $(top_srcdir)/src/general/lineparse.o | |
459 | $(top_srcdir)/src/general/lineparse.o \ | |
460 | $(top_srcdir)/src/general/threadref.o | |
446 | 461 | phase_test_LDFLAGS = |
447 | 462 | modeltype_test_OBJECTS = modeltype.test.o modeltype.o ungapped.o \ |
448 | 463 | affine.o est2genome.o ner.o protein2dna.o protein2genome.o \ |
464 | 479 | $(top_srcdir)/src/sequence/splice.o \ |
465 | 480 | $(top_srcdir)/src/sequence/translate.o \ |
466 | 481 | $(top_srcdir)/src/general/argument.o \ |
467 | $(top_srcdir)/src/general/lineparse.o | |
482 | $(top_srcdir)/src/general/lineparse.o \ | |
483 | $(top_srcdir)/src/general/threadref.o | |
468 | 484 | modeltype_test_LDFLAGS = |
469 | 485 | bootstrapper_OBJECTS = bootstrapper.o modeltype.o ungapped.o affine.o \ |
470 | 486 | est2genome.o ner.o protein2dna.o protein2genome.o coding2coding.o \ |
492 | 508 | $(top_srcdir)/src/sequence/splice.o \ |
493 | 509 | $(top_srcdir)/src/sequence/translate.o \ |
494 | 510 | $(top_srcdir)/src/general/argument.o \ |
495 | $(top_srcdir)/src/general/lineparse.o | |
511 | $(top_srcdir)/src/general/lineparse.o \ | |
512 | $(top_srcdir)/src/general/threadref.o | |
496 | 513 | bootstrapper_LDFLAGS = |
497 | 514 | CFLAGS = @CFLAGS@ |
498 | 515 | COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
2 | 2 | * Module for various affine gapped models * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module for various affine gapped models * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module for various affine gapped models * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * bootstrapper: required prior to static model linking * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * cDNA <-> genomic alignment model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * cDNA <-> genomic alignment model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * cDNA <-> genomic alignment model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
31 | 31 | query->len, target->len); |
32 | 32 | score = Optimal_find_score(optimal, region, cd2gd, NULL); |
33 | 33 | g_message("Score is [%d]", score); |
34 | g_assert(score == 1290); | |
34 | g_assert(score == 1281); | |
35 | 35 | alignment = Optimal_find_path(optimal, region, cd2gd, |
36 | 36 | C4_IMPOSSIBLY_LOW_SCORE, NULL); |
37 | 37 | g_message("Alignment score is [%d]", alignment->score); |
2 | 2 | * Coding DNA comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Coding DNA comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Coding DNA comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Coding <-> Genome comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Coding <-> Genome comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Coding <-> Genome comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * edit distance model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * edit distance model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * edit distance model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module for EST <-> genome alignments * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module for EST <-> genome alignments * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module for EST <-> genome alignments * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
59 | 59 | e2gd = EST2Genome_Data_create(query, target); |
60 | 60 | score = Optimal_find_score(optimal, region, e2gd, NULL); |
61 | 61 | g_message("Score is [%d]", score); |
62 | g_assert(score == 159); | |
62 | g_assert(score == 157); | |
63 | 63 | /**/ |
64 | 64 | alignment = Optimal_find_path(optimal, region, e2gd, |
65 | 65 | C4_IMPOSSIBLY_LOW_SCORE, NULL); |
2 | 2 | * Module for frameshift modelling * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module for frameshift modelling * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module for frameshift modelling * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Genome <-> Genome comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Genome <-> Genome comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Genome <-> Genome comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module of splice site and intron modelling * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module of splice site and intron modelling * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module for splice site and intron modelling * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Interface for different types of alignment model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Interface for different types of alignment model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Interface for different types of alignment model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Model for alignments with non-equivalenced regions * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Model for alignments with non-equivalenced regions * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Model for alignments with non-equivalenced regions * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Model for phased introns. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Model for phased introns. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Model for phased introns. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Protein <-> DNA comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Protein <-> DNA comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Protein <-> DNA comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Protein <-> Genome comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Protein <-> Genome comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Protein <-> Genome comparison model * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
29 | 29 | register Region *region = Region_create(0, 0, |
30 | 30 | query->len, target->len); |
31 | 31 | score = Optimal_find_score(optimal, region, p2gd, NULL); |
32 | g_message("Score is [%d] (expect 131)", score); | |
33 | g_assert(score == 129); | |
32 | g_message("Score is [%d] (expect 125)", score); | |
33 | g_assert(score == 125); | |
34 | 34 | alignment = Optimal_find_path(optimal, region, p2gd, |
35 | 35 | C4_IMPOSSIBLY_LOW_SCORE, NULL); |
36 | 36 | g_message("Alignment score is [%d]", alignment->score); |
2 | 2 | * Module for various ungapped alignment models * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module for various ungapped alignment models * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Module for various ungapped alignment models * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
11 | 11 | -I$(top_srcdir)/src/hub \ |
12 | 12 | -I$(top_srcdir)/src/general \ |
13 | 13 | -DHOSTTYPE="\"@host@\"" \ |
14 | -DSOURCE_ROOT_DIR="\"@source_root_dir@\"" | |
14 | -DSOURCE_ROOT_DIR="\"@source_root_dir@\"" \ | |
15 | -DCUSTOM_GUINT64_FORMAT="\"@custom_guint64_format@\"" | |
15 | 16 | |
16 | 17 | # Missing viterb.o and scheduler.o so codegen versions may be substituted |
17 | 18 | C4_OBJECTS = $(top_srcdir)/src/c4/c4.o \ |
57 | 58 | $(top_srcdir)/src/general/argument.o \ |
58 | 59 | $(top_srcdir)/src/general/lineparse.o \ |
59 | 60 | $(top_srcdir)/src/general/socket.o \ |
61 | $(top_srcdir)/src/general/jobqueue.o \ | |
60 | 62 | $(top_srcdir)/src/comparison/match.o \ |
61 | 63 | $(top_srcdir)/src/sequence/submat.o \ |
62 | 64 | $(top_srcdir)/src/sequence/codonsubmat.o |
95 | 97 | $(top_srcdir)/src/hub/bsam.o \ |
96 | 98 | $(top_srcdir)/src/hub/analysis.o \ |
97 | 99 | $(top_srcdir)/src/general/compoundfile.o \ |
100 | $(top_srcdir)/src/general/threadref.o \ | |
98 | 101 | $(C4_OBJECTS) |
99 | 102 | |
100 | 103 | exonerate_SOURCES = exonerate.c |
156 | 159 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
157 | 160 | $(top_srcdir)/src/general/compoundfile.o \ |
158 | 161 | $(top_srcdir)/src/general/lineparse.o \ |
162 | $(top_srcdir)/src/general/threadref.o \ | |
159 | 163 | -lm |
160 | 164 | |
161 | 165 | CLEANFILES = $(EXTRA_exonerate_SOURCES) @codegen_extra_sources@ \ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
79 | 80 | |
80 | 81 | bin_PROGRAMS = exonerate ipcress exonerate-server |
81 | 82 | |
82 | INCLUDES = -I$(top_srcdir)/src/sequence -I$(top_srcdir)/src/database -I$(top_srcdir)/src/comparison -I$(top_srcdir)/src/struct -I$(top_srcdir)/src/c4 -I$(top_srcdir)/src/bsdp -I$(top_srcdir)/src/sdp -I$(top_srcdir)/src/model -I$(top_srcdir)/src/hub -I$(top_srcdir)/src/general -DHOSTTYPE="\"@host@\"" -DSOURCE_ROOT_DIR="\"@source_root_dir@\"" | |
83 | INCLUDES = -I$(top_srcdir)/src/sequence -I$(top_srcdir)/src/database -I$(top_srcdir)/src/comparison -I$(top_srcdir)/src/struct -I$(top_srcdir)/src/c4 -I$(top_srcdir)/src/bsdp -I$(top_srcdir)/src/sdp -I$(top_srcdir)/src/model -I$(top_srcdir)/src/hub -I$(top_srcdir)/src/general -DHOSTTYPE="\"@host@\"" -DSOURCE_ROOT_DIR="\"@source_root_dir@\"" -DCUSTOM_GUINT64_FORMAT="\"@custom_guint64_format@\"" | |
83 | 84 | |
84 | 85 | |
85 | 86 | # Missing viterb.o and scheduler.o so codegen versions may be substituted |
86 | C4_OBJECTS = $(top_srcdir)/src/c4/c4.o $(top_srcdir)/src/c4/codegen.o $(top_srcdir)/src/c4/cgutil.o $(top_srcdir)/src/c4/opair.o $(top_srcdir)/src/c4/alignment.o $(top_srcdir)/src/c4/optimal.o $(top_srcdir)/src/c4/layout.o $(top_srcdir)/src/c4/region.o $(top_srcdir)/src/c4/subopt.o $(top_srcdir)/src/bsdp/bsdp.o $(top_srcdir)/src/bsdp/sar.o $(top_srcdir)/src/bsdp/heuristic.o $(top_srcdir)/src/bsdp/hpair.o $(top_srcdir)/src/sdp/boundary.o $(top_srcdir)/src/sdp/sdp.o $(top_srcdir)/src/sdp/lookahead.o $(top_srcdir)/src/sdp/straceback.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/struct/slist.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/model/affine.o $(top_srcdir)/src/model/est2genome.o $(top_srcdir)/src/model/ner.o $(top_srcdir)/src/model/protein2dna.o $(top_srcdir)/src/model/protein2genome.o $(top_srcdir)/src/model/coding2coding.o $(top_srcdir)/src/model/coding2genome.o $(top_srcdir)/src/model/cdna2genome.o $(top_srcdir)/src/model/genome2genome.o $(top_srcdir)/src/model/ungapped.o $(top_srcdir)/src/model/intron.o $(top_srcdir)/src/model/frameshift.o $(top_srcdir)/src/model/phase.o $(top_srcdir)/src/model/modeltype.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o $(top_srcdir)/src/general/socket.o $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o | |
87 | C4_OBJECTS = $(top_srcdir)/src/c4/c4.o $(top_srcdir)/src/c4/codegen.o $(top_srcdir)/src/c4/cgutil.o $(top_srcdir)/src/c4/opair.o $(top_srcdir)/src/c4/alignment.o $(top_srcdir)/src/c4/optimal.o $(top_srcdir)/src/c4/layout.o $(top_srcdir)/src/c4/region.o $(top_srcdir)/src/c4/subopt.o $(top_srcdir)/src/bsdp/bsdp.o $(top_srcdir)/src/bsdp/sar.o $(top_srcdir)/src/bsdp/heuristic.o $(top_srcdir)/src/bsdp/hpair.o $(top_srcdir)/src/sdp/boundary.o $(top_srcdir)/src/sdp/sdp.o $(top_srcdir)/src/sdp/lookahead.o $(top_srcdir)/src/sdp/straceback.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/struct/slist.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/model/affine.o $(top_srcdir)/src/model/est2genome.o $(top_srcdir)/src/model/ner.o $(top_srcdir)/src/model/protein2dna.o $(top_srcdir)/src/model/protein2genome.o $(top_srcdir)/src/model/coding2coding.o $(top_srcdir)/src/model/coding2genome.o $(top_srcdir)/src/model/cdna2genome.o $(top_srcdir)/src/model/genome2genome.o $(top_srcdir)/src/model/ungapped.o $(top_srcdir)/src/model/intron.o $(top_srcdir)/src/model/frameshift.o $(top_srcdir)/src/model/phase.o $(top_srcdir)/src/model/modeltype.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o $(top_srcdir)/src/general/socket.o $(top_srcdir)/src/general/jobqueue.o $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o | |
87 | 88 | |
88 | 89 | |
89 | 90 | EXTRA_exonerate_SOURCES = c4_model_archive.a c4_model_archive.h |
91 | 92 | BUILT_SOURCES = c4_model_archive.a |
92 | 93 | BOOTSTRAPPER = $(top_srcdir)/src/model/bootstrapper |
93 | 94 | |
94 | exonerate_COMPONENTS = @codegen_extra_ldadd@ $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/seeder.o $(top_srcdir)/src/comparison/comparison.o $(top_srcdir)/src/database/fastapipe.o $(top_srcdir)/src/database/fastadb.o $(top_srcdir)/src/struct/dejavu.o $(top_srcdir)/src/struct/fsm.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/hub/gam.o $(top_srcdir)/src/hub/bsam.o $(top_srcdir)/src/hub/analysis.o $(top_srcdir)/src/general/compoundfile.o $(C4_OBJECTS) | |
95 | exonerate_COMPONENTS = @codegen_extra_ldadd@ $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/seeder.o $(top_srcdir)/src/comparison/comparison.o $(top_srcdir)/src/database/fastapipe.o $(top_srcdir)/src/database/fastadb.o $(top_srcdir)/src/struct/dejavu.o $(top_srcdir)/src/struct/fsm.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/hub/gam.o $(top_srcdir)/src/hub/bsam.o $(top_srcdir)/src/hub/analysis.o $(top_srcdir)/src/general/compoundfile.o $(top_srcdir)/src/general/threadref.o $(C4_OBJECTS) | |
95 | 96 | |
96 | 97 | |
97 | 98 | exonerate_SOURCES = exonerate.c |
105 | 106 | # Files to clear away |
106 | 107 | |
107 | 108 | exonerate_server_SOURCES = exonerate-server.c |
108 | exonerate_server_LDADD = $(top_srcdir)/src/general/socket.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/database/dataset.o $(top_srcdir)/src/database/index.o $(top_srcdir)/src/database/fastadb.o $(top_srcdir)/src/struct/bitarray.o $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/struct/splaytree.o $(top_srcdir)/src/struct/noitree.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/general/compoundfile.o $(top_srcdir)/src/general/lineparse.o -lm | |
109 | exonerate_server_LDADD = $(top_srcdir)/src/general/socket.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/match.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/database/dataset.o $(top_srcdir)/src/database/index.o $(top_srcdir)/src/database/fastadb.o $(top_srcdir)/src/struct/bitarray.o $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/struct/splaytree.o $(top_srcdir)/src/struct/noitree.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/general/compoundfile.o $(top_srcdir)/src/general/lineparse.o $(top_srcdir)/src/general/threadref.o -lm | |
109 | 110 | |
110 | 111 | |
111 | 112 | CLEANFILES = $(EXTRA_exonerate_SOURCES) @codegen_extra_sources@ @codegen_extra_ld_add@ |
159 | 160 | $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/submat.o \ |
160 | 161 | $(top_srcdir)/src/sequence/codonsubmat.o \ |
161 | 162 | $(top_srcdir)/src/general/compoundfile.o \ |
162 | $(top_srcdir)/src/general/lineparse.o | |
163 | $(top_srcdir)/src/general/lineparse.o \ | |
164 | $(top_srcdir)/src/general/threadref.o | |
163 | 165 | exonerate_server_LDFLAGS = |
164 | 166 | CFLAGS = @CFLAGS@ |
165 | 167 | COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
2 | 2 | * The exonerate server * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
65 | 65 | if(preload) |
66 | 66 | Dataset_preload_seqs(exonerate_server->dataset); |
67 | 67 | exonerate_server->verbosity = verbosity; |
68 | if(verbosity >= 1){ | |
69 | Dataset_info(exonerate_server->dataset); | |
70 | Index_info(exonerate_server->index); | |
71 | } | |
68 | 72 | return exonerate_server; |
69 | 73 | } |
70 | 74 | |
92 | 96 | gint dna_hsp_threshold; |
93 | 97 | gint protein_hsp_threshold; |
94 | 98 | gint codon_hsp_threshold; |
99 | gint dna_word_limit; | |
100 | gint protein_word_limit; | |
101 | gint codon_word_limit; | |
95 | 102 | gint dna_hsp_dropoff; |
96 | 103 | gint protein_hsp_dropoff; |
97 | 104 | gint codon_hsp_dropoff; |
117 | 124 | connection->dna_hsp_threshold = has->dna_hsp_threshold; |
118 | 125 | connection->protein_hsp_threshold = has->protein_hsp_threshold; |
119 | 126 | connection->codon_hsp_threshold = has->codon_hsp_threshold; |
127 | connection->dna_word_limit = has->dna_word_limit; | |
128 | connection->protein_word_limit = has->protein_word_limit; | |
129 | connection->codon_word_limit = has->codon_word_limit; | |
120 | 130 | connection->dna_hsp_dropoff = has->dna_hsp_dropoff; |
121 | 131 | connection->protein_hsp_dropoff = has->protein_hsp_dropoff; |
122 | 132 | connection->codon_hsp_dropoff = has->codon_hsp_dropoff; |
142 | 152 | /**/ |
143 | 153 | |
144 | 154 | static gpointer Exonerate_Server_Connection_open(gpointer user_data){ |
145 | g_message("[%s]", __FUNCTION__); | |
146 | 155 | return Exonerate_Server_Connection_create(); |
147 | 156 | } |
148 | 157 | |
150 | 159 | gpointer user_data){ |
151 | 160 | register Exonerate_Server_Connection *server_connection |
152 | 161 | = connection_data; |
153 | g_message("[%s]", __FUNCTION__); | |
154 | 162 | Exonerate_Server_Connection_destroy(server_connection); |
155 | 163 | return; |
156 | 164 | } |
220 | 228 | "\n" |
221 | 229 | " valid parameters:\n" |
222 | 230 | " seedrepeat\n" |
231 | "\n" | |
223 | 232 | " dnahspthreshold\n" |
224 | 233 | " proteinhspthreshold\n" |
225 | 234 | " codonhspthreshold\n" |
235 | "\n" | |
236 | " dnawordlimit\n" | |
237 | " proteinwordlimit\n" | |
238 | " codonwordlimit\n" | |
226 | 239 | "\n" |
227 | 240 | " geneseedthreshold\n" |
228 | 241 | " geneseedrepeat\n" |
391 | 404 | HSP_Param_set_codon_hsp_threshold(connection->hsp_param, |
392 | 405 | connection->codon_hsp_threshold); |
393 | 406 | /**/ |
407 | HSP_Param_set_dna_word_limit(connection->hsp_param, | |
408 | connection->dna_word_limit); | |
409 | HSP_Param_set_protein_word_limit(connection->hsp_param, | |
410 | connection->protein_word_limit); | |
411 | HSP_Param_set_codon_word_limit(connection->hsp_param, | |
412 | connection->codon_word_limit); | |
413 | /**/ | |
394 | 414 | HSP_Param_set_dna_hsp_dropoff(connection->hsp_param, |
395 | 415 | connection->dna_hsp_dropoff); |
396 | 416 | HSP_Param_set_protein_hsp_dropoff(connection->hsp_param, |
452 | 472 | if(connection->hsp_param) |
453 | 473 | HSP_Param_set_codon_hsp_threshold(connection->hsp_param, |
454 | 474 | codonhspthreshold); |
475 | return g_strdup_printf("ok: set\n"); | |
476 | } | |
477 | ||
478 | /**/ | |
479 | ||
480 | static gchar *Exonerate_Server_set_param_dnawordlimit( | |
481 | Exonerate_Server_Connection *connection, GPtrArray *word_list){ | |
482 | register gint dnawordlimit = atoi(word_list->pdata[3]); | |
483 | if(dnawordlimit < 0) | |
484 | return g_strdup_printf("error: dnawordlimit must be >= 0\n"); | |
485 | connection->dna_word_limit = dnawordlimit; | |
486 | if(connection->hsp_param) | |
487 | HSP_Param_set_dna_word_limit(connection->hsp_param, dnawordlimit); | |
488 | return g_strdup_printf("ok: set\n"); | |
489 | } | |
490 | ||
491 | static gchar *Exonerate_Server_set_param_proteinwordlimit( | |
492 | Exonerate_Server_Connection *connection, GPtrArray *word_list){ | |
493 | register gint proteinwordlimit = atoi(word_list->pdata[3]); | |
494 | if(proteinwordlimit < 0) | |
495 | return g_strdup_printf("error: proteinwordlimit must be >= 0\n"); | |
496 | connection->protein_word_limit = proteinwordlimit; | |
497 | if(connection->hsp_param) | |
498 | HSP_Param_set_protein_word_limit(connection->hsp_param, | |
499 | proteinwordlimit); | |
500 | return g_strdup_printf("ok: set\n"); | |
501 | } | |
502 | ||
503 | static gchar *Exonerate_Server_set_param_codonwordlimit( | |
504 | Exonerate_Server_Connection *connection, GPtrArray *word_list){ | |
505 | register gint codonwordlimit = atoi(word_list->pdata[3]); | |
506 | if(codonwordlimit < 0) | |
507 | return g_strdup_printf("error: codonwordlimit must be >= 0\n"); | |
508 | connection->codon_word_limit = codonwordlimit; | |
509 | if(connection->hsp_param) | |
510 | HSP_Param_set_codon_word_limit(connection->hsp_param, | |
511 | codonwordlimit); | |
455 | 512 | return g_strdup_printf("ok: set\n"); |
456 | 513 | } |
457 | 514 | |
544 | 601 | } else if(!strcmp(name, "codonhspthreshold")){ |
545 | 602 | reply = Exonerate_Server_set_param_codonhspthreshold(connection, |
546 | 603 | word_list); |
604 | } else if(!strcmp(name, "dnawordlimit")){ | |
605 | reply = Exonerate_Server_set_param_dnawordlimit(connection, | |
606 | word_list); | |
607 | } else if(!strcmp(name, "proteinwordlimit")){ | |
608 | reply = Exonerate_Server_set_param_proteinwordlimit(connection, | |
609 | word_list); | |
610 | } else if(!strcmp(name, "codonwordlimit")){ | |
611 | reply = Exonerate_Server_set_param_codonwordlimit(connection, | |
612 | word_list); | |
547 | 613 | } else if(!strcmp(name, "dnahspdropoff")){ |
548 | 614 | reply = Exonerate_Server_set_param_dnahspdropoff(connection, word_list); |
549 | 615 | } else if(!strcmp(name, "proteinhspdropoff")){ |
599 | 665 | (*reply) = NULL; |
600 | 666 | keep_connection = FALSE; |
601 | 667 | } else if(!strcmp(word, "dbinfo")){ |
602 | (*reply) = g_strdup_printf("dbinfo: %s %s %lld %lld %lld\n", | |
668 | (*reply) = g_strdup_printf("dbinfo: %s %s" | |
669 | " %" CUSTOM_GUINT64_FORMAT | |
670 | " %" CUSTOM_GUINT64_FORMAT | |
671 | " %" CUSTOM_GUINT64_FORMAT "\n", | |
603 | 672 | (server->dataset->header->type & 1)?"dna":"protein", |
604 | 673 | (server->dataset->header->type & (1<<1)) |
605 | 674 | ?"softmasked":"unmasked", |
2 | 2 | * exonerate : a generic sequence comparison tool * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
76 | 76 | Argument_parse_int, &verbosity); |
77 | 77 | /**/ |
78 | 78 | Argument_absorb_ArgumentSet(arg, as_input); |
79 | Translate_ArgumentSet_create(arg); | |
79 | 80 | Analysis_ArgumentSet_create(arg); |
80 | 81 | FastaDB_ArgumentSet_create(arg); |
81 | 82 | GAM_ArgumentSet_create(arg); |
93 | 94 | Intron_ArgumentSet_create(arg); |
94 | 95 | Frameshift_ArgumentSet_create(arg); |
95 | 96 | Alphabet_ArgumentSet_create(arg); |
96 | Translate_ArgumentSet_create(arg); | |
97 | 97 | HSPset_ArgumentSet_create(arg); |
98 | 98 | Alignment_ArgumentSet_create(arg); |
99 | 99 | SAR_ArgumentSet_create(arg); |
101 | 101 | /**/ |
102 | 102 | Argument_process(arg, "exonerate", |
103 | 103 | "A generic sequence comparison tool\n" |
104 | "Guy St.C. Slater. guy@ebi.ac.uk. 2000-2008.\n", | |
104 | "Guy St.C. Slater. guy@ebi.ac.uk. 2000-2009.\n", | |
105 | 105 | "\n" |
106 | 106 | "Examples of use:\n" |
107 | 107 | "\n" |
135 | 135 | return 0; |
136 | 136 | } |
137 | 137 | |
138 | /**/ | |
139 |
2 | 2 | * ipcress : in-silico PCR experiment simulation system * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
22 | 22 | $(top_srcdir)/src/sequence/translate.o \ |
23 | 23 | $(top_srcdir)/src/general/argument.o \ |
24 | 24 | $(top_srcdir)/src/general/lineparse.o \ |
25 | $(top_srcdir)/src/general/threadref.o \ | |
25 | 26 | -lm |
26 | 27 | |
27 | 28 | C4_OBJ = $(top_srcdir)/src/c4/c4.o \ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
87 | 88 | |
88 | 89 | noinst_HEADERS = scheduler.h sdp.h lookahead.h boundary.h straceback.h |
89 | 90 | |
90 | SEQUENCE_OBJ = $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o -lm | |
91 | SEQUENCE_OBJ = $(top_srcdir)/src/struct/sparsecache.o $(top_srcdir)/src/struct/matrix.o $(top_srcdir)/src/sequence/sequence.o $(top_srcdir)/src/sequence/alphabet.o $(top_srcdir)/src/sequence/splice.o $(top_srcdir)/src/sequence/translate.o $(top_srcdir)/src/general/argument.o $(top_srcdir)/src/general/lineparse.o $(top_srcdir)/src/general/threadref.o -lm | |
91 | 92 | |
92 | 93 | |
93 | 94 | C4_OBJ = $(top_srcdir)/src/c4/c4.o $(top_srcdir)/src/c4/alignment.o $(top_srcdir)/src/c4/optimal.o $(top_srcdir)/src/c4/codegen.o $(top_srcdir)/src/c4/region.o $(top_srcdir)/src/c4/layout.o $(top_srcdir)/src/c4/viterbi.o $(top_srcdir)/src/c4/subopt.o $(top_srcdir)/src/c4/cgutil.o |
149 | 150 | $(top_srcdir)/src/sequence/splice.o \ |
150 | 151 | $(top_srcdir)/src/sequence/translate.o \ |
151 | 152 | $(top_srcdir)/src/general/argument.o \ |
152 | $(top_srcdir)/src/general/lineparse.o | |
153 | $(top_srcdir)/src/general/lineparse.o \ | |
154 | $(top_srcdir)/src/general/threadref.o | |
153 | 155 | sdp_test_LDFLAGS = |
154 | 156 | lookahead_test_OBJECTS = lookahead.test.o lookahead.o |
155 | 157 | lookahead_test_LDADD = $(LDADD) |
176 | 178 | $(top_srcdir)/src/sequence/splice.o \ |
177 | 179 | $(top_srcdir)/src/sequence/translate.o \ |
178 | 180 | $(top_srcdir)/src/general/argument.o \ |
179 | $(top_srcdir)/src/general/lineparse.o | |
181 | $(top_srcdir)/src/general/lineparse.o \ | |
182 | $(top_srcdir)/src/general/threadref.o | |
180 | 183 | scheduler_test_LDFLAGS = |
181 | 184 | straceback_test_OBJECTS = straceback.test.o straceback.o |
182 | 185 | straceback_test_DEPENDENCIES = $(top_srcdir)/src/struct/recyclebin.o \ |
191 | 194 | $(top_srcdir)/src/sequence/splice.o \ |
192 | 195 | $(top_srcdir)/src/sequence/translate.o \ |
193 | 196 | $(top_srcdir)/src/general/argument.o \ |
194 | $(top_srcdir)/src/general/lineparse.o | |
197 | $(top_srcdir)/src/general/lineparse.o \ | |
198 | $(top_srcdir)/src/general/threadref.o | |
195 | 199 | straceback_test_LDFLAGS = |
196 | 200 | CFLAGS = @CFLAGS@ |
197 | 201 | COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
2 | 2 | * C4 dynamic programming library - Boundary Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - Boundary Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - Boundary Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - SDP Lookahead Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - SDP Lookahead Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - SDP Lookahead Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - DP Scheduler * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - DP Scheduler * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - DP Scheduler * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - Seeded Dynamic Programming * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
299 | 299 | register SDP *sdp = g_new0(SDP, 1); |
300 | 300 | register C4_Portal *portal; |
301 | 301 | /**/ |
302 | sdp->ref_count = 1; | |
302 | sdp->thread_ref = ThreadRef_create(); | |
303 | 303 | sdp->sas = SDP_ArgumentSet_create(NULL); |
304 | 304 | g_assert(model); |
305 | 305 | g_assert(!model->is_open); |
355 | 355 | |
356 | 356 | SDP *SDP_share(SDP *sdp){ |
357 | 357 | g_assert(sdp); |
358 | sdp->ref_count++; | |
358 | ThreadRef_share(sdp->thread_ref); | |
359 | 359 | return sdp; |
360 | 360 | } |
361 | 361 | |
362 | 362 | void SDP_destroy(SDP *sdp){ |
363 | 363 | g_assert(sdp); |
364 | if(--sdp->ref_count) | |
364 | if(ThreadRef_destroy(sdp->thread_ref)) | |
365 | 365 | return; |
366 | 366 | if(sdp->find_starts_scheduler) |
367 | 367 | Scheduler_destroy(sdp->find_starts_scheduler); |
2 | 2 | * C4 dynamic programming library - Seeded Dynamic Programming * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
32 | 32 | #include "sparsecache.h" |
33 | 33 | #include "boundary.h" |
34 | 34 | #include "scheduler.h" |
35 | #include "threadref.h" | |
35 | 36 | |
36 | 37 | /**/ |
37 | 38 | |
65 | 66 | /**/ |
66 | 67 | |
67 | 68 | typedef struct { |
68 | gint ref_count; | |
69 | ThreadRef *thread_ref; | |
69 | 70 | SDP_ArgumentSet *sas; |
70 | 71 | C4_Model *model; |
71 | 72 | gboolean use_boundary; |
2 | 2 | * C4 dynamic programming library - Seeded Dynamic Programming * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - Scheduler Traceback * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - Scheduler Traceback * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * C4 dynamic programming library - Scheduler Traceback * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
2 | 2 | * Simple Alphabet Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
150 | 150 | register Alphabet *a = g_new0(Alphabet, 1); |
151 | 151 | a->ref_count = 1; |
152 | 152 | a->type = type; |
153 | a->is_soft_masked = is_soft_masked; | |
153 | 154 | /* Set look-up tables */ |
154 | 155 | a->unmasked = Alphabet_Filter_get(Alphabet_Filter_TO_UPPER); |
155 | 156 | if(is_soft_masked){ |
371 | 372 | return short_names[index[(guchar)aa]]; |
372 | 373 | } |
373 | 374 | |
375 | gchar *Alphabet_nt2ambig(gchar nt){ | |
376 | static gchar *ambig[16] = { | |
377 | /* - */ NULL, | |
378 | /* G */ "G", | |
379 | /* A */ "A", | |
380 | /* R */ "AG", | |
381 | /* T */ "T", | |
382 | /* K */ "GT", | |
383 | /* W */ "AT", | |
384 | /* D */ "AGT", | |
385 | /* C */ "C", | |
386 | /* S */ "CG", | |
387 | /* M */ "AC", | |
388 | /* V */ "ACG", | |
389 | /* Y */ "CT", | |
390 | /* B */ "CGT", | |
391 | /* H */ "ACT", | |
392 | /* N */ "ACGT" | |
393 | }; | |
394 | static guchar index[(1<<8)] = { /* GARTKWDCSMVYBHN */ | |
395 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
396 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
397 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
398 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
399 | 0, 2, 13, 8, 7, 0, 0, 1, 14, 0, 0, 5, 0, 10, 15, 0, | |
400 | 0, 0, 3, 9, 4, 0, 11, 6, 0, 12, 0, 0, 0, 0, 0, 0, | |
401 | 0, 2, 13, 8, 7, 0, 0, 1, 14, 0, 0, 5, 0, 10, 15, 0, | |
402 | 0, 0, 3, 9, 4, 0, 11, 6, 0, 12, 0, 0, 0, 0, 0, 0, | |
403 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
404 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
405 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
406 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
407 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
408 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
409 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
410 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
411 | }; | |
412 | g_assert(index[(guchar)nt]); | |
413 | return ambig[index[(guchar)nt]]; | |
414 | } | |
415 |
2 | 2 | * Simple Alphabet Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
48 | 48 | |
49 | 49 | typedef struct { |
50 | 50 | gint ref_count; |
51 | gboolean is_soft_masked; | |
51 | 52 | guchar *member; |
52 | 53 | Alphabet_Type type; |
53 | 54 | guchar *is_member; |
112 | 113 | /* Give three-letter-abbreviation for amino acid. |
113 | 114 | * eg 'M' -> "Met" etc */ |
114 | 115 | |
116 | gchar *Alphabet_nt2ambig(gchar nt); | |
117 | /* Returns the ambiguity bases for the given nucleotide | |
118 | * The returned string does not need to be freed. | |
119 | */ | |
120 | ||
121 | ||
115 | 122 | /**/ |
116 | 123 | |
117 | 124 | #ifdef __cplusplus |
2 | 2 | * Simple Alphabet Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Codon Substutition Matrix Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Codon Substitution Matrix Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Codon Substitution Matrix Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Simple Sequence Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
180 | 180 | ? g_tree_lookup(sas->annotation_tree, s->id) |
181 | 181 | : NULL; |
182 | 182 | s->len = len; |
183 | #ifdef USE_PTHREADS | |
184 | pthread_mutex_init(&s->seq_lock, NULL); | |
185 | #endif /* USE_PTHREADS */ | |
183 | 186 | return s; |
184 | 187 | } |
185 | 188 | |
235 | 238 | |
236 | 239 | Sequence *Sequence_share(Sequence *s){ |
237 | 240 | g_assert(s); |
241 | Sequence_lock(s); | |
238 | 242 | g_assert(s->ref_count); |
239 | 243 | s->ref_count++; |
244 | Sequence_unlock(s); | |
240 | 245 | return s; |
241 | 246 | } |
242 | 247 | |
539 | 544 | |
540 | 545 | /**/ |
541 | 546 | |
547 | #if 0 | |
542 | 548 | static void Sequence_print_type(Sequence *s){ |
543 | 549 | register Sequence_Subseq *subseq; |
544 | 550 | register Sequence *revcomp; |
579 | 585 | } |
580 | 586 | return; |
581 | 587 | } |
588 | #endif /* 0 */ | |
589 | ||
582 | 590 | |
583 | 591 | void Sequence_strncpy(Sequence *s, gint start, gint length, gchar *dst){ |
584 | 592 | register gint i; |
646 | 654 | |
647 | 655 | void Sequence_destroy(Sequence *s){ |
648 | 656 | g_assert(s); |
649 | if(--s->ref_count) | |
657 | #ifdef USE_PTHREADS | |
658 | pthread_mutex_lock(&s->seq_lock); | |
659 | #endif /* USE_PTHREADS */ | |
660 | if(--s->ref_count){ | |
661 | #ifdef USE_PTHREADS | |
662 | pthread_mutex_unlock(&s->seq_lock); | |
663 | #endif /* USE_PTHREADS */ | |
650 | 664 | return; |
665 | } | |
666 | #ifdef USE_PTHREADS | |
667 | pthread_mutex_unlock(&s->seq_lock); | |
668 | #endif /* USE_PTHREADS */ | |
651 | 669 | if(s->id) |
652 | 670 | g_free(s->id); |
653 | 671 | if(s->def) |
678 | 696 | } |
679 | 697 | } |
680 | 698 | Alphabet_destroy(s->alphabet); |
699 | #ifdef USE_PTHREADS | |
700 | pthread_mutex_destroy(&s->seq_lock); | |
701 | #endif /* USE_PTHREADS */ | |
681 | 702 | g_free(s); |
682 | 703 | return; |
683 | 704 | } |
784 | 805 | } |
785 | 806 | |
786 | 807 | |
808 | void Sequence_lock(Sequence *s){ | |
809 | register Sequence_Subseq *subseq; | |
810 | register Sequence_Filter *filter; | |
811 | register Sequence_Translation *translation; | |
812 | register Sequence *revcomp; | |
813 | g_assert(s); | |
814 | #ifdef USE_PTHREADS | |
815 | pthread_mutex_lock(&s->seq_lock); | |
816 | if(s->data){ | |
817 | switch(s->type){ | |
818 | case Sequence_Type_INTMEM: | |
819 | break; | |
820 | case Sequence_Type_EXTMEM: | |
821 | break; | |
822 | case Sequence_Type_SUBSEQ: | |
823 | subseq = s->data; | |
824 | Sequence_lock(subseq->sequence); | |
825 | break; | |
826 | case Sequence_Type_REVCOMP: | |
827 | revcomp = s->data; | |
828 | Sequence_lock(revcomp); | |
829 | break; | |
830 | case Sequence_Type_FILTER: | |
831 | filter = s->data; | |
832 | Sequence_lock(filter->sequence); | |
833 | break; | |
834 | case Sequence_Type_TRANSLATE: | |
835 | translation = s->data; | |
836 | Sequence_lock(translation->sequence); | |
837 | break; | |
838 | default: | |
839 | g_error("Unknown Sequence type [%d]", s->type); | |
840 | break; | |
841 | } | |
842 | } | |
843 | #endif /* USE_PTHREADS */ | |
844 | return; | |
845 | } | |
846 | ||
847 | void Sequence_unlock(Sequence *s){ | |
848 | register Sequence_Subseq *subseq; | |
849 | register Sequence_Filter *filter; | |
850 | register Sequence_Translation *translation; | |
851 | register Sequence *revcomp; | |
852 | g_assert(s); | |
853 | #ifdef USE_PTHREADS | |
854 | pthread_mutex_unlock(&s->seq_lock); | |
855 | if(s->data){ | |
856 | switch(s->type){ | |
857 | case Sequence_Type_INTMEM: | |
858 | break; | |
859 | case Sequence_Type_EXTMEM: | |
860 | break; | |
861 | case Sequence_Type_SUBSEQ: | |
862 | subseq = s->data; | |
863 | Sequence_unlock(subseq->sequence); | |
864 | break; | |
865 | case Sequence_Type_REVCOMP: | |
866 | revcomp = s->data; | |
867 | Sequence_unlock(revcomp); | |
868 | break; | |
869 | case Sequence_Type_FILTER: | |
870 | filter = s->data; | |
871 | Sequence_unlock(filter->sequence); | |
872 | break; | |
873 | case Sequence_Type_TRANSLATE: | |
874 | translation = s->data; | |
875 | Sequence_unlock(translation->sequence); | |
876 | break; | |
877 | default: | |
878 | g_error("Unknown Sequence type [%d]", s->type); | |
879 | break; | |
880 | } | |
881 | } | |
882 | #endif /* USE_PTHREADS */ | |
883 | return; | |
884 | } | |
885 | ||
886 | ||
887 |
2 | 2 | * Simple Sequence Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
21 | 21 | |
22 | 22 | #include <stdio.h> |
23 | 23 | #include <glib.h> |
24 | ||
25 | #ifdef USE_PTHREADS | |
26 | #include <pthread.h> | |
27 | #endif /* USE_PTHREADS */ | |
24 | 28 | |
25 | 29 | #include "alphabet.h" |
26 | 30 | #include "translate.h" |
82 | 86 | gpointer data; |
83 | 87 | Sequence_Type type; |
84 | 88 | gint (*get_symbol)(gpointer data, gint pos); |
89 | #ifdef USE_PTHREADS | |
90 | pthread_mutex_t seq_lock; | |
91 | #endif /* USE_PTHREADS */ | |
85 | 92 | } Sequence; |
86 | 93 | |
87 | 94 | #define Sequence_get_symbol(sequence, pos) \ |
133 | 140 | Sequence *Sequence_translate(Sequence *s, Translate *translate, gint frame); |
134 | 141 | |
135 | 142 | Sequence *Sequence_mask(Sequence *s); |
143 | void Sequence_lock(Sequence *s); | |
144 | void Sequence_unlock(Sequence *s); | |
136 | 145 | |
137 | 146 | /**/ |
138 | 147 |
2 | 2 | * Simple Sequence Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for Splice site prediction. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
281 | 281 | for(j = 0; j < 4; j++){ |
282 | 282 | sp->model_data[i][j] = (((gfloat)(1+sp->model_data[i][j])) |
283 | 283 | /((25.0+1.0))); |
284 | sp->model_data[i][j] = log(sp->model_data[i][j]) * 2.0; | |
284 | sp->model_data[i][j] = log(sp->model_data[i][j]) * 1.5; | |
285 | 285 | } |
286 | 286 | sp->model_data[i][4] = 0.0; |
287 | 287 | } |
2 | 2 | * Library for Splice site prediction. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for Splice site prediction. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Substutition Matrix Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
265 | 265 | } |
266 | 266 | break; |
267 | 267 | case '0': case '1': case '2': case '3': case '4': |
268 | case '5': case '6': case '7': case '8': case '9': | |
268 | case '5': case '6': case '7': case '8': case '9': | |
269 | 269 | num *= 10; |
270 | 270 | num += (ch-'0'); |
271 | 271 | seen = TRUE; |
2 | 2 | * Substitution Matrix Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Substitution Matrix Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Nucleotide Translation Code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
19 | 19 | #include "translate.h" |
20 | 20 | |
21 | 21 | /* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
22 | CTAG | |
22 | 23 | 0 - 0000 - blank Representation of Nucleotides |
23 | 24 | 1 G 0001 C ----------------------------- |
24 | 25 | 2 A 0010 T |
71 | 72 | "pon", "jihP", "fCcd", "rHmpi", "xfrj", "Xx*" }; |
72 | 73 | for(i = 0; i < Translate_AA_SET_SIZE; i++) |
73 | 74 | t->aa2d[t->aa[i]] = i; |
74 | for(i = 1; i < 22; i++) | |
75 | for(i = 1; i < 23; i++) | |
75 | 76 | t->aamask[i] = (1L<<(i-1)); /* First is zero */ |
76 | 77 | for(i = 0; i < Translate_PIMA_SET_SIZE; i++){ |
77 | 78 | t->aamask[t->aa2d[pimagrp[i][0]]] |
137 | 138 | result[n++] = code[(table[a] << 4) |
138 | 139 | | (table[b] << 2) |
139 | 140 | | table[c]]; |
140 | /* g_print("generated genetic code [%s]\n", result); */ | |
141 | 141 | return result; |
142 | 142 | } |
143 | 143 | /* Converts genetic code from NCBI format (TCAG order) |
2 | 2 | * Nucleotide Translation Code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Nucleotide Translation Code * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
23 | 23 | |
24 | 24 | static void check_translate(Translate *t, gchar *codon, gchar crib){ |
25 | 25 | register gchar aa = Translate_codon(t, codon); |
26 | g_message("Translate [%s] -> [%c] (crib:[%c]", codon, aa, crib); | |
26 | 27 | g_assert(aa == crib); |
27 | g_message("Translate [%s] -> [%c] (crib:[%c]", codon, aa, crib); | |
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
38 | 38 | } |
39 | 39 | |
40 | 40 | gint Argument_main(Argument *arg){ |
41 | register Translate *t = Translate_create(FALSE); | |
41 | register Translate *t; | |
42 | Translate_ArgumentSet_create(arg); | |
43 | Argument_process(arg, "translate.test", NULL, NULL); | |
44 | t = Translate_create(FALSE); | |
42 | 45 | check_translate(t, "ATG", 'M'); |
43 | 46 | check_translate(t, "GGX", 'G'); |
44 | 47 | check_translate(t, "NGT", 'X'); |
48 | check_translate(t, "TGA", '*'); | |
45 | 49 | /**/ |
46 | 50 | check_reverse_translate(t, "S*MXG", 72); |
47 | 51 | check_reverse_translate(t, "SSSSS", 7776); |
0 | 0 | |
1 | 1 | TESTS = fsm.test matrix.test pqueue.test slist.test rangetree.test \ |
2 | 2 | vfsm.test recyclebin.test sparsecache.test dejavu.test \ |
3 | bitarray.test splaytree.test noitree.test | |
3 | bitarray.test splaytree.test noitree.test | |
4 | # huffman.test fmindex.test | |
5 | ||
4 | 6 | noinst_PROGRAMS = $(TESTS) |
5 | 7 | |
6 | 8 | noinst_HEADERS = fsm.h matrix.h pqueue.h slist.h rangetree.h vfsm.h \ |
7 | 9 | recyclebin.h sparsecache.h dejavu.h bitarray.h \ |
8 | 10 | splaytree.h noitree.h |
11 | # huffman.h fmindex.h | |
12 | ||
13 | INCLUDES = -DCUSTOM_GUINT64_FORMAT="\"@custom_guint64_format@\"" | |
9 | 14 | |
10 | 15 | fsm_test_SOURCES = fsm.test.c fsm.c |
11 | 16 | fsm_test_LDADD = recyclebin.o |
30 | 35 | noitree_test_SOURCES = noitree.test.c noitree.c |
31 | 36 | noitree_test_LDADD = recyclebin.o splaytree.o |
32 | 37 | |
38 | # huffman_test_SOURCES = huffman.test.c huffman.c | |
39 | # huffman_test_LDADD = bitarray.o pqueue.o recyclebin.o | |
40 | ||
41 | # fmindex_test_SOURCES = fmindex.test.c fmindex.c | |
42 | # fmindex_test_LDADD = bitarray.o pqueue.o recyclebin.o huffman.o | |
43 | ||
33 | 44 | # Files to clear away |
34 | 45 | |
35 | 46 | MAINTAINERCLEANFILES = Makefile.in |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
77 | 78 | source_root_dir = @source_root_dir@ |
78 | 79 | use_pthreads = @use_pthreads@ |
79 | 80 | |
80 | TESTS = fsm.test matrix.test pqueue.test slist.test rangetree.test vfsm.test recyclebin.test sparsecache.test dejavu.test bitarray.test splaytree.test noitree.test | |
81 | TESTS = fsm.test matrix.test pqueue.test slist.test rangetree.test vfsm.test recyclebin.test sparsecache.test dejavu.test bitarray.test splaytree.test noitree.test | |
82 | ||
83 | # huffman.test fmindex.test | |
81 | 84 | |
82 | 85 | noinst_PROGRAMS = $(TESTS) |
83 | 86 | |
84 | 87 | noinst_HEADERS = fsm.h matrix.h pqueue.h slist.h rangetree.h vfsm.h recyclebin.h sparsecache.h dejavu.h bitarray.h splaytree.h noitree.h |
85 | 88 | |
89 | # huffman.h fmindex.h | |
90 | ||
91 | INCLUDES = -DCUSTOM_GUINT64_FORMAT="\"@custom_guint64_format@\"" | |
86 | 92 | |
87 | 93 | fsm_test_SOURCES = fsm.test.c fsm.c |
88 | 94 | fsm_test_LDADD = recyclebin.o |
106 | 112 | |
107 | 113 | noitree_test_SOURCES = noitree.test.c noitree.c |
108 | 114 | noitree_test_LDADD = recyclebin.o splaytree.o |
115 | ||
116 | # huffman_test_SOURCES = huffman.test.c huffman.c | |
117 | # huffman_test_LDADD = bitarray.o pqueue.o recyclebin.o | |
118 | ||
119 | # fmindex_test_SOURCES = fmindex.test.c fmindex.c | |
120 | # fmindex_test_LDADD = bitarray.o pqueue.o recyclebin.o huffman.o | |
109 | 121 | |
110 | 122 | # Files to clear away |
111 | 123 |
2 | 2 | * A simple bitarray data structure * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * A simple bitarray data structure * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
51 | 51 | |
52 | 52 | void BitArray_write_int(guint64 num, FILE *fp); |
53 | 53 | guint64 BitArray_read_int(FILE *fp); |
54 | void BitArray_int_print(guint64 num); | |
55 | gchar *BitArray_int_sprintf(guint64 num); | |
54 | 56 | |
55 | 57 | #ifdef __cplusplus |
56 | 58 | } |
2 | 2 | * A simple bitarray data structure * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Deja-vu library for fast linear space repeat finding * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
68 | 68 | continue; |
69 | 69 | if(first[ch] == -1) |
70 | 70 | first[ch] = i; |
71 | if(last[ch] != -1){ | |
71 | if(last[ch] != -1) | |
72 | 72 | dv->next[last[ch]] = i; |
73 | } | |
74 | 73 | last[ch] = i; |
75 | 74 | } |
76 | 75 | for(i = 0; i < ALPHABET_SIZE; i++){ |
2 | 2 | * Deja-vu library for fast linear space repeat finding * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Deja-vu library for fast linear space repeat finding * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for FSM-based word matching. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
217 | 217 | return; |
218 | 218 | } |
219 | 219 | |
220 | /**/ | |
221 |
2 | 2 | * Library for FSM-based word matching. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Library for FSM-based word matching. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Simple matrix creation routines * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Simple matrix creation routines * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Simple matrix creation routines * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * NOI_Tree : non-overlapping interval tree * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * NOI_Tree : non-overlapping interval tree * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * NOI_Tree : non-overlapping interval tree * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Priority queue library using pairing heaps. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Priority queue library using pairing heaps. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Priority queue library using pairing heaps. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Trees for 2D range searching. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Trees for 2D range searching. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Trees for 2D range searching. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Efficient Memory Allocation Routines * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
15 | 15 | #include <string.h> |
16 | 16 | #include "recyclebin.h" |
17 | 17 | |
18 | #ifndef USE_PTHREADS | |
18 | 19 | static GTree *global_recycle_bin_tree = NULL; |
20 | #endif /* USE_PTHREADS */ | |
19 | 21 | |
22 | #ifndef USE_PTHREADS | |
20 | 23 | static gint RecycleBin_compare(gconstpointer a, |
21 | 24 | gconstpointer b){ |
22 | 25 | return a - b; |
23 | 26 | } |
27 | #endif /* USE_PTHREADS */ | |
24 | 28 | |
25 | 29 | RecycleBin *RecycleBin_create(gchar *name, gsize node_size, |
26 | 30 | gint nodes_per_chunk){ |
35 | 39 | recycle_bin->node_size = node_size; |
36 | 40 | recycle_bin->count = 0; |
37 | 41 | recycle_bin->recycle = NULL; |
42 | #ifndef USE_PTHREADS | |
38 | 43 | if(!global_recycle_bin_tree) |
39 | 44 | global_recycle_bin_tree = g_tree_new(RecycleBin_compare); |
40 | 45 | g_tree_insert(global_recycle_bin_tree, recycle_bin, recycle_bin); |
46 | #endif /* USE_PTHREADS */ | |
41 | 47 | return recycle_bin; |
42 | 48 | } |
43 | 49 | |
45 | 51 | register gint i; |
46 | 52 | if(--recycle_bin->ref_count) |
47 | 53 | return; |
54 | #ifndef USE_PTHREADS | |
48 | 55 | g_assert(global_recycle_bin_tree); |
49 | 56 | g_assert(g_tree_lookup(global_recycle_bin_tree, recycle_bin)); |
50 | 57 | g_tree_remove(global_recycle_bin_tree, recycle_bin); |
52 | 59 | g_tree_destroy(global_recycle_bin_tree); |
53 | 60 | global_recycle_bin_tree = NULL; |
54 | 61 | } |
62 | #endif /* USE_PTHREADS */ | |
55 | 63 | for(i = 0; i < recycle_bin->chunk_list->len; i++) |
56 | 64 | g_free(recycle_bin->chunk_list->pdata[i]); |
57 | 65 | g_ptr_array_free(recycle_bin->chunk_list, TRUE); |
114 | 122 | return; |
115 | 123 | } |
116 | 124 | |
125 | #ifndef USE_PTHREADS | |
117 | 126 | static gint RecycleBin_profile_traverse(gpointer key, |
118 | 127 | gpointer value, |
119 | 128 | gpointer data){ |
125 | 134 | recycle_bin->count); |
126 | 135 | return FALSE; |
127 | 136 | } |
137 | #endif /* USE_PTHREADS */ | |
128 | 138 | |
129 | 139 | void RecycleBin_profile(void){ |
130 | 140 | g_message("BEGIN RecycleBin profile"); |
141 | #ifdef USE_PTHREADS | |
142 | g_message("multi-threaded RecycleBin_profile() not implemented"); | |
143 | #else /* USE_PTHREADS */ | |
131 | 144 | if(global_recycle_bin_tree) |
132 | 145 | g_tree_traverse(global_recycle_bin_tree, |
133 | 146 | RecycleBin_profile_traverse, G_IN_ORDER, NULL); |
134 | 147 | else |
135 | 148 | g_message("no active RecycleBins"); |
149 | #endif /* USE_PTHREADS */ | |
136 | 150 | g_message("END RecycleBin profile"); |
137 | 151 | return; |
138 | 152 | } |
2 | 2 | * Efficient Memory Allocation Routines * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Efficient Memory Allocation Routines * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Efficient single-linked list routines. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Efficient single-linked list routines. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Efficient single-linked list routines. * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Sparse Cache Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Sparse Cache Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Sparse Cache Object * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Splay Tree Library * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Splay Tree Library * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * Splay Tree Library * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * VFSM Library : complete trie navigation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * VFSM Library : complete trie navigation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
21 | 21 | #ifdef G_HAVE_GINT64 |
22 | 22 | typedef guint64 VFSM_Int; |
23 | 23 | #define VFSM_MAX G_GINT64_CONSTANT(18446744073709551615U) |
24 | #ifdef CUSTOM_GUINT64_FORMAT | |
25 | #define VFSM_PRINT_FORMAT CUSTOM_GUINT64_FORMAT | |
26 | #else /* CUSTOM_GUINT64_FORMAT */ | |
24 | 27 | #define VFSM_PRINT_FORMAT "llu" |
28 | #endif /* CUSTOM_GUINT64_FORMAT */ | |
25 | 29 | #else /* G_HAVE_GINT64 */ |
26 | 30 | typedef guint32 VFSM_Int; |
27 | 31 | #define VFSM_MAX 4294967295U |
2 | 2 | * VFSM Library : complete trie navigation * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
56 | 56 | |
57 | 57 | esd2esi_LDADD = $(top_srcdir)/src/database/dataset.o \ |
58 | 58 | $(top_srcdir)/src/database/index.o \ |
59 | $(top_srcdir)/src/general/threadref.o \ | |
59 | 60 | $(top_srcdir)/src/struct/bitarray.o \ |
60 | 61 | $(top_srcdir)/src/struct/vfsm.o \ |
61 | 62 | $(top_srcdir)/src/struct/pqueue.o \ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
115 | 116 | fasta2esd_LDADD = $(top_srcdir)/src/database/dataset.o $(top_srcdir)/src/struct/bitarray.o $(LDADD) |
116 | 117 | |
117 | 118 | |
118 | esd2esi_LDADD = $(top_srcdir)/src/database/dataset.o $(top_srcdir)/src/database/index.o $(top_srcdir)/src/struct/bitarray.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/struct/noitree.o $(top_srcdir)/src/struct/splaytree.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/match.o $(LDADD) | |
119 | esd2esi_LDADD = $(top_srcdir)/src/database/dataset.o $(top_srcdir)/src/database/index.o $(top_srcdir)/src/general/threadref.o $(top_srcdir)/src/struct/bitarray.o $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/struct/noitree.o $(top_srcdir)/src/struct/splaytree.o $(top_srcdir)/src/sequence/submat.o $(top_srcdir)/src/sequence/codonsubmat.o $(top_srcdir)/src/comparison/wordhood.o $(top_srcdir)/src/comparison/hspset.o $(top_srcdir)/src/comparison/match.o $(LDADD) | |
119 | 120 | |
120 | 121 | |
121 | 122 | EXTRA_fastavalidcds_SOURCES = fastavalidcds.c |
435 | 436 | fastaannotatecdna_LDFLAGS = |
436 | 437 | esd2esi_OBJECTS = esd2esi.o |
437 | 438 | esd2esi_DEPENDENCIES = $(top_srcdir)/src/database/dataset.o \ |
438 | $(top_srcdir)/src/database/index.o $(top_srcdir)/src/struct/bitarray.o \ | |
439 | $(top_srcdir)/src/struct/vfsm.o $(top_srcdir)/src/struct/pqueue.o \ | |
440 | $(top_srcdir)/src/struct/recyclebin.o \ | |
439 | $(top_srcdir)/src/database/index.o \ | |
440 | $(top_srcdir)/src/general/threadref.o \ | |
441 | $(top_srcdir)/src/struct/bitarray.o $(top_srcdir)/src/struct/vfsm.o \ | |
442 | $(top_srcdir)/src/struct/pqueue.o $(top_srcdir)/src/struct/recyclebin.o \ | |
441 | 443 | $(top_srcdir)/src/struct/rangetree.o $(top_srcdir)/src/struct/noitree.o \ |
442 | 444 | $(top_srcdir)/src/struct/splaytree.o \ |
443 | 445 | $(top_srcdir)/src/sequence/submat.o \ |
2 | 2 | * esd2esi - generate an exonerate index file from a dataset * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
25 | 25 | gboolean is_translated = FALSE; |
26 | 26 | register gint word_length; |
27 | 27 | gint dna_word_length, protein_word_length, |
28 | word_jump, saturate_threshold, memory_limit; | |
28 | word_jump, word_ambiguity, | |
29 | saturate_threshold, memory_limit; | |
29 | 30 | /**/ |
30 | 31 | ArgumentSet_add_option(as, 'd', "dataset", "path", |
31 | 32 | "Exonerate dataset file", NULL, |
47 | 48 | ArgumentSet_add_option(as, 0, "wordjump", NULL, |
48 | 49 | "Jump between database words", "1", |
49 | 50 | Argument_parse_int, &word_jump); |
51 | ArgumentSet_add_option(as, 0, "wordambiguity", NULL, | |
52 | "Number of ambiguous words to index", "1", | |
53 | Argument_parse_int, &word_ambiguity); | |
50 | 54 | ArgumentSet_add_option(as, 0, "saturatethreshold", NULL, |
51 | 55 | "Word saturation threshold", "10", |
52 | 56 | Argument_parse_int, &saturate_threshold); |
64 | 68 | || (dataset->alphabet->type == Alphabet_Type_PROTEIN)) |
65 | 69 | ? protein_word_length |
66 | 70 | : dna_word_length; |
71 | if(word_ambiguity < 1) | |
72 | g_error("Word ambiguity cannot be less than one."); | |
73 | if((word_ambiguity > 1) | |
74 | && (dataset->alphabet->type == Alphabet_Type_PROTEIN)) | |
75 | g_error("Protein ambuigity symbols not implemented"); | |
67 | 76 | g_message("Building index"); |
68 | index = Index_create(dataset, is_translated, word_length, word_jump, | |
77 | index = Index_create(dataset, is_translated, word_length, | |
78 | word_jump, word_ambiguity, | |
69 | 79 | saturate_threshold, index_path, dataset_path, |
70 | 80 | memory_limit); |
71 | 81 | Index_destroy(index); |
2 | 2 | * fasta2esd - generate an exonerate sequence database file * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastaannotatecdna : a utility to annotate cDNA with a protein * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastachecksum : a utility to print GCG checksums * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastaclean : a utility to clean fasta format files * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastaclip : clip terminal Ns from fasta format sequences * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastacomposition : a utility to dump sequence composition * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastadiff : a utility to compare fasta sequence files * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastaexplode : break a fasta file into individual sequences * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastafetch : fetch a sequence from a fasta format file * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
43 | 43 | static CompoundFile_Pos fasta_index_lookup(FastaDB *fdb, FILE *index_fp, |
44 | 44 | gchar *id){ |
45 | 45 | register long left, right, pos; |
46 | CompoundFile_Pos result = -1; | |
46 | CompoundFile_Pos_scan_type result = -1; | |
47 | 47 | register GString *curr = g_string_sized_new(100); |
48 | 48 | register gint cond; |
49 | 49 | left = 0; |
79 | 79 | } |
80 | 80 | } |
81 | 81 | g_string_free(curr, TRUE); |
82 | return result; | |
82 | return (CompoundFile_Pos)result; | |
83 | 83 | } |
84 | 84 | |
85 | 85 | static FastaDB_Seq *fasta_index_fetch(FastaDB *fdb, FILE *index_fp, |
2 | 2 | * fastahardmask : convert lower case chars to 'N's * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastaindex : index a fasta format file * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastalength : a utility to print fasta sequence length * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastanrdb : create non-redundant versions of fasta database * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastaoverlap: generate overlapping sequences * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastalength : a utility to reformat fasta format sequences * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastaremove : remove sequences from a fasta format file * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastarevcomp : a utility to revcomp fasta format sequences * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastasoftmask: merge masked and unmasked files to softmask * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastasort : a utility for sorting fasta format databases * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastasplit: split a fasta format file into chunks * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastasubseq: extract subsequences from fasta format sequences * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
2 | 2 | * fastatranslate: a utility to translate fasta format sequences * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
36 | 36 | } else { |
37 | 37 | aa_seq = Sequence_translate(fdbs->seq, translate, frame); |
38 | 38 | } |
39 | Sequence_print_fasta(aa_seq, stdout, FALSE); | |
39 | if(aa_seq->len) | |
40 | Sequence_print_fasta(aa_seq, stdout, FALSE); | |
40 | 41 | Sequence_destroy(aa_seq); |
41 | 42 | return; |
42 | 43 | } |
46 | 47 | register FastaDB_Seq *fdbs; |
47 | 48 | register ArgumentSet *as |
48 | 49 | = ArgumentSet_create("Sequence Input Options"); |
49 | register Translate *translate = Translate_create(FALSE); | |
50 | register Translate *translate; | |
50 | 51 | register Alphabet *dna_alphabet |
51 | 52 | = Alphabet_create(Alphabet_Type_DNA, FALSE); |
52 | 53 | register Alphabet *protein_alphabet |
65 | 66 | "A utility to translate fasta format sequences\n" |
66 | 67 | "Guy St.C. Slater. guy@ebi.ac.uk. 2000-2003.\n", NULL); |
67 | 68 | fdb = FastaDB_open(query_path, dna_alphabet); |
69 | translate = Translate_create(FALSE); | |
68 | 70 | while((fdbs = FastaDB_next(fdb, FastaDB_Mask_ALL))){ |
69 | 71 | fasta_translate_seq(fdbs, translate, frame, protein_alphabet); |
70 | 72 | FastaDB_Seq_destroy(fdbs); |
2 | 2 | * fastavalidcds: a utility to check for valid CDS sequences * |
3 | 3 | * * |
4 | 4 | * Guy St.C. Slater.. mailto:guy@ebi.ac.uk * |
5 | * Copyright (C) 2000-2008. All Rights Reserved. * | |
5 | * Copyright (C) 2000-2009. All Rights Reserved. * | |
6 | 6 | * * |
7 | 7 | * This source code is distributed under the terms of the * |
8 | 8 | * GNU General Public License, version 3. See the file COPYING * |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |
69 | 69 | VERSION = @VERSION@ |
70 | 70 | codegen_extra_ldadd = @codegen_extra_ldadd@ |
71 | 71 | codegen_extra_sources = @codegen_extra_sources@ |
72 | custom_guint64_format = @custom_guint64_format@ | |
72 | 73 | datarootdir = @datarootdir@ |
73 | 74 | glib_cflags = @glib_cflags@ |
74 | 75 | glib_libs = @glib_libs@ |