From 66a95267c635048e01d687ea9b7afa7395001b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arna=20=C3=93skarsd=C3=B3ttir?= Date: Thu, 30 Jan 2020 10:48:26 +0000 Subject: [PATCH 1/3] checksum for cram --- Makefile | 21 +- README.md | 9 +- bamhash_checksum_bam.cpp | 179 +- bamhash_checksum_common.h | 2 +- bamhash_checksum_fasta.cpp | 37 +- bamhash_checksum_fastq.cpp | 80 +- seqan/LICENSE | 26 - seqan/align.h | 209 - seqan/align/INFO | 13 - seqan/align/align_base.h | 865 --- seqan/align/align_cols.h | 448 -- seqan/align/align_config.h | 429 -- seqan/align/align_iterator_base.h | 570 -- seqan/align/align_metafunctions.h | 178 - seqan/align/align_traceback.h | 176 - seqan/align/alignment_algorithm_tags.h | 192 - seqan/align/alignment_operations.h | 159 - seqan/align/dp_algorithm_impl.h | 1461 ----- seqan/align/dp_band.h | 228 - seqan/align/dp_cell.h | 227 - seqan/align/dp_cell_affine.h | 186 - seqan/align/dp_cell_linear.h | 115 - seqan/align/dp_formula.h | 226 - seqan/align/dp_formula_affine.h | 624 -- seqan/align/dp_formula_linear.h | 295 - seqan/align/dp_matrix.h | 671 --- seqan/align/dp_matrix_navigator.h | 230 - .../align/dp_matrix_navigator_score_matrix.h | 417 -- .../dp_matrix_navigator_score_matrix_sparse.h | 379 -- .../align/dp_matrix_navigator_trace_matrix.h | 468 -- seqan/align/dp_matrix_sparse.h | 165 - seqan/align/dp_meta_info.h | 453 -- seqan/align/dp_profile.h | 456 -- seqan/align/dp_scout.h | 269 - seqan/align/dp_setup.h | 904 --- seqan/align/dp_trace_segment.h | 341 -- seqan/align/dp_traceback_adaptor.h | 342 -- seqan/align/dp_traceback_impl.h | 572 -- seqan/align/evaluate_alignment.h | 257 - seqan/align/gap_anchor.h | 402 -- seqan/align/gapped_value_type.h | 98 - seqan/align/gaps_anchor.h | 1046 ---- seqan/align/gaps_array.h | 847 --- seqan/align/gaps_base.h | 1485 ----- seqan/align/gaps_iterator_anchor.h | 750 --- seqan/align/gaps_iterator_array.h | 741 --- seqan/align/gaps_iterator_base.h | 372 -- seqan/align/global_alignment_banded.h | 531 -- .../align/global_alignment_hirschberg_impl.h | 729 --- .../global_alignment_myers_hirschberg_impl.h | 750 --- seqan/align/global_alignment_myers_impl.h | 201 - seqan/align/global_alignment_specialized.h | 199 - seqan/align/global_alignment_unbanded.h | 740 --- seqan/align/local_alignment_banded.h | 161 - ...al_alignment_banded_waterman_eggert_impl.h | 601 -- seqan/align/local_alignment_enumeration.h | 342 -- .../local_alignment_enumeration_banded.h | 126 - .../local_alignment_enumeration_unbanded.h | 122 - seqan/align/local_alignment_unbanded.h | 330 -- .../local_alignment_waterman_eggert_impl.h | 768 --- seqan/align/matrix_base.h | 1141 ---- seqan/arg_parse.h | 67 - seqan/arg_parse/INFO | 10 - seqan/arg_parse/arg_parse_argument.h | 1402 ----- seqan/arg_parse/arg_parse_ctd_support.h | 568 -- seqan/arg_parse/arg_parse_doc.h | 747 --- seqan/arg_parse/arg_parse_exceptions.h | 120 - seqan/arg_parse/arg_parse_option.h | 587 -- seqan/arg_parse/arg_parse_parse.h | 376 -- seqan/arg_parse/arg_parse_type_support.h | 190 - seqan/arg_parse/argument_parser.h | 1478 ----- seqan/arg_parse/tool_doc.h | 1675 ------ seqan/arg_parse/xml_support.h | 104 - seqan/bam_io.h | 109 - seqan/bam_io/INFO | 12 - seqan/bam_io/bam_alignment_record.h | 923 --- seqan/bam_io/bam_alignment_record_util.h | 236 - seqan/bam_io/bam_header_record.h | 648 --- seqan/bam_io/bam_index_bai.h | 818 --- seqan/bam_io/bam_index_base.h | 130 - seqan/bam_io/bam_io_context.h | 272 - seqan/bam_io/bam_reader.h | 206 - seqan/bam_io/bam_sam_conversion.h | 682 --- seqan/bam_io/bam_stream.h | 851 --- seqan/bam_io/bam_tags_dict.h | 1058 ---- seqan/bam_io/bam_writer.h | 161 - seqan/bam_io/cigar.h | 578 -- seqan/bam_io/read_bam.h | 407 -- seqan/bam_io/read_sam.h | 510 -- seqan/bam_io/sam_reader.h | 201 - seqan/bam_io/sam_writer.h | 161 - seqan/bam_io/write_bam.h | 303 - seqan/bam_io/write_sam.h | 287 - seqan/bam_io/xam_reader.h | 103 - seqan/bam_io/xam_writer.h | 98 - seqan/basic.h | 97 - seqan/basic/INFO | 14 - seqan/basic/aggregate_concept.h | 178 - seqan/basic/allocator_chunkpool.h | 276 - seqan/basic/allocator_interface.h | 436 -- seqan/basic/allocator_multipool.h | 288 - seqan/basic/allocator_simple.h | 275 - seqan/basic/allocator_singlepool.h | 275 - seqan/basic/allocator_to_std.h | 245 - seqan/basic/alphabet_adapt_builtins.h | 274 - seqan/basic/alphabet_bio.h | 101 - seqan/basic/alphabet_concept.h | 923 --- seqan/basic/alphabet_math.h | 277 - seqan/basic/alphabet_profile.h | 395 -- seqan/basic/alphabet_qualities.h | 143 - seqan/basic/alphabet_residue.h | 1741 ------ seqan/basic/alphabet_residue_funcs.h | 63 - seqan/basic/alphabet_residue_tabs.h | 586 -- seqan/basic/alphabet_simple_type.h | 1081 ---- seqan/basic/alphabet_storage.h | 335 -- seqan/basic/array_construct_destruct.h | 1687 ------ seqan/basic/basic_aggregate.h | 62 - seqan/basic/basic_allocator.h | 64 - seqan/basic/basic_alphabet.h | 98 - seqan/basic/basic_concept.h | 66 - seqan/basic/basic_container.h | 56 - seqan/basic/basic_debug.h | 60 - seqan/basic/basic_exception.h | 246 - seqan/basic/basic_fundamental.h | 85 - seqan/basic/basic_iterator.h | 77 - seqan/basic/basic_math.h | 58 - seqan/basic/basic_metaprogramming.h | 59 - seqan/basic/basic_parallelism.h | 94 - seqan/basic/basic_proxy.h | 59 - seqan/basic/basic_smart_pointer.h | 59 - seqan/basic/basic_tangle.h | 175 - seqan/basic/basic_type.h | 718 --- seqan/basic/boost_preprocessor_subset.h | 5138 ----------------- seqan/basic/builtin_functions.h | 269 - seqan/basic/concept_checking.h | 1007 ---- seqan/basic/container_concept.h | 632 -- seqan/basic/debug_helper.h | 240 - seqan/basic/debug_test_system.h | 3125 ---------- seqan/basic/fundamental_comparison.h | 180 - seqan/basic/fundamental_concepts.h | 1195 ---- seqan/basic/fundamental_conversion.h | 206 - seqan/basic/fundamental_metafunctions.h | 413 -- seqan/basic/fundamental_tags.h | 722 --- seqan/basic/fundamental_transport.h | 300 - seqan/basic/holder_base.h | 479 -- seqan/basic/holder_simple.h | 341 -- seqan/basic/holder_tristate.h | 1076 ---- seqan/basic/hosted_type_interface.h | 410 -- seqan/basic/iterator_adapt_pointer.h | 96 - seqan/basic/iterator_adapt_std.h | 622 -- seqan/basic/iterator_adaptor.h | 763 --- seqan/basic/iterator_base.h | 433 -- seqan/basic/iterator_concept.h | 1122 ---- seqan/basic/iterator_interface.h | 945 --- seqan/basic/iterator_position.h | 578 -- seqan/basic/macro_deprecated.h | 78 - seqan/basic/math_functions.h | 218 - seqan/basic/math_log_space_value.h | 498 -- seqan/basic/metaprogramming_control.h | 383 -- seqan/basic/metaprogramming_enable_if.h | 449 -- seqan/basic/metaprogramming_logic.h | 696 --- seqan/basic/metaprogramming_math.h | 216 - seqan/basic/metaprogramming_type.h | 411 -- seqan/basic/pair_base.h | 513 -- seqan/basic/pair_bit_compressed.h | 201 - seqan/basic/pair_packed.h | 205 - seqan/basic/profiling.h | 651 --- seqan/basic/proxy_base.h | 505 -- seqan/basic/proxy_iterator.h | 325 -- seqan/basic/test_system.h | 353 -- seqan/basic/triple_base.h | 567 -- seqan/basic/triple_packed.h | 211 - seqan/basic/tuple_base.h | 611 -- seqan/basic/tuple_bit_compressed.h | 465 -- seqan/basic/volatile_ptr.h | 246 - seqan/consensus.h | 53 - seqan/consensus/INFO | 11 - seqan/consensus/consensus_base.h | 1973 ------- seqan/consensus/consensus_library.h | 577 -- seqan/consensus/consensus_realign.h | 802 --- seqan/consensus/consensus_score.h | 588 -- seqan/file.h | 123 - seqan/file/INFO | 13 - seqan/file/chunk_collector.h | 598 -- seqan/file/cstream.h | 337 -- seqan/file/file_base.h | 898 --- seqan/file/file_cstyle.h | 278 - seqan/file/file_filereader.h | 1034 ---- seqan/file/file_filereaderiterator.h | 182 - seqan/file/file_format.h | 785 --- seqan/file/file_format_cgviz.h | 259 - seqan/file/file_format_embl.h | 664 --- seqan/file/file_format_fasta.h | 621 -- seqan/file/file_format_fasta_align.h | 368 -- seqan/file/file_format_genbank.h | 412 -- seqan/file/file_format_guess.h | 129 - seqan/file/file_format_mmap.h | 1656 ------ seqan/file/file_format_raw.h | 351 -- seqan/file/file_forwards.h | 57 - seqan/file/file_interface.h | 264 - seqan/file/file_mapping.h | 921 --- seqan/file/file_page.h | 1542 ----- seqan/file/meta.h | 50 - seqan/file/stream.h | 496 -- seqan/file/stream_algorithms.h | 254 - seqan/file/string_external.h | 2374 -------- seqan/file/string_mmap.h | 733 --- seqan/find.h | 91 - seqan/find/INFO | 13 - seqan/find/find_abndm.h | 659 --- seqan/find/find_ahocorasick.h | 366 -- seqan/find/find_base.h | 1279 ---- seqan/find/find_begin.h | 442 -- seqan/find/find_bndm.h | 278 - seqan/find/find_bom.h | 295 - seqan/find/find_hamming_simple.h | 296 - seqan/find/find_horspool.h | 492 -- seqan/find/find_multi.h | 160 - seqan/find/find_multiple_bfam.h | 428 -- seqan/find/find_multiple_shiftand.h | 450 -- seqan/find/find_myers_ukkonen.h | 1780 ------ seqan/find/find_pattern_base.h | 563 -- seqan/find/find_pex.h | 794 --- seqan/find/find_score.h | 560 -- seqan/find/find_set_horspool.h | 318 - seqan/find/find_shiftand.h | 315 - seqan/find/find_shiftor.h | 352 -- seqan/find/find_simple.h | 177 - seqan/find/find_wild_shiftand.h | 715 --- seqan/find/find_wumanber.h | 493 -- seqan/gff_io.h | 58 - seqan/gff_io/INFO | 10 - seqan/gff_io/gff_io_base.h | 947 --- seqan/gff_io/gff_io_context.h | 274 - seqan/gff_io/gff_stream.h | 597 -- seqan/graph_algorithms.h | 52 - seqan/graph_algorithms/INFO | 11 - seqan/graph_algorithms/graph_algorithm.h | 2415 -------- .../graph_algorithm_heap_tree.h | 516 -- seqan/graph_algorithms/graph_algorithm_hmm.h | 1259 ---- .../graph_algorithm_lis_his.h | 496 -- seqan/graph_align.h | 68 - seqan/graph_align/INFO | 9 - .../graph_algorithm_refine_align.h | 194 - .../graph_algorithm_refine_aligngraph.h | 292 - .../graph_algorithm_refine_annotation.h | 413 -- .../graph_algorithm_refine_exact.h | 566 -- .../graph_algorithm_refine_exact_iterative.h | 705 --- .../graph_algorithm_refine_fragment.h | 207 - .../graph_algorithm_refine_inexact.h | 352 -- .../graph_algorithm_refine_scoring.h | 52 - seqan/graph_align/graph_impl_align.h | 2375 -------- seqan/graph_align/graph_impl_align_adapt.h | 426 -- seqan/graph_msa.h | 54 - seqan/graph_msa/INFO | 9 - seqan/graph_msa/graph_align_tcoffee_base.h | 1170 ---- .../graph_msa/graph_align_tcoffee_distance.h | 256 - .../graph_msa/graph_align_tcoffee_guidetree.h | 971 ---- seqan/graph_msa/graph_align_tcoffee_io.h | 1179 ---- seqan/graph_msa/graph_align_tcoffee_kmer.h | 155 - seqan/graph_msa/graph_align_tcoffee_library.h | 937 --- seqan/graph_msa/graph_align_tcoffee_msa.h | 497 -- .../graph_align_tcoffee_progressive.h | 502 -- .../graph_align_tcoffee_refinement.h | 516 -- seqan/graph_types.h | 83 - seqan/graph_types/INFO | 9 - seqan/graph_types/graph_base.h | 430 -- seqan/graph_types/graph_drawing.h | 949 --- seqan/graph_types/graph_edgestump.h | 1319 ----- seqan/graph_types/graph_idmanager.h | 604 -- seqan/graph_types/graph_impl_automaton.h | 1136 ---- seqan/graph_types/graph_impl_directed.h | 1048 ---- seqan/graph_types/graph_impl_fragment.h | 721 --- seqan/graph_types/graph_impl_hmm.h | 1248 ---- seqan/graph_types/graph_impl_oracle.h | 287 - seqan/graph_types/graph_impl_tree.h | 1278 ---- seqan/graph_types/graph_impl_trie.h | 316 - seqan/graph_types/graph_impl_undirected.h | 836 --- seqan/graph_types/graph_impl_wordgraph.h | 353 -- seqan/graph_types/graph_interface.h | 782 --- seqan/graph_types/graph_iterator.h | 98 - seqan/graph_types/graph_iterator_adjacency.h | 388 -- seqan/graph_types/graph_iterator_bfs.h | 344 -- seqan/graph_types/graph_iterator_dfs.h | 349 -- seqan/graph_types/graph_iterator_edge.h | 519 -- seqan/graph_types/graph_iterator_outedge.h | 1284 ---- seqan/graph_types/graph_iterator_vertex.h | 565 -- seqan/graph_types/graph_property.h | 865 --- seqan/graph_types/graph_utility_parsing.h | 92 - seqan/index.h | 183 - seqan/index/INFO | 12 - seqan/index/find_index.h | 311 - seqan/index/find_index_approx.h | 331 -- seqan/index/find_index_esa.h | 1975 ------- seqan/index/find_index_qgram.h | 116 - seqan/index/find_pigeonhole.h | 1155 ---- seqan/index/find_quasar.h | 168 - seqan/index/find_swift.h | 2270 -------- seqan/index/index_base.h | 2106 ------- seqan/index/index_bwt.h | 312 - seqan/index/index_childtab.h | 316 - seqan/index/index_dfi.h | 620 -- seqan/index/index_esa_algs.h | 1142 ---- seqan/index/index_esa_algs_multi.h | 809 --- seqan/index/index_esa_base.h | 673 --- seqan/index/index_esa_drawing.h | 109 - seqan/index/index_esa_stree.h | 3576 ------------ seqan/index/index_fm.h | 913 --- seqan/index/index_fm_compressed_sa.h | 543 -- seqan/index/index_fm_compressed_sa_iterator.h | 139 - seqan/index/index_fm_doc.h | 1367 ----- seqan/index/index_fm_dox.h | 2026 ------- seqan/index/index_fm_lf_table.h | 446 -- seqan/index/index_fm_prefix_sum_table.h | 740 --- seqan/index/index_fm_rank_dictionary_bms.h | 354 -- seqan/index/index_fm_rank_dictionary_wt.h | 627 -- .../index/index_fm_rank_support_bit_string.h | 834 --- ...ndex_fm_rank_support_bit_string_iterator.h | 173 - .../index/index_fm_right_array_binary_tree.h | 418 -- ...ndex_fm_right_array_binary_tree_iterator.h | 712 --- .../index/index_fm_sentinel_rank_dictionary.h | 777 --- seqan/index/index_fm_sparse_string.h | 413 -- seqan/index/index_fm_stree.h | 542 -- seqan/index/index_forwards.h | 69 - seqan/index/index_lcp.h | 535 -- seqan/index/index_lcp_tree.h | 179 - seqan/index/index_pizzachili.h | 426 -- seqan/index/index_pizzachili_find.h | 174 - seqan/index/index_pizzachili_string.h | 821 --- seqan/index/index_qgram.h | 3257 ----------- seqan/index/index_qgram_openaddressing.h | 362 -- seqan/index/index_sa_btree.h | 134 - seqan/index/index_sa_bwtwalk.h | 657 --- seqan/index/index_sa_lss.h | 451 -- seqan/index/index_sa_mm.h | 201 - seqan/index/index_sa_qsort.h | 245 - seqan/index/index_shawarma.h | 100 - seqan/index/index_shims.h | 1063 ---- seqan/index/index_skew3.h | 595 -- seqan/index/index_skew7.h | 926 --- seqan/index/index_skew7_multi.h | 446 -- seqan/index/index_wotd.h | 2142 ------- seqan/index/pipe_merger3.h | 168 - seqan/index/pipe_merger7.h | 555 -- seqan/index/pizzachili_api.h | 232 - seqan/index/pump_extender3.h | 141 - seqan/index/pump_extender7.h | 518 -- seqan/index/pump_lcp_core.h | 388 -- seqan/index/pump_separator7.h | 85 - seqan/index/radix.h | 195 - seqan/index/repeat_base.h | 656 --- seqan/index/shape_base.h | 1174 ---- seqan/index/shape_gapped.h | 776 --- seqan/index/shape_onegapped.h | 436 -- seqan/index/shape_predefined.h | 128 - seqan/index/shape_threshold.h | 1124 ---- seqan/map.h | 62 - seqan/map/INFO | 8 - seqan/map/map_adapter_stl.h | 757 --- seqan/map/map_base.h | 318 - seqan/map/map_chooser.h | 66 - seqan/map/map_skiplist.h | 1317 ----- seqan/map/map_vector.h | 530 -- seqan/map/sumlist.h | 214 - seqan/map/sumlist_mini.h | 976 ---- seqan/map/sumlist_skip.h | 1124 ---- seqan/misc/INFO | 14 - seqan/misc/cmdparser/INFO | 11 - seqan/misc/cmdparser/cmdoption.h | 664 --- seqan/misc/cmdparser/cmdparser.h | 1642 ------ seqan/misc/cmdparser/cmdparser_ctd_support.h | 280 - seqan/misc/cmdparser/cmdparser_parse.h | 226 - seqan/misc/cmdparser/cmdparser_type_support.h | 68 - seqan/misc/edit_environment.h | 1307 ----- seqan/misc/misc_accumulators.h | 457 -- seqan/misc/misc_base.h | 113 - seqan/misc/misc_bit_twiddling.h | 498 -- seqan/misc/misc_cmdparser.h | 41 - seqan/misc/misc_dequeue.h | 421 -- seqan/misc/misc_interval_tree.h | 2333 -------- seqan/misc/misc_map.h | 218 - seqan/misc/misc_memset.h | 228 - seqan/misc/misc_name_store_cache.h | 350 -- seqan/misc/misc_parsing.h | 723 --- seqan/misc/misc_set.h | 608 -- seqan/misc/misc_sse2.h | 508 -- seqan/misc/misc_svg.h | 498 -- seqan/misc/misc_terminal.h | 248 - seqan/misc/misc_union_find.h | 452 -- seqan/misc/priority_type_base.h | 94 - seqan/misc/priority_type_heap.h | 420 -- seqan/modifier.h | 73 - seqan/modifier/INFO | 11 - seqan/modifier/modifier_alphabet.h | 781 --- seqan/modifier/modifier_alphabet_expansion.h | 548 -- seqan/modifier/modifier_functors.h | 292 - seqan/modifier/modifier_iterator.h | 686 --- seqan/modifier/modifier_reverse.h | 629 -- seqan/modifier/modifier_shortcuts.h | 727 --- seqan/modifier/modifier_string.h | 843 --- seqan/modifier/modifier_view.h | 495 -- seqan/parallel.h | 66 - seqan/parallel/INFO | 12 - seqan/parallel/parallel_algorithms.h | 254 - seqan/parallel/parallel_atomic_misc.h | 168 - seqan/parallel/parallel_atomic_primitives.h | 527 -- seqan/parallel/parallel_macros.h | 133 - seqan/parallel/parallel_splitting.h | 407 -- seqan/parallel/parallel_tags.h | 80 - seqan/pipe.h | 80 - seqan/pipe/INFO | 10 - seqan/pipe/pipe_base.h | 1211 ---- seqan/pipe/pipe_caster.h | 127 - seqan/pipe/pipe_counter.h | 125 - seqan/pipe/pipe_echoer.h | 178 - seqan/pipe/pipe_edit_environment.h | 372 -- seqan/pipe/pipe_filter.h | 163 - seqan/pipe/pipe_iterator.h | 264 - seqan/pipe/pipe_joiner.h | 149 - seqan/pipe/pipe_namer.h | 175 - seqan/pipe/pipe_sampler.h | 668 --- seqan/pipe/pipe_shifter.h | 190 - seqan/pipe/pipe_source.h | 421 -- seqan/pipe/pipe_tupler.h | 557 -- seqan/pipe/pool_base.h | 1434 ----- seqan/pipe/pool_mapper.h | 686 --- seqan/pipe/pool_sorter.h | 520 -- seqan/platform.h | 61 - seqan/platform/INFO | 11 - seqan/platform/platform_gcc.h | 178 - seqan/platform/platform_icc.h | 89 - seqan/platform/platform_mingw.h | 83 - seqan/platform/platform_nvcc.h | 145 - seqan/platform/platform_pgi.h | 88 - seqan/platform/platform_solaris.h | 48 - seqan/platform/platform_windows.h | 140 - seqan/platform/windows_stdint.h | 252 - seqan/random.h | 70 - seqan/random/INFO | 8 - seqan/random/ext_MersenneTwister.h | 486 -- seqan/random/random_base.h | 374 -- seqan/random/random_beta.h | 158 - seqan/random/random_beta_kfunc.h | 187 - seqan/random/random_geometric.h | 145 - seqan/random/random_lognormal.h | 200 - seqan/random/random_mt19937.h | 172 - seqan/random/random_normal.h | 158 - seqan/random/random_rng_functor.h | 153 - seqan/random/random_shuffle.h | 100 - seqan/random/random_uniform.h | 189 - seqan/score.h | 51 - seqan/score/INFO | 11 - seqan/score/score_base.h | 500 -- seqan/score/score_edit.h | 165 - seqan/score/score_matrix.h | 263 - seqan/score/score_matrix_data.h | 755 --- seqan/score/score_matrix_io.h | 525 -- seqan/score/score_simple.h | 488 -- seqan/seeds.h | 90 - seqan/seeds/INFO | 18 - seqan/seeds/banded_chain_alignment.h | 584 -- seqan/seeds/banded_chain_alignment_impl.h | 1247 ---- seqan/seeds/banded_chain_alignment_profile.h | 267 - seqan/seeds/banded_chain_alignment_scout.h | 357 -- .../seeds/banded_chain_alignment_traceback.h | 381 -- seqan/seeds/basic_iter_indirect.h | 191 - seqan/seeds/seeds_base.h | 42 - seqan/seeds/seeds_combination.h | 473 -- seqan/seeds/seeds_extension.h | 920 --- seqan/seeds/seeds_global_chaining.h | 278 - seqan/seeds/seeds_global_chaining_base.h | 44 - seqan/seeds/seeds_global_chaining_gusfield.h | 48 - seqan/seeds/seeds_seed_base.h | 936 --- seqan/seeds/seeds_seed_chained.h | 626 -- seqan/seeds/seeds_seed_diagonal.h | 218 - seqan/seeds/seeds_seed_set_base.h | 428 -- seqan/seeds/seeds_seed_set_non_scored.h | 69 - seqan/seeds/seeds_seed_set_scored.h | 69 - seqan/seeds/seeds_seed_set_unordered.h | 393 -- seqan/seeds/seeds_seed_simple.h | 299 - seqan/seq_io.h | 85 - seqan/seq_io/INFO | 12 - seqan/seq_io/fai_index.h | 883 --- seqan/seq_io/genomic_region.h | 365 -- seqan/seq_io/guess_stream_format.h | 477 -- seqan/seq_io/read_embl.h | 267 - seqan/seq_io/read_fasta_fastq.h | 1131 ---- seqan/seq_io/read_genbank.h | 299 - seqan/seq_io/sequence_stream.h | 1265 ---- seqan/seq_io/sequence_stream_impl.h | 1091 ---- seqan/seq_io/simple_read_fasta.h | 145 - seqan/seq_io/write_fasta_fastq.h | 605 -- seqan/sequence.h | 137 - seqan/sequence/INFO | 15 - seqan/sequence/adapt_array_pointer.h | 888 --- seqan/sequence/adapt_std_list.h | 362 -- seqan/sequence/adapt_std_string.h | 761 --- seqan/sequence/adapt_std_vector.h | 806 --- seqan/sequence/iter_concat_virtual.h | 596 -- seqan/sequence/segment_base.h | 900 --- seqan/sequence/segment_infix.h | 943 --- seqan/sequence/segment_prefix.h | 754 --- seqan/sequence/segment_suffix.h | 769 --- seqan/sequence/segment_utils.h | 138 - seqan/sequence/sequence_concatenator.h | 309 - seqan/sequence/sequence_forwards.h | 405 -- seqan/sequence/sequence_interface.h | 2388 -------- seqan/sequence/sequence_lexical.h | 1072 ---- seqan/sequence/sequence_shortcuts.h | 404 -- seqan/sequence/string_alloc.h | 482 -- seqan/sequence/string_array.h | 280 - seqan/sequence/string_base.h | 2150 ------- seqan/sequence/string_block.h | 691 --- seqan/sequence/string_cstyle.h | 1000 ---- seqan/sequence/string_packed.h | 1623 ------ seqan/sequence/string_packed_old.h | 1369 ----- seqan/sequence/string_set_base.h | 2037 ------- seqan/sequence/string_set_concat_direct.h | 560 -- .../sequence/string_set_dependent_generous.h | 288 - seqan/sequence/string_set_dependent_tight.h | 352 -- seqan/sequence/string_set_owner.h | 338 -- seqan/sequence_journaled.h | 71 - seqan/sequence_journaled/INFO | 11 - .../journal_entries_sorted_array.h | 669 --- .../journal_entries_unbalanced_tree.h | 779 --- ...journal_entries_unbalanced_tree_iterator.h | 519 -- .../journal_entries_unbalanced_tree_node.h | 145 - seqan/sequence_journaled/journal_entry.h | 161 - seqan/sequence_journaled/sequence_journaled.h | 1211 ---- .../sequence_journaled_iterator.h | 1211 ---- seqan/store.h | 72 - seqan/store/INFO | 12 - seqan/store/store_align.h | 1596 ----- seqan/store/store_align_intervals.h | 353 -- seqan/store/store_all.h | 2841 --------- seqan/store/store_annotation.h | 1731 ------ seqan/store/store_base.h | 47 - seqan/store/store_contig.h | 308 - seqan/store/store_intervaltree.h | 196 - seqan/store/store_io.h | 1734 ------ seqan/store/store_io_gff.h | 582 -- seqan/store/store_io_sam.h | 1244 ---- seqan/store/store_io_ucsc.h | 722 --- seqan/store/store_library.h | 127 - seqan/store/store_matepair.h | 145 - seqan/store/store_read.h | 127 - seqan/stream.h | 137 - seqan/stream/INFO | 32 - seqan/stream/adapt_cstdio.h | 382 -- seqan/stream/adapt_fstream.h | 720 --- seqan/stream/adapt_iostream.h | 383 -- seqan/stream/adapt_mmap.h | 166 - seqan/stream/adapt_sstream.h | 628 -- seqan/stream/concept_stream.h | 647 --- seqan/stream/file_stream.h | 1168 ---- seqan/stream/is.h | 350 -- seqan/stream/lexical_cast.h | 223 - seqan/stream/read.h | 131 - seqan/stream/read_auto_format.h | 238 - seqan/stream/read_sam.h | 192 - seqan/stream/record_reader_base.h | 344 -- seqan/stream/record_reader_double.h | 454 -- seqan/stream/record_reader_double_mmap.h | 235 - seqan/stream/record_reader_single.h | 270 - seqan/stream/record_reader_single_mmap.h | 208 - seqan/stream/stream_base.h | 141 - seqan/stream/stream_bgzf.h | 1231 ---- seqan/stream/stream_bz2_file.h | 453 -- seqan/stream/stream_char_array.h | 536 -- seqan/stream/stream_gz_file.h | 480 -- seqan/stream/stream_put.h | 312 - seqan/stream/tokenize.h | 2479 -------- seqan/stream/write.h | 124 - seqan/system.h | 91 - seqan/system/INFO | 9 - seqan/system/file_async.h | 1143 ---- seqan/system/file_directory.h | 315 - seqan/system/file_forwards.h | 161 - seqan/system/file_sync.h | 468 -- seqan/system/system_base.h | 65 - seqan/system/system_event.h | 376 -- seqan/system/system_forwards.h | 125 - seqan/system/system_mutex.h | 183 - seqan/system/system_sema.h | 141 - seqan/system/system_thread.h | 217 - seqan/version.h | 77 - 586 files changed, 205 insertions(+), 300961 deletions(-) delete mode 100644 seqan/LICENSE delete mode 100644 seqan/align.h delete mode 100644 seqan/align/INFO delete mode 100644 seqan/align/align_base.h delete mode 100644 seqan/align/align_cols.h delete mode 100644 seqan/align/align_config.h delete mode 100644 seqan/align/align_iterator_base.h delete mode 100644 seqan/align/align_metafunctions.h delete mode 100644 seqan/align/align_traceback.h delete mode 100644 seqan/align/alignment_algorithm_tags.h delete mode 100644 seqan/align/alignment_operations.h delete mode 100644 seqan/align/dp_algorithm_impl.h delete mode 100644 seqan/align/dp_band.h delete mode 100644 seqan/align/dp_cell.h delete mode 100644 seqan/align/dp_cell_affine.h delete mode 100644 seqan/align/dp_cell_linear.h delete mode 100644 seqan/align/dp_formula.h delete mode 100644 seqan/align/dp_formula_affine.h delete mode 100644 seqan/align/dp_formula_linear.h delete mode 100644 seqan/align/dp_matrix.h delete mode 100644 seqan/align/dp_matrix_navigator.h delete mode 100644 seqan/align/dp_matrix_navigator_score_matrix.h delete mode 100644 seqan/align/dp_matrix_navigator_score_matrix_sparse.h delete mode 100644 seqan/align/dp_matrix_navigator_trace_matrix.h delete mode 100644 seqan/align/dp_matrix_sparse.h delete mode 100644 seqan/align/dp_meta_info.h delete mode 100644 seqan/align/dp_profile.h delete mode 100644 seqan/align/dp_scout.h delete mode 100644 seqan/align/dp_setup.h delete mode 100644 seqan/align/dp_trace_segment.h delete mode 100644 seqan/align/dp_traceback_adaptor.h delete mode 100644 seqan/align/dp_traceback_impl.h delete mode 100644 seqan/align/evaluate_alignment.h delete mode 100644 seqan/align/gap_anchor.h delete mode 100644 seqan/align/gapped_value_type.h delete mode 100644 seqan/align/gaps_anchor.h delete mode 100644 seqan/align/gaps_array.h delete mode 100644 seqan/align/gaps_base.h delete mode 100644 seqan/align/gaps_iterator_anchor.h delete mode 100644 seqan/align/gaps_iterator_array.h delete mode 100644 seqan/align/gaps_iterator_base.h delete mode 100644 seqan/align/global_alignment_banded.h delete mode 100644 seqan/align/global_alignment_hirschberg_impl.h delete mode 100644 seqan/align/global_alignment_myers_hirschberg_impl.h delete mode 100644 seqan/align/global_alignment_myers_impl.h delete mode 100644 seqan/align/global_alignment_specialized.h delete mode 100644 seqan/align/global_alignment_unbanded.h delete mode 100644 seqan/align/local_alignment_banded.h delete mode 100644 seqan/align/local_alignment_banded_waterman_eggert_impl.h delete mode 100644 seqan/align/local_alignment_enumeration.h delete mode 100644 seqan/align/local_alignment_enumeration_banded.h delete mode 100644 seqan/align/local_alignment_enumeration_unbanded.h delete mode 100644 seqan/align/local_alignment_unbanded.h delete mode 100644 seqan/align/local_alignment_waterman_eggert_impl.h delete mode 100644 seqan/align/matrix_base.h delete mode 100644 seqan/arg_parse.h delete mode 100644 seqan/arg_parse/INFO delete mode 100644 seqan/arg_parse/arg_parse_argument.h delete mode 100644 seqan/arg_parse/arg_parse_ctd_support.h delete mode 100644 seqan/arg_parse/arg_parse_doc.h delete mode 100644 seqan/arg_parse/arg_parse_exceptions.h delete mode 100644 seqan/arg_parse/arg_parse_option.h delete mode 100644 seqan/arg_parse/arg_parse_parse.h delete mode 100644 seqan/arg_parse/arg_parse_type_support.h delete mode 100644 seqan/arg_parse/argument_parser.h delete mode 100644 seqan/arg_parse/tool_doc.h delete mode 100644 seqan/arg_parse/xml_support.h delete mode 100644 seqan/bam_io.h delete mode 100644 seqan/bam_io/INFO delete mode 100644 seqan/bam_io/bam_alignment_record.h delete mode 100644 seqan/bam_io/bam_alignment_record_util.h delete mode 100644 seqan/bam_io/bam_header_record.h delete mode 100644 seqan/bam_io/bam_index_bai.h delete mode 100644 seqan/bam_io/bam_index_base.h delete mode 100644 seqan/bam_io/bam_io_context.h delete mode 100644 seqan/bam_io/bam_reader.h delete mode 100644 seqan/bam_io/bam_sam_conversion.h delete mode 100644 seqan/bam_io/bam_stream.h delete mode 100644 seqan/bam_io/bam_tags_dict.h delete mode 100644 seqan/bam_io/bam_writer.h delete mode 100755 seqan/bam_io/cigar.h delete mode 100644 seqan/bam_io/read_bam.h delete mode 100644 seqan/bam_io/read_sam.h delete mode 100644 seqan/bam_io/sam_reader.h delete mode 100644 seqan/bam_io/sam_writer.h delete mode 100644 seqan/bam_io/write_bam.h delete mode 100644 seqan/bam_io/write_sam.h delete mode 100644 seqan/bam_io/xam_reader.h delete mode 100644 seqan/bam_io/xam_writer.h delete mode 100644 seqan/basic.h delete mode 100644 seqan/basic/INFO delete mode 100644 seqan/basic/aggregate_concept.h delete mode 100644 seqan/basic/allocator_chunkpool.h delete mode 100644 seqan/basic/allocator_interface.h delete mode 100644 seqan/basic/allocator_multipool.h delete mode 100644 seqan/basic/allocator_simple.h delete mode 100644 seqan/basic/allocator_singlepool.h delete mode 100644 seqan/basic/allocator_to_std.h delete mode 100644 seqan/basic/alphabet_adapt_builtins.h delete mode 100644 seqan/basic/alphabet_bio.h delete mode 100644 seqan/basic/alphabet_concept.h delete mode 100644 seqan/basic/alphabet_math.h delete mode 100644 seqan/basic/alphabet_profile.h delete mode 100644 seqan/basic/alphabet_qualities.h delete mode 100644 seqan/basic/alphabet_residue.h delete mode 100644 seqan/basic/alphabet_residue_funcs.h delete mode 100644 seqan/basic/alphabet_residue_tabs.h delete mode 100644 seqan/basic/alphabet_simple_type.h delete mode 100644 seqan/basic/alphabet_storage.h delete mode 100644 seqan/basic/array_construct_destruct.h delete mode 100644 seqan/basic/basic_aggregate.h delete mode 100644 seqan/basic/basic_allocator.h delete mode 100644 seqan/basic/basic_alphabet.h delete mode 100644 seqan/basic/basic_concept.h delete mode 100644 seqan/basic/basic_container.h delete mode 100644 seqan/basic/basic_debug.h delete mode 100644 seqan/basic/basic_exception.h delete mode 100644 seqan/basic/basic_fundamental.h delete mode 100644 seqan/basic/basic_iterator.h delete mode 100644 seqan/basic/basic_math.h delete mode 100644 seqan/basic/basic_metaprogramming.h delete mode 100644 seqan/basic/basic_parallelism.h delete mode 100644 seqan/basic/basic_proxy.h delete mode 100644 seqan/basic/basic_smart_pointer.h delete mode 100644 seqan/basic/basic_tangle.h delete mode 100644 seqan/basic/basic_type.h delete mode 100644 seqan/basic/boost_preprocessor_subset.h delete mode 100644 seqan/basic/builtin_functions.h delete mode 100644 seqan/basic/concept_checking.h delete mode 100644 seqan/basic/container_concept.h delete mode 100644 seqan/basic/debug_helper.h delete mode 100644 seqan/basic/debug_test_system.h delete mode 100644 seqan/basic/fundamental_comparison.h delete mode 100644 seqan/basic/fundamental_concepts.h delete mode 100644 seqan/basic/fundamental_conversion.h delete mode 100644 seqan/basic/fundamental_metafunctions.h delete mode 100644 seqan/basic/fundamental_tags.h delete mode 100644 seqan/basic/fundamental_transport.h delete mode 100644 seqan/basic/holder_base.h delete mode 100644 seqan/basic/holder_simple.h delete mode 100644 seqan/basic/holder_tristate.h delete mode 100644 seqan/basic/hosted_type_interface.h delete mode 100644 seqan/basic/iterator_adapt_pointer.h delete mode 100644 seqan/basic/iterator_adapt_std.h delete mode 100644 seqan/basic/iterator_adaptor.h delete mode 100644 seqan/basic/iterator_base.h delete mode 100644 seqan/basic/iterator_concept.h delete mode 100644 seqan/basic/iterator_interface.h delete mode 100644 seqan/basic/iterator_position.h delete mode 100644 seqan/basic/macro_deprecated.h delete mode 100644 seqan/basic/math_functions.h delete mode 100644 seqan/basic/math_log_space_value.h delete mode 100644 seqan/basic/metaprogramming_control.h delete mode 100644 seqan/basic/metaprogramming_enable_if.h delete mode 100644 seqan/basic/metaprogramming_logic.h delete mode 100644 seqan/basic/metaprogramming_math.h delete mode 100644 seqan/basic/metaprogramming_type.h delete mode 100644 seqan/basic/pair_base.h delete mode 100644 seqan/basic/pair_bit_compressed.h delete mode 100644 seqan/basic/pair_packed.h delete mode 100644 seqan/basic/profiling.h delete mode 100644 seqan/basic/proxy_base.h delete mode 100644 seqan/basic/proxy_iterator.h delete mode 100644 seqan/basic/test_system.h delete mode 100644 seqan/basic/triple_base.h delete mode 100644 seqan/basic/triple_packed.h delete mode 100644 seqan/basic/tuple_base.h delete mode 100644 seqan/basic/tuple_bit_compressed.h delete mode 100644 seqan/basic/volatile_ptr.h delete mode 100644 seqan/consensus.h delete mode 100644 seqan/consensus/INFO delete mode 100644 seqan/consensus/consensus_base.h delete mode 100644 seqan/consensus/consensus_library.h delete mode 100644 seqan/consensus/consensus_realign.h delete mode 100644 seqan/consensus/consensus_score.h delete mode 100644 seqan/file.h delete mode 100644 seqan/file/INFO delete mode 100644 seqan/file/chunk_collector.h delete mode 100644 seqan/file/cstream.h delete mode 100644 seqan/file/file_base.h delete mode 100644 seqan/file/file_cstyle.h delete mode 100644 seqan/file/file_filereader.h delete mode 100644 seqan/file/file_filereaderiterator.h delete mode 100644 seqan/file/file_format.h delete mode 100644 seqan/file/file_format_cgviz.h delete mode 100644 seqan/file/file_format_embl.h delete mode 100644 seqan/file/file_format_fasta.h delete mode 100644 seqan/file/file_format_fasta_align.h delete mode 100644 seqan/file/file_format_genbank.h delete mode 100644 seqan/file/file_format_guess.h delete mode 100644 seqan/file/file_format_mmap.h delete mode 100644 seqan/file/file_format_raw.h delete mode 100644 seqan/file/file_forwards.h delete mode 100644 seqan/file/file_interface.h delete mode 100644 seqan/file/file_mapping.h delete mode 100644 seqan/file/file_page.h delete mode 100644 seqan/file/meta.h delete mode 100644 seqan/file/stream.h delete mode 100644 seqan/file/stream_algorithms.h delete mode 100644 seqan/file/string_external.h delete mode 100644 seqan/file/string_mmap.h delete mode 100644 seqan/find.h delete mode 100644 seqan/find/INFO delete mode 100644 seqan/find/find_abndm.h delete mode 100644 seqan/find/find_ahocorasick.h delete mode 100644 seqan/find/find_base.h delete mode 100644 seqan/find/find_begin.h delete mode 100644 seqan/find/find_bndm.h delete mode 100644 seqan/find/find_bom.h delete mode 100644 seqan/find/find_hamming_simple.h delete mode 100644 seqan/find/find_horspool.h delete mode 100644 seqan/find/find_multi.h delete mode 100644 seqan/find/find_multiple_bfam.h delete mode 100644 seqan/find/find_multiple_shiftand.h delete mode 100644 seqan/find/find_myers_ukkonen.h delete mode 100644 seqan/find/find_pattern_base.h delete mode 100644 seqan/find/find_pex.h delete mode 100644 seqan/find/find_score.h delete mode 100644 seqan/find/find_set_horspool.h delete mode 100644 seqan/find/find_shiftand.h delete mode 100644 seqan/find/find_shiftor.h delete mode 100644 seqan/find/find_simple.h delete mode 100644 seqan/find/find_wild_shiftand.h delete mode 100644 seqan/find/find_wumanber.h delete mode 100644 seqan/gff_io.h delete mode 100644 seqan/gff_io/INFO delete mode 100644 seqan/gff_io/gff_io_base.h delete mode 100644 seqan/gff_io/gff_io_context.h delete mode 100644 seqan/gff_io/gff_stream.h delete mode 100644 seqan/graph_algorithms.h delete mode 100644 seqan/graph_algorithms/INFO delete mode 100644 seqan/graph_algorithms/graph_algorithm.h delete mode 100644 seqan/graph_algorithms/graph_algorithm_heap_tree.h delete mode 100644 seqan/graph_algorithms/graph_algorithm_hmm.h delete mode 100644 seqan/graph_algorithms/graph_algorithm_lis_his.h delete mode 100644 seqan/graph_align.h delete mode 100644 seqan/graph_align/INFO delete mode 100644 seqan/graph_align/graph_algorithm_refine_align.h delete mode 100644 seqan/graph_align/graph_algorithm_refine_aligngraph.h delete mode 100644 seqan/graph_align/graph_algorithm_refine_annotation.h delete mode 100644 seqan/graph_align/graph_algorithm_refine_exact.h delete mode 100644 seqan/graph_align/graph_algorithm_refine_exact_iterative.h delete mode 100644 seqan/graph_align/graph_algorithm_refine_fragment.h delete mode 100644 seqan/graph_align/graph_algorithm_refine_inexact.h delete mode 100644 seqan/graph_align/graph_algorithm_refine_scoring.h delete mode 100644 seqan/graph_align/graph_impl_align.h delete mode 100644 seqan/graph_align/graph_impl_align_adapt.h delete mode 100644 seqan/graph_msa.h delete mode 100644 seqan/graph_msa/INFO delete mode 100644 seqan/graph_msa/graph_align_tcoffee_base.h delete mode 100644 seqan/graph_msa/graph_align_tcoffee_distance.h delete mode 100644 seqan/graph_msa/graph_align_tcoffee_guidetree.h delete mode 100644 seqan/graph_msa/graph_align_tcoffee_io.h delete mode 100644 seqan/graph_msa/graph_align_tcoffee_kmer.h delete mode 100644 seqan/graph_msa/graph_align_tcoffee_library.h delete mode 100644 seqan/graph_msa/graph_align_tcoffee_msa.h delete mode 100644 seqan/graph_msa/graph_align_tcoffee_progressive.h delete mode 100644 seqan/graph_msa/graph_align_tcoffee_refinement.h delete mode 100644 seqan/graph_types.h delete mode 100644 seqan/graph_types/INFO delete mode 100644 seqan/graph_types/graph_base.h delete mode 100644 seqan/graph_types/graph_drawing.h delete mode 100644 seqan/graph_types/graph_edgestump.h delete mode 100644 seqan/graph_types/graph_idmanager.h delete mode 100644 seqan/graph_types/graph_impl_automaton.h delete mode 100644 seqan/graph_types/graph_impl_directed.h delete mode 100644 seqan/graph_types/graph_impl_fragment.h delete mode 100644 seqan/graph_types/graph_impl_hmm.h delete mode 100644 seqan/graph_types/graph_impl_oracle.h delete mode 100644 seqan/graph_types/graph_impl_tree.h delete mode 100644 seqan/graph_types/graph_impl_trie.h delete mode 100644 seqan/graph_types/graph_impl_undirected.h delete mode 100644 seqan/graph_types/graph_impl_wordgraph.h delete mode 100644 seqan/graph_types/graph_interface.h delete mode 100644 seqan/graph_types/graph_iterator.h delete mode 100644 seqan/graph_types/graph_iterator_adjacency.h delete mode 100644 seqan/graph_types/graph_iterator_bfs.h delete mode 100644 seqan/graph_types/graph_iterator_dfs.h delete mode 100644 seqan/graph_types/graph_iterator_edge.h delete mode 100644 seqan/graph_types/graph_iterator_outedge.h delete mode 100644 seqan/graph_types/graph_iterator_vertex.h delete mode 100644 seqan/graph_types/graph_property.h delete mode 100644 seqan/graph_types/graph_utility_parsing.h delete mode 100644 seqan/index.h delete mode 100644 seqan/index/INFO delete mode 100644 seqan/index/find_index.h delete mode 100644 seqan/index/find_index_approx.h delete mode 100644 seqan/index/find_index_esa.h delete mode 100644 seqan/index/find_index_qgram.h delete mode 100755 seqan/index/find_pigeonhole.h delete mode 100644 seqan/index/find_quasar.h delete mode 100644 seqan/index/find_swift.h delete mode 100644 seqan/index/index_base.h delete mode 100644 seqan/index/index_bwt.h delete mode 100644 seqan/index/index_childtab.h delete mode 100644 seqan/index/index_dfi.h delete mode 100644 seqan/index/index_esa_algs.h delete mode 100644 seqan/index/index_esa_algs_multi.h delete mode 100644 seqan/index/index_esa_base.h delete mode 100644 seqan/index/index_esa_drawing.h delete mode 100644 seqan/index/index_esa_stree.h delete mode 100644 seqan/index/index_fm.h delete mode 100755 seqan/index/index_fm_compressed_sa.h delete mode 100755 seqan/index/index_fm_compressed_sa_iterator.h delete mode 100644 seqan/index/index_fm_doc.h delete mode 100644 seqan/index/index_fm_dox.h delete mode 100755 seqan/index/index_fm_lf_table.h delete mode 100755 seqan/index/index_fm_prefix_sum_table.h delete mode 100644 seqan/index/index_fm_rank_dictionary_bms.h delete mode 100755 seqan/index/index_fm_rank_dictionary_wt.h delete mode 100755 seqan/index/index_fm_rank_support_bit_string.h delete mode 100755 seqan/index/index_fm_rank_support_bit_string_iterator.h delete mode 100755 seqan/index/index_fm_right_array_binary_tree.h delete mode 100755 seqan/index/index_fm_right_array_binary_tree_iterator.h delete mode 100644 seqan/index/index_fm_sentinel_rank_dictionary.h delete mode 100755 seqan/index/index_fm_sparse_string.h delete mode 100644 seqan/index/index_fm_stree.h delete mode 100644 seqan/index/index_forwards.h delete mode 100644 seqan/index/index_lcp.h delete mode 100644 seqan/index/index_lcp_tree.h delete mode 100644 seqan/index/index_pizzachili.h delete mode 100644 seqan/index/index_pizzachili_find.h delete mode 100644 seqan/index/index_pizzachili_string.h delete mode 100644 seqan/index/index_qgram.h delete mode 100644 seqan/index/index_qgram_openaddressing.h delete mode 100644 seqan/index/index_sa_btree.h delete mode 100644 seqan/index/index_sa_bwtwalk.h delete mode 100644 seqan/index/index_sa_lss.h delete mode 100644 seqan/index/index_sa_mm.h delete mode 100644 seqan/index/index_sa_qsort.h delete mode 100644 seqan/index/index_shawarma.h delete mode 100644 seqan/index/index_shims.h delete mode 100644 seqan/index/index_skew3.h delete mode 100644 seqan/index/index_skew7.h delete mode 100644 seqan/index/index_skew7_multi.h delete mode 100644 seqan/index/index_wotd.h delete mode 100644 seqan/index/pipe_merger3.h delete mode 100644 seqan/index/pipe_merger7.h delete mode 100755 seqan/index/pizzachili_api.h delete mode 100644 seqan/index/pump_extender3.h delete mode 100644 seqan/index/pump_extender7.h delete mode 100644 seqan/index/pump_lcp_core.h delete mode 100644 seqan/index/pump_separator7.h delete mode 100644 seqan/index/radix.h delete mode 100644 seqan/index/repeat_base.h delete mode 100644 seqan/index/shape_base.h delete mode 100644 seqan/index/shape_gapped.h delete mode 100644 seqan/index/shape_onegapped.h delete mode 100644 seqan/index/shape_predefined.h delete mode 100755 seqan/index/shape_threshold.h delete mode 100644 seqan/map.h delete mode 100644 seqan/map/INFO delete mode 100644 seqan/map/map_adapter_stl.h delete mode 100644 seqan/map/map_base.h delete mode 100644 seqan/map/map_chooser.h delete mode 100644 seqan/map/map_skiplist.h delete mode 100644 seqan/map/map_vector.h delete mode 100644 seqan/map/sumlist.h delete mode 100644 seqan/map/sumlist_mini.h delete mode 100644 seqan/map/sumlist_skip.h delete mode 100644 seqan/misc/INFO delete mode 100644 seqan/misc/cmdparser/INFO delete mode 100644 seqan/misc/cmdparser/cmdoption.h delete mode 100644 seqan/misc/cmdparser/cmdparser.h delete mode 100644 seqan/misc/cmdparser/cmdparser_ctd_support.h delete mode 100644 seqan/misc/cmdparser/cmdparser_parse.h delete mode 100644 seqan/misc/cmdparser/cmdparser_type_support.h delete mode 100644 seqan/misc/edit_environment.h delete mode 100644 seqan/misc/misc_accumulators.h delete mode 100644 seqan/misc/misc_base.h delete mode 100644 seqan/misc/misc_bit_twiddling.h delete mode 100644 seqan/misc/misc_cmdparser.h delete mode 100644 seqan/misc/misc_dequeue.h delete mode 100644 seqan/misc/misc_interval_tree.h delete mode 100644 seqan/misc/misc_map.h delete mode 100644 seqan/misc/misc_memset.h delete mode 100755 seqan/misc/misc_name_store_cache.h delete mode 100644 seqan/misc/misc_parsing.h delete mode 100644 seqan/misc/misc_set.h delete mode 100644 seqan/misc/misc_sse2.h delete mode 100644 seqan/misc/misc_svg.h delete mode 100644 seqan/misc/misc_terminal.h delete mode 100644 seqan/misc/misc_union_find.h delete mode 100644 seqan/misc/priority_type_base.h delete mode 100644 seqan/misc/priority_type_heap.h delete mode 100644 seqan/modifier.h delete mode 100644 seqan/modifier/INFO delete mode 100644 seqan/modifier/modifier_alphabet.h delete mode 100644 seqan/modifier/modifier_alphabet_expansion.h delete mode 100644 seqan/modifier/modifier_functors.h delete mode 100644 seqan/modifier/modifier_iterator.h delete mode 100644 seqan/modifier/modifier_reverse.h delete mode 100644 seqan/modifier/modifier_shortcuts.h delete mode 100644 seqan/modifier/modifier_string.h delete mode 100644 seqan/modifier/modifier_view.h delete mode 100755 seqan/parallel.h delete mode 100644 seqan/parallel/INFO delete mode 100644 seqan/parallel/parallel_algorithms.h delete mode 100755 seqan/parallel/parallel_atomic_misc.h delete mode 100755 seqan/parallel/parallel_atomic_primitives.h delete mode 100755 seqan/parallel/parallel_macros.h delete mode 100755 seqan/parallel/parallel_splitting.h delete mode 100644 seqan/parallel/parallel_tags.h delete mode 100644 seqan/pipe.h delete mode 100644 seqan/pipe/INFO delete mode 100644 seqan/pipe/pipe_base.h delete mode 100644 seqan/pipe/pipe_caster.h delete mode 100644 seqan/pipe/pipe_counter.h delete mode 100644 seqan/pipe/pipe_echoer.h delete mode 100644 seqan/pipe/pipe_edit_environment.h delete mode 100644 seqan/pipe/pipe_filter.h delete mode 100644 seqan/pipe/pipe_iterator.h delete mode 100644 seqan/pipe/pipe_joiner.h delete mode 100644 seqan/pipe/pipe_namer.h delete mode 100644 seqan/pipe/pipe_sampler.h delete mode 100644 seqan/pipe/pipe_shifter.h delete mode 100644 seqan/pipe/pipe_source.h delete mode 100644 seqan/pipe/pipe_tupler.h delete mode 100644 seqan/pipe/pool_base.h delete mode 100644 seqan/pipe/pool_mapper.h delete mode 100644 seqan/pipe/pool_sorter.h delete mode 100755 seqan/platform.h delete mode 100644 seqan/platform/INFO delete mode 100644 seqan/platform/platform_gcc.h delete mode 100644 seqan/platform/platform_icc.h delete mode 100644 seqan/platform/platform_mingw.h delete mode 100644 seqan/platform/platform_nvcc.h delete mode 100644 seqan/platform/platform_pgi.h delete mode 100644 seqan/platform/platform_solaris.h delete mode 100644 seqan/platform/platform_windows.h delete mode 100644 seqan/platform/windows_stdint.h delete mode 100644 seqan/random.h delete mode 100644 seqan/random/INFO delete mode 100755 seqan/random/ext_MersenneTwister.h delete mode 100644 seqan/random/random_base.h delete mode 100644 seqan/random/random_beta.h delete mode 100644 seqan/random/random_beta_kfunc.h delete mode 100644 seqan/random/random_geometric.h delete mode 100644 seqan/random/random_lognormal.h delete mode 100644 seqan/random/random_mt19937.h delete mode 100644 seqan/random/random_normal.h delete mode 100644 seqan/random/random_rng_functor.h delete mode 100644 seqan/random/random_shuffle.h delete mode 100644 seqan/random/random_uniform.h delete mode 100644 seqan/score.h delete mode 100644 seqan/score/INFO delete mode 100644 seqan/score/score_base.h delete mode 100644 seqan/score/score_edit.h delete mode 100644 seqan/score/score_matrix.h delete mode 100644 seqan/score/score_matrix_data.h delete mode 100644 seqan/score/score_matrix_io.h delete mode 100644 seqan/score/score_simple.h delete mode 100644 seqan/seeds.h delete mode 100644 seqan/seeds/INFO delete mode 100644 seqan/seeds/banded_chain_alignment.h delete mode 100644 seqan/seeds/banded_chain_alignment_impl.h delete mode 100644 seqan/seeds/banded_chain_alignment_profile.h delete mode 100644 seqan/seeds/banded_chain_alignment_scout.h delete mode 100644 seqan/seeds/banded_chain_alignment_traceback.h delete mode 100644 seqan/seeds/basic_iter_indirect.h delete mode 100644 seqan/seeds/seeds_base.h delete mode 100644 seqan/seeds/seeds_combination.h delete mode 100644 seqan/seeds/seeds_extension.h delete mode 100644 seqan/seeds/seeds_global_chaining.h delete mode 100644 seqan/seeds/seeds_global_chaining_base.h delete mode 100644 seqan/seeds/seeds_global_chaining_gusfield.h delete mode 100644 seqan/seeds/seeds_seed_base.h delete mode 100644 seqan/seeds/seeds_seed_chained.h delete mode 100644 seqan/seeds/seeds_seed_diagonal.h delete mode 100644 seqan/seeds/seeds_seed_set_base.h delete mode 100644 seqan/seeds/seeds_seed_set_non_scored.h delete mode 100644 seqan/seeds/seeds_seed_set_scored.h delete mode 100644 seqan/seeds/seeds_seed_set_unordered.h delete mode 100644 seqan/seeds/seeds_seed_simple.h delete mode 100644 seqan/seq_io.h delete mode 100644 seqan/seq_io/INFO delete mode 100644 seqan/seq_io/fai_index.h delete mode 100644 seqan/seq_io/genomic_region.h delete mode 100644 seqan/seq_io/guess_stream_format.h delete mode 100644 seqan/seq_io/read_embl.h delete mode 100644 seqan/seq_io/read_fasta_fastq.h delete mode 100644 seqan/seq_io/read_genbank.h delete mode 100644 seqan/seq_io/sequence_stream.h delete mode 100644 seqan/seq_io/sequence_stream_impl.h delete mode 100644 seqan/seq_io/simple_read_fasta.h delete mode 100644 seqan/seq_io/write_fasta_fastq.h delete mode 100644 seqan/sequence.h delete mode 100644 seqan/sequence/INFO delete mode 100644 seqan/sequence/adapt_array_pointer.h delete mode 100644 seqan/sequence/adapt_std_list.h delete mode 100644 seqan/sequence/adapt_std_string.h delete mode 100644 seqan/sequence/adapt_std_vector.h delete mode 100644 seqan/sequence/iter_concat_virtual.h delete mode 100644 seqan/sequence/segment_base.h delete mode 100644 seqan/sequence/segment_infix.h delete mode 100644 seqan/sequence/segment_prefix.h delete mode 100644 seqan/sequence/segment_suffix.h delete mode 100644 seqan/sequence/segment_utils.h delete mode 100644 seqan/sequence/sequence_concatenator.h delete mode 100644 seqan/sequence/sequence_forwards.h delete mode 100644 seqan/sequence/sequence_interface.h delete mode 100644 seqan/sequence/sequence_lexical.h delete mode 100644 seqan/sequence/sequence_shortcuts.h delete mode 100644 seqan/sequence/string_alloc.h delete mode 100644 seqan/sequence/string_array.h delete mode 100644 seqan/sequence/string_base.h delete mode 100644 seqan/sequence/string_block.h delete mode 100644 seqan/sequence/string_cstyle.h delete mode 100644 seqan/sequence/string_packed.h delete mode 100644 seqan/sequence/string_packed_old.h delete mode 100644 seqan/sequence/string_set_base.h delete mode 100644 seqan/sequence/string_set_concat_direct.h delete mode 100644 seqan/sequence/string_set_dependent_generous.h delete mode 100644 seqan/sequence/string_set_dependent_tight.h delete mode 100644 seqan/sequence/string_set_owner.h delete mode 100644 seqan/sequence_journaled.h delete mode 100644 seqan/sequence_journaled/INFO delete mode 100644 seqan/sequence_journaled/journal_entries_sorted_array.h delete mode 100644 seqan/sequence_journaled/journal_entries_unbalanced_tree.h delete mode 100644 seqan/sequence_journaled/journal_entries_unbalanced_tree_iterator.h delete mode 100644 seqan/sequence_journaled/journal_entries_unbalanced_tree_node.h delete mode 100644 seqan/sequence_journaled/journal_entry.h delete mode 100644 seqan/sequence_journaled/sequence_journaled.h delete mode 100644 seqan/sequence_journaled/sequence_journaled_iterator.h delete mode 100644 seqan/store.h delete mode 100644 seqan/store/INFO delete mode 100644 seqan/store/store_align.h delete mode 100644 seqan/store/store_align_intervals.h delete mode 100644 seqan/store/store_all.h delete mode 100644 seqan/store/store_annotation.h delete mode 100644 seqan/store/store_base.h delete mode 100644 seqan/store/store_contig.h delete mode 100644 seqan/store/store_intervaltree.h delete mode 100644 seqan/store/store_io.h delete mode 100755 seqan/store/store_io_gff.h delete mode 100644 seqan/store/store_io_sam.h delete mode 100755 seqan/store/store_io_ucsc.h delete mode 100644 seqan/store/store_library.h delete mode 100644 seqan/store/store_matepair.h delete mode 100644 seqan/store/store_read.h delete mode 100644 seqan/stream.h delete mode 100644 seqan/stream/INFO delete mode 100644 seqan/stream/adapt_cstdio.h delete mode 100644 seqan/stream/adapt_fstream.h delete mode 100644 seqan/stream/adapt_iostream.h delete mode 100644 seqan/stream/adapt_mmap.h delete mode 100644 seqan/stream/adapt_sstream.h delete mode 100644 seqan/stream/concept_stream.h delete mode 100755 seqan/stream/file_stream.h delete mode 100644 seqan/stream/is.h delete mode 100644 seqan/stream/lexical_cast.h delete mode 100644 seqan/stream/read.h delete mode 100644 seqan/stream/read_auto_format.h delete mode 100644 seqan/stream/read_sam.h delete mode 100644 seqan/stream/record_reader_base.h delete mode 100644 seqan/stream/record_reader_double.h delete mode 100644 seqan/stream/record_reader_double_mmap.h delete mode 100644 seqan/stream/record_reader_single.h delete mode 100644 seqan/stream/record_reader_single_mmap.h delete mode 100644 seqan/stream/stream_base.h delete mode 100644 seqan/stream/stream_bgzf.h delete mode 100644 seqan/stream/stream_bz2_file.h delete mode 100644 seqan/stream/stream_char_array.h delete mode 100644 seqan/stream/stream_gz_file.h delete mode 100644 seqan/stream/stream_put.h delete mode 100644 seqan/stream/tokenize.h delete mode 100644 seqan/stream/write.h delete mode 100644 seqan/system.h delete mode 100644 seqan/system/INFO delete mode 100644 seqan/system/file_async.h delete mode 100644 seqan/system/file_directory.h delete mode 100644 seqan/system/file_forwards.h delete mode 100644 seqan/system/file_sync.h delete mode 100644 seqan/system/system_base.h delete mode 100644 seqan/system/system_event.h delete mode 100644 seqan/system/system_forwards.h delete mode 100644 seqan/system/system_mutex.h delete mode 100644 seqan/system/system_sema.h delete mode 100644 seqan/system/system_thread.h delete mode 100644 seqan/version.h diff --git a/Makefile b/Makefile index b58113f..6736f77 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,27 @@ # include SeqAn libraries, don't warn about MD5 deprecation CXXFLAGS+=-I. -Wno-deprecated-declarations +#include htslib by setting -I and link to the htslib library +#HTSDIR= +HTSDIR=/nfs/fs1/bioinfo/apps-x86_64/htslib/1.9 +CXXFLAGS+=-I$(HTSDIR)/include -# RELEASE build -CXXFLAGS+= -O3 -DSEQAN_ENABLE_TESTING=0 -DSEQAN_ENABLE_DEBUG=0 -DSEQAN_HAS_ZLIB=1 -LDLIBS=-lz -lssl -lcrypto - +# RELEASE build +CXX=g++ -std=c++11 -pthread +CXXFLAGS+= -O3 -DSEQAN_ENABLE_TESTING=0 -DSEQAN_ENABLE_DEBUG=0 -DSEQAN_HAS_ZLIB=1 +LDFLAGS=-L$(HTSDIR)/lib -lz -lssl -lcrypto -Wl,-rpath,$(HTSDIR)/lib -lhts TARGET = bamhash_checksum_bam bamhash_checksum_fastq bamhash_checksum_fasta all: $(TARGET) bamhash_checksum_bam: bamhash_checksum_common.o bamhash_checksum_bam.o - $(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS) + $(CXX) $(LDFLAGS) -o $@ $^ bamhash_checksum_fastq: bamhash_checksum_common.o bamhash_checksum_fastq.o - $(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS) + $(CXX) $(LDFLAGS) -o $@ $^ bamhash_checksum_fasta: bamhash_checksum_common.o bamhash_checksum_fasta.o - $(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS) - + $(CXX) $(LDFLAGS) -o $@ $^ clean: - $(RM) *.o *~ $(TARGET) + $(RM) *.o *~ $(TARGET) diff --git a/README.md b/README.md index df36656..e23e79e 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ composed of the readname, whether it is first or last in pair, sequence and qual All the hash values are summed up so the result is independent of the ordering within the files. The result can be compared to verify that the pair of FASTQ files contain the same read information as the aligned BAM file. +The program is written in C++ and uses SeqAnHTS v1.0 for parsing FASTQ, gzip compressed FASTQ and BAM files. +SeqAnHTS is a fork of SeqAn library ( Döring etal. , 2008 ) that uses htslib to read SAM/BAM/CRAM files. ## Manuscript @@ -35,6 +37,7 @@ Both multiline FASTA and FASTQ are supported and gzipped input for FASTA and FAS ~~~ bamhash_checksum_bam [OPTIONS] ... +bamhash_checksum_bam [OPTIONS] -r ~~~ processes a number of BAM files. BAM files are assumed to contain paired end reads. If you run with `--no-paired` it treats all reads as single end and displays a warning if any read is marked as "second in pair" in the BAM file. @@ -57,4 +60,8 @@ processes a number of FASTA files. All FASTA files are assumed to be single end ## Compiling -The only external dependency is on OpenSSL for the MD5 implementation. +External dependencies are on: + OpenSSL for the MD5 implementation + htslib library (version 1.9) + + diff --git a/bamhash_checksum_bam.cpp b/bamhash_checksum_bam.cpp index f5fda99..e6edee0 100644 --- a/bamhash_checksum_bam.cpp +++ b/bamhash_checksum_bam.cpp @@ -1,6 +1,7 @@ +#include "htslib/hts.h" +#include #include #include -#include #include #include #include @@ -9,26 +10,29 @@ #include #include #include +#include -#include "bamhash_checksum_common.h" +#include "bamhash_checksum_common.h" -/** only needed for seqan 1.4.1 and lower -inline bool -hasFlagSupplementary(seqan::BamAlignmentRecord const & record) -{ - return (record.flag & 0x0800) == 0x0800; -} -*/ struct Baminfo { std::vector bamfiles; bool debug; bool noReadNames; bool noQuality; bool paired; + seqan::CharString reference; - Baminfo() : debug(false), noReadNames(false), noQuality(false), paired(true) {} + Baminfo() : debug(false), noReadNames(false), noQuality(false), paired(true), reference("") {} + +}; + +struct Counts { + uint64_t sum; + uint64_t count; + + Counts() : sum(0), count(0) {} }; @@ -38,16 +42,15 @@ parseCommandLine(Baminfo& options, int argc, char const **argv) { seqan::ArgumentParser parser("bamhash_checksum_bam"); //readlink("/proc/self/exe", options.bindir, sizeof(options.bindir)-1); - setShortDescription(parser, "Checksum of a bam file"); //TODO change description + setShortDescription(parser, "Checksum of a sam, bam or cram file"); //TODO change description setVersion(parser, BAMHASH_VERSION); - setDate(parser, "May 2015"); + setDate(parser, "Oct 2018"); addUsageLine(parser, "[\\fIOPTIONS\\fP] \\fI ...\\fP"); addDescription(parser, "Program for checksum of sequence reads. "); - addArgument(parser, seqan::ArgParseArgument(seqan::ArgParseArgument::INPUTFILE,"bamfile", "False", 1)); - - setValidValues(parser, 0,"bam sam"); + addArgument(parser, seqan::ArgParseArgument(seqan::ArgParseArgument::INPUT_FILE,"bamfile", "False", 1)); + setValidValues(parser, 0,"sam bam cram"); addSection(parser, "Options"); @@ -55,7 +58,11 @@ parseCommandLine(Baminfo& options, int argc, char const **argv) { addOption(parser, seqan::ArgParseOption("d", "debug", "Debug mode. Prints full hex for each read to stdout")); addOption(parser, seqan::ArgParseOption("R", "no-readnames", "Do not use read names as part of checksum")); addOption(parser, seqan::ArgParseOption("Q", "no-quality", "Do not use read quality as part of checksum")); - addOption(parser, seqan::ArgParseOption("P", "no-paired", "Bam files were not generated with paired-end reads")); + addOption(parser, seqan::ArgParseOption("P", "no-paired", "Cram files were not generated with paired-end reads")); + addOption(parser, seqan::ArgParseOption("r", "reference-file", "Path to reference-file if reference not given in header", + seqan::ArgParseArgument::INPUT_FILE)); + + setValidValues(parser, "reference-file", "fa"); // Parse command line. seqan::ArgumentParser::ParseResult res = seqan::parse(parser, argc, argv); @@ -67,6 +74,7 @@ parseCommandLine(Baminfo& options, int argc, char const **argv) { options.noReadNames = isSet(parser, "no-readnames"); options.noQuality = isSet(parser, "no-quality"); options.paired = !isSet(parser, "no-paired"); + getOptionValue(options.reference, parser, "reference-file"); options.bamfiles = getArgumentValues(parser, 0); @@ -74,6 +82,68 @@ parseCommandLine(Baminfo& options, int argc, char const **argv) { } +// ----------------------------------------------------------------------------- +// FUNCTION getSampleIdAndLaneNames() +// ----------------------------------------------------------------------------- + +void getLaneNames(std::map & laneNames, std::string const & header) +{ + for (int i = 0; i < header.size(); /*empty on purpose*/) + { + auto hdr_find_it = std::find(header.begin() + i, header.end(), '\n'); + std::string line = header.substr(i, hdr_find_it - header.begin() - i); + + if (line.size() > 7 && line[0] == '@' && line[1] == 'R' && line[2] == 'G' && line[3] == '\t') + { + for (int j = 0; j < static_cast(line.size()); /*empty on purpose*/) + { + auto line_find_it = std::find(line.begin() + j, line.end(), '\t'); + std::string field = line.substr(j, line_find_it - line.begin() - j); + + if (field.size() > 3 && field[0] == 'I' && field[1] == 'D' && field[2] == ':') + { + seqan::CharString read_group_name = field.substr(3); + int read_group_index = laneNames.size(); + laneNames[read_group_name] = read_group_index; + } + + j = std::distance(line.begin(), line_find_it) + 1; + } + } + + i = std::distance(header.begin(), hdr_find_it) + 1; + } +} + +// ----------------------------------------------------------------------------- +// FUNCTION getLane() +// ----------------------------------------------------------------------------- + +int getLane(seqan::BamAlignmentRecord & record, + seqan::BamTagsDict & tagsDict, + std::map & laneNames) +{ + unsigned tagIdx = 0; + + if (!seqan::findTagKey(tagIdx, tagsDict, "RG")) + { + std::cerr << "ERROR: Found a read with a missing read group (RG) tag\n"; + return -1; + } + + seqan::CharString read_group; + + if(!seqan::extractTagValue(read_group, tagsDict, tagIdx)) + { + std::cerr << "ERROR: Failed to extract read group (RG) tag value\n"; + return -1; + } + + return laneNames[read_group]; +} + + + int main(int argc, char const **argv) { Baminfo info; // Define structure variable @@ -83,58 +153,48 @@ int main(int argc, char const **argv) { return res == seqan::ArgumentParser::PARSE_ERROR; } - uint64_t sum = 0; - uint64_t count = 0; +//Moving below to struct +// uint64_t sum = 0; +// uint64_t count = 0; bool pairedWarning = false; - + //adding new stuff + std::map laneNames; + // Initialize all counts for each lane. + seqan::String counts; for (int i = 0; i < info.bamfiles.size(); i++) { - // Open BGZF Stream for reading. - seqan::Stream inStream; const char* bamfile = info.bamfiles[i].c_str(); - - if (!open(inStream, bamfile, "r")) { - std::cerr << "ERROR: Could not open " << bamfile << " for reading.\n"; - return 1; - } + const char* reference = toCString(info.reference); - // Setup name store, cache, and BAM I/O context. - typedef seqan::StringSet TNameStore; - typedef seqan::NameStoreCache TNameStoreCache; - typedef seqan::BamIOContext TBamIOContext; - TNameStore nameStore; - TNameStoreCache nameStoreCache(nameStore); - TBamIOContext context(nameStore, nameStoreCache); - - // Read header. - seqan::BamHeader header; - if (readRecord(header, context, inStream, seqan::Bam()) != 0) { - std::cerr << "ERROR: Could not read header from BAM file " << bamfile << "\n"; - return 1; - } - seqan::clear(header); + // Open stream for reading + seqan::HtsFile inStream(bamfile, "r", reference); + + // Initialize lane names (read groups). + std::string header(inStream.hdr->text, inStream.hdr->l_text); + getLaneNames(laneNames, header); + unsigned lanecount = laneNames.size(); + resize(counts, lanecount); // Define: seqan::BamAlignmentRecord record; seqan::CharString string2hash; - //char hexCstr[33]; // Read record - while (!atEnd(inStream)) { - if (readRecord(record, context, inStream, seqan::Bam()) != 0) { - std::cerr << "ERROR: Could not read record from BAM File " << bamfile << "\n"; - return 1; - } + while (seqan::readRecord(record, inStream)){ + seqan::BamTagsDict tagsDict(record.tags); + int l = getLane(record, tagsDict, laneNames); + if (l == -1) return 1; + // Check if flag: reverse complement and change record accordingly if (hasFlagRC(record)) { - reverseComplement(record.seq); - reverse(record.qual); + seqan::reverseComplement(record.seq); + seqan::reverse(record.qual); } // Check if flag: supplementary and exclude those if (!hasFlagSupplementary(record) && !hasFlagSecondary(record)) { - count +=1; + counts[l].count +=1; // Construct one string from record if (!info.noReadNames) { seqan::append(string2hash, record.qName); @@ -143,7 +203,7 @@ int main(int argc, char const **argv) { seqan::append(string2hash, "/2"); } else { if (!pairedWarning) { - std::cerr << "WARNING: BamHash was run with --no-paired mode, but BAM file has reads marked as second pair" << std::endl; + std::cerr << "WARNING: seqread was run with --no-paired mode, but BAM file has reads marked as second pair" << std::endl; pairedWarning = true; } seqan::append(string2hash, "/1"); @@ -162,26 +222,25 @@ int main(int argc, char const **argv) { // Get MD5 hash hash_t hex = str2md5(toCString(string2hash), length(string2hash)); - if (info.debug) { std::cout << string2hash << " " << std::hex << hex.p.low << "\n"; } else { - hexSum(hex, sum); + hexSum(hex, counts[l].sum); } seqan::clear(string2hash); } } - - // print result - } if (!info.debug) { - std::cout << std::hex << sum << "\t"; - std::cout << std::dec << count << "\n"; + for (std::map::iterator it = laneNames.begin(); it != laneNames.end(); ++it) { + std::cout << it->first << "\t"; + int lid = it->second; + std::cout << std::hex << counts[lid].sum << "\t"; + std::cout << std::dec << counts[lid].count << "\n"; + } } - + return 0; } - diff --git a/bamhash_checksum_common.h b/bamhash_checksum_common.h index b3732d9..e8c6b30 100644 --- a/bamhash_checksum_common.h +++ b/bamhash_checksum_common.h @@ -1,7 +1,7 @@ #ifndef BAMHASH_CHECKSUM_COMMON_H #define BAMHASH_CHECKSUM_COMMON_H -#define BAMHASH_VERSION "1.1" +#define BAMHASH_VERSION "1.3" #include #include diff --git a/bamhash_checksum_fasta.cpp b/bamhash_checksum_fasta.cpp index f6279e6..f8d1adb 100644 --- a/bamhash_checksum_fasta.cpp +++ b/bamhash_checksum_fasta.cpp @@ -28,12 +28,12 @@ parseCommandLine(Fastainfo& options, int argc, char const **argv) { setShortDescription(parser, "Checksum of a set of fasta files"); setVersion(parser, BAMHASH_VERSION); - setDate(parser, "May 2015"); + setDate(parser, "Okt 2018"); addUsageLine(parser, "[\\fIOPTIONS\\fP] \\fI\\fP [\\fIin2.fasta ... \\fP]"); addDescription(parser, "Program for checksum of sequence reads. "); - addArgument(parser, seqan::ArgParseArgument(seqan::ArgParseArgument::INPUTFILE,"fastafiles", true)); + addArgument(parser, seqan::ArgParseArgument(seqan::ArgParseArgument::INPUT_FILE,"fastafiles", true)); setValidValues(parser, 0,"fa fa.gz fasta fasta.gz"); @@ -58,7 +58,6 @@ parseCommandLine(Fastainfo& options, int argc, char const **argv) { return seqan::ArgumentParser::PARSE_OK; } - int main(int argc, char const **argv) { Fastainfo info; // Define structure variable seqan::ArgumentParser::ParseResult res = parseCommandLine(info, argc, argv); // Parse the command line. @@ -77,29 +76,26 @@ int main(int argc, char const **argv) { seqan::CharString seq; hash_t hex; - - // Open GZStream - seqan::Stream gzStream; - - + // Open stream + seqan::SeqFileIn seqFileIn; for (int i = 0; i < info.fastafiles.size(); i++) { const char* fasta = info.fastafiles[i].c_str(); - if (!open(gzStream, fasta, "r")) { + if (!open(seqFileIn, fasta)) { std::cerr << "ERROR: Could not open the file: " << fasta << " for reading.\n"; return 1; } - //Setup RecordReader for reading FASTA file from gzip-compressed file - seqan::RecordReader, seqan::SinglePass<> > reader(gzStream); - - - // Read record - while (!atEnd(reader)) { - if (readRecord(id, seq, reader, seqan::Fasta()) != 0) { - if (atEnd(reader)) { + while (!seqan::atEnd(seqFileIn)) { + try + { + readRecord(id, seq, seqFileIn); + } + catch (seqan::Exception const & e) + { + if (seqan::atEnd(seqFileIn)) { std::cerr << "WARNING: Could not continue reading " << fasta << " at line: " << count+1 << ".\n"; return 1; } @@ -109,10 +105,8 @@ int main(int argc, char const **argv) { count +=1; - // cut away after first space - seqan::strSplit(idSub, id, ' ', false, 1); - + seqan::strSplit(idSub, id, seqan::EqualsChar<' '>(), false, 1); if (!info.noReadNames) { seqan::append(string2hash, idSub[0]); @@ -131,8 +125,6 @@ int main(int argc, char const **argv) { seqan::clear(string2hash); seqan::clear(idSub); - - } } @@ -141,7 +133,6 @@ int main(int argc, char const **argv) { std::cout << std::hex << sum << "\t"; std::cout << std::dec << count << "\n"; } - return 0; } diff --git a/bamhash_checksum_fastq.cpp b/bamhash_checksum_fastq.cpp index 653fadf..f4d4ed2 100644 --- a/bamhash_checksum_fastq.cpp +++ b/bamhash_checksum_fastq.cpp @@ -31,12 +31,12 @@ parseCommandLine(Fastqinfo& options, int argc, char const **argv) { setShortDescription(parser, "Checksum of a set of fastq files"); setVersion(parser, BAMHASH_VERSION); - setDate(parser, "May 2015"); + setDate(parser, "Okt 2018"); addUsageLine(parser, "[\\fIOPTIONS\\fP] \\fI\\fP [\\fIin2.fastq.gz ... \\fP]"); addDescription(parser, "Program for checksum of sequence reads. "); - addArgument(parser, seqan::ArgParseArgument(seqan::ArgParseArgument::INPUTFILE,"fastqfiles", true)); + addArgument(parser, seqan::ArgParseArgument(seqan::ArgParseArgument::INPUT_FILE,"fastqfiles", true)); setValidValues(parser, 0,"fq fq.gz fastq fastq.gz"); @@ -89,10 +89,10 @@ int main(int argc, char const **argv) { hash_t hex1; hash_t hex2; - // Open GZStream - seqan::Stream gzStream1; - seqan::Stream gzStream2; + // Open Files + seqan::SeqFileIn seqFileIn1; + seqan::SeqFileIn seqFileIn2; if (info.paired && (info.fastqfiles.size() % 2 != 0)) { std::cerr << "ERROR: Running with paired end mode, but supplied an odd number of input files "; @@ -109,38 +109,56 @@ int main(int argc, char const **argv) { if (info.paired) { fastq2 = info.fastqfiles[i+1].c_str(); } - - if (!open(gzStream1, fastq1, "r")) { - std::cerr << "ERROR: Could not open the file: " << fastq1 << " for reading.\n"; - return 1; - } - if (info.paired && !open(gzStream2, fastq2, "r")) { - std::cerr << "ERROR: Could not open the file: " << fastq2 << " for reading.\n"; - return 1; + + if (!open(seqFileIn1, fastq1)) + { + std::cerr << "ERROR: Could not open the file: " << fastq1 << " for reading.\n"; + return 1; } - //Setup RecordReader for reading FASTQ file from gzip-compressed file - seqan::RecordReader, seqan::SinglePass<> > reader1(gzStream1); - seqan::RecordReader, seqan::SinglePass<> > reader2(gzStream2); + if (!open(seqFileIn2, fastq2)) + { + std::cerr << "ERROR: Could not open the file: " << fastq1 << " for reading.\n"; + return 1; + } +/* + StringSet seqs; +*/ // Read record - while (!atEnd(reader1)) { - if(info.paired) { - if(atEnd(reader2)) { break; } + while (!atEnd(seqFileIn1)) { + if(info.paired) + { + if(atEnd(seqFileIn2)) { break; } } - if (readRecord(id1, seq1, qual1, reader1, seqan::Fastq()) != 0) { - if (atEnd(reader1)) { - std::cerr << "WARNING: Could not continue reading " << fastq1 << " at line: " << count+1 << ".\n"; + try + { + seqan::readRecord(id1, seq1, qual1, seqFileIn1); + } + catch (seqan::Exception const & e) + { + if (atEnd(seqFileIn1)) + { + std::cerr << "WARNING: Could not continue reading " << fastq1 << " at line: " << count+1 << ". Check if files have the same number of reads.\n"; return 1; } std::cerr << "ERROR: Could not read from " << fastq1 << "\n"; return 1; } - if (info.paired && readRecord(id2, seq2, qual2, reader2, seqan::Fastq()) != 0) { - if (atEnd(reader2)) { + try + { + if (info.paired) + { + seqan::readRecord(id2, seq2, qual2, seqFileIn2); + } + } + catch (seqan::Exception const & e) + { + if (atEnd(seqFileIn2)) + { std::cerr << "WARNING: Could not continue reading " << fastq2 << " at line: " << count+1 << ". Check if files have the same number of reads.\n"; return 1; } @@ -153,16 +171,16 @@ int main(int argc, char const **argv) { // If include id, then cut id on first whitespace if (seqan::endsWith(id1,"/1") || seqan::endsWith(id1,"/2")) { - seqan::strSplit(idSub1, id1, '/', false, 1); + seqan::strSplit(idSub1, id1, seqan::EqualsChar<'/'>(), false, 1); } else { - seqan::strSplit(idSub1, id1, ' ', false, 1); + seqan::strSplit(idSub1, id1, seqan::EqualsChar<' '>(), false, 1); } if (info.paired) { if (seqan::endsWith(id2,"/1") || seqan::endsWith(id2,"/2")) { - seqan::strSplit(idSub2, id2, '/', false, 1); + seqan::strSplit(idSub2, id2, seqan::EqualsChar<'/'>(), false, 1); } else { - seqan::strSplit(idSub2, id2, ' ', false, 1); + seqan::strSplit(idSub2, id2, seqan::EqualsChar<' '>(), false, 1); } } @@ -181,7 +199,6 @@ int main(int argc, char const **argv) { seqan::append(string2hash1, qual1); } - if (info.paired) { if (!info.noReadNames) { seqan::append(string2hash2, idSub2[0]); @@ -213,6 +230,11 @@ int main(int argc, char const **argv) { } } + if (!info.debug && count == 0) + { + std::cerr << "WARNING: Read count is : " << count << "\n"; + return 1; + } if (!info.debug) { std::cout << std::hex << sum << "\t"; diff --git a/seqan/LICENSE b/seqan/LICENSE deleted file mode 100644 index 0b7f5a9..0000000 --- a/seqan/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2006-2011, Knut Reinert, FU Berlin -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/seqan/align.h b/seqan/align.h deleted file mode 100644 index 55f9c10..0000000 --- a/seqan/align.h +++ /dev/null @@ -1,209 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_H_ - -// TODO(holtgrew): Usage of gapped value in align module is not consistent, need proxies in many places, reference not cleanly implemented everywhere yet. -// TODO(holtgrew): The Author: tag at the top has to be corrected in the headers of this module. -// TODO(holtgrew): Anchor Gaps must be integrated completely. -// TODO(holtgrew): Local alignments & Fragments don't work nicely together at the moment, multiLocalAlignments() needs an equivalent in the new align module. -// TODO(holtgrew): Align<>, AlignCol<> need some love and documentation. -// TODO(holtgrew): Gaps need better documentation. -// TODO(holtgrew): refinement should become graph_align and also host Graph> -// TODO(holtgrew): graph_msa should become align_msa, or so, see whitepaper. -// TODO(holtgrew): The documentation and Tutorial need heavy updates, clipping alignments howto can go away. - -// ============================================================================ -// Prerequisites -// ============================================================================ - -#include -#include // ModifiedAlphabet<>. -#include // TODO(holtgrew): We should not have to depend on this. - -// TODO(holtgrew): Why not use priority queue from STL? -#include -#include - -// ============================================================================ -// Support -// ============================================================================ - -#include -#include -#include -#include - -// ============================================================================ -// Gaps & Gaps Iterator Data Structures -// ============================================================================ - -#include -#include - -#include -#include - -#include -#include -#include - -// ============================================================================ -// Alignment Data Structures and Columns -// ============================================================================ - -#include -#include -#include - -// ============================================================================ -// Alignment Algorithm Implementations. -// ============================================================================ - -//################################################################################ -// New module -//################################################################################ - -// The tags have to be available everywhere so we define them centrally. -#include - -// Defines all tags needed for the DP alignment. -#include - -// The DP Band -#include - -// The DP Scout -#include - -// Stores the score value of a particular cell in the dp matrix. -// If affine gap costs are selected one cell stores the three values -// for all three dp matrices. -#include -#include -#include - -// Stores the actual trace segment that was detected during traceback. -// The trace segments can be adapted into any alignment representation -// form. -#include -#include - -// Ensures the backwards compatibility for the global interfaces of the -// alignment algorithms. Based on the called function this selects the -// correct parameters for the new alignment module. -#include - -// Implements the different recursion formula of the alignment algorithms. -#include -#include -#include - -// Defines meta informations which determine how to compute a column and a -// certain cell for different profiles. -#include - -// Actual matrix to store the values. Uses the matrix_base.h definitions -// as a host. -#include -#include - -// The navigator that based on the selected profile and band chooses the -// correct way to navigate through the matrix. -#include -#include -#include -#include - -// The actual implementations of the traceback and the dynamic programming that -// is used by all different alignment algorithms. -#include -#include - -//################################################################################ -// Old module -//################################################################################ - -// Also, we have an implementation of Hirschberg's algorithm to compute -// alignments. -#include - -// The implementations of Myers' bitvector algorithm for alignments can only -// compute alignment scores. The combination of Hirschberg's and Myers' -// algorithm is limited in the same way. -#include -#include - -// Implementations of the local alignment algorithms with declumping. We also -// use them for the localAlignment() calls and return the best local alignment -// only. -// TODO(rmaerker): Replace this with a new implementation based on the new alignment module. -#include -#include - -// We carry around this implementation of Smith-Waterman because it supports -// aligning into fragment strings and alignment graphs. Eventually, it could -// go away if Waterman-Eggert supports them. -//#include - -// ============================================================================ -// Alignment Algorithm Interfaces -// ============================================================================ - -// The front-end functions for global alignments. -#include -#include - -// The front-end functions for local alignments. -#include -#include - -// The front-end for enumeration of local alignments. -#include // documentation -#include -#include - -// The front-end functions for the more specialized alignment algorithms such as -// Hirschberg, Myers and Myers-Hirschberg. -#include - -// ============================================================================ -// Operations On Alignments -// ============================================================================ - -#include -#include - -#endif // SEQAN_CORE_INCLUDE_SEQAN_ALIGN_H_ diff --git a/seqan/align/INFO b/seqan/align/INFO deleted file mode 100644 index a5a30e3..0000000 --- a/seqan/align/INFO +++ /dev/null @@ -1,13 +0,0 @@ -Name: seqan-align -Author: Andreas Gogol-Doering -Author: Birte Kehr -Author: Anne-Katrin Emde -Author: Manuel Holtgrewe -Author: Rene Rahn -Maintainer: Rene Rahn -License: BSD 3-clause -Copyright: 2006-2013, FU Berlin -Status: mature -Description: Alignment data structures. - Definition of alignment data structures and pairwise DP alignment - algorithms. diff --git a/seqan/align/align_base.h b/seqan/align/align_base.h deleted file mode 100644 index c26ca1c..0000000 --- a/seqan/align/align_base.h +++ /dev/null @@ -1,865 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// The Align class provides tabular alignments. It contains multiple -// Gap objects, one for each row of the alignment. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_BASE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_BASE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -struct TagRaw_; -typedef Tag Raw; - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class Align -// ---------------------------------------------------------------------------- - -/*! - * @class Align - * @implements EqualityComparableConcept - * @headerfile - * @brief Tabular alignment of same-type sequences. - * - * @signature template - * class Align; - * - * @tparam TSequence Type of the underlying sequence. - * @tparam TGapSpec Tag for selecting the @link Gaps @endlink specialization. - * - * The Alignment class is for storing tabular alignments of sequences having the same type. They do so by being a - * container of @link Gaps @endlink objects. The most common use case is storing pairwise alignments that are - * generated by one of the dynamic programming alignment algorithms. - * - * @section Example - * - * Here is an example of using an Align object with @link globalAlignment @endlink. - * - * @include demos/align/align.cpp - * - * The output is as follows: - * - * @include demos/align/align.cpp.stdout - * - * @see globalAlignment - * @see localAlignment - * @see Gaps - */ - -/** -.Class.Align: -..cat:Alignments -..summary:An alignment of sequences. -..signature:Align -..param.TSource:Type of the ungapped sequences. -...metafunction:Metafunction.Source -..param.TSpec:The specializing type. -...metafunction:Metafunction.Spec -...default:@Spec.ArrayGaps@ -..remarks:The default implementation of $Align$ stores the alignment in a set of @Class.Gaps|Gaps@ objects. -Hence, the default implementation is row-based, so it will be faster to access the alignment row-wise than column-wise. -..example.file:demos/align/align.cpp -..example.text:The output is as follows: -..example.output: -score = -4 -align - 0 . : - AGTTTAATCA - ||| | | | - AGTAT-ACGA -..include:seqan/align.h -*/ - -template -class Align -{ -public: - typedef Gaps TGaps; - typedef String TRows; - typedef typename Size::Type TRowsSize; - - TRows data_rows; - - Align() {} - - template - Align(StringSet & stringset) - { - setStrings(*this, stringset); - } - - Align & operator=(Align const & other) - { - data_rows = other.data_rows; - return *this; - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction Cols -// ---------------------------------------------------------------------------- - -/*! - * @mfn Align#Cols - * @brief Return the type representing a column in an Align object. - * - * @signature Cols::Type - * - * @tparam TAlign The Align object to get the column type for. - * - * @return Type The resulting column type. - */ - -///.Metafunction.Cols.param.T.type:Class.Align - -template -struct Cols > -{ - typedef AlignCols > Type; -}; - -template -struct Cols const> -{ - typedef AlignCols const> Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Value -// ---------------------------------------------------------------------------- - -/*! - * @mfn Align#Value - * @brief Return the value type for an Align object. - * - * @signature Value::Type - * - * @tparam TAlign The Align object to get the value type for. - * - * @return Type The resulting value type. - */ - -///.Metafunction.Value.param.T.type:Class.Align - -template -struct Value >: - Value > -{}; -template -struct Value const>: - Value const> -{}; - -// ---------------------------------------------------------------------------- -// Metafunction GetValue -// ---------------------------------------------------------------------------- - -/*! - * @mfn Align#GetValue - * @brief Return the get-value type for an Align object. - * - * @signature GetValue::Type - * - * @tparam TAlign The Align object to get the get-value type for. - * - * @return Type The resulting get-value type. - */ - -///.Metafunction.GetValue.param.T.type:Class.Align - -template -struct GetValue >: - GetValue > -{}; -template -struct GetValue const>: - GetValue const> -{}; - -// ---------------------------------------------------------------------------- -// Metafunction Reference -// ---------------------------------------------------------------------------- - -/*! - * @mfn Align#Reference - * @brief Return the reference type for an Align object. - * - * @signature GetValue::Type - * - * @tparam TAlign The Align object to get the reference type for. - * - * @return Type The resulting reference type. - */ - -///.Metafunction.Reference.param.T.type:Class.Align - -template -struct Reference >: - Reference > -{}; -template -struct Reference const>: - Reference const> -{}; - -// ---------------------------------------------------------------------------- -// Metafunction Rows -// ---------------------------------------------------------------------------- - -/*! - * @mfn Align#Row - * @brief Return the row type (@link Gaps @endlink specialization). - * - * @signature Row::Type - * - * @tparam TAlign The Align object to get the row type for. - * - * @return Type The resulting row type. - */ - -/*! - * @mfn Align#Rows - * @brief Return the type used for rows in an Align object (a Gaps specialization). - * - * @signature Rows::Type - * - * @tparam TAlign The Align object to get the rows type for. - * - * @return Type The resulting rows type. - */ - -///.Metafunction.Rows.param.T.type:Class.Align - -template -struct Rows > -{ - typedef String > Type; -}; -template -struct Rows const> -{ - typedef String > const Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Source -// ---------------------------------------------------------------------------- - -/*! - * @mfn Align#Source - * @brief Return the type of the underlying sequence. - * - * @signature Rows::Type - * - * @tparam TAlign The Align object to get the underlying sequence type for. - * - * @return Type The resulting sequence type. - */ - -///.Metafunction.Source.param.T.type:Class.Align - -template -struct Source > -{ - typedef TSource Type; -}; -template -struct Source const> -{ - typedef TSource Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction StringSetType -// ---------------------------------------------------------------------------- - -/*! - * @mfn Align#StringSetType - * @brief Return the type that would be used for a string set of the sources. - * - * @signature Rows::Type - * - * @tparam TAlign The Align object to get the string set type for. - * - * @return Type The resulting string set type. - */ - -template -struct StringSetType > -{ - typedef StringSet > Type; -}; - -template -struct StringSetType const> -{ - typedef StringSet > Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function move() -// ---------------------------------------------------------------------------- - -template -inline -void move(Align & target, Align & source) -{ - move(target.data_rows, source.data_rows); -} - -// ---------------------------------------------------------------------------- -// Function rows() -// ---------------------------------------------------------------------------- - -/*! - * @fn Align#rows - * @brief Returns the rows of an Align object. - * - * @signature TRows rows(align); - * - * @param align The Align object to get the rows for. - * - * @signature TRows A container with the Gaps of the Align object. - */ - -/** -.Function.rows: -..cat:Alignments -..summary:The container of rows in an alignment. -..signature:Rows rows(align) -..param.align:An alignment. -...type:Class.Align -..returns:The container of rows in $align$. -...metafunction:Metafunction.Rows -..see:Function.cols -..see:Metafunction.Rows -..include:seqan/align.h - */ - -template -inline typename Rows >::Type & -rows(Align & me) -{ - return me.data_rows; -} - -template -inline typename Rows const>::Type & -rows(Align const & me) -{ - return me.data_rows; -} - -// ---------------------------------------------------------------------------- -// Function row() -// ---------------------------------------------------------------------------- - -/*! - * @fn Align#row - * @brief Returns a single row of an Align object. - * - * @signature TRow row(align, pos); - * - * @param align The Align object to get the row of. - * @param pos The number of the row to get. - * - * @signature TRow Reference to the given row of align (Type: @link Gap#Row @endlink). - */ - -/** -.Function.row: -..cat:Alignments -..summary:A row in an alignment. -..signature:Row & row(align, position) -..param.align:An alignment. -...type:Class.Align -..param.position:A position in the @Function.rows@ container of $align$. -..returns:The row in @Function.rows@ container of $align$ at the given $position$. -...metafunction:Metafunction.Row -..remarks:This function is equivalent to $value(rows(align), position)$. -..see:Function.rows -..see:Function.col -..see:Metafunction.Row -..include:seqan/align.h - */ - -template -inline typename Row >::Type & -row(Align & me, - TPosition _pos) -{ - return value(rows(me), _pos); -} - -template -inline typename Row const>::Type & -row(Align const & me, - TPosition _pos) -{ - return value(rows(me), _pos); -} - -// ---------------------------------------------------------------------------- -// Function cols() -// ---------------------------------------------------------------------------- - -/*! - * @fn Align#cols - * @brief Returns the columns of an Align object. - * - * @signature TCols cols(align); - * - * @param align The Align object to get the cols of. - * - * @signature TCols The columns of the Align object (type @link Align#Cols @endlink). - */ - -/** -.Function.cols: -..cat:Alignments -..summary:The container of columns in an alignment. -..signature:Cols cols(align) -..param.align:An alignment. -...type:Class.Align -..returns:The container of columns in $align$. -...metafunction:Metafunction.Cols -..see:Metafunction.Cols -..include:seqan/align.h -*/ - -template -inline typename Cols >::Type -cols(Align & me) -{ - return typename Cols >::Type(me); -} - -template -inline typename Cols const>::Type -cols(Align const & me) -{ - return typename Cols const>::Type(me); -} - -// ---------------------------------------------------------------------------- -// Function col() -// ---------------------------------------------------------------------------- - -/*! - * @fn Align#col - * @brief Returns the columns of an Align object. - * - * @signature TCol col(align); - * - * @param align The Align object to get the cols of. - * - * @signature TCol The column of the Align object (type @link Align#Col @endlink). - */ - -/** -.Function.col: -..cat:Alignments -..summary:A column in an alignment. -..signature:Col & col(align, position) -..param.align:An alignment. -...type:Class.Align -..param.position:A position in the @Function.cols@ container of $align$. -..returns:The column in @Function.cols@ container of $align$ at the given $position$. -...metafunction:Metafunction.Col -..remarks:This function is equivalent to $value(cols(align), position)$. -..see:Function.cols -..see:Metafunction.Col -..include:seqan/align.h -*/ - -template -inline typename Col >::Type -col(Align & me, - TPosition _pos) -{ - return value(cols(me), _pos); -} - -template -inline typename Col const>::Type -col(Align const & me, - TPosition _pos) -{ - return value(cols(me), _pos); -} - -// ---------------------------------------------------------------------------- -// Function detach() -// ---------------------------------------------------------------------------- - -///.Function.detach.param.object.type:Class.Align - -template -inline void -detach(Align & me) -{ - typedef Align TAlign; - typedef typename Rows::Type TRows; - typedef typename Iterator::Type TRowsIterator; - - TRowsIterator it = begin(rows(me)); - TRowsIterator it_end = end(rows(me)); - - while (it != it_end) - { - detach(*it); - ++it; - } -} - -// ---------------------------------------------------------------------------- -// Function write() -// ---------------------------------------------------------------------------- - -/*! - * @fn Align#write - * @deprecated Old-style I/O. - * @brief Writing of Gaps to Streams in human-readable format. - * - * @signature void write(stream, align, id, Raw()); - * - * @param stream The Stream to write to. - * @param align The Align object to write out. - * @param id ID string (ignored). - */ - -// TODO(holtgrew): Part of the old I/O system. Undocumented. Rename Raw() to HumanReadable() or OnScreen()? - -template -inline void -write(TFile & target, - Align const & source, - TIDString const &, - Raw) -{ - typedef Align const TAlign; - typedef typename Row::Type TRow; - typedef typename Position::Type>::Type TRowsPosition; - typedef typename Position::Type TPosition; - - TRowsPosition row_count = length(rows(source)); - TPosition begin_ = 0; - TPosition end_ = std::min(length(row(source, 0)), length(row(source, 1))); - - unsigned int baseCount = 0; - unsigned int leftSpace = 6; - while (begin_ < end_) - { - unsigned int windowSize_ = 50; - if ((begin_ + windowSize_) > end_) - windowSize_ = end_ - begin_; - - // Print header line - char buffer[100]; - sprintf(buffer, "%7u", (unsigned)baseCount); - streamPut(target, buffer); - baseCount += windowSize_; - streamPut(target, ' '); - for (TPosition i = 1; i <= windowSize_; ++i) - { - if ((i % 10) == 0) - streamPut(target, ':'); - else if ((i % 5) == 0) - streamPut(target, '.'); - else - streamPut(target, ' '); - } - streamPut(target, ' '); - streamPut(target, '\n'); - - // Print sequences - for (TRowsPosition i = 0; i < 2 * row_count - 1; ++i) - { - for (unsigned int j = 0; j < leftSpace + 2; ++j) - streamPut(target, ' '); - if ((i % 2) == 0) - { - TRow & row_ = row(source, i / 2); - typedef typename Iterator::Type const, Standard>::Type TIter; - TIter begin1_ = iter(row_, begin_); - TIter end1_ = iter(row_, begin_ + windowSize_); - for (; begin1_ != end1_; ++begin1_) - { - if (isGap(begin1_)) - streamPut(target, gapValue()); - else - streamPut(target, *begin1_); - } - } - else - { - for (unsigned int j = 0; j < windowSize_; ++j) - { - if ((!isGap(row(source, (i - 1) / 2), begin_ + j)) && - (!isGap(row(source, (i + 1) / 2), begin_ + j)) && - (row(source, (i - 1) / 2)[begin_ + j] == row(source, (i + 1) / 2)[begin_ + j])) - { - streamPut(target, '|'); - } - else - { - streamPut(target, ' '); - } - } - } - streamPut(target, '\n'); - } - streamPut(target, '\n'); - begin_ += 50; - } - streamPut(target, '\n'); -} - -// ---------------------------------------------------------------------------- -// Function clearClipping() -// ---------------------------------------------------------------------------- - -/*! - * @fn Align#clearClipping - * @brief Clear clipping on all rows. - * - * @signature void clearClipping(align); - * - * @param align Align object to clear clippings of. - */ - -// TODO(holtgrew): Undocumented. - -template -inline void -clearClipping(Align & align_) -{ - typedef typename Rows >::Type TRows; - typedef typename Iterator::Type TRowsIterator; - - for (TRowsIterator it = begin(rows(align_)); it != end(rows(align_)); goNext(it)) - clearClipping(*it); -} - -// ---------------------------------------------------------------------------- -// Function operator<<() -// ---------------------------------------------------------------------------- - -/*! - * @fn Align#operator<< - * @brief Stream-output for Align objects. - * - * @signature TStream operator<<(stream, align); - * - * @param stream std::ostream to write to. - * @param align Align object to write out. - * - * @return TStream Reference to stream after output of align. - */ - -// stream operators - -template -inline TStream & -operator<<(TStream & target, - Align const & source) -{ - write(target, source); - return target; -} - -// ---------------------------------------------------------------------------- -// Function setStrings() -// ---------------------------------------------------------------------------- - -/*! - * @fn Align#setStrings - * @brief Loads the sequences of a string set into an alignment. - * - * @signature void setStrings(align, stringSet); - * - * @param align Align object to set underlying sequence of. - * @param stringSet The source of the data. - */ - -/** -.Function.setStrings: -..cat:Alignments -..summary:Loads the sequences of a stringset into an alignment. -..signature:setStrings(align, stringset) -..param.align:An alignment. -...type:Class.Align -..param.stringset:A string set. -...type:Class.StringSet -..remarks:The function clears $align$ and creates an new global alignment between strings in $stringset$ that contains only trainling gaps. -The alignment will be dependent from the strings in the stringset; use @Function.detach@ to make $align$ the owner of its strings. -..include:seqan/align.h - */ - -template -inline void -setStrings(Align & me, - StringSet & stringset) -{ - typedef Align TAlign; - typedef StringSet TStringset; - - typedef typename Rows::Type TRows; - typedef typename Iterator::Type TRowsIterator; - typedef typename Size::Type TStringsetSize; - - clear(me.data_rows); - resize(me.data_rows, length(stringset)); - TRowsIterator it = begin(rows(me)); - TStringsetSize stringset_length = length(stringset); - for (TStringsetSize i = 0; i < stringset_length; ++i) - { - setSource(*it, value(stringset, i)); - ++it; - } -} - -// ---------------------------------------------------------------------------- -// Function clearGaps() -// ---------------------------------------------------------------------------- - -/*! - * @fn Align#clearGaps - * @brief Clear gaps of all Align rows. - * - * @signature void clearGaps(align); - * - * @param align The Align object to clear all all gaps from. - */ - -template -inline void -clearGaps(Align & me) -{ - typedef Align TAlign; - typedef typename Rows::Type TRows; - typedef typename Iterator::Type TRowsIterator; - - for (TRowsIterator it = begin(rows(me)); it != end(rows(me)); goNext(it)) - clearGaps(*it); -} - -// ---------------------------------------------------------------------------- -// Function stringSet() -// ---------------------------------------------------------------------------- - -/*! - * @fn Align#stringSet - * @brief Return string set with all ungapped sequences. - * - * @signature TStringSet stringSet(align); - * - * @param align Align object to get sequences of. - * - * @return TStringSet The set of ungapped sequences. Get type with Gaps#StringSetType. - */ - -/** -.Function.stringSet: -..param.g.type:Class.Align -..include:seqan/align.h -*/ - -template -inline typename StringSetType >::Type -stringSet(Align & me) -{ - typedef Align TAlign; - typedef typename StringSetType::Type TStringSet; - - typedef typename Rows::Type TRows; - typedef typename Iterator::Type TRowsIterator; - - TStringSet ss; - - for (TRowsIterator it = begin(rows(me)); it != end(rows(me)); goNext(it)) - appendValue(ss, source(*it)); - return ss; -} - -// ---------------------------------------------------------------------------- -// Function operator==() -// ---------------------------------------------------------------------------- - -template -inline bool operator==(Align const & lhs, - Align const & rhs) -{ - if (length(lhs.data_rows) != length(rhs.data_rows)) - return false; - typedef typename Align::TGaps TGaps; - typedef typename Iterator::Type TIter; - for (unsigned i = 0; i < length(rhs.data_rows); ++i) - for (TIter itL = begin(lhs.data_rows[i], Rooted()), itR = begin(rhs.data_rows[i], Rooted()); !atEnd(itL); goNext(itL), goNext(itR)) - if (*itL != *itR) - return false; - return true; -} - -// ---------------------------------------------------------------------------- -// Function operator!=() -// ---------------------------------------------------------------------------- - -template -inline bool operator!=(Align const & lhs, - Align const & rhs) -{ - return !(lhs == rhs); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_BASE_H_ diff --git a/seqan/align/align_cols.h b/seqan/align/align_cols.h deleted file mode 100644 index d140c2d..0000000 --- a/seqan/align/align_cols.h +++ /dev/null @@ -1,448 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// AlignCols is a wrapper around Align that allows the virtual access to the -// rows of an alignment. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_COLS_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_COLS_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class AlignCols -// ---------------------------------------------------------------------------- - -/*! - * @class AlignCols - * @implements EqualityComparableConcept - * @implements RandomAccessContainerConcept - * @headerfile - * @brief Pseudo columns container for row-based Align class. - * - * @signature template - * class AlignCols; - * - * @tparam TAlign The Align type. - */ - -/** -.Class.AlignCols: -..cat:Alignments -..summary:Pseudo columns container for row-based alignment classes. -..signature:AlignCols -..param.TAlign:Alignment type. -...metafunction:Metafunction.Host -..remarks: -This class emulates a container of columns on alignment classes that store the alignment in a container of rows. -Note that accessing a row-based alignment column-wise can be significantly slower than accessing the alignment row-wise. -..see:Class.Align -..include:seqan/align.h - */ - -template -struct AlignCols -{ - // TODO(holtgrew): Do we need this mutable? - mutable TAlign * data_align; - - AlignCols() : - data_align(0) - {} - - - AlignCols(TAlign & align) : data_align(&align) - {} - - template - inline typename Value::Type - operator[](TPosition _pos) - { - return value(*this, _pos); - } - - template - inline typename Value::Type - operator[](TPosition _pos) const - { - return value(*this, _pos); - } -}; - -// ---------------------------------------------------------------------------- -// Specialization AlignCols -// ---------------------------------------------------------------------------- - -/** -.Spec.AlignColIterator: -..cat:Iterators -..summary:Iterator for @Class.AlignCols@ pseudo container. -..signature:Iter< TAlign, AlignColIterator > -..param.TSpec:Specialization tag. -..general:Class.Iter -..see:Class.AlignCols -..include:seqan/align.h -*/ - -template -struct AlignColIterator; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction Host -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Add HostedTypeConcept and make AlignCols object implement the concept. - -///.Metafunction.Host.param.T.type:Class.AlignCols - -template -struct Host > -{ - typedef TAlign Type; -}; -template -struct Host const> -{ - typedef TAlign Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction AlignColIterator -// ---------------------------------------------------------------------------- - -///.Metafunction.Iterator.param.T.type:Class.AlignCols - -template -struct Iterator, TIteratorSpec> -{ - typedef Iter > Type; -}; -template -struct Iterator const, TIteratorSpec> -{ - typedef Iter > Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Value -// ---------------------------------------------------------------------------- - -// Iterator is also used as Value - -///.Metafunction.Value.param.T.type:Class.AlignCols - -template -struct Value >: - Iterator, Standard> -{}; - -template -struct Value const>: - Iterator const, Standard> -{}; - -// ---------------------------------------------------------------------------- -// Metafunction Size -// ---------------------------------------------------------------------------- - -///.Metafunction.Size.param.T.type:Class.AlignCols - -template -struct Size >: - Size::Type> -{}; - -template -struct Size const>: - Size::Type> -{}; - -// ---------------------------------------------------------------------------- -// Metafunction Position -// ---------------------------------------------------------------------------- - -///.Metafunction.Position.param.T.type:Class.AlignCols - -template -struct Position >: - Position::Type> -{}; - -template -struct Position const>: - Position::Type> -{}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function host() -// ---------------------------------------------------------------------------- - -///.Function.host.param.object.type:Class.AlignCols - -template -inline typename Host >::Type & -host(AlignCols & me) -{ - SEQAN_ASSERT(me.data_align != 0); - return *me.data_align; -} - -template -inline typename Host const>::Type & -host(AlignCols const & me) -{ - SEQAN_ASSERT(me.data_align != 0); - return *me.data_align; -} - -// ---------------------------------------------------------------------------- -// Function iter() -// ---------------------------------------------------------------------------- - -///.Function.iter.param.object.type:Class.AlignCols - -template -inline typename Iterator, Tag const>::Type -iter(AlignCols & me, - TPosition pos_, - Tag const) -{ - return typename Iterator, Tag const>::Type(host(me), pos_); -} - -template -inline typename Iterator const, Tag const>::Type -iter(AlignCols const & me, - TPosition pos_, - Tag const) -{ - return typename Iterator const, Tag const>::Type(host(me), pos_); -} - -// ---------------------------------------------------------------------------- -// Function value() -// ---------------------------------------------------------------------------- - -///.Function.value.param.container.type:Class.AlignCols - -template -inline typename Value >::Type -value(AlignCols & me, - TPosition _pos) -{ - return iter(me, _pos); -} - -template -inline typename Value const>::Type -value(AlignCols const & me, - TPosition _pos) -{ - return iter(me, _pos); -} - -// ---------------------------------------------------------------------------- -// Function beginPosition() -// ---------------------------------------------------------------------------- - -///.Function.beginPosition.param.object.type:Class.AlignCols - -template -inline typename Position::Type -_beginPositionAlignCols(TAlignCols const & me) -{ - typedef typename Host::Type TAlign; - typename Position::Type>::Type _i = length(rows(host(me))); - - if (!_i) - { - return 0; - } - - --_i; - typename Position::Type _pos = beginPosition(row(host(me), _i)); - - while (_i > 0) - { - --_i; - typename Position::Type _pos2 = beginPosition(row(host(me), _i)); - if (_pos2 < _pos) - { - _pos = _pos2; - } - } - return _pos; -} - -template -inline typename Position >::Type -beginPosition(AlignCols const & me) -{ - return _beginPositionAlignCols(me); -} - -template -inline typename Position >::Type -beginPosition(AlignCols & me) -{ - return _beginPositionAlignCols(me); -} - -// ---------------------------------------------------------------------------- -// Function begin() -// ---------------------------------------------------------------------------- - -///.Function.begin.param.object.type:Class.AlignCols - -template -inline typename Iterator, Tag const>::Type -begin(AlignCols & me, - Tag const tag_) -{ - return iter(me, beginPosition(me), tag_); -} - -template -inline typename Iterator const, Tag const>::Type -begin(AlignCols const & me, - Tag const tag_) -{ - return iter(me, beginPosition(me), tag_); -} - -// ---------------------------------------------------------------------------- -// Function endPosition() -// ---------------------------------------------------------------------------- - -///.Function.endPosition.param.object.type:Class.AlignCols - -template -inline typename Position::Type -_endPositionAlignCols(TAlignCols const & me) -{ - typedef typename Host::Type TAlign; - - typename Position::Type>::Type _i = length(rows(host(me))); - typename Position::Type _pos = 0; - - while (_i > 0) - { - --_i; - typename Position::Type _pos2 = endPosition(row(host(me), _i)); - if (_pos2 > _pos) - { - _pos = _pos2; - } - } - return _pos; -} - -template -inline typename Position >::Type -endPosition(AlignCols & me) -{ - return _endPositionAlignCols(me); -} - -template -inline typename Position const>::Type -endPosition(AlignCols const & me) -{ - return _endPositionAlignCols(me); -} - -// ---------------------------------------------------------------------------- -// Function end() -// ---------------------------------------------------------------------------- - -///.Function.end.param.object.type:Class.AlignCols - -template -inline typename Iterator, Tag const>::Type -end(AlignCols & me, - Tag const tag_) -{ - return iter(me, endPosition(me), tag_); -} - -template -inline typename Iterator const, Tag const>::Type -end(AlignCols const & me, - Tag const tag_) -{ - return iter(me, endPosition(me), tag_); -} - -// ---------------------------------------------------------------------------- -// Function length() -// ---------------------------------------------------------------------------- - -template -inline typename Size >::Type -length(AlignCols const & me) -{ - return endPosition(me) - beginPosition(me); -} - -// ---------------------------------------------------------------------------- -// Function operator==() -// ---------------------------------------------------------------------------- - -template -inline bool -operator==(AlignCols const & left, - AlignCols const & right) -{ - return left.data_align == right.data_align; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_COLS_H_ diff --git a/seqan/align/align_config.h b/seqan/align/align_config.h deleted file mode 100644 index 5adbade..0000000 --- a/seqan/align/align_config.h +++ /dev/null @@ -1,429 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Tobias Rausch -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_CONFIG_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_CONFIG_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class AlignConfig -// ---------------------------------------------------------------------------- - -/*! - * @class AlignConfig - * @headerfile - * @brief Indication of whether begin/end gaps are free for DP alignment algorithms. - * - * @signature template - * AlignConfig; - * - * @tparam TOP Whether or not the begin gaps in the vertical sequence are free. - * @tparam LEFT Whether or not the begin gaps in the horizontal sequence are free. - * @tparam RIGHT Whether or not the end gaps in the horizontal sequence are free. - * @tparam BOTTOM Whether or not the end gap sin the vertical sequence are free. - * @tparam TSpec Tag for specializing the AlignConfig object (default: Default). - * - * Used in the DP alignment algorithms to configure the begin/end gap free-nes. - * - * @section Specialization List - * - * The following gives an (incomplete) list of useful AlignConfig specializations. - * - *
- *
AlignConfig<false, false, false, false>
- *
ordinary global alignment
- *
AlignConfig<true, false, false, true>
- *
semiglobal alignment, free begin and end gaps in second/vertical sequence
- *
AlignConfig<false, true, true, false>
- *
semiglobal alignment, free begin and end gaps in first/horizontal sequence
- *
AlignConfig<false, true, false, true>
- *
overlap alignment with second/vertical sequence overhanging to the left of first/horizontal
- *
AlignConfig<true, false, true, false>
- *
overlap alignment with first/horizontal sequence overhanging to the left of second/vertical
- *
AlignConfig<false, true, false, false>
- *
free begin gaps in second/vertical sequence only
- *
AlignConfig<false, false, true, false>
- *
free end gaps in second/vertical sequence only
- *
- */ - -/** -.Class.AlignConfig: -..cat:Alignments -..summary:The AlignConfig class encapsulates how DP is carried out. -It indicates at what ends gaps are free, the so-called free ends-space alignments. -..signature:AlignConfig -..param.TOP:If true then 0's in top row. -...default:$false$ -..param.LEFT:If true then 0's in the left column. -...default:$false$ -..param.RIGHT:If true then maximum is also searched in the last column. -...default:$false$ -..param.BOTTOM:If true then maximum is also searched in the last row. -...default:$false$ -..param.TSpec:The specializing type. -...metafunction:Metafunction.Spec -...default:$Default$, see @Tag.Default@. -..include:seqan/align.h -*/ - -template -class AlignConfig -{}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// TODO(holtgrew): Make this follow the header structure. - -template -inline void -_initFirstColumn(AlignConfig const, - TElement& element, - TCost const cost) -{ - SEQAN_CHECKPOINT - element = cost; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_initFirstColumn(AlignConfig const, - TElement& element, - TCost const) -{ - SEQAN_CHECKPOINT - element = 0; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_initFirstRow(AlignConfig const, - TElement& element, - TCost const cost) -{ - SEQAN_CHECKPOINT - element = cost; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_initFirstRow(AlignConfig const, - TElement& element, - TCost const) -{ - SEQAN_CHECKPOINT - element = 0; -} - -////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_lastRow(AlignConfig const, - TValue1&, - TIndex1&, - TValue2 const, - TIndex2 const) -{ - SEQAN_CHECKPOINT - // Nop -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_lastRow(AlignConfig const, - TValue1& maxValue, - TIndex1& maxIndex, - TValue2 const val, - TIndex2 const index) -{ - SEQAN_CHECKPOINT - if (val > maxValue[0]) { - maxValue[0] = val; - maxIndex[0] = index; - } -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_lastColumn(AlignConfig const, - TValue1& maxValue, - TIndex1&, - TColumn const& column) -{ - SEQAN_CHECKPOINT - maxValue[1] = column[length(column) - 1]; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_lastColumn(AlignConfig const, - TValue1& maxValue, - TIndex1& maxIndex, - TColumn const& column) -{ - SEQAN_CHECKPOINT; - typedef typename Size::Type TSize; - typedef typename Iterator::Type TColIter; - TSize limit = length(column) - 1; - maxValue[1] = column[limit]; - TColIter itCol = begin(column, Standard()); - TColIter itColEnd = end(column, Standard()); - for(TSize i = 0;itCol != itColEnd; ++i, ++itCol) { - if (*itCol > maxValue[1]) { - maxValue[1] = *itCol; - maxIndex[1] = i; - } - } -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline TScoreValue -_maxOfAlignment(AlignConfig const, - TValue& maxValue, - TIndex&, - TSize const, - TSize const) -{ - SEQAN_CHECKPOINT - return maxValue[1]; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline TScoreValue -_maxOfAlignment(AlignConfig const, - TValue& maxValue, - TIndex& maxIndex, - TSize const len1, - TSize const) -{ - SEQAN_CHECKPOINT - maxIndex[0] = len1; - return maxValue[1]; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline TScoreValue -_maxOfAlignment(AlignConfig const, - TValue& maxValue, - TIndex& maxIndex, - TSize const, - TSize const len2) -{ - SEQAN_CHECKPOINT - maxIndex[1] = len2; - return maxValue[0]; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline TScoreValue -_maxOfAlignment(AlignConfig const, - TValue& maxValue, - TIndex& maxIndex, - TSize const len1, - TSize const len2) -{ - SEQAN_CHECKPOINT - // Find the maximum - if (maxValue[1] > maxValue[0]) maxIndex[0] = len1; - else maxIndex[1] = len2; - return (maxValue[0] > maxValue[1]) ? maxValue[0] : maxValue[1]; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_lastColumn(AlignConfig const, - TValue1& maxValue, - TIndex1& maxIndex, - TValue2 const val, - TIndex2 const row, - TIndex2 const col) -{ - SEQAN_CHECKPOINT - maxValue[1] = val; maxIndex[2] = row; maxIndex[3] = col; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_lastColumn(AlignConfig const, - TValue1& maxValue, - TIndex1& maxIndex, - TValue2 const val, - TIndex2 const row, - TIndex2 const col) -{ - SEQAN_CHECKPOINT - if (val > maxValue[1]) {maxValue[1] = val; maxIndex[2] = row; maxIndex[3] = col; } -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_lastRow(AlignConfig const, - TValue1& maxValue, - TIndex1& maxIndex, - TValue2 const val, - TIndex2 const row, - TIndex2 const col) -{ - SEQAN_CHECKPOINT - maxValue[0] = val; maxIndex[0] = row; maxIndex[1] = col; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -_lastRow(AlignConfig const, - TValue1& maxValue, - TIndex1& maxIndex, - TValue2 const val, - TIndex2 const row, - TIndex2 const col) -{ - SEQAN_CHECKPOINT - if (val > maxValue[0]) {maxValue[0] = val; maxIndex[0] = row; maxIndex[1] = col; } -} - - -////////////////////////////////////////////////////////////////////////////// - -template -inline bool -_configValueTop(AlignConfig const) -{ - return true; -} - -template -inline bool -_configValueTop(AlignConfig const) -{ - return false; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline bool -_configValueLeft(AlignConfig const) -{ - return true; -} - -template -inline bool -_configValueLeft(AlignConfig const) -{ - return false; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline bool -_configValueRight(AlignConfig const) -{ - return true; -} - -template -inline bool -_configValueRight(AlignConfig const) -{ - return false; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline bool -_configValueBottom(AlignConfig const) -{ - return true; -} - -template -inline bool -_configValueBottom(AlignConfig const) -{ - return false; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_CONFIG_H_ diff --git a/seqan/align/align_iterator_base.h b/seqan/align/align_iterator_base.h deleted file mode 100644 index 26364d9..0000000 --- a/seqan/align/align_iterator_base.h +++ /dev/null @@ -1,570 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== - -#ifndef SEQAN_HEADER_ALIGN_ITERATOR_BASE_H -#define SEQAN_HEADER_ALIGN_ITERATOR_BASE_H - -namespace SEQAN_NAMESPACE_MAIN -{ - -////////////////////////////////////////////////////////////////////////////// -// Align Iterator for Gaps alignment -////////////////////////////////////////////////////////////////////////////// - -// TODO(holtgrew): Extend class Iter? -/*! - * @class AlignColIterator - * @brief Iterator for alignment columns. - * - * @signature template - * class Iter >; - * - * @tparam TAlign Align object to iterate columns of. - * @tparam TSpec Tag for specializing the class further. - */ - -template -class Iter > -{ -public: - typedef typename Rows::Type TRows; - typedef typename Row::Type TRow; - typedef typename Iterator::Type TRowIterator; - typedef typename Position::Type TRowPosition; - typedef String TIterators; - - TAlign * data_host; - TIterators data_iterators; - -public: - Iter() - { -SEQAN_CHECKPOINT - } - Iter(TAlign & _align): - data_host(& _align) - { -SEQAN_CHECKPOINT - typename Position::Type _i = length(rows(_align)); - resize(data_iterators, _i, Exact()); - } - Iter(TAlign & _align, TRowPosition _pos): - data_host(& _align) - { -SEQAN_CHECKPOINT - typename Position::Type _i = length(rows(_align)); - resize(data_iterators, _i, Exact()); - - while (_i > 0) - { - --_i; - data_iterators[_i] = iter(row(_align, _i), _pos); - } - } - Iter(Iter const & _other): - data_host(_other.data_host), - data_iterators(_other.data_iterators) - { - } - ~Iter() - { -SEQAN_CHECKPOINT - } - - Iter const & - operator = (Iter const & _other) - { -SEQAN_CHECKPOINT - data_host = _other.data_host; - data_iterators = _other.data_iterators; - return *this; - } -//____________________________________________________________________________ -}; - -////////////////////////////////////////////////////////////////////////////// - -// TODO(holtgrew); Document as dox/hosted? - -template -inline TAlign & -host(Iter > & me) -{ -SEQAN_CHECKPOINT - return *me.data_host; -} -template -inline TAlign & -host(Iter > const & me) -{ -SEQAN_CHECKPOINT - return *me.data_host; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -setHost(Iter > & me, TAlign & _host) -{ -SEQAN_CHECKPOINT - me.data_host = & _host; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline typename Cols::Type -container(Iter > & me) -{ -SEQAN_CHECKPOINT - return cols(*me.data_host); -} -template -inline typename Cols::Type -container(Iter > const & me) -{ -SEQAN_CHECKPOINT - return cols(*me.data_host); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -goNext(Iter > & me) -{ -SEQAN_CHECKPOINT - typedef typename Row::Type TRow; - typedef typename Iterator::Type TRowIterator; - typedef String TIterators; - typedef typename Iterator::Type TIteratorsIterator; - - TIteratorsIterator _it = begin(me.data_iterators); - TIteratorsIterator _it_end = end(me.data_iterators); - - while (_it != _it_end) - { - goNext(*_it); - ++_it; - } -} -//____________________________________________________________________________ - -template -inline Iter > & -operator ++(Iter > & me) -{ -SEQAN_CHECKPOINT - goNext(me); - return me; -} -//____________________________________________________________________________ - -template -inline Iter > -operator ++(Iter > & me, int) -{ -SEQAN_CHECKPOINT - Iter > ret = me; - goNext(me); - return ret; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -goPrevious(Iter > & me) -{ -SEQAN_CHECKPOINT - typedef typename Row::Type TRow; - typedef typename Iterator::Type TRowIterator; - typedef String TIterators; - typedef typename Iterator::Type TIteratorsIterator; - - TIteratorsIterator _it = begin(me.data_iterators); - TIteratorsIterator _it_end = end(me.data_iterators); - - while (_it != _it_end) - { - goPrevious(*_it); - ++_it; - } -} -//____________________________________________________________________________ - -template -inline Iter > & -operator --(Iter > & me) -{ -SEQAN_CHECKPOINT - goPrevious(me); - return me; -} -//____________________________________________________________________________ - -template -inline Iter > -operator --(Iter > & me, int) -{ -SEQAN_CHECKPOINT - Iter > ret = me; - goPrevious(me); - return ret; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline bool -operator ==(Iter > & _left, - Iter > & _right) -{ -SEQAN_CHECKPOINT - return getValue(_left.data_iterators, 0) == getValue(_right.data_iterators, 0); -} -template -inline bool -operator ==(Iter > const & _left, - Iter > & _right) -{ -SEQAN_CHECKPOINT - return value(_left.data_iterators, 0) == value(_right.data_iterators, 0); -} -template -inline bool -operator ==(Iter > & _left, - Iter > const & _right) -{ -SEQAN_CHECKPOINT - return value(_left.data_iterators, 0) == value(_right.data_iterators, 0); -} -template -inline bool -operator ==(Iter > const & _left, - Iter > const & _right) -{ -SEQAN_CHECKPOINT - return value(_left.data_iterators, 0) == value(_right.data_iterators, 0); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline bool -operator !=(Iter > & _left, - Iter > & _right) -{ -SEQAN_CHECKPOINT - return value(_left.data_iterators, 0) != value(_right.data_iterators, 0); -} -template -inline bool -operator !=(Iter > const & _left, - Iter > & _right) -{ -SEQAN_CHECKPOINT - return value(_left.data_iterators, 0) != value(_right.data_iterators, 0); -} -template -inline bool -operator !=(Iter > & _left, - Iter > const & _right) -{ -SEQAN_CHECKPOINT - return value(_left.data_iterators, 0) != value(_right.data_iterators, 0); -} -template -inline bool -operator !=(Iter > const & _left, - Iter > const & _right) -{ -SEQAN_CHECKPOINT - return value(_left.data_iterators, 0) != value(_right.data_iterators, 0); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline typename Reference::Type -value(Iter > & me, - TPosition pos_) -{ -SEQAN_CHECKPOINT - return value(me.data_iterators[pos_]); -} -template -inline typename Reference::Type -value(Iter > const & me, - TPosition pos_) -{ -SEQAN_CHECKPOINT - return value(me.data_iterators[pos_]); -} -////////////////////////////////////////////////////////////////////////////// - -template -inline typename GetValue::Type -getValue(Iter > & me, - TPosition pos_) -{ -SEQAN_CHECKPOINT - return getValue(me.data_iterators[pos_]); -} -template -inline typename GetValue::Type -getValue(Iter > const & me, - TPosition pos_) -{ -SEQAN_CHECKPOINT - return getValue(me.data_iterators[pos_]); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -assignValue(Iter > & me, - TPosition pos_, - TValue & val) -{ -SEQAN_CHECKPOINT - return assignValue(me.data_iterators[pos_], val); -} -template -inline void -assignValue(Iter > & me, - TPosition pos_, - TValue const & val) -{ -SEQAN_CHECKPOINT - return assignValue(me.data_iterators[pos_], val); -} -template -inline void -assignValue(Iter > const & me, - TPosition pos_, - TValue & val) -{ -SEQAN_CHECKPOINT - return assignValue(me.data_iterators[pos_], val); -} -template -inline void -assignValue(Iter > const & me, - TPosition pos_, - TValue const & val) -{ -SEQAN_CHECKPOINT - return assignValue(me.data_iterators[pos_], val); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -moveValue(Iter > & me, - TPosition pos_, - TValue & val) -{ -SEQAN_CHECKPOINT - return moveValue(me.data_iterators[pos_], val); -} -template -inline void -moveValue(Iter > & me, - TPosition pos_, - TValue const & val) -{ -SEQAN_CHECKPOINT - return moveValue(me.data_iterators[pos_], val); -} -template -inline void -moveValue(Iter > const & me, - TPosition pos_, - TValue & val) -{ -SEQAN_CHECKPOINT - return moveValue(me.data_iterators[pos_], val); -} -template -inline void -moveValue(Iter > const & me, - TPosition pos_, - TValue const & val) -{ -SEQAN_CHECKPOINT - return moveValue(me.data_iterators[pos_], val); -} - -////////////////////////////////////////////////////////////////////////////// - -//??? TODO -//disabled since GapsIterator has no operator - and + -/* -template -inline Iter > & -operator +=(Iter > & me, - TSize size) -{ -SEQAN_CHECKPOINT - typedef typename Row::Type TRow; - typedef typename Iterator::Type TRowIterator; - typedef String TIterators; - typedef typename Iterator::Type TIteratorsIterator; - - TIteratorsIterator _it = begin(me.data_iterators); - TIteratorsIterator _it_end = end(me.data_iterators); - - while (_it != _it_end) - { - *_it += size; - ++_it; - } - return me; -} - - -////////////////////////////////////////////////////////////////////////////// - -template -inline Iter > -operator +(Iter > & me, - TSize size) -{ -SEQAN_CHECKPOINT - Iter > ret = me; - me += size; - return me; -} -template -inline Iter > -operator +(Iter > const & me, - TSize size) -{ -SEQAN_CHECKPOINT - Iter > ret = me; - me += size; - return me; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline Iter > & -operator -=(Iter > & me, - TSize size) -{ -SEQAN_CHECKPOINT - typedef typename Row::Type TRow; - typedef typename Iterator::Type TRowIterator; - typedef String TIterators; - typedef typename Iterator::Type TIteratorsIterator; - - TIteratorsIterator _it = begin(me.data_iterators); - TIteratorsIterator _it_end = end(me.data_iterators); - - while (_it != _it_end) - { - *_it -= size; - ++_it; - } - return me; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline Iter > -operator -(Iter > & me, - TSize size) -{ -SEQAN_CHECKPOINT - Iter > ret = me; - me -= size; - return me; -} -template -inline Iter > -operator -(Iter > const & me, - TSize size) -{ -SEQAN_CHECKPOINT - Iter > ret = me; - me -= size; - return me; -} - -//____________________________________________________________________________ - -template -inline typename Difference::Type -operator -(Iter > const & left, - Iter > const & right) -{ -SEQAN_CHECKPOINT - SEQAN_ASSERT_GT(length(left.data_iterators), 0u); - SEQAN_ASSERT_GT(length(right.data_iterators), 0u); - - return (left.data_iterators[0] - right.data_iterators[0]); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline typename Position::Type -position(Iter > & me) -{ -SEQAN_CHECKPOINT - return position(me.data_iterators[0], row(host(me), 0)); -} -template -inline typename Position::Type -position(Iter > const & me) -{ -SEQAN_CHECKPOINT - return position(me.data_iterators[0], row(host(me), 0)); -} -*/ -////////////////////////////////////////////////////////////////////////////// - - - -////////////////////////////////////////////////////////////////////////////// - -}// namespace SEQAN_NAMESPACE_MAIN - -#endif //#ifndef SEQAN_HEADER_... diff --git a/seqan/align/align_metafunctions.h b/seqan/align/align_metafunctions.h deleted file mode 100644 index 7cd7f67..0000000 --- a/seqan/align/align_metafunctions.h +++ /dev/null @@ -1,178 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// Align-specific metafunctions. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_METAFUNCTIONS_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_METAFUNCTIONS_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction Cols -// ---------------------------------------------------------------------------- - -/** -.Metafunction.Cols: -..cat:Alignments -..summary:Type of column container of an alignment. -..signature:Cols::Type -..param.T:An alignment type. -...type:Class.Align -..returns.param.Type:The type of the container that allows access to the columns of $T$. -..include:seqan/align.h -*/ - -template -struct Cols; - -// ---------------------------------------------------------------------------- -// Metafunction Col -// ---------------------------------------------------------------------------- - -/*! - * @mfn Align#Col - * @headerfile - * @brief The column type for @link Align @endlink objects. - * - * @signature Col::Type - * - * @tparam TAlign The @link Align @endlink object to query for its column type. - * - * @return Type The resulting type. - */ - -/** -.Metafunction.Col: -..cat:Alignments -..summary:Type of a column in an alignment. -..signature:Col::Type -..param.T:An alignment type. -...type:Class.Align -..returns.param.Type:The column type of $T$. -..remarks:The returned type is equivalent to $Value::Type>::Type$. -..see:Metafunction.Cols -..see:Metafunction.Value -..include:seqan/align.h -*/ - -template -struct Col : Value::Type> -{}; - -// ---------------------------------------------------------------------------- -// Metafunction Rows -// ---------------------------------------------------------------------------- - -/** -.Metafunction.Rows: -..cat:Alignments -..summary:Type of row container of an alignment. -..signature:Rows::Type -..param.T:An alignment type. -...type:Class.Align -..returns.param.Type:The type of the container that allows access to the rows of $T$. -..see:Metafunction.Cols -..include:seqan/align.h -*/ - -template -struct Rows; - -// ---------------------------------------------------------------------------- -// Metafunction Row -// ---------------------------------------------------------------------------- - -/** -.Metafunction.Row: -..cat:Alignments -..summary:Type of a row in an alignment. -..signature:Row::Type -..param.T:An alignment type. -...type:Class.Align -..returns.param.Type:The row type of $T$. -..remarks:The returned type is equivalent to $Value::Type>::Type$. -..see:Metafunction.Rows -..see:Metafunction.Value -..include:seqan/align.h -*/ - -template -struct Row : Value::Type> -{}; - -template -struct Row -{ - typedef typename Row::Type const Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction StringSetType -// ---------------------------------------------------------------------------- - -/** -.Metafunction.StringSetType: -..cat:Alignments -..summary:Return type of @Function.stringSet@ function. -..signature:StringSetType::Type -..param.T:Alignment data structure. -..param.T.type:Spec.Alignment Graph -..param.T.type:Class.Align -..returns.param.Type:A @Class.StringSet.string set@ type of a reference to a string set type. -..see:Function.stringSet -..include:seqan/align.h -*/ -template -struct StringSetType; - -// ============================================================================ -// Functions -// ============================================================================ - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_METAFUNCTIONS_H_ diff --git a/seqan/align/align_traceback.h b/seqan/align/align_traceback.h deleted file mode 100644 index b6de5bf..0000000 --- a/seqan/align/align_traceback.h +++ /dev/null @@ -1,176 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// Author: Tobias Rausch -// ========================================================================== -// AlignTraceback object for storing the alignment traceback results. -// -// The _pump* functions for converting from AlignTrace to Gaps and Fragment -// String objects are defined where Gaps / the Alignment Graph spec is -// defined. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_TRACEBACK_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_TRACEBACK_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Specialization TraceBack -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Mark as internal with underscore? - -/*! - * @tag TraceBack - * @headerfile - * @brief Traceback value. - * - * @signature struct TraceBack_; - * @signature typedef SimpleType TraceBack. - * - * @section Remarks - * - * The ValueSize of TraceBack is 3. The values are defined in the following way: - * - *
    - *
  • 0 - Diagonal Move
  • - *
  • 1 - Horizontal Move
  • - *
  • 2 - Vertical Move
  • - *
- */ - -/** -.Spec.TraceBack: -..cat:Alphabets -..summary: Trace back values. -..general:Class.SimpleType -..signature:TraceBack -..remarks: -...text:The @Metafunction.ValueSize@ of $TraceBack$ is 3. -The values are defined in the following way: 0=Diagonal Move, 1=Horizontal Move, 2=Vertical Move -..see:Metafunction.ValueSize -..include:seqan/align.h -*/ - -struct TraceBack_ {}; -typedef SimpleType TraceBack; - -template <> struct ValueSize -{ - typedef __uint8 Type; - static const Type VALUE = 3; -}; - -template <> struct BitsPerValue -{ - typedef __uint8 Type; - static const Type VALUE = 2; -}; - -// ---------------------------------------------------------------------------- -// Helper Class AlignTraceback -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Mark as internal with underscore? - -/*! - * @class AlignTraceback - * @headerfile - * @brief Data structure for storing alignment traceback. - * - * @signature template - * struct AlignTraceback; - * - * @tparam TSize Size type to use in the traceback. - */ - -/*! - * @var TSizes AlignTraceback#sizes - * @brief The traceback lengths. - */ - -/*! - * @var TLengths AlignTraceback#tsv - * @brief The traceback lengths. - */ - -template -struct AlignTraceback -{ - // Run lengths in the align matrix. - String sizes; - // Trace values: 0 = diagonal, 1 = horizontal, 2 = vertical. - String tvs; -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _alignTracePrint() -// ---------------------------------------------------------------------------- - -// _alignTracePrint: this function is called by various alignment algorithm to build up the alignment during traceback - -template -inline void -_alignTracePrint(AlignTraceback & tb, - TSequenceH const &, - TSequenceV const &, - TId const, - TPos const, - TId const, - TPos const, - TPos const segLen, - TTraceValue const tv) -{ - appendValue(tb.sizes, segLen); - appendValue(tb.tvs, tv); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGN_TRACEBACK_H_ diff --git a/seqan/align/alignment_algorithm_tags.h b/seqan/align/alignment_algorithm_tags.h deleted file mode 100644 index 41008f4..0000000 --- a/seqan/align/alignment_algorithm_tags.h +++ /dev/null @@ -1,192 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// We put the tag definition into its own header so we can include them -// independently from the algorithms. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGNMENT_ALGORITHM_TAGS_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGNMENT_ALGORITHM_TAGS_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Global Alignment Algorithm Tags -// ---------------------------------------------------------------------------- - -/*! - * @defgroup AlignmentAlgorithmTags Alignment Algorithm Tags - * @brief Tags for selecting algorithms. - */ - -// TODO(holtgrew): Rename MyersBitVector to Myers? Clashes with find module at the moment. - -/*! - * @tag AlignmentAlgorithmTags#Gotoh - * @headerfile - * @brief Tag for selecting Gotoh DP algorithm. - * - * @signature struct Gotoh_; - * @signature typedef Tag Gotoh; - */ - -/** -.Tag.Pairwise Global Alignment Algorithms -..cat:Alignments -..summary:Tags used for selecting pairwise global alignment algorithms. -..tag -...Gotoh:Gotoh's for affine gap costs. -...NeedlemanWunsch:The Needleman-Wunsch algorithm for linear gap costs. -...Hirschberg:Hirschberg's algorithm using linear space. -...MyersBitVector:Myer's bit-vector algorithm. -...MyersHirschberg:Combination of Myer's and Hirschberg's algorithm. -..see:Function.globalAlignment -..see:Function.globalAlignmentScore -..include:seqan/align.h -*/ - -struct Gotoh_; -typedef Tag Gotoh; - -/*! - * @tag AlignmentAlgorithmTags#NeedlemanWunsch - * @headerfile - * @brief Tag for selecting NeedlemanWunsch DP algorithm. - * - * @signature struct Hirschberg_; - * @signature typedef Tag NeedlemanWunsch; - */ - -struct NeedlemanWunsch_; -typedef Tag NeedlemanWunsch; - -/*! - * @tag AlignmentAlgorithmTags#Hirschberg - * @headerfile - * @brief Tag for selecting Hirschberg's DP algorithm. - * - * @signature struct Hirschberg_; - * @signature typedef Tag Hirschberg; - */ - -struct Hirschberg_; -typedef Tag Hirschberg; - -/*! - * @tag AlignmentAlgorithmTags#MyersBitVector - * @headerfile - * @brief Tag for selecting Myers' bit-vector algorithm. - * - * @signature struct MyersBitVector_; - * @signature typedef Tag MyersBitVector; - */ - -struct MyersBitVector_; -typedef Tag MyersBitVector; - -/*! - * @tag AlignmentAlgorithmTags#MyersHirschberg - * @headerfile - * @brief Tag for selecting a combination of Myers' bit-vector algorithm with Hirschberg's algorithm. - * - * @signature struct MyersHirschberg_; - * @signature typedef Tag MyersHirschberg; - */ - -struct MyersHirschberg_; -typedef Tag MyersHirschberg; - -// ---------------------------------------------------------------------------- -// Local Alignment Algorithm Tags -// ---------------------------------------------------------------------------- - -/*! - * @defgroup PairwiseLocalAlignmentAlgorithms Pairwise Local Alignment Algorithms - * @brief Tags for selecting algorithms. - */ - -/** -.Tag.Pairwise Local Alignment Algorithms -..cat:Alignments -..summary:Tags used for selecting pairwise global alignment algorithms. -..tag -...SmithWaterman:Smith-Waterman algorithm for local alignments. -...WatermanEggert:Smith-Waterman algorithm with declumping to identify suboptimal local alignments. -..see:Function.localAlignment -..see:Class.LocalAlignmentEnumerator -..include:seqan/align.h -*/ - -/*! - * @tag PairwiseLocalAlignmentAlgorithms#SmithWaterman - * @headerfile - * @brief Tag for selecting the Smith-Waterman algorithm. - * - * @signature struct SmithWaterman_; - * @signature typedef Tag SmithWaterman; - */ - -struct SmithWaterman_; -typedef Tag SmithWaterman; - -/*! - * @tag PairwiseLocalAlignmentAlgorithms#WatermanEggert - * @headerfile - * @brief Tag for selecting the Waterman-Eggert algorithm. - * - * @signature struct WatermanEggert_; - * @signature typedef Tag WatermanEggert; - */ - -struct WatermanEggert_; -typedef Tag WatermanEggert; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGNMENT_ALGORITHM_TAGS_H_ diff --git a/seqan/align/alignment_operations.h b/seqan/align/alignment_operations.h deleted file mode 100644 index e2c705c..0000000 --- a/seqan/align/alignment_operations.h +++ /dev/null @@ -1,159 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Birte Kehr -// ========================================================================== -// Operations on alignments such as integration -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGNMENT_OPERATIONS_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGNMENT_OPERATIONS_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function integrateAlign() -// ---------------------------------------------------------------------------- - -/*! - * @fn integrateAlign - * @headerfile - * @brief Integrates an alignment into another by copying the gaps. - * - * @signature void integrateAlign(align1, align2[, positions]); - * - * @param align1 Target Alignment object into which align2 is to be integrated. - * @param align2 Alignment object that is to be integrated into align1. - * @param positions The integration positions in align1 for all rows (view positions), String of positions. - * - * @section Examples - * - * @include demos/align/integrate_align.cpp - * - * The output is as follows: - * - * @include demos/align/integrate_align.cpp.stdout - */ - -/** -.Function.integrateAlign -..summary:Integrates an alignment into another by copying the gaps. -..cat:Alignments -...type:Class.Align -..signature:integrateAlign(align1, align2[, positions]) -..param.align1:Alignment object into which align2 is to be integrated. -...type:Class.Align -..param.align2:Alignment object that is to be integrated into align1. -...type:Class.Align -..param.positions:The integration positions in align1 for all rows (view positions). -...type:Class.String -..remarks:If the integration positions are not specified, the sources of align2 have to be @Metafunction.Infix@es of the sources of align1. -..include:seqan/align.h - */ - -template -void integrateAlign(Align & align, - Align const & infixAlign, - String const & viewPos) -{ - typedef Align TAlign; - typedef Align TInfixAlign; - typedef typename Size::Type TSize; - - typedef typename Row::Type TRow; - typedef typename Row::Type TInfixRow; - - // Iterators on align and infixAlign. - typename Iterator::Type it; - typedef typename Iterator::Type TInfixRowIt; - - - for (TSize i = 0; i < length(rows(align)); ++i) - { - TInfixRow const & infixRow = row(infixAlign, i); - // This assertion ensures that the number of sequence characters after viewPos[i] is greater than or equal to - // the number of source characters in the clipped infix row. - SEQAN_ASSERT_GEQ(endPosition(row(align, i)) - toSourcePosition(row(align, i), viewPos[i]), - endPosition(infixRow) - beginPosition(infixRow)); - - // init iterators - it = iter(row(align, i), value(viewPos, i)); - - // walk through Gaps containers and copy gaps - for (TInfixRowIt infixIt = begin(infixRow, Standard()); !atEnd(infixIt);) - { - TSize gapSize = countGaps(infixIt); - insertGaps(it, gapSize); - goFurther(it, gapSize+1); - goFurther(infixIt, gapSize+1); - } - } -} - -template -void integrateAlign(Align & align, - Align::Type, TSpec2> const & infixAlign) -{ - typedef typename Size::Type TSize; - typedef typename Position >::Type>::Type TPos; - - String viewPos; - TPos pos; - for (TSize i = 0; i < length(rows(infixAlign)); ++i) - { - pos = beginPosition(source(row(infixAlign, i))) - - beginPosition(source(row(align, i))) - + beginPosition(row(infixAlign, i)); - appendValue(viewPos, toViewPosition(row(align, i), pos)); - } - - integrateAlign(align, infixAlign, viewPos); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_ALIGNMENT_OPERATIONS_H_ diff --git a/seqan/align/dp_algorithm_impl.h b/seqan/align/dp_algorithm_impl.h deleted file mode 100644 index 7b31030..0000000 --- a/seqan/align/dp_algorithm_impl.h +++ /dev/null @@ -1,1461 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// Implements the core of the dp algorithms. -// This is the crucial part of the refactoring of the alignment algorithms. -// It implements - at the moment only a column wise approach - the core -// loop structure for all alignment profiles. We generally differ between an -// unbanded alignment which is very easy, a banded alignment and a special -// case of the banded alignment the Hamming distance, where upper diagonal -// equals lower diagonal. -// -// The unbanded alignment: -// The computation of the unbanded alignment is divided into three parts. -// In the following we refer to a track as the part where the inner loop -// is iterating (in case of column wise navigation a track is equivalent -// to a column). -// First we compute the initial track. Afterwards we continue with all -// inner tracks of the dp matrix and in the end we compute the last track -// separately. This is because all three types have a special property that -// is different from the other track types. -// Each track itself is further divided into three parts, namely the first cell -// the inner cell and the last cell, corresponding to the initial row, -// all inner rows and the last row of a typical dp matrix. This partition of -// the dp matrix allows us to easily change the behavior of different cells -// according to the chosen dp profile at compile time. -// See alignment_dp_meta_info.h to learn about the different meta objects -// that manage the characteristics of each cell of a particular track type. -// -// The banded alignment: -// In the banded alignment we generally divide the dp matrix into the same -// partition as for the unbanded alignment. The only difference is that we, -// additionally add a specific information of how the current track is -// located within the dp matrix. Since we only consider a band we do not -// necessarily span over the full matrix size for a particular column. -// We distinguish between the locations: PartialColumnTop, -// PartialColumnMiddle, PartialColumnBottom and FullColumn (which is the -// default location for unbanded alignments). Each location of the column -// implies a different composition of the cells contained within a -// particular track. Thus, we are able to set different recursion -// directions and tracking informations for each cell independent from the -// runtime. The only difference is that the outer for-loop (iterating over -// the tracks) is split up into three loops. The first loop then only -// iterates over these tracks that are located at the top of the matrix. -// The second for-loop iterates over the tracks that either are of type -// PartialColumnMiddle or FullColumn (wide bands, where the upper diagonal -// begins behind the track where the lower diagonal crosses the last row of -// the dp matrix). And the last for-loop iterates over the tail of the band -// which is located at the PartialColumnBottom. -// -// The Hamming distance: -// In the special case where upper diagonal equals lower diagonal we only -// have to parse one diagonal of the matrix so we have a special -// implementation for that, though it works for all dp profiles. -// -// Restricitons: -// At the moment we have implemented a restriction such that not all bands -// are accepted. If the dp profile consists of the standard global alignment -// algorithm (NeedlemanWunsch or Gotoh), the band is required to go through -// the sink and the source of the dp matrix. If this is not given the -// alignment algorithm is aborted and the score MinValue::VALUE -// is returned. -// There are no further restrictions. -// -// GapCosts: -// Another detail of the new module is the selection of the gap functions, -// which is also now part of the compile time configuration. Whenever an -// algorithm is implemented it would automatically work for both gap -// functions (linear gaps and affine gaps). -// -// Navigation: -// It is possible to a certain degree to change the behavior of how to parse -// through the dp matrix. Using the new navigators one can implement -// different behaviors for different matrices. At the moment we only support -// column wise navigation for full and sparse score matrices and for full -// traceback matrices. Another detail of this navigators comes into account, -// when we want to compute only the score. We actually create a navigator -// for the dp matrix but implemented it this way that it gets never actually -// called when the traceback is disabled. Thus we do not store the traceback -// matrix if it is not necessary. -// -// Traceback: -// The traceback is now implemented as a single function that is used by all -// alignment profiles. Here we prefer the diagonal direction before the -// vertical before the horizontal direction. -// All tracebacks are first stored within the String object -// and afterwards, when the traceback is finished adapted to its given -// target object such as Align, Graph, Fragments, etc. -// -// Tracing: -// We use now an object called DPScout to keep track of the maximal score. -// This object scouts for the best value and can be overloaded to implement -// different strategies of how the score should be traced. Togehter with -// the meta_info file it only traces thus cells that are allowed to be -// traced given the current dp profile. Since this is also a compile time -// property we do not need to track every cell for the global alignment, -// while we do in the local alignment. -// -// Structure: -// The sequences within the matrix are marked as horizontal and vertical -// sequence to determine there orientation within the matrix. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_ALGORITHM_IMPL_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_ALGORITHM_IMPL_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _checkBandProperties() -// ---------------------------------------------------------------------------- - -// Checks whether the chosen band fits the dp profile. -template -inline bool _checkBandProperties(TSequenceH const & /*seqH*/, - TSequenceV const & /*seqV*/, - DPBand_ const & /*band*/, - TAlignmentProfile const & /*alignProfile*/) -{ - return true; -} - -template -inline bool _checkBandProperties(TSequenceH const & seqH, - TSequenceV const & seqV, - DPBand_ const & band, - TAlignmentProfile const & /*alignProfile*/) -{ - typedef typename MakeSigned::Type>::Type TSignedSize; - - // Check if the intersection between band and DP matrix is empty. - if (upperDiagonal(band) < (0 - static_cast(length(seqV))) || - lowerDiagonal(band) > static_cast(length(seqH))) - { - return false; - } - - // If the band begins before the beginning of the horizontal sequence - // then check if free end-gaps are enabled at the beginning of the vertical sequence. - if (upperDiagonal(band) < 0 && !IsFreeEndGap_::VALUE) - return false; - - // If the band begins before the beginning of the vertical sequence - // then check if free end-gaps are enabled at the beginning of the horizontal sequence. - if (lowerDiagonal(band) > 0 && !IsFreeEndGap_::VALUE) - return false; - - // If the band ends behind the end of the vertical sequence - // then check if free end-gaps are enabled at the end of the horizontal sequence. - if (upperDiagonal(band) + static_cast(length(seqV)) < static_cast(length(seqH)) && - !IsFreeEndGap_::VALUE) - { - return false; - } - - // If the band ends behind the end of the horizontal sequence - // then check if free end-gaps are enabled at the end of the vertical sequence. - if (lowerDiagonal(band) + static_cast(length(seqV)) > static_cast(length(seqH)) && - !IsFreeEndGap_::VALUE) - { - return false; - } - - return true; -} - -// ---------------------------------------------------------------------------- -// Function _invalidDPSettings() -// ---------------------------------------------------------------------------- - - -// Checks if the settings for the dp algorithm are valid. -// Returns true if they are valid, false otherwise. -template -inline bool _isValidDPSettings(TSequenceH const & seqH, - TSequenceV const & seqV, - TBand const & band, - TAlignmentProfile const & alignProfile) -{ - // Check if the sequences are empty. - if (empty(seqH) || empty(seqV)) - { - return false; - } - - return _checkBandProperties(seqH, seqV, band, alignProfile); -} - -// ---------------------------------------------------------------------------- -// Function _isBandEnabled() -// ---------------------------------------------------------------------------- - -// Returns true if a band is selected, otherwise false. -template -inline bool -_isBandEnabled(DPBand_ const & /*band*/) -{ - return IsSameType::VALUE; -} - -// ---------------------------------------------------------------------------- -// Function _computeCell() -// ---------------------------------------------------------------------------- - -// Computes the score and tracks it if enabled. -template -inline void -_computeCell(TDPScout & scout, - TTraceMatrixNavigator & traceMatrixNavigator, - DPCell_ & activeCell, - DPCell_ const & previousDiagonal, - DPCell_ const & previousHorizontal, - DPCell_ const & previousVertical, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - TColumnDescriptor const &, - TCellDescriptor const &, // One of FirstCell, InnerCell or LastCell. - TDPProfile const &) -{ - typedef DPMetaColumn_ TMetaColumn; - assignValue(traceMatrixNavigator, - _computeScore(activeCell, previousDiagonal, previousHorizontal, previousVertical, seqHVal, seqVVal, - scoringScheme, typename RecursionDirection_::Type(), - TDPProfile())); -// std::cout << "("<< activeCell._score << "," << previousDiagonal._score << "," << previousHorizontal._score << "," << previousVertical._score << ") "; - if (TrackingEnabled_::VALUE) - { - bool isLastColumn = IsSameType::VALUE; - bool isLastRow = And, - Or, - IsSameType > >::VALUE; - _scoutBestScore(scout, activeCell, traceMatrixNavigator, isLastColumn, isLastRow); - } -} - -// ---------------------------------------------------------------------------- -// Function _computeTrack() -// ---------------------------------------------------------------------------- - -// Computes one track of the dp algorithm. A track is defined as the area that is filled by the inner loop and -// iterated by the outer loop. For the column-wise navigation the track is equivalent with the column. -template -inline void -_computeTrack(TDPScout & scout, - TDPScoreMatrixNavigator & dpScoreMatrixNavigator, - TDPTraceMatrixNavigator & dpTraceMatrixNavigator, - TSeqHValue const & seqHValue, - TSeqVValue const & seqVValue, - TSeqVIterator const & seqBegin, - TSeqVIterator const & seqEnd, - TScoringScheme const & scoringScheme, - TColumnDescriptor const &, - TDPProfile const &) -{ - // Set the iterator to the begin of the track. - _goNextCell(dpScoreMatrixNavigator, TColumnDescriptor(), FirstCell()); - _goNextCell(dpTraceMatrixNavigator, TColumnDescriptor(), FirstCell()); - - // Compute the first cell. - _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), - previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), - previousCellVertical(dpScoreMatrixNavigator), seqHValue, seqVValue, scoringScheme, - TColumnDescriptor(), FirstCell(), TDPProfile()); -// std::cerr << _scoreOfCell(value(dpScoreMatrixNavigator)) << " \t"; -// std::cerr << _scoreOfCell(value(dpScoreMatrixNavigator)) << "(" << _horizontalScoreOfCell(value(dpScoreMatrixNavigator)) << "," << _verticalScoreOfCell(value(dpScoreMatrixNavigator)) << ")" << " \t"; - - TSeqVIterator iter = seqBegin; - TSeqVIterator itEnd = (seqEnd - 1); - // Compute the inner cells of the current track. - for (; iter != itEnd; ++iter) - { - // Set the iterator to the next cell within the track. - _goNextCell(dpScoreMatrixNavigator, TColumnDescriptor(), InnerCell()); - _goNextCell(dpTraceMatrixNavigator, TColumnDescriptor(), InnerCell()); - // Compute the inner cell. - _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), - previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), - previousCellVertical(dpScoreMatrixNavigator), seqHValue, - sequenceEntryForScore(scoringScheme, container(iter), position(iter)), scoringScheme, - TColumnDescriptor(), InnerCell(), TDPProfile()); -// std::cerr << _scoreOfCell(value(dpScoreMatrixNavigator)) << " \t"; -// std::cerr << _scoreOfCell(value(dpScoreMatrixNavigator)) << "(" << _horizontalScoreOfCell(value(dpScoreMatrixNavigator)) << "," << _verticalScoreOfCell(value(dpScoreMatrixNavigator)) << ")" << " \t"; - } - // Set the iterator to the last cell of the track. - _goNextCell(dpScoreMatrixNavigator, TColumnDescriptor(), LastCell()); - _goNextCell(dpTraceMatrixNavigator, TColumnDescriptor(), LastCell()); - // Compute the last cell. - _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), - previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), - previousCellVertical(dpScoreMatrixNavigator), seqHValue, - sequenceEntryForScore(scoringScheme, container(iter), position(iter)), scoringScheme, - TColumnDescriptor(), LastCell(), TDPProfile()); - -// std::cerr << _scoreOfCell(value(dpScoreMatrixNavigator)) << std::endl; -// std::cerr << _scoreOfCell(value(dpScoreMatrixNavigator)) << "(" << _horizontalScoreOfCell(value(dpScoreMatrixNavigator)) << "," << _verticalScoreOfCell(value(dpScoreMatrixNavigator)) << ")" << std::endl; -} - -// TODO(rmaerker): Debug code! -//template -//inline void -//_computeTrack(TDPScout & scout, -// TDPScoreMatrixNavigator & dpScoreMatrixNavigator, -// TDPTraceMatrixNavigator & dpTraceMatrixNavigator, -// TSeqHValue const & seqHValue, -// TSeqVValue const & seqVValue, -// TSeqVIterator const & seqBegin, -// TSeqVIterator const & seqEnd, -// TScoringScheme const & scoringScheme, -// TColumnDescriptor const &, -// TDPProfile const &, -// unsigned col, -// unsigned row, -// String & testMatrix) -//{ -// // Set the iterator to the begin of the track. -// _goNextCell(dpScoreMatrixNavigator, TColumnDescriptor(), FirstCell()); -// _goNextCell(dpTraceMatrixNavigator, TColumnDescriptor(), FirstCell()); -// -// // Compute the first cell. -// _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), -// previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), -// previousCellVertical(dpScoreMatrixNavigator), seqHValue, seqVValue, scoringScheme, -// TColumnDescriptor(), FirstCell(), TDPProfile()); -// // TODO(rmaerker): remove debug code -//// std::cout << _scoreOfCell(value(dpScoreMatrixNavigator)) << "\t"; -// std::stringstream stream; -// stream << _scoreOfCell(value(dpScoreMatrixNavigator)); -//// stream << col + row; -// testMatrix[col + row] = stream.str(); -// ++row; -// -// TSeqVIterator iter = seqBegin; -// TSeqVIterator itEnd = (seqEnd - 1); -// // Compute the inner cells of the current track. -// for (; iter != itEnd; ++iter, ++row) // He will out of scope.... -// { -// // Set the iterator to the next cell within the track. -// _goNextCell(dpScoreMatrixNavigator, TColumnDescriptor(), InnerCell()); -// _goNextCell(dpTraceMatrixNavigator, TColumnDescriptor(), InnerCell()); -// // Compute the inner cell. -// _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), -// previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), -// previousCellVertical(dpScoreMatrixNavigator), seqHValue, value(iter), scoringScheme, -// TColumnDescriptor(), InnerCell(), TDPProfile()); -// // TODO(rmaerker): remove debug code -//// std::cout << _scoreOfCell(value(dpScoreMatrixNavigator)) << "\t"; -// stream.str(""); -// stream << _scoreOfCell(value(dpScoreMatrixNavigator)); -//// stream << col + row; -// testMatrix[col + row] = stream.str(); -// } -// // Set the iterator to the last cell of the track. -// _goNextCell(dpScoreMatrixNavigator, TColumnDescriptor(), LastCell()); -// _goNextCell(dpTraceMatrixNavigator, TColumnDescriptor(), LastCell()); -// // Compute the last cell. -// _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), -// previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), -// previousCellVertical(dpScoreMatrixNavigator), seqHValue, value(iter), scoringScheme, -// TColumnDescriptor(), LastCell(), TDPProfile()); -// // TODO(rmaerker): remove debug code -//// std::cout << _scoreOfCell(value(dpScoreMatrixNavigator)) << "\n"; -// stream.str(""); -// stream << _scoreOfCell(value(dpScoreMatrixNavigator)); -//// stream << col + row; -// testMatrix[col + row] = stream.str(); -//} - -// ---------------------------------------------------------------------------- -// Function _computeUnbandedAlignmentHelperTerminate() -// ---------------------------------------------------------------------------- - -template -inline bool //TODO(C++11) constexpr -_computeAlignmentHelperCheckTerminate(DPScout_ const & /**/) -{ - return false; -} - -template -inline bool -_computeAlignmentHelperCheckTerminate(DPScout_ > const & s) -{ - return _terminationCriteriumIsMet(s); -} - - -// ---------------------------------------------------------------------------- -// Function _computeUnbandedAlignment() -// ---------------------------------------------------------------------------- - -// Computes the standard DP-algorithm. -template -inline void -_computeUnbandedAlignment(TDPScout & scout, - TDPScoreMatrixNavigator & dpScoreMatrixNavigator, - TDPTraceMatrixNavigator & dpTraceMatrixNavigator, - TSequenceH const & seqH, - TSequenceV const & seqV, - TScoringScheme const & scoringScheme, - DPProfile_ const & dpProfile) -{ - typedef typename Iterator::Type TConstSeqHIterator; - typedef typename Iterator::Type TConstSeqVIterator; - - // ============================================================================ - // PREPROCESSING - // ============================================================================ - - TConstSeqVIterator seqVBegin = begin(seqV, Rooted()); - TConstSeqVIterator seqVEnd = end(seqV, Rooted()); - - SEQAN_ASSERT_GT(length(seqH), 0u); - SEQAN_ASSERT_GT(length(seqV), 0u); - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, 0), - sequenceEntryForScore(scoringScheme, seqV, 0), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - - // ============================================================================ - // MAIN DP - // ============================================================================ - - TConstSeqHIterator seqHIter = begin(seqH, Rooted()); - TConstSeqHIterator seqHIterEnd = end(seqH, Rooted()) - 1; - - for (; seqHIter != seqHIterEnd; ++seqHIter) - { - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, 0), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - - if (_computeAlignmentHelperCheckTerminate(scout)) - { - return; - } - } - - // ============================================================================ - // POSTPROCESSING - // ============================================================================ - - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, 0), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - - // If we compute only the single option. we need to check if there are other possibilities at the end. - // Traceback only from Diagonal, but could also come from vertical or horizontal. - -// for (unsigned i = 0; i < length(recMatrix); ++i) -// { -// std::cout << recMatrix[i]._score << "\t"; -// } -// std::cout << std::endl; -} - -// ---------------------------------------------------------------------------- -// Function _computeBandedAlignment() -// ---------------------------------------------------------------------------- - -// Computes the banded DP-algorithm. -template -inline void -_computeBandedAlignment(TDPScout & scout, - TDPScoreMatrixNavigator & dpScoreMatrixNavigator, - TDPTraceMatrixNavigator & dpTraceMatrixNavigator, - TSequenceH const & seqH, - TSequenceV const & seqV, - TScoringScheme const & scoringScheme, - TBand const & band, - DPProfile_ const & dpProfile) -{ - typedef DPProfile_ TDPProfile; - typedef typename MakeSigned::Type>::Type TSignedSizeSeqH; - typedef typename MakeSigned::Type>::Type TSignedSizeSeqV; - typedef typename Iterator::Type TConstSeqHIterator; - typedef typename Iterator::Type TConstSeqVIterator; - - - // Now we have the problem of not knowing when we are in the last cell. - - // ============================================================================ - // PREPROCESSING - // ============================================================================ - TSignedSizeSeqH seqHlength = static_cast(length(seqH)); - TSignedSizeSeqH seqVlength = static_cast(length(seqV)); - - TConstSeqVIterator seqVBegin = begin(seqV, Rooted()) - _min(0, 1 + upperDiagonal(band)); - TConstSeqVIterator seqVEnd = begin(seqV, Rooted()) - _min(0, _max(-seqVlength, lowerDiagonal(band))); - - // We have to distinguish two band sizes. Some which spans the whole matrix in between and thus who not. - // This can be distinguished, if UpperDiagonal > length(seqV) + LowerDiagonal - - // We start at least at the first position of the horizontal sequence or wherever the lower diagonal begins first. - TConstSeqHIterator seqHIterBegin = begin(seqH, Rooted()) + _max(0, _min(seqHlength - 1, lowerDiagonal(band))); - - // The horizontal initial phase ends after the upper diagonal but at most after the horizontal sequence, or there is no horizontal initialization phase. - TConstSeqHIterator seqHIterEndColumnTop = begin(seqH, Rooted()) + _min(seqHlength - 1, _max(0, upperDiagonal(band))); - - // The middle band phase ends after the lower diagonal crosses the bottom of the alignment matrix or after the horizontal sequence if it is smaller. - TConstSeqHIterator seqHIterEndColumnMiddle = begin(seqH, Rooted()) + _min(seqHlength - 1, _max(0, seqVlength + lowerDiagonal(band))); - // Swap the two iterators if we are in a band that spans over the full column. - if (upperDiagonal(band) > seqVlength + lowerDiagonal(band)) - std::swap(seqHIterEndColumnTop, seqHIterEndColumnMiddle); - - // The bottom band phase ends after the upper diagonal of the band crosses the bottom of the matrix or after the horizontal sequence if it is smaller. - TConstSeqHIterator seqHIterEndColumnBottom = begin(seqH, Rooted()) + _max(0, _min(seqHlength, - upperDiagonal(band) + seqVlength) - 1); - - // The Initial column can be PartialColumnTop which is given if the upper diagonal is >= 0, - // otherwise it only can be PartialColumnMiddle or PartialColumnBottom depending where the lower diagonal is. - - // Check for single initialization cells in InitialColumn and FinalColumn. - if (seqHIterBegin == end(seqH, Rooted()) - 1) - { - // Set the iterator to the begin of the track. - _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - // Only one cell - _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), - previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), - previousCellVertical(dpScoreMatrixNavigator), - sequenceEntryForScore(scoringScheme, seqH, position(seqHIterBegin)), - sequenceEntryForScore(scoringScheme, seqV, 0), scoringScheme, - MetaColumnDescriptor(), FirstCell(), TDPProfile()); - // we might need to additionally track this point. - if (TrackingEnabled_ >, FirstCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator, true, false); - return; - } - if (seqHIterEndColumnBottom == begin(seqH, Rooted())) - { - // Set the iterator to the begin of the track. - _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - // Only one cell - _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), - previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), - previousCellVertical(dpScoreMatrixNavigator), - sequenceEntryForScore(scoringScheme, seqH, 0), - sequenceEntryForScore(scoringScheme, seqV, position(seqVBegin)), scoringScheme, - MetaColumnDescriptor(), FirstCell(), TDPProfile()); - // We might need to additionally track this point. - if (TrackingEnabled_ >, LastCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator, false, true); - return; - } - - if (upperDiagonal(band) < 0) - { - ++seqVBegin; - if (lowerDiagonal(band) > -seqVlength) - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, 0), - sequenceEntryForScore(scoringScheme, seqV, position(seqVBegin) - 1), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - else - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, 0), - sequenceEntryForScore(scoringScheme, seqV, position(seqVBegin) - 1), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - } - else if (lowerDiagonal(band) >= 0) - { - // Set the iterator to the begin of the track. - _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - // Should we not just compute the cell? - _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), - previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), - previousCellVertical(dpScoreMatrixNavigator), - sequenceEntryForScore(scoringScheme, seqH, position(seqHIterBegin)), - sequenceEntryForScore(scoringScheme, seqV, 0), - scoringScheme, - MetaColumnDescriptor(), FirstCell(), TDPProfile()); - // we might need to additionally track this point. - if (TrackingEnabled_ >, FirstCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator, false, false); - } - else // Upper diagonal >= 0 and lower Diagonal < 0 - if (lowerDiagonal(band) <= -seqVlength) // The band is bounded by the top and bottom of the matrix. - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, 0), - sequenceEntryForScore(scoringScheme, seqV, 0), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - else // The band is bounded by the top but not the bottom of the matrix. - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, 0), - sequenceEntryForScore(scoringScheme, seqV, 0), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - - if (_computeAlignmentHelperCheckTerminate(scout)) - { - return; - } - - // ============================================================================ - // MAIN DP - // ============================================================================ - - TConstSeqHIterator seqHIter = seqHIterBegin; - // Compute the first part of the band, where the band is bounded by the top but not by the bottom of the matrix. - for (; seqHIter != seqHIterEndColumnTop; ++seqHIter) - { - ++seqVEnd; - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, 0), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - if (_computeAlignmentHelperCheckTerminate(scout)) - { - return; - } - } - - // TODO(rmaerker): Check if putting the if-statement before the actual algorithm can speedup the code. - // Check whether the band spans over the full column or not at some point. - if (upperDiagonal(band) > seqVlength + lowerDiagonal(band)) - { - // Compute the second part of the band, where the band is bounded by the top and the bottom of the matrix. - // We might want to track the current cell here, since this is the first cell that crosses the bottom but is - // not part of the FullColumn tracks. - if (TrackingEnabled_ >, LastCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator, false, true); - for (; seqHIter != seqHIterEndColumnMiddle; ++seqHIter) - { - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, 0), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - - if (_computeAlignmentHelperCheckTerminate(scout)) - { - return; - } - } - } - else // Compute the second part of the band, where the band is not bounded by the top and bottom of the matrix - { - for (; seqHIter != seqHIterEndColumnMiddle; ++seqHIter) - { - ++seqVBegin; - ++seqVEnd; - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, position(seqVBegin) - 1), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - if (_computeAlignmentHelperCheckTerminate(scout)) - { - return; - } - } // We might want to track the current cell here, since this is the first cell that crosses the bottom. - if (TrackingEnabled_ >, LastCell>::VALUE) - { - if (lowerDiagonal(band) + seqVlength < seqHlength) - { - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator, false, true); - } - } - - } - // Compute the third part of the band, where the band, is bounded by the bottom but not by the top of the matrix. - for (; seqHIter != seqHIterEndColumnBottom; ++seqHIter) - { - ++seqVBegin; - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, position(seqVBegin) - 1), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - if (_computeAlignmentHelperCheckTerminate(scout)) - { - return; - } - } - - // ============================================================================ - // POSTPROCESSING - // ============================================================================ - - // Check where the last track of the column is located. - if (seqHIter - begin(seqH, Rooted()) < seqHlength - 1) // Case 1: The band ends before the final column is reached. - { - // Set the iterator to the begin of the track. - _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - - _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), - previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), - previousCellVertical(dpScoreMatrixNavigator), - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, position(seqVBegin)), - scoringScheme, - MetaColumnDescriptor(), FirstCell(), TDPProfile()); - // We might need to additionally track this point. - if (TrackingEnabled_ >, LastCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator, false, true); - } - else if (seqHIter == end(seqH, Rooted()) - 1) // Case 2: The band ends somewhere in the final column of the matrix. - { - // Case2a: The band ends in the last cell of the final column. - if (upperDiagonal(band) == seqHlength - seqVlength) - { - // Set the iterator to the begin of the track. - _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - - _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), - previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), - previousCellVertical(dpScoreMatrixNavigator), - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, position(seqVBegin)), - scoringScheme, - MetaColumnDescriptor(), FirstCell(), TDPProfile()); - // we might need to additionally track this point. - if (TrackingEnabled_ >, LastCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator, true, true); - } - else // Case2b: At least two cells intersect between the band and the matrix in the final column of the matrix. - { - if (upperDiagonal(band) >= seqHlength) // The band is bounded by the top of the matrix only or by the top and the bottom. - { - if (lowerDiagonal(band) + seqVlength > seqHlength) // The band is bounded by the top of the matrix - { - ++seqVEnd; - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, 0), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - } - else // The band is bounded by the top and the bottom of the matrix. - { - if (lowerDiagonal(band) + seqVlength + 1 > seqHlength) // We have to go into the last cell. - { - ++seqVEnd; - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, 0), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - if (TrackingEnabled_ >, LastCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator, true, true); - } - else - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, 0), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - } - - } - else // The band is bounded by bottom of matrix or completely unbounded. - { - ++seqVBegin; - if (lowerDiagonal(band) + seqVlength <= seqHlength) // The band is bounded by the bottom of the matrix. - { - if (lowerDiagonal(band) + seqVlength == seqHlength) // We have to go into the last cell. - { - ++seqVEnd; - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, position(seqVBegin) - 1), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - if (TrackingEnabled_ >, LastCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator, true, true); - } - else - { - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, position(seqVBegin) - 1), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - } - } - else // The band is unbounded by the matrix. - { - ++seqVEnd; - _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, - sequenceEntryForScore(scoringScheme, seqH, position(seqHIter)), - sequenceEntryForScore(scoringScheme, seqV, position(seqVBegin) - 1), - seqVBegin, seqVEnd, scoringScheme, - MetaColumnDescriptor(), dpProfile); - } - - } - } - } -} - -// TODO(rmaerker): This is denbug code only. -//template -//inline void -//_debugBandedAlignment(TDPScout & scout, -// TDPScoreMatrixNavigator & dpScoreMatrixNavigator, -// TDPTraceMatrixNavigator & dpTraceMatrixNavigator, -// TSequenceH const & seqH, -// TSequenceV const & seqV, -// TScoringScheme const & scoringScheme, -// TBand const & band, -// DPProfile_ const & dpProfile) -//{ -// typedef DPProfile_ TDPProfile; -// typedef typename Value::Type TSeqHValue; -// typedef typename Value::Type TSeqVValue; -// typedef typename Iterator::Type TConstSeqHIterator; -// typedef typename Iterator::Type TConstSeqVIterator; -// -// -// String testMatrix; -// resize(testMatrix, (length(seqH) + 1) * (length(seqV)+1)); -// // Now we have the problem of not knowing when we are in the last cell. -// -// // INITIALIZATION -// TConstSeqVIterator seqVBegin = begin(seqV, Standard()) - _min(0, 1+upperDiagonal(band)); -// TConstSeqVIterator seqVEnd = begin(seqV, Standard()) - _min(0, _max(-static_cast(length(seqV)), lowerDiagonal(band))); -// -//// std::cout << "Begin Pos: " << seqVBegin - begin(seqV) << "\n"; -//// std::cout << "End Pos: " << seqVEnd - begin(seqV) << "\n"; -// -// // We have to distinguish two band sizes. Some which spans the whole matrix in between and thus who not. -// // This can be distinguished, if UpperDiagonal > length(seqV) + LowerDiagonal -// -// // We start at the least at the first sequence or wherever the lower diagonal begins first. -// TConstSeqHIterator seqHIterBegin = begin(seqH, Standard()) + _max(0, _min(static_cast(length(seqH) - 1), lowerDiagonal(band))); -// // TODO(rmaerker): Cehck if this assertion is correct. -//// SEQAN_ASSERT_NEQ(seqHIterBegin, end(seqH, Standard())); // The iterator never points to the end of the horizontal sequence. -// -// // The horizontal initial phase ends after the upper diagonal but at most after the horizontal sequence, or there is no horizontal initialization phase. -// TConstSeqHIterator seqHIterEndColumnTop = begin(seqH, Standard()) + _min(static_cast(length(seqH))-1, _max(0, upperDiagonal(band))); -// -// // The middle band phase ends after the lower diagonal crosses the bottom of the alignment matrix or after the horizontal sequence if it is smaller. -// TConstSeqHIterator seqHIterEndColumnMiddle = begin(seqH, Standard()) + _min(static_cast(length(seqH))-1, _max(0,static_cast(length(seqV)) + lowerDiagonal(band))); -// // Swap the two iterators if we are in a band that spans over the full column. -// if (upperDiagonal(band) > static_cast(length(seqV)) + lowerDiagonal(band)) -// std::swap(seqHIterEndColumnTop, seqHIterEndColumnMiddle); -// -// // The bottom band phase ends after the upper diagonal of the band crosses the bottom of the matrix or after the horizontal sequence if it is smaller. -// TConstSeqHIterator seqHIterEndColumnBottom = begin(seqH, Standard()) + _max(0, _min(static_cast(length(seqH)), -// upperDiagonal(band) + static_cast(length(seqV))) -1); -// -//// std::cout << "seqHIterBegin Pos H: " << seqHIterBegin - begin(seqH) << "\n"; -//// std::cout << "seqHIterEndColumnTop Pos H: " << seqHIterEndColumnTop - begin(seqH) << "\n"; -//// std::cout << "seqHIterEndColumnMiddle Pos H: " << seqHIterEndColumnMiddle - begin(seqH) << "\n"; -//// std::cout << "seqHIterEndColumnBottom Pos H: " << seqHIterEndColumnBottom - begin(seqH) << "\n"; -//// -//// std::cout << "_activeColIterator Pos: " << dpScoreMatrixNavigator._activeColIterator - begin(*dpScoreMatrixNavigator._ptrDataContainer) << "\n"; -//// std::cout << "_prevColIterator Pos: " << dpScoreMatrixNavigator._prevColIterator - begin(*dpScoreMatrixNavigator._ptrDataContainer) << "\n"; -// -// // The Initial column can be PartialColumnTop which is given if the upper diagonal is >= 0, -// // otherwise it only can be PartialColumnMiddle or PartialColumnBottom depending where the lower diagonal is. -// -// // Have to check for single initialization cells in InitialColumn and FinalColumn. -// if (seqHIterBegin == end(seqH)-1) -// { -// // Set the iterator to the begin of the track. -// _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); -// _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); -// // Only one cell -// _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), -// previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), -// previousCellVertical(dpScoreMatrixNavigator), value(seqHIterBegin), TSeqVValue(), scoringScheme, -// MetaColumnDescriptor(), FirstCell(), TDPProfile()); -//// std::cout << _scoreOfCell(value(dpScoreMatrixNavigator)) << "\n"; -// std::stringstream stream; -// stream << _scoreOfCell(value(dpScoreMatrixNavigator)); -// testMatrix[length(seqH) * length(seqV)] = stream.str(); -// // we might need to additionally track this point. -// if (TrackingEnabled_ >, FirstCell>::VALUE) -// _scoutBestScore(scout, _scoreOfCell(value(dpScoreMatrixNavigator)), dpTraceMatrixNavigator); -// return; -// } -// if (seqHIterEndColumnBottom == begin(seqH)) -// { -// // Set the iterator to the begin of the track. -// _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); -// _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); -// // Only one cell -// _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), -// previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), -// previousCellVertical(dpScoreMatrixNavigator), TSeqHValue(), value(seqVBegin), scoringScheme, -// MetaColumnDescriptor(), FirstCell(), TDPProfile()); -//// std::cout << _scoreOfCell(value(dpScoreMatrixNavigator)) << "\n"; -// std::stringstream stream; -// stream << _scoreOfCell(value(dpScoreMatrixNavigator)); -// testMatrix[length(seqH) * length(seqV)] = stream.str(); -// // We might need to additionally track this point. -// if (TrackingEnabled_ >, LastCell>::VALUE) -// _scoutBestScore(scout, _scoreOfCell(value(dpScoreMatrixNavigator)), dpTraceMatrixNavigator); -// return; -// } -// -// if (upperDiagonal(band) < 0) -// { -// ++seqVBegin; -// if (lowerDiagonal(band) > -static_cast(length(seqV))) -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// TSeqHValue(), value(seqVBegin-1), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, 0, seqVBegin - begin(seqV) + 1, testMatrix); -// else -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// TSeqHValue(), value(seqVBegin-1), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, 0, seqVBegin - begin(seqV) + 1, testMatrix); -// } -// else if (lowerDiagonal(band) >= 0) -// { -// // Set the iterator to the begin of the track. -// _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); -// _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); -// // Should we not just compute the cell? -// _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), -// previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), -// previousCellVertical(dpScoreMatrixNavigator), value(seqHIterBegin), TSeqVValue(), scoringScheme, -// MetaColumnDescriptor(), FirstCell(), TDPProfile()); -// // we might need to additionally track this point. -//// std::cout << _scoreOfCell(value(dpScoreMatrixNavigator)) << "\n"; -// int col = lowerDiagonal(band); -// std::stringstream stream; -// stream << _scoreOfCell(value(dpScoreMatrixNavigator)); -// testMatrix[col * (length(seqV) + 1)] = stream.str(); -// if (TrackingEnabled_ >, FirstCell>::VALUE) -// _scoutBestScore(scout, _scoreOfCell(value(dpScoreMatrixNavigator)), dpTraceMatrixNavigator); -// } -// else // Upper diagonal >= 0 and lower Diagonal < 0 -// if (lowerDiagonal(band) <= -static_cast(length(seqV))) // The band is bounded by the top and bottom of the matrix. -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// TSeqHValue(), TSeqVValue(), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, 0, 0, testMatrix); -// else // The band is bounded by the top but not the bottom of the matrix. -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// TSeqHValue(), TSeqVValue(), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, 0,0, testMatrix); -// -// -// // RECURSION -// TConstSeqHIterator seqHIter = seqHIterBegin; -// // Compute the first part of the band, where the band is bounded by the top but not by the bottom of the matrix. -// for (;seqHIter != seqHIterEndColumnTop; ++seqHIter) -// { -//// std::cout << value(seqHIter) << ":\t"; -// ++seqVEnd; -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// value(seqHIter), TSeqVValue(), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, ((seqHIter - begin(seqH)) + 1)*(length(seqV) +1), 0, testMatrix); -// } -// -// // Check whether the band spans over the full column or not at some point. -// if (upperDiagonal(band) > static_cast(length(seqV)) + lowerDiagonal(band)) -// { -// // Compute the second part of the band, where the band is bounded by the top and the bottom of the matrix. -// // We might want to track the current cell here, since this is the first cell that crosses the bottom. -// // TODO(rmaerker): We have to check if the initial column/ row can be tracked!!! -// if (TrackingEnabled_ >, LastCell>::VALUE) -// _scoutBestScore(scout, _scoreOfCell(value(dpScoreMatrixNavigator)), dpTraceMatrixNavigator); -// for (;seqHIter != seqHIterEndColumnMiddle; ++seqHIter) -// { -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// value(seqHIter), TSeqVValue(), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, (seqHIter - begin(seqH) + 1) * (length(seqV) + 1), 0, testMatrix); -// } -// } -// else // Compute the second part of the band, where the band is not bounded by the top and bottom of the matrix -// { -// for (;seqHIter != seqHIterEndColumnMiddle; ++seqHIter) -// { -// ++seqVBegin; -// ++seqVEnd; -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// value(seqHIter), value(seqVBegin-1), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, (seqHIter - begin(seqH) +1) * (length(seqV)+1), seqVBegin - begin(seqV), testMatrix); -// } // We might want to track the current cell here, since this is the first cell that crosses the bottom. -// if (TrackingEnabled_ >, LastCell>::VALUE) -// { -// // TODO(rmaerker): This is only a hot fix. -// if (lowerDiagonal(band) + length(seqV) < length(seqH)) -// _scoutBestScore(scout, _scoreOfCell(value(dpScoreMatrixNavigator)), dpTraceMatrixNavigator); -// } -// } -// // Compute the third part of the band, where the band, is bounded by the bottom but not by the top of the matrix. -// for (;seqHIter != seqHIterEndColumnBottom; ++seqHIter) -// { -// ++seqVBegin; -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// value(seqHIter), value(seqVBegin-1), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, (seqHIter - begin(seqH) + 1) * (length(seqV) + 1), seqVBegin - begin(seqV), testMatrix); -// } -// -// // Where ends the last cell? -// if(seqHIter - begin(seqH) < static_cast(length(seqH))-1) // Case 1: The band ends before the final column is reached. -// { -// // Set the iterator to the begin of the track. -// _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); -// _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); -// -// _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), -// previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), -// previousCellVertical(dpScoreMatrixNavigator), value(seqHIter), value(seqVBegin), scoringScheme, -// MetaColumnDescriptor(), FirstCell(), TDPProfile()); -//// std::cout << _scoreOfCell(value(dpScoreMatrixNavigator)) << "\n"; -// std::stringstream stream; -// stream << _scoreOfCell(value(dpScoreMatrixNavigator)); -// testMatrix[(seqHIter - begin(seqH) + 1) * (length(seqV) + 1) + length(seqV)] = stream.str(); -// // We might need to additionally track this point. -// if (TrackingEnabled_ >, LastCell>::VALUE) -// _scoutBestScore(scout, _scoreOfCell(value(dpScoreMatrixNavigator)), dpTraceMatrixNavigator); -// } -// else if(seqHIter == end(seqH)-1) // Case 2: The band ends somewhere in the final column of the matrix. -// { -// if (upperDiagonal(band) == static_cast(length(seqH))-static_cast(length(seqV))) // Case2a: The band ends in the last cell of the final column. // He should be here.... -// { -// // Set the iterator to the begin of the track. -// _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); -// _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); -// -// _computeCell(scout, dpTraceMatrixNavigator, value(dpScoreMatrixNavigator), -// previousCellDiagonal(dpScoreMatrixNavigator), previousCellHorizontal(dpScoreMatrixNavigator), -// previousCellVertical(dpScoreMatrixNavigator), value(seqHIter), value(seqVBegin), scoringScheme, -// MetaColumnDescriptor(), FirstCell(), TDPProfile()); -//// std::cout << _scoreOfCell(value(dpScoreMatrixNavigator)) << "\n"; -// std::stringstream stream; -// stream << _scoreOfCell(value(dpScoreMatrixNavigator)); -// testMatrix[(length(seqH) * (length(seqV) + 1)) + length(seqV)] = stream.str(); -// // we might need to additionally track this point. -// if (TrackingEnabled_ >, LastCell>::VALUE) -// _scoutBestScore(scout, _scoreOfCell(value(dpScoreMatrixNavigator)), dpTraceMatrixNavigator); -// } -// else // Case2b: At least two cells intersect between the band and the matrix in the final column of the matrix. -// { -// if (upperDiagonal(band) >= static_cast(length(seqH))) // The band is bounded by the top of the matrix only or by the top and the bottom. -// { -// if (lowerDiagonal(band) + static_cast(length(seqV)) > static_cast(length(seqH))) // The band is bounded by the top of the matrix -// { -// ++seqVEnd; -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// value(seqHIter), TSeqVValue(), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, length(seqH) * (length(seqV) + 1), 0, testMatrix); -// } -// else // The band is bounded by the top and the bottom of the matrix. -// { -// if (lowerDiagonal(band) + static_cast(length(seqV)) + 1 > static_cast(length(seqH)) ) -// { -// ++seqVEnd; -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// value(seqHIter), TSeqVValue(), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, length(seqH) * (length(seqV) + 1), 0, testMatrix); -// if (TrackingEnabled_ >, LastCell>::VALUE) -// _scoutBestScore(scout, _scoreOfCell(value(dpScoreMatrixNavigator)), dpTraceMatrixNavigator); -// } -// else -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// value(seqHIter), TSeqVValue(), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, length(seqH) * (length(seqV) +1), 0, testMatrix); -// -// } -// -// } -// else // The band is bounded by bottom of matrix or completely unbounded. -// { -// ++seqVBegin; -// if (lowerDiagonal(band) + length(seqV) <= length(seqH)) // The band is bounded by the bottom of the matrix. -// { -// if (lowerDiagonal(band) + length(seqV) == length(seqH)) -// { -// ++seqVEnd; -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// value(seqHIter), value(seqVBegin-1), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, length(seqH) * (length(seqV)+1), seqVBegin - begin(seqV), testMatrix); -// if (TrackingEnabled_ >, LastCell>::VALUE) -// _scoutBestScore(scout, _scoreOfCell(value(dpScoreMatrixNavigator)), dpTraceMatrixNavigator); -// } -// else -// { -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// value(seqHIter), value(seqVBegin-1), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, length(seqH) * (length(seqV) + 1), seqVBegin - begin(seqV), testMatrix); -// } -// } -// else // The band is unbounded by the matrix. -// { -// ++seqVEnd; -// _computeTrack(scout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, -// value(seqHIter), value(seqVBegin-1), seqVBegin, seqVEnd, scoringScheme, -// MetaColumnDescriptor(), dpProfile, length(seqH) * (length(seqV)+1), seqVBegin - begin(seqV), testMatrix); -// } -// -// } -// } -// } -// -// for (unsigned i = 0; i <= length(seqV); ++i) -// { -// for (unsigned j = 0; j <= length(seqH); ++j) -// { -// unsigned pos = j * (length(seqV) + 1) + i; -// //if (!testMatrix[pos].empty()) -// std::cout << testMatrix[pos] << "\t" << std::flush; -// } -// std::cout << std::endl; -// } -// -//} - -// ---------------------------------------------------------------------------- -// Function _computeHammingDistance() -// ---------------------------------------------------------------------------- - -// Computes the Hamming-Distance if the band-size is 1. -template -inline void -_computeHammingDistance(TDPScout & scout, - TDPScoreMatrixNavigator & dpScoreMatrixNavigator, - TDPTraceMatrixNavigator & dpTraceMatrixNavigator, - TSequenceH const & seqH, - TSequenceV const & seqV, - TScoringScheme const & scoringScheme, - TBand const & band, - DPProfile_ const &) -{ - typedef typename MakeSigned::Type>::Type TSignedSizeSeqH; - typedef typename MakeSigned::Type>::Type TSignedSizeSeqV; - typedef typename Iterator::Type TConstSeqHIterator; - typedef typename Iterator::Type TConstSeqVIterator; - typedef typename Value::Type TDPCell; - typedef DPProfile_ TDPProfile; - - // ============================================================================ - // PREPROCESSING - // ============================================================================ - - TSignedSizeSeqH seqHlength = static_cast(length(seqH)); - TSignedSizeSeqH seqVlength = static_cast(length(seqV)); - - TConstSeqHIterator itH = begin(seqH, Rooted()) + _max(0, _min(seqHlength - 1, upperDiagonal(band))); - TConstSeqHIterator itHEnd = begin(seqH, Rooted()) + _min(seqHlength - 1, upperDiagonal(band) + seqVlength); - - TConstSeqVIterator itV = begin(seqV, Rooted()) + _max(0, _min(seqVlength - 1, -lowerDiagonal(band))); - TConstSeqVIterator itVEnd = begin(seqV, Rooted()) + _min(seqVlength - 1, lowerDiagonal(band) + seqHlength); - - assignValue(dpTraceMatrixNavigator, - _computeScore(value(dpScoreMatrixNavigator), TDPCell(), TDPCell(), TDPCell(), - sequenceEntryForScore(scoringScheme, seqH, position(itH)), - sequenceEntryForScore(scoringScheme, seqV, position(itV)), - scoringScheme, RecursionDirectionZero(), TDPProfile())); - - if (upperDiagonal(band) < 0) - { - if (upperDiagonal(band) == -seqVlength) - { - if (TrackingEnabled_ >, LastCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator); - return; - } - else - { - if (TrackingEnabled_ >, InnerCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator); - } - } - else if (lowerDiagonal(band) > 0) - { - if (lowerDiagonal(band) == seqHlength) - { - if (TrackingEnabled_ >, FirstCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator); - return; - } - else - { - if (TrackingEnabled_ >, FirstCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator); - } - } - else - { - if (TrackingEnabled_ >, FirstCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator); - } - - TDPCell prevDiagonal = value(dpScoreMatrixNavigator); - - // ============================================================================ - // MAIN DP - // ============================================================================ - - while (itH != itHEnd && itV != itVEnd) - { - _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - assignValue(dpTraceMatrixNavigator, - _computeScore(value(dpScoreMatrixNavigator), prevDiagonal, TDPCell(), TDPCell(), - sequenceEntryForScore(scoringScheme, seqH, position(itH)), - sequenceEntryForScore(scoringScheme, seqV, position(itV)), - scoringScheme, RecursionDirectionDiagonal(), TDPProfile())); - if (TrackingEnabled_ >, InnerCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator); - prevDiagonal = value(dpScoreMatrixNavigator); - ++itH; - ++itV; - } - - // ============================================================================ - // POSTPROCESSING - // ============================================================================ - - _goNextCell(dpScoreMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - _goNextCell(dpTraceMatrixNavigator, MetaColumnDescriptor(), FirstCell()); - - assignValue(dpTraceMatrixNavigator, - _computeScore(value(dpScoreMatrixNavigator), prevDiagonal, TDPCell(), TDPCell(), - sequenceEntryForScore(scoringScheme, seqH, position(itH)), - sequenceEntryForScore(scoringScheme, seqV, position(itV)), - scoringScheme, RecursionDirectionDiagonal(), TDPProfile())); - - if (itH == itHEnd) - { - if (itV == itVEnd) // Is in the last cell of final column - { - if (TrackingEnabled_ >, LastCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator); - } - if (TrackingEnabled_ >, LastCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator); - } - else - { - if (TrackingEnabled_ >, InnerCell>::VALUE) - _scoutBestScore(scout, value(dpScoreMatrixNavigator), dpTraceMatrixNavigator); - } -} - -// ---------------------------------------------------------------------------- -// Function _printTracebackMatrix() -// ---------------------------------------------------------------------------- - -template -void _printTracebackMatrix(TTraceMatrix & dpTraceMatrix) -{ - typedef typename Size::Type TSize; - TSize dimH = length(dpTraceMatrix, +DPMatrixDimension_::HORIZONTAL); - TSize dimV = length(dpTraceMatrix, +DPMatrixDimension_::VERTICAL); - - for (unsigned row = 0; row < dimV; ++row) - { - for (unsigned column = 0; column < dimH; ++column) - { - std::cout << _translateTraceValue(value(dpTraceMatrix, row + column * dimV)) << "\t"; - } - std::cout << std::endl; - } - std::cout << std::endl; -} - -template -inline void -_correctTraceValue(TTraceNavigator &, - DPScout_, TDPScoutSpec> const &) -{ - // Nothing to do. -} - -template -inline void -_correctTraceValue(TTraceNavigator & traceNavigator, - DPScout_, TDPScoutSpec> const & dpScout) -{ - _setToPosition(traceNavigator, maxHostPosition(dpScout)); - if (_verticalScoreOfCell(dpScout._maxScore) == _scoreOfCell(dpScout._maxScore)) - { - value(traceNavigator) &= ~TraceBitMap_::DIAGONAL; - value(traceNavigator) |= TraceBitMap_::MAX_FROM_VERTICAL_MATRIX; - } - else if (_horizontalScoreOfCell(dpScout._maxScore) == _scoreOfCell(dpScout._maxScore)) - { - value(traceNavigator) &= ~TraceBitMap_::DIAGONAL; - value(traceNavigator) |= TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX; - } - -} - -// ---------------------------------------------------------------------------- -// Function _computeAligmnment() -// ---------------------------------------------------------------------------- - -template -inline typename Value::Type -_computeAlignment(TTraceTarget & traceSegments, - TScoutState & scoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - TScoreScheme const & scoreScheme, - DPBand_ const & band, - DPProfile_ const & dpProfile) -{ - typedef typename Value::Type TScoreValue; - typedef DPCell_ TDPScoreValue; - typedef typename DefaultScoreMatrixSpec_::Type TScoreMatrixSpec; - typedef typename TraceBitMap_::TTraceValue TTraceValue; - - typedef DPMatrix_ TDPScoreMatrix; - typedef DPMatrix_ TDPTraceMatrix; - - typedef DPMatrixNavigator_ TDPScoreMatrixNavigator; - typedef DPMatrixNavigator_, NavigateColumnWise> TDPTraceMatrixNavigator; - - typedef typename ScoutSpecForAlignmentAlgorithm_::Type TDPScoutSpec; - typedef DPScout_ TDPScout; - - // Check if current dp settings are valid. If not return infinity value for dp score value. - if (!_isValidDPSettings(seqH, seqV, band, dpProfile)) - return MinValue::VALUE; - - TDPScoreMatrix dpScoreMatrix; - TDPTraceMatrix dpTraceMatrix; - - // TODO(rmaerker): Check whether the matrix allocation can be reduced if upperDiagonal < 0? - setLength(dpScoreMatrix, +DPMatrixDimension_::HORIZONTAL, length(seqH) + 1 - std::max(0, lowerDiagonal(band))); - setLength(dpTraceMatrix, +DPMatrixDimension_::HORIZONTAL, length(seqH) + 1 - std::max(0, lowerDiagonal(band))); - - if (IsSameType::VALUE) - { - setLength(dpScoreMatrix, +DPMatrixDimension_::VERTICAL, length(seqV) + 1); - setLength(dpTraceMatrix, +DPMatrixDimension_::VERTICAL, length(seqV) + 1); - } - else - { - int bandSize = _min(static_cast(length(seqH)), upperDiagonal(band)) - _max(lowerDiagonal(band), -static_cast(length(seqV))) + 1; - setLength(dpScoreMatrix, +DPMatrixDimension_::VERTICAL, _min(static_cast(length(seqV)) + 1, bandSize)); - setLength(dpTraceMatrix, +DPMatrixDimension_::VERTICAL, _min(static_cast(length(seqV)) + 1, bandSize)); - } - - resize(dpScoreMatrix); - // We do not need to allocate the memory for the trace matrix if the traceback is disabled. - if (IsTracebackEnabled_::VALUE) - resize(dpTraceMatrix); - - TDPScoreMatrixNavigator dpScoreMatrixNavigator; - TDPTraceMatrixNavigator dpTraceMatrixNavigator; - - _init(dpScoreMatrixNavigator, dpScoreMatrix, band); - _init(dpTraceMatrixNavigator, dpTraceMatrix, band); - - TDPScout dpScout(scoutState); - - // Execute the alignment. - if (!_isBandEnabled(band)) - _computeUnbandedAlignment(dpScout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, seqH, seqV, scoreScheme, dpProfile); - else if (upperDiagonal(band) == lowerDiagonal(band)) - _computeHammingDistance(dpScout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, seqH, seqV, scoreScheme, band, dpProfile); - else - _computeBandedAlignment(dpScout, dpScoreMatrixNavigator, dpTraceMatrixNavigator, seqH, seqV, scoreScheme, - band, dpProfile); - - if (IsSameType::VALUE) - return maxScore(dpScout); - - if (IsSingleTrace_::VALUE) - { - // Check if max was found at the bottom right corner of the matrix. - // This is also true if in last row, and last column -// if ((maxHostPosition(dpScout) + 1) == (end(dpTraceMatrix) - begin(dpTraceMatrix))) - -// maxHostPosition(dpScout); // We only have the trace value not the score value. - _correctTraceValue(dpTraceMatrixNavigator, dpScout); - } - -// _printTracebackMatrix(dpTraceMatrix); - _computeTraceback(traceSegments, dpTraceMatrixNavigator, dpScout, seqH, seqV, band, dpProfile); - - return maxScore(dpScout); -} - -template -inline typename Value::Type -_computeAlignment(TTraceTarget & traceSegments, - TSequenceH const & seqH, - TSequenceV const & seqV, - TScoreScheme const & scoreScheme, - DPBand_ const & band, - DPProfile_ const & dpProfile) -{ - DPScoutState_ noState; - return _computeAlignment(traceSegments, noState, seqH, seqV, scoreScheme, band, dpProfile); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_ALGORITHM_IMPL_H_ diff --git a/seqan/align/dp_band.h b/seqan/align/dp_band.h deleted file mode 100644 index 49cc73f..0000000 --- a/seqan/align/dp_band.h +++ /dev/null @@ -1,228 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// This class stores the band information as well as the meta-inforation, -// whether a band was selected or not. -// ========================================================================== - -// TODO(holtgrew): Documentation in this header necessary or internal only? - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_BAND_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_BAND_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Tag BandOff -// ---------------------------------------------------------------------------- - -// Used when computing unbanded alignments. -struct BandOff_; -typedef Tag BandOff; - -// ---------------------------------------------------------------------------- -// Tag BandOn -// ---------------------------------------------------------------------------- - -// Used when computing banded alignments. -struct BandOn_; -typedef Tag BandOn; - -// ---------------------------------------------------------------------------- -// Class DPBand_ -// ---------------------------------------------------------------------------- - -// Simple band class. -template -struct DPBand_ {}; - -// ---------------------------------------------------------------------------- -// Class DPBand_ [BandOff] -// ---------------------------------------------------------------------------- - -// The specialization when using no band. -// Per default the member variables _lowerDiagonal and _upperDiagonal are -// always 0. -template <> -struct DPBand_ -{ - typedef int TPosition; -}; - -// ---------------------------------------------------------------------------- -// Class DPBand_ [BandOn] -// ---------------------------------------------------------------------------- - -// The specialization when using a band. -// On construction the diagonals are set to 0. -template <> -struct DPBand_ -{ - typedef int TPosition; - - int _lowerDiagonal; - int _upperDiagonal; - - DPBand_() : - _lowerDiagonal(0), _upperDiagonal(0) {} - - DPBand_(int lowerDiagonal, int upperDiagonal) : - _lowerDiagonal(lowerDiagonal), _upperDiagonal(upperDiagonal) {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction Position -// ---------------------------------------------------------------------------- - -template -struct Position > -{ - typedef typename DPBand_::TPosition Type; -}; - -template -struct Position const>: - Position >{}; - -// ---------------------------------------------------------------------------- -// Metafunction Size -// ---------------------------------------------------------------------------- - -template -struct Size >: - Position >{}; - -template -struct Size const>: - Size >{}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function setLowerDiagonal -// ---------------------------------------------------------------------------- - -inline void -setLowerDiagonal(DPBand_ & /*dpBand*/, int /*newLowerDiagonal*/) -{ - //no-op -} - -inline void -setLowerDiagonal(DPBand_ & dpBand, int newLowerDiagonal) -{ - dpBand._lowerDiagonal = newLowerDiagonal; -} - -// ---------------------------------------------------------------------------- -// Function lowerDiagonal -// ---------------------------------------------------------------------------- - -inline int -lowerDiagonal(DPBand_ const & /*dpBand*/) -{ - return 0; -} - -template -inline int -lowerDiagonal(DPBand_ const & dpBand) -{ - return dpBand._lowerDiagonal; -} - -// ---------------------------------------------------------------------------- -// Function setUpperDiagonal -// ---------------------------------------------------------------------------- - -inline void -setUpperDiagonal(DPBand_ & /*dpBand*/, int /*newUpperDiagonal*/) -{ - //no-op -} - -inline void -setUpperDiagonal(DPBand_ & dpBand, int newUpperDiagonal) -{ - dpBand._upperDiagonal = newUpperDiagonal; -} - -// ---------------------------------------------------------------------------- -// Function upperDiagonal -// ---------------------------------------------------------------------------- - -inline int -upperDiagonal(DPBand_ const & /*dpBand*/) -{ - return 0; -} - -inline int -upperDiagonal(DPBand_ const & dpBand) -{ - return dpBand._upperDiagonal; -} - -// ---------------------------------------------------------------------------- -// Function bandSize() -// ---------------------------------------------------------------------------- - -inline unsigned int -bandSize(DPBand_ const &) -{ - return 0; -} - -inline unsigned int -bandSize(DPBand_ const & band) -{ - return upperDiagonal(band) - lowerDiagonal(band) + 1; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_BAND_H_ diff --git a/seqan/align/dp_cell.h b/seqan/align/dp_cell.h deleted file mode 100644 index 41d5c7f..0000000 --- a/seqan/align/dp_cell.h +++ /dev/null @@ -1,227 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// Declares the DPCell, which is used to substitute the score of each cell. -// Thus, we are able to add additional features to an alignment cell such as -// a flag to indicate if it is forbidden or not. Or to store two additional -// scores necessary for the affine gap function. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_CELL_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_CELL_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class DPCell_ -// ---------------------------------------------------------------------------- - -// Used to store the score of a particular cell of the score matrix. -// It can be specialized for linear and affine gap costs. -// For affine gap costs it stores the values of all three matrices at a particular -// position of the matrix. -template -class DPCell_; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction Value -// ---------------------------------------------------------------------------- - -template -struct Value > -{ - typedef TScoreValue Type; -}; - -template -struct Value const> -{ - typedef TScoreValue const Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Reference -// ---------------------------------------------------------------------------- - -template -struct Reference > -{ - typedef TScoreValue & Type; -}; - -template -struct Reference const> -{ - typedef TScoreValue const & Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction DPCellDefaultInfinity -// ---------------------------------------------------------------------------- - -// Defines the default infinity value for a DPCell. -template -struct DPCellDefaultInfinity -{ - static const int VALUE; -}; - -template -const int DPCellDefaultInfinity::VALUE = MinValue::VALUE; - -// We use the min value of the score type and shift it one bits to the left. This way we can use "infinity" without -// checking for it during the computation. -template -struct DPCellDefaultInfinity > -{ - static const TScoreValue VALUE; -}; - -template -const TScoreValue DPCellDefaultInfinity >::VALUE = MinValue::VALUE / 2; - -template -struct DPCellDefaultInfinity const>: - DPCellDefaultInfinity >{}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _scoreOfCell -// ---------------------------------------------------------------------------- - -// Returns the score value for a given cell. -template -inline typename Reference >::Type -_scoreOfCell(DPCell_ & dpCell) -{ - return dpCell._score; -} - -template -inline typename Reference const>::Type -_scoreOfCell(DPCell_ const & dpCell) -{ - return dpCell._score; -} - -// ---------------------------------------------------------------------------- -// Function _setScoreOfCell -// ---------------------------------------------------------------------------- - -template -inline void -_setScoreOfCell(DPCell_ & dpCell, TScoreValue const & newScore) -{ - dpCell._score = newScore; -} - -// ---------------------------------------------------------------------------- -// Function _verticalScoreOfCell() -// ---------------------------------------------------------------------------- - -// Returns the score of the matrix for vertical-gaps of the given cell. -template -inline typename Reference >::Type -_verticalScoreOfCell(DPCell_ & dpCell) -{ - return dpCell._score; -} - -template -inline typename Reference const>::Type -_verticalScoreOfCell(DPCell_ const & dpCell) -{ - return dpCell._score; -} - -// ---------------------------------------------------------------------------- -// Function _setVerticalScoreOfCell() -// ---------------------------------------------------------------------------- - -// Returns the score of the matrix for vertical-gaps of the given cell. -template -inline void -_setVerticalScoreOfCell(DPCell_ & /*dpCell*/, TScoreValue const & /*newVerticalScore*/) -{ - // no-op -} - -// ---------------------------------------------------------------------------- -// Function _horizontalScoreOfCell() -// ---------------------------------------------------------------------------- - -// Returns the score of the matrix for horizontal-gaps of the given cell. -template -inline typename Reference >::Type -_horizontalScoreOfCell(DPCell_ & dpCell) -{ - return dpCell._score; -} - -template -inline typename Reference const>::Type -_horizontalScoreOfCell(DPCell_ const & dpCell) -{ - return dpCell._score; -} - -// ---------------------------------------------------------------------------- -// Function _setHorizontalScoreOfCell() -// ---------------------------------------------------------------------------- - -// Returns the score of the matrix for vertical-gaps of the given cell. -template -inline void -_setHorizontalScoreOfCell(DPCell_ & /*dpCell*/, TScoreValue const & /*newHorizontalScore*/) -{ - // no-op -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_CELL_H_ diff --git a/seqan/align/dp_cell_affine.h b/seqan/align/dp_cell_affine.h deleted file mode 100644 index 47a6c58..0000000 --- a/seqan/align/dp_cell_affine.h +++ /dev/null @@ -1,186 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// Implements the DPCell for affine gap functions. It stores the score -// values for the three matrices: diagonal, vertical and horizontal. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_CELL_AFFINE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_CELL_AFFINE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class DPCell [AffineGaps] -// ---------------------------------------------------------------------------- - -// Specialization for the affine gap cost function. -// This class stores three values belonging to the matrix storing the current -// maximum, the matrix for horizontal gaps and the matrix for vertical gaps. -template -class DPCell_ -{ -public: - TScoreValue _score; - TScoreValue _horizontalScore; - TScoreValue _verticalScore; - - // The default c'tor. - DPCell_() : - _score(DPCellDefaultInfinity::VALUE), - _horizontalScore(DPCellDefaultInfinity::VALUE), - _verticalScore(DPCellDefaultInfinity::VALUE) - {} - - // The copy c'tor. - DPCell_(DPCell_ const & other) : - _score(other._score), - _horizontalScore(other._horizontalScore), - _verticalScore(other._verticalScore) - {} - - // The assignment operator. - DPCell_ & - operator=(DPCell_ const & other) - { - if (this != &other) - { - _score = other._score; - _horizontalScore = other._horizontalScore; - _verticalScore = other._verticalScore; - } - return *this; - } - - DPCell_ & - operator=(TScoreValue const & score) - { - _score = score; - return *this; - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function operator<() -// ---------------------------------------------------------------------------- - -// Needed for banded chain alignment for the set. -template -inline bool operator<(DPCell_ const & left, - DPCell_ const & right) -{ - return left._score < right._score && left._horizontalScore < right._horizontalScore && - left._verticalScore < right._verticalScore; -} - -// ---------------------------------------------------------------------------- -// Function _verticalScoreOfCell() -// ---------------------------------------------------------------------------- - -// Returns the score of the matrix for vertical-gaps of the given cell. -template -inline typename Reference >::Type -_verticalScoreOfCell(DPCell_ & dpCell) -{ - return dpCell._verticalScore; -} - -template -inline typename Reference const>::Type -_verticalScoreOfCell(DPCell_ const & dpCell) -{ - return dpCell._verticalScore; -} - -// ---------------------------------------------------------------------------- -// Function _setVerticalScoreOfCell() -// ---------------------------------------------------------------------------- - -// Returns the score of the matrix for vertical-gaps of the given cell. -template -inline void -_setVerticalScoreOfCell(DPCell_ & dpCell, TScoreValue const & newVerticalScore) -{ - dpCell._verticalScore = newVerticalScore; -} - -// ---------------------------------------------------------------------------- -// Function _horizontalScoreOfCell() -// ---------------------------------------------------------------------------- - -// Returns the score of the matrix for horizontal-gaps of the given cell. -template -inline typename Reference >::Type -_horizontalScoreOfCell(DPCell_ & dpCell) -{ - return dpCell._horizontalScore; -} - -template -inline typename Reference const>::Type -_horizontalScoreOfCell(DPCell_ const & dpCell) -{ - return dpCell._horizontalScore; -} - -// ---------------------------------------------------------------------------- -// Function _setHorizontalScoreOfCell() -// ---------------------------------------------------------------------------- - -// Returns the score of the matrix for vertical-gaps of the given cell. -template -inline void -_setHorizontalScoreOfCell(DPCell_ & dpCell, TScoreValue const & newHorizontalScore) -{ - dpCell._horizontalScore = newHorizontalScore; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_CELL_AFFINE_H_ diff --git a/seqan/align/dp_cell_linear.h b/seqan/align/dp_cell_linear.h deleted file mode 100644 index 56f1572..0000000 --- a/seqan/align/dp_cell_linear.h +++ /dev/null @@ -1,115 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// Implements the DPCell for linear gap cost functions. This requires only -// one matrix, such that we only need to store one score value per matrix -// entry. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_CELL_LINEAR_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_CELL_LINEAR_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - - -// ---------------------------------------------------------------------------- -// Class DPCell [LinearGaps] -// ---------------------------------------------------------------------------- - -// The specialization for linear gap cost function. -// It solely stores the maximal score. -template -class DPCell_ -{ -public: - - TScoreValue _score; - - // The default c'tor. - DPCell_() : - _score(DPCellDefaultInfinity::VALUE) - {} - - // The copy c'tor. - DPCell_(DPCell_ const & other) : - _score(other._score) - {} - - // The assignment operator. - DPCell_ & - operator=(DPCell_ const & other) - { - if (this != &other) - _score = other._score; - return *this; - } - - DPCell_ & - operator=(TScoreValue const & score) - { - _score = score; - return *this; - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function operator<() -// ---------------------------------------------------------------------------- - -// Needed for banded chain alignment for the std::set. -template -inline bool operator<(DPCell_ const & left, - DPCell_ const & right) -{ - return left._score < right._score; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_CELL_LINEAR_H_ diff --git a/seqan/align/dp_formula.h b/seqan/align/dp_formula.h deleted file mode 100644 index a3a9571..0000000 --- a/seqan/align/dp_formula.h +++ /dev/null @@ -1,226 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// Defines the recursion formula for the dp-alignment algorithms. -// ========================================================================== - -// TODO(holtgrew): Documentation in this header necessary or internal only? - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_FORMULA_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_FORMULA_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Tag RecursionDirectionDiagonal -// ---------------------------------------------------------------------------- - -struct RecursionDirectionDiagonal_; -typedef Tag RecursionDirectionDiagonal; - -// ---------------------------------------------------------------------------- -// Tag RecursionDirectionHorizontal -// ---------------------------------------------------------------------------- - -struct RecursionDirectionHorizontal_; -typedef Tag RecursionDirectionHorizontal; - -// ---------------------------------------------------------------------------- -// Tag RecursionDirectionVertical -// ---------------------------------------------------------------------------- - -struct RecursionDirectionVertical_; -typedef Tag RecursionDirectionVertical; - -// ---------------------------------------------------------------------------- -// Tag RecursionDirectionAll -// ---------------------------------------------------------------------------- - -struct RecursionDirectionAll_; -typedef Tag RecursionDirectionAll; - -// ---------------------------------------------------------------------------- -// Tag RecursionDirectionUpperDiagonal -// ---------------------------------------------------------------------------- - -struct RecursionDirectionUpperDiagonal_; -typedef Tag RecursionDirectionUpperDiagonal; - -// ---------------------------------------------------------------------------- -// Tag RecursionDirectionLowerDiagonal -// ---------------------------------------------------------------------------- - -struct RecursionDirectionLowerDiagonal_; -typedef Tag RecursionDirectionLowerDiagonal; - -// ---------------------------------------------------------------------------- -// Tag RecursionDirectionZero -// ---------------------------------------------------------------------------- - -struct RecursionDirectionZero_; -typedef Tag RecursionDirectionZero; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _conditionalOrOnEquality() -// ---------------------------------------------------------------------------- - -// Function used to compare two trace values and to add a given state to the result -// value if they are equal using a bit-or operation. -template -inline void -_conditionalOrOnEquality(TTraceValue & target, - TScoreValue const & leftComp, - TScoreValue const & rightComp, - TTraceValue state) -{ - if (leftComp == rightComp) - target |= state; -} - -// ---------------------------------------------------------------------------- -// Function _conditionalOrOnInequality() -// ---------------------------------------------------------------------------- - -// Function used to compare two trace values and to add a given state to the result -// value if they are equal using a bit-or operation. -template -inline void -_conditionalOrOnInequality(TTraceValue & target, - TScoreValue const & leftComp, - TScoreValue const & rightComp, - TTraceValue state) -{ - if (leftComp != rightComp) - target |= state; -} - -// ---------------------------------------------------------------------------- -// Function _computeScore -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_computeScore(DPCell_ & activeCell, - DPCell_ const & previousDiagonal, - DPCell_ const & previousHorizontal, - DPCell_ const & previousVertical, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - TRecursionDirection const & recDir, - TDPProfile const & dpProfile) -{ - typedef typename TraceBitMap_::TTraceValue TTraceValue; - - TTraceValue traceDir = _doComputeScore(activeCell, previousDiagonal, previousHorizontal, previousVertical, seqHVal, - seqVVal, scoringScheme, recDir, dpProfile); - if (IsLocalAlignment_::VALUE) - if (activeCell._score <= 0) - { - _setScoreOfCell(activeCell, static_cast(0)); - _setHorizontalScoreOfCell(activeCell, static_cast(0)); - _setVerticalScoreOfCell(activeCell, static_cast(0)); - return TraceBitMap_::NONE; - } - - return traceDir; -} - - - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionDirectionDiagonal] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & previousDiagonal, - DPCell_ const & /*previousHorizontal*/, - DPCell_ const & /*previousVertical*/, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionDiagonal const &, - TDPProfile const &) -{ - activeCell._score = _scoreOfCell(previousDiagonal) + score(scoringScheme, seqHVal, seqVVal); - - if (!IsTracebackEnabled_::VALUE) - return TraceBitMap_::NONE; - - return TraceBitMap_::DIAGONAL; -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionDirectionZero] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & /*previousDiagonal*/, - DPCell_ const & /*previousHorizontal*/, - DPCell_ const & /*previousVertical*/, - TSequenceHValue const & /*seqHVal*/, - TSequenceVValue const & /*seqVVal*/, - TScoringScheme const & /*scoringScheme*/, - RecursionDirectionZero const &, - DPProfile_ const &) -{ - _scoreOfCell(activeCell) = 0; - return TraceBitMap_::NONE; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_FORMULA_H_ diff --git a/seqan/align/dp_formula_affine.h b/seqan/align/dp_formula_affine.h deleted file mode 100644 index e5c5e09..0000000 --- a/seqan/align/dp_formula_affine.h +++ /dev/null @@ -1,624 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// Implements the affine gap cost functions. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_FORMULA_AFFINE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_FORMULA_AFFINE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _retrieveTraceAffine [RecursionDirectionAll] -// ---------------------------------------------------------------------------- - -template -inline TraceBitMap_::TTraceValue -_retrieveTraceAffine(TScoreValue const & globalMax, - TScoreValue const & diagScore, - TScoreValue const & horiScore, - TScoreValue const & horiOpenScore, - TScoreValue const & vertiScore, - TScoreValue const & vertiOpenScore, - RecursionDirectionAll const &) -{ - typename TraceBitMap_::TTraceValue traceValue(TraceBitMap_::NONE); - _conditionalOrOnEquality(traceValue, globalMax, diagScore, TraceBitMap_::DIAGONAL); - _conditionalOrOnEquality(traceValue, globalMax, horiScore, TraceBitMap_::HORIZONTAL); - _conditionalOrOnEquality(traceValue, globalMax, horiOpenScore, TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX); - _conditionalOrOnEquality(traceValue, globalMax, vertiScore, TraceBitMap_::VERTICAL); - _conditionalOrOnEquality(traceValue, globalMax, vertiOpenScore, TraceBitMap_::MAX_FROM_VERTICAL_MATRIX); - return traceValue; -} - -// ---------------------------------------------------------------------------- -// Function _retrieveTraceAffine [RecursionDirectionUpperDiagonal] -// ---------------------------------------------------------------------------- - -template -inline TraceBitMap_::TTraceValue -_retrieveTraceAffine(TScoreValue const & globalMax, - TScoreValue const & diagScore, - TScoreValue const & horiScore, - TScoreValue const & horiOpenScore, - TScoreValue const &, - TScoreValue const &, - RecursionDirectionUpperDiagonal const &) -{ - typename TraceBitMap_::TTraceValue traceValue(TraceBitMap_::NONE); - _conditionalOrOnEquality(traceValue, globalMax, diagScore, TraceBitMap_::DIAGONAL); - _conditionalOrOnEquality(traceValue, globalMax, horiScore, TraceBitMap_::HORIZONTAL); - _conditionalOrOnEquality(traceValue, globalMax, horiOpenScore, TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX); - return traceValue; -} - -// ---------------------------------------------------------------------------- -// Function _retrieveTraceAffine [RecursionDirectionLowerDiagonal] -// ---------------------------------------------------------------------------- - -template -inline TraceBitMap_::TTraceValue -_retrieveTraceAffine(TScoreValue const & globalMax, - TScoreValue const & diagScore, - TScoreValue const &, - TScoreValue const &, - TScoreValue const & vertiScore, - TScoreValue const & vertiOpenScore, - RecursionDirectionLowerDiagonal const &) -{ - typename TraceBitMap_::TTraceValue traceValue(TraceBitMap_::NONE); - _conditionalOrOnEquality(traceValue, globalMax, diagScore, TraceBitMap_::DIAGONAL); - _conditionalOrOnEquality(traceValue, globalMax, vertiScore, TraceBitMap_::VERTICAL); - _conditionalOrOnEquality(traceValue, globalMax, vertiOpenScore, TraceBitMap_::MAX_FROM_VERTICAL_MATRIX); - return traceValue; -} - -// ---------------------------------------------------------------------------- -// Function _retrieveTraceAffine [RecursionDirectionHorizontal] -// ---------------------------------------------------------------------------- - -template -inline TraceBitMap_::TTraceValue -_retrieveTraceAffine(TScoreValue const & globalMax, - TScoreValue const &, - TScoreValue const & horiScore, - TScoreValue const & horiOpenScore, - TScoreValue const &, - TScoreValue const &, - RecursionDirectionHorizontal const &) -{ - typename TraceBitMap_::TTraceValue traceValue(TraceBitMap_::NONE); - _conditionalOrOnEquality(traceValue, globalMax, horiScore, TraceBitMap_::HORIZONTAL); - _conditionalOrOnEquality(traceValue, globalMax, horiOpenScore, TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX); - return traceValue; -} - -// ---------------------------------------------------------------------------- -// Function _retrieveTraceAffine [RecursionDirectionVertical] -// ---------------------------------------------------------------------------- - -template -inline TraceBitMap_::TTraceValue -_retrieveTraceAffine(TScoreValue const & globalMax, - TScoreValue const &, - TScoreValue const &, - TScoreValue const &, - TScoreValue const & vertiScore, - TScoreValue const & vertiOpenScore, - RecursionDirectionVertical const &) -{ - typename TraceBitMap_::TTraceValue traceValue(TraceBitMap_::NONE); - _conditionalOrOnEquality(traceValue, globalMax, vertiScore, TraceBitMap_::VERTICAL); - _conditionalOrOnEquality(traceValue, globalMax, vertiOpenScore, TraceBitMap_::MAX_FROM_VERTICAL_MATRIX); - return traceValue; -} - -// ---------------------------------------------------------------------------- -// Function _internalComputeScore [RecursionDirectionDiagonal, AffineGaps] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL, - TTraceValueGap, - TracebackOff const &, - RecursionDirectionDiagonal const &) -{ - if(activeCell._score < rightCompare) - activeCell._score = rightCompare; - return TraceBitMap_::NONE; -} - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL leftTrace, - TTraceValueGap gapTrace, - TracebackOn > const &, - RecursionDirectionDiagonal const &) -{ - if(activeCell._score <= rightCompare) - { - activeCell._score = rightCompare; - return TraceBitMap_::DIAGONAL | leftTrace; - } - return leftTrace | gapTrace; -} - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL leftTrace, - TTraceValueGap gapTrace, - TracebackOn > const &, - RecursionDirectionDiagonal const &) -{ - if(activeCell._score < rightCompare) - { - activeCell._score = rightCompare; // Maximal score comes from diagonal. - return TraceBitMap_::DIAGONAL | leftTrace; // Return trace for Diagonal. - } - if (activeCell._score == rightCompare) // Maximal score comes from previous computed directions and diagonal. - return leftTrace | TraceBitMap_::DIAGONAL | gapTrace; // Return all directions inclusively the flag indicating max from gap. - return leftTrace | gapTrace; // Maximum comes from gap. Return gap value inclusively the flag indicating max from gap. -} - -// ---------------------------------------------------------------------------- -// Function _internalComputeScore [RecursionDirectionHorizontal, AffineGaps] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL, - TTraceValueR, - TracebackOff const &, - RecursionDirectionHorizontal const &) -{ - if(activeCell._horizontalScore < rightCompare) - activeCell._score = activeCell._horizontalScore = rightCompare; - else - activeCell._score = activeCell._horizontalScore; - return TraceBitMap_::NONE; -} - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL leftTrace, - TTraceValueR rightTrace, - TracebackOn > const &, - RecursionDirectionHorizontal const &) -{ - if(activeCell._horizontalScore < rightCompare) - { - activeCell._score = activeCell._horizontalScore = rightCompare; - return rightTrace; - } - activeCell._score = activeCell._horizontalScore; - return leftTrace; -} - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL leftTrace, - TTraceValueR rightTrace, - TracebackOn > const &, - RecursionDirectionHorizontal const &) -{ - if(activeCell._horizontalScore < rightCompare) - { - activeCell._score = activeCell._horizontalScore = rightCompare; - return rightTrace; - } - activeCell._score = activeCell._horizontalScore; - if (activeCell._horizontalScore == rightCompare) - return leftTrace | rightTrace; - return leftTrace; -} - -// ---------------------------------------------------------------------------- -// Function _internalComputeScore [RecursionDirectionVertical, AffineGaps] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL, - TTraceValueR, - TracebackOff const &, - RecursionDirectionVertical const &) -{ - if(activeCell._verticalScore < rightCompare) - activeCell._score = activeCell._verticalScore = rightCompare; - else - activeCell._score = activeCell._verticalScore; - return TraceBitMap_::NONE; -} - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL leftTrace, - TTraceValueR rightTrace, - TracebackOn > const &, - RecursionDirectionVertical const &) -{ - if(activeCell._verticalScore < rightCompare) - { - activeCell._score = activeCell._verticalScore = rightCompare; - return rightTrace; - } - activeCell._score = activeCell._verticalScore; - return leftTrace; -} - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL leftTrace, - TTraceValueR rightTrace, - TracebackOn > const &, - RecursionDirectionVertical const &) -{ - if(activeCell._verticalScore < rightCompare) - { - activeCell._score = activeCell._verticalScore = rightCompare; - return rightTrace; - } - activeCell._score = activeCell._verticalScore; - if (activeCell._verticalScore == rightCompare) - return leftTrace | rightTrace; - return leftTrace; -} - -// ---------------------------------------------------------------------------- -// Function _internalComputeScore [Vertical vs Horizontal, AffineGaps] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TracebackOff const &) -{ - if(activeCell._score < activeCell._horizontalScore) - activeCell._score = activeCell._horizontalScore; - return TraceBitMap_::NONE; -} - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TracebackOn > const &) -{ - if(activeCell._score < activeCell._horizontalScore) - { - activeCell._score = activeCell._horizontalScore; - return TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX; -// return traceRight; - } - return TraceBitMap_::MAX_FROM_VERTICAL_MATRIX; -// returntraceRight; -} - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TracebackOn > const &) -{ - if(activeCell._score < activeCell._horizontalScore) - { - activeCell._score = activeCell._horizontalScore; - return TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX; -// return traceRight | (traceLeft & TraceBitMap_::VERTICAL_OPEN); - } -// traceGap = TraceBitMap_::MAX_FROM_VERTICAL_MATRIX; - if (activeCell._score == activeCell._horizontalScore) - { - return TraceBitMap_::MAX_FROM_VERTICAL_MATRIX | TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX; -// return traceRight | traceLeft; - } - return TraceBitMap_::MAX_FROM_VERTICAL_MATRIX; -// return traceLeft | (traceRight & TraceBitMap_::HORIZONTAL_OPEN); -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionAllDirection, AffineGaps] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & previousDiagonal, - DPCell_ const & previousHorizontal, - DPCell_ const & previousVertical, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionAll const &, - DPProfile_ const &) -{ - typedef typename TraceBitMap_::TTraceValue TTraceValue; - - // Now we have to find a smart version to solve this problem. Which is not as easy I would think. - - activeCell._horizontalScore = _horizontalScoreOfCell(previousHorizontal) + - scoreGapExtendHorizontal(scoringScheme, seqHVal, seqVVal); - TScoreValue tmpScore = _scoreOfCell(previousHorizontal) + scoreGapOpenHorizontal(scoringScheme, seqHVal, seqVVal); - - TTraceValue tvGap = _internalComputeScore(activeCell, tmpScore, TraceBitMap_::HORIZONTAL, TraceBitMap_::HORIZONTAL_OPEN, TTracebackConfig(), RecursionDirectionHorizontal()); -// activeCell._score = activeCell._horizontalScore; _max(activeCell._horizontal, tmpScore) - - // Now we can decide for the optimal score in horizontal score or not? - activeCell._verticalScore = _verticalScoreOfCell(previousVertical) + scoreGapExtendVertical(scoringScheme, seqHVal, seqVVal); - tmpScore = _scoreOfCell(previousVertical) + scoreGapOpenVertical(scoringScheme, seqHVal, seqVVal); - tvGap |= _internalComputeScore(activeCell, tmpScore, TraceBitMap_::VERTICAL, TraceBitMap_::VERTICAL_OPEN, TTracebackConfig(), RecursionDirectionVertical()); - - // Finds the maximum between the vertical and the horizontal matrix. Stores the flag for coming from a potential direction. - TTraceValue tvMax = _internalComputeScore(activeCell, TTracebackConfig()); // Stores from where the maximal score comes. - tmpScore = _scoreOfCell(previousDiagonal) + score(scoringScheme, seqHVal, seqVVal); - return _internalComputeScore(activeCell, tmpScore, tvGap, tvMax, TTracebackConfig(), RecursionDirectionDiagonal()); - - // This should be the fastest version. - -// TScoreValue tmpScoreDiagonal = _scoreOfCell(previousDiagonal) + score(scoringScheme, seqHVal, seqVVal); -// TScoreValue tmpGapExtendHorizontal = _horizontalScoreOfCell(previousHorizontal) + -// scoreGapExtendHorizontal(scoringScheme, seqHVal, seqVVal); -// TScoreValue tmpGapOpenHorizontal = _scoreOfCell(previousHorizontal) -// + scoreGapOpenHorizontal(scoringScheme, seqHVal, seqVVal); -// TScoreValue tmpGapExtendVertical = _verticalScoreOfCell(previousVertical) -// + scoreGapExtendVertical(scoringScheme, seqHVal, seqVVal); -// TScoreValue tmpGapOpenVertical = _scoreOfCell(previousVertical) -// + scoreGapOpenVertical(scoringScheme, seqHVal, seqVVal); -// -// activeCell._horizontalScore = _max(tmpGapExtendHorizontal, tmpGapOpenHorizontal); -// activeCell._verticalScore = _max(tmpGapExtendVertical, tmpGapOpenVertical); -// activeCell._score = _max(tmpScoreDiagonal, _max(activeCell._horizontalScore, activeCell._verticalScore)); -// -// if (!IsTracebackEnabled_::VALUE) -// return TraceBitMap_::NONE; -// -// TTraceValue traceGapOpen = TraceBitMap_::NONE; -// _conditionalOrOnInequality(traceGapOpen, _horizontalScoreOfCell(activeCell), tmpGapExtendHorizontal, TraceBitMap_::HORIZONTAL_OPEN); -// _conditionalOrOnInequality(traceGapOpen, _verticalScoreOfCell(activeCell), tmpGapExtendVertical, TraceBitMap_::VERTICAL_OPEN); -// return traceGapOpen | -// _retrieveTraceAffine(activeCell._score, tmpScoreDiagonal, tmpGapExtendHorizontal, tmpGapOpenHorizontal, -// tmpGapExtendVertical, tmpGapOpenVertical, RecursionDirectionAll()); -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionUpperDiagonalDirection, AffineGaps] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & previousDiagonal, - DPCell_ const & previousHorizontal, - DPCell_ const & /*previousVertical*/, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionUpperDiagonal const &, - DPProfile_ const &) -{ - typedef typename TraceBitMap_::TTraceValue TTraceValue; - activeCell._horizontalScore = _horizontalScoreOfCell(previousHorizontal) - + scoreGapExtendHorizontal(scoringScheme, seqHVal, seqVVal); - - activeCell._verticalScore = DPCellDefaultInfinity >::VALUE; - TScoreValue tmpScore = _scoreOfCell(previousHorizontal) + scoreGapOpenHorizontal(scoringScheme, seqHVal, seqVVal); - TTraceValue tv = _internalComputeScore(activeCell, tmpScore, TraceBitMap_::HORIZONTAL, TraceBitMap_::HORIZONTAL_OPEN, TTracebackConfig(), RecursionDirectionHorizontal()); - tmpScore = _scoreOfCell(previousDiagonal) + score(scoringScheme, seqHVal, seqVVal); - return _internalComputeScore(activeCell, tmpScore, tv, TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX, TTracebackConfig(), RecursionDirectionDiagonal()); - -// TScoreValue tmpScoreDiagonal = _scoreOfCell(previousDiagonal) + score(scoringScheme, seqHVal, seqVVal); -// TScoreValue tmpGapExtendHorizontal = _horizontalScoreOfCell(previousHorizontal) -// + scoreGapExtendHorizontal(scoringScheme, seqHVal, seqVVal); -// TScoreValue tmpGapOpenHorizontal = _scoreOfCell(previousHorizontal) -// + scoreGapOpenHorizontal(scoringScheme, seqHVal, seqVVal); -// -// activeCell._horizontalScore = _max(tmpGapExtendHorizontal, tmpGapOpenHorizontal); -// activeCell._score = _max(tmpScoreDiagonal, activeCell._horizontalScore); -// -// if (!IsTracebackEnabled_::VALUE) -// return TraceBitMap_::NONE; -// -// TTraceValue traceGapOpen = TraceBitMap_::NONE; -// _conditionalOrOnInequality(traceGapOpen, _horizontalScoreOfCell(activeCell), tmpGapExtendHorizontal, TraceBitMap_::HORIZONTAL_OPEN); -// return traceGapOpen | -// _retrieveTraceAffine(activeCell._score, tmpScoreDiagonal, tmpGapExtendHorizontal, tmpGapOpenHorizontal, -// TScoreValue(), TScoreValue(), RecursionDirectionUpperDiagonal()); -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionDirectionLowerDiagonal, AffineGaps] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & previousDiagonal, - DPCell_ const & /*previousHorizontal*/, - DPCell_ const & previousVertical, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionLowerDiagonal const &, - DPProfile_ const &) -{ - typedef typename TraceBitMap_::TTraceValue TTraceValue; - - activeCell._verticalScore = _verticalScoreOfCell(previousVertical) + - scoreGapExtendVertical(scoringScheme, seqHVal, seqVVal); - TScoreValue tmpScore = _scoreOfCell(previousVertical) + scoreGapOpenVertical(scoringScheme, seqHVal, seqVVal); - - activeCell._horizontalScore = DPCellDefaultInfinity >::VALUE; - // This computes the difference between the vertical extend and vertical open. - TTraceValue tv = _internalComputeScore(activeCell, tmpScore, TraceBitMap_::VERTICAL, TraceBitMap_::VERTICAL_OPEN, TTracebackConfig(), RecursionDirectionVertical()); - - // Up to here, activeCell stores the highest value of vertical or vertical open. - tmpScore = _scoreOfCell(previousDiagonal) + score(scoringScheme, seqHVal, seqVVal); - return _internalComputeScore(activeCell, tmpScore, tv, TraceBitMap_::MAX_FROM_VERTICAL_MATRIX, TTracebackConfig(), RecursionDirectionDiagonal()); // Now we have this problem. How do we determine if the max comes from the vertical distance. - -// activeCell._verticalScore = _max(tmpGapExtendVertical, tmpGapOpenVertical); -// activeCell._score = _max(tmpScoreDiagonal, activeCell._verticalScore); -// -// if (!IsTracebackEnabled_::VALUE) -// return TraceBitMap_::NONE; -// -// TTraceValue traceGapOpen = TraceBitMap_::NONE; -// _conditionalOrOnInequality(traceGapOpen, _verticalScoreOfCell(activeCell), tmpGapExtendVertical, TraceBitMap_::VERTICAL_OPEN); -// return traceGapOpen | -// _retrieveTraceAffine(activeCell._score, tmpScoreDiagonal, TScoreValue(), TScoreValue(), tmpGapExtendVertical, -// tmpGapOpenVertical, RecursionDirectionLowerDiagonal()); -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionHorizontalDirection] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & /*previousDiagonal*/, - DPCell_ const & previousHorizontal, - DPCell_ const & /*previousVertical*/, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionHorizontal const &, - DPProfile_ const &) -{ - //typedef typename TraceBitMap_::TTraceValue TTraceValue; - TScoreValue tmpGapOpenHorizontal = _scoreOfCell(previousHorizontal) + scoreGapOpenHorizontal(scoringScheme, seqHVal, seqVVal); - activeCell._horizontalScore = _horizontalScoreOfCell(previousHorizontal) + scoreGapExtendHorizontal(scoringScheme, seqHVal, seqVVal); - - activeCell._verticalScore = DPCellDefaultInfinity >::VALUE; - return _internalComputeScore(activeCell, tmpGapOpenHorizontal, TraceBitMap_::HORIZONTAL, TraceBitMap_::HORIZONTAL_OPEN, TTracebackConfig(), RecursionDirectionHorizontal()) | TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX; - -// typedef typename TraceBitMap_::TTraceValue TTraceValue; -// TScoreValue tmpGapOpenHorizontal = _scoreOfCell(previousHorizontal) + -// scoreGapOpenHorizontal(scoringScheme, seqHVal, seqVVal); -// TScoreValue tmpGapExtendHorizontal = _horizontalScoreOfCell(previousHorizontal) + -// scoreGapExtendHorizontal(scoringScheme, seqHVal, seqVVal); -// activeCell._horizontalScore = _max(tmpGapOpenHorizontal, tmpGapExtendHorizontal); -// activeCell._score = activeCell._horizontalScore; -// -// if (!IsTracebackEnabled_::VALUE) -// return TraceBitMap_::NONE; -// -// TTraceValue traceGapOpen = TraceBitMap_::NONE; -// _conditionalOrOnInequality(traceGapOpen, _horizontalScoreOfCell(activeCell), tmpGapExtendHorizontal, TraceBitMap_::HORIZONTAL_OPEN); -// return traceGapOpen | -// _retrieveTraceAffine(activeCell._score, TScoreValue(), tmpGapExtendHorizontal, tmpGapOpenHorizontal, -// TScoreValue(), TScoreValue(), RecursionDirectionHorizontal()); -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionVerticalDirection] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & /*previousDiagonal*/, - DPCell_ const & /*previousHorizontal*/, - DPCell_ const & previousVertical, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionVertical const &, - DPProfile_ const &) -{ - //typedef typename TraceBitMap_::TTraceValue TTraceValue; - TScoreValue tmpGapOpenVertical = _scoreOfCell(previousVertical) + scoreGapOpenVertical(scoringScheme, seqHVal, seqVVal); - activeCell._verticalScore = _verticalScoreOfCell(previousVertical) + scoreGapExtendVertical(scoringScheme, seqHVal, seqVVal); - - // Here we distinguish between vertical and vertical open. - activeCell._horizontalScore = DPCellDefaultInfinity >::VALUE; - return _internalComputeScore(activeCell, tmpGapOpenVertical, TraceBitMap_::VERTICAL, TraceBitMap_::VERTICAL_OPEN, TTracebackConfig(), RecursionDirectionVertical()) | TraceBitMap_::MAX_FROM_VERTICAL_MATRIX; -// typedef typename TraceBitMap_::TTraceValue TTraceValue; -// TScoreValue tmpGapOpenVertical = _scoreOfCell(previousVertical) + -// scoreGapOpenVertical(scoringScheme, seqHVal, seqVVal); -// TScoreValue tmpGapExtendVertical = _verticalScoreOfCell(previousVertical) + -// scoreGapExtendVertical(scoringScheme, seqHVal, seqVVal); -// activeCell._verticalScore = _max(tmpGapExtendVertical, tmpGapOpenVertical); -// activeCell._score = activeCell._verticalScore; -// -// if (!IsTracebackEnabled_::VALUE) -// return TraceBitMap_::NONE; -// -// TTraceValue traceGapOpen = TraceBitMap_::NONE; -// _conditionalOrOnInequality(traceGapOpen, _verticalScoreOfCell(activeCell), tmpGapExtendVertical, TraceBitMap_::VERTICAL_OPEN); -// return traceGapOpen | -// _retrieveTraceAffine(activeCell._score, TScoreValue(), TScoreValue(), TScoreValue(), tmpGapExtendVertical, -// tmpGapOpenVertical, RecursionDirectionVertical()); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_FORMULA_AFFINE_H_ diff --git a/seqan/align/dp_formula_linear.h b/seqan/align/dp_formula_linear.h deleted file mode 100644 index 7b18d58..0000000 --- a/seqan/align/dp_formula_linear.h +++ /dev/null @@ -1,295 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// Defines the methods to compute the score when using linear gap costs. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_FORMULA_LINEAR_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_FORMULA_LINEAR_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _computeTraceLinear [RecursionDirectionAll] -// ---------------------------------------------------------------------------- - -template -inline TraceBitMap_::TTraceValue -_computeTraceLinear(TScoreValue const & globalMax, - TScoreValue const & diagScore, - TScoreValue const & horiScore, - TScoreValue const & vertiScore, - RecursionDirectionAll const &) -{ - typename TraceBitMap_::TTraceValue traceValue(TraceBitMap_::NONE); - - _conditionalOrOnEquality(traceValue, globalMax, diagScore, TraceBitMap_::DIAGONAL); - _conditionalOrOnEquality(traceValue, globalMax, horiScore, TraceBitMap_::HORIZONTAL); - _conditionalOrOnEquality(traceValue, globalMax, vertiScore, TraceBitMap_::VERTICAL); - return traceValue; -} - -// ---------------------------------------------------------------------------- -// Function _computeTraceLinear [RecursionDirectionUpperDiagonal] -// ---------------------------------------------------------------------------- - -template -inline TraceBitMap_::TTraceValue -_computeTraceLinear(TScoreValue const & globalMax, - TScoreValue const & diagScore, - TScoreValue const & horiScore, - TScoreValue const &, - RecursionDirectionUpperDiagonal const &) -{ - typename TraceBitMap_::TTraceValue traceValue(TraceBitMap_::NONE); - - _conditionalOrOnEquality(traceValue, globalMax, diagScore, TraceBitMap_::DIAGONAL); - _conditionalOrOnEquality(traceValue, globalMax, horiScore, TraceBitMap_::HORIZONTAL); - return traceValue; -} - -// ---------------------------------------------------------------------------- -// Function _computeTraceLinear [RecursionDirectionLowerDiagonal] -// ---------------------------------------------------------------------------- - -template -inline TraceBitMap_::TTraceValue -_computeTraceLinear(TScoreValue const & globalMax, - TScoreValue const & diagScore, - TScoreValue const &, - TScoreValue const & vertiScore, - RecursionDirectionLowerDiagonal const &) -{ - typename TraceBitMap_::TTraceValue traceValue(TraceBitMap_::NONE); - _conditionalOrOnEquality(traceValue, globalMax, diagScore, TraceBitMap_::DIAGONAL); - _conditionalOrOnEquality(traceValue, globalMax, vertiScore, TraceBitMap_::VERTICAL); - return traceValue; -} - -// ---------------------------------------------------------------------------- -// Function _internalComputeScore() -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL, - TTraceValueR, - TracebackOff const &) -{ - if (activeCell._score < rightCompare) - activeCell._score = rightCompare; - return TraceBitMap_::NONE; -} - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL leftTrace, - TTraceValueR rightTrace, - TracebackOn > const &) -{ - if (activeCell._score < rightCompare) - { - activeCell._score = rightCompare; - return rightTrace; - } - return leftTrace; -} - -template -inline typename TraceBitMap_::TTraceValue -_internalComputeScore(DPCell_ & activeCell, - TScoreValue const & rightCompare, - TTraceValueL leftTrace, - TTraceValueR rightTrace, - TracebackOn > const &) -{ - if (activeCell._score <= rightCompare) - { - if (activeCell._score == rightCompare) - return leftTrace | rightTrace; - activeCell._score = rightCompare; - return rightTrace; - } - return leftTrace; -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionDirectionAll, LinearGaps] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & previousDiagonal, - DPCell_ const & previousHorizontal, - DPCell_ const & previousVertical, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionAll const &, - DPProfile_ const &) -{ - typedef typename TraceBitMap_::TTraceValue TTraceValue; - activeCell._score = _scoreOfCell(previousDiagonal) + score(scoringScheme, seqHVal, seqVVal); - - TScoreValue tmpScore = _scoreOfCell(previousVertical) + scoreGapExtendVertical(scoringScheme, seqHVal, seqVVal); - - TTraceValue tv = _internalComputeScore(activeCell, tmpScore, TraceBitMap_::DIAGONAL, TraceBitMap_::VERTICAL | TraceBitMap_::MAX_FROM_VERTICAL_MATRIX, TTracebackConfig()); - tmpScore = _scoreOfCell(previousHorizontal) + scoreGapExtendHorizontal(scoringScheme, seqHVal, seqVVal); - return _internalComputeScore(activeCell, tmpScore, tv, TraceBitMap_::HORIZONTAL | TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX, TTracebackConfig()); -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionDirectionUpperDiagonal, LinearGaps] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & previousDiagonal, - DPCell_ const & previousHorizontal, - DPCell_ const & /*previousVertical*/, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionUpperDiagonal const &, - DPProfile_ const &) -{ - activeCell._score = _scoreOfCell(previousDiagonal) + score(scoringScheme, seqHVal, seqVVal); - TScoreValue tmpScore = _scoreOfCell(previousHorizontal) - + scoreGapExtendHorizontal(scoringScheme, seqHVal, seqVVal); - - return _internalComputeScore(activeCell, tmpScore, TraceBitMap_::DIAGONAL, TraceBitMap_::HORIZONTAL | TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX, TTracebackConfig()); -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionDirectionLowerDiagonal, LinearGaps] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & previousDiagonal, - DPCell_ const & /*previousHorizontal*/, - DPCell_ const & previousVertical, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionLowerDiagonal const &, - DPProfile_ const &) -{ - activeCell._score = _scoreOfCell(previousDiagonal) + score(scoringScheme, seqHVal, seqVVal); - TScoreValue tmpScore = _scoreOfCell(previousVertical) - + scoreGapExtendVertical(scoringScheme, seqHVal, seqVVal); - - return _internalComputeScore(activeCell, tmpScore, TraceBitMap_::DIAGONAL, TraceBitMap_::VERTICAL | TraceBitMap_::MAX_FROM_VERTICAL_MATRIX, TTracebackConfig()); -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionDirectionHorizontal] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & /*previousDiagonal*/, - DPCell_ const & previousHorizontal, - DPCell_ const & /*previousVertical*/, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionHorizontal const &, - DPProfile_ const &) -{ - activeCell._score = _scoreOfCell(previousHorizontal) - + scoreGapExtendHorizontal(scoringScheme, seqHVal, seqVVal); - - if (!IsTracebackEnabled_::VALUE) - return TraceBitMap_::NONE; - - return TraceBitMap_::HORIZONTAL | TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX; -} - -// ---------------------------------------------------------------------------- -// Function _doComputeScore [RecursionDirectionVertical] -// ---------------------------------------------------------------------------- - -template -inline typename TraceBitMap_::TTraceValue -_doComputeScore(DPCell_ & activeCell, - DPCell_ const & /*previousDiagonal*/, - DPCell_ const & /*previousHorizontal*/, - DPCell_ const & previousVertical, - TSequenceHValue const & seqHVal, - TSequenceVValue const & seqVVal, - TScoringScheme const & scoringScheme, - RecursionDirectionVertical const &, - DPProfile_ const &) -{ - activeCell._score = _scoreOfCell(previousVertical) - + scoreGapExtendVertical(scoringScheme, seqHVal, seqVVal); - - if (!IsTracebackEnabled_::VALUE) - return TraceBitMap_::NONE; - - return TraceBitMap_::VERTICAL | TraceBitMap_::MAX_FROM_VERTICAL_MATRIX; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_FORMULA_LINEAR_H_ diff --git a/seqan/align/dp_matrix.h b/seqan/align/dp_matrix.h deleted file mode 100644 index e973648..0000000 --- a/seqan/align/dp_matrix.h +++ /dev/null @@ -1,671 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Ren� Rahn -// ========================================================================== -// This file implements the class DPMatrix and its specialization -// FullDPMatrix. The DPMatrix is a wrapper class around the Matrix -// class. Thus we can implement different specializations for the dp-matrix -// that are used through the different dp-algorithms. For example, we need -// a full dp matrix to store the traceback or the score for the Waterman- -// Eggert algorithm, while for the other dp-algorithms we only need one -// column vector to compute the scores. The default dp-matrix specialization -// can be selected using a special meta-function. -// ========================================================================== - -// TODO(holtgrew): Documentation in this header necessary or internal only? - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -template -struct DefaultScoreMatrixSpec_; - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Tag SparseDPMatrix -// ---------------------------------------------------------------------------- - -struct SparseDPMatrix_; -typedef Tag SparseDPMatrix; - -// ---------------------------------------------------------------------------- -// Tag FullDPMatrix -// ---------------------------------------------------------------------------- - -struct FullDPMatrix_; -typedef Tag FullDPMatrix; - - -// ---------------------------------------------------------------------------- -// Enum DPMatrixDimension -// ---------------------------------------------------------------------------- - -// Used to globally specify the correct dimension and the correct size of -// dimension for the dp matrix. -struct DPMatrixDimension_ -{ - typedef unsigned int TValue; - - static const TValue VERTICAL = 0u; - static const TValue HORIZONTAL = 1u; - static const TValue DIMENSION = 2u; -}; - -// ---------------------------------------------------------------------------- -// Class DPMatrix_ -// ---------------------------------------------------------------------------- - -// The dp matrix used as a score matrix and as a trace-back matrix. -template -class DPMatrix_ -{}; - - -// Default dp matrix implementation stores all cells of the dp matrix in the -// underlying two-dimensional matrix. -template -class DPMatrix_ -{ -public: - - typedef Matrix THost; - - Holder _dataHost; // The host containing the actual matrix. - - DPMatrix_() : - _dataHost() - { - create(_dataHost); - } - - DPMatrix_(DPMatrix_ const & other) : - _dataHost(other._dataHost) {} - - ~DPMatrix_() {} - - DPMatrix_ & operator=(DPMatrix_ const & other) - { - if (this != &other) - { - _dataHost = other._dataHost; - } - return *this; - } - -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction DefaultScoreMatrixSpec_ -// ---------------------------------------------------------------------------- - -// This meta-function determines the default specialization of dp matrix -// based on the given algorithm tag. -template -struct DefaultScoreMatrixSpec_ -{ - typedef SparseDPMatrix Type; -}; - -// TODO(rmaerker): Move to WatermanEggert implementation? -template <> -struct DefaultScoreMatrixSpec_ > -{ - typedef FullDPMatrix Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction _DataHost -// ---------------------------------------------------------------------------- - -// Returns the type of the underlying matrix. -template -struct _DataHost {}; - -template -struct _DataHost > -{ - typedef DPMatrix_ TDPMatrix_; - typedef typename TDPMatrix_::THost Type; -}; - -template -struct _DataHost const> -{ - typedef DPMatrix_ TDPMatrix_; - typedef typename TDPMatrix_::THost const Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction _SizeArr -// ---------------------------------------------------------------------------- - -// Returns the type of the containers to store the dimensions and the factors -// in order to move properly in the matrix. -template -struct _SizeArr {}; - -template -struct _SizeArr > -{ - typedef DPMatrix_ TDPMatrix_; - typedef typename _DataHost::Type TDataHost_; - typedef typename SizeArr_::Type Type; -}; - -template -struct _SizeArr const> -{ - typedef DPMatrix_ TDPMatrix_; - typedef typename _DataHost::Type TDataHost_; - typedef typename SizeArr_::Type const Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Spec -// ---------------------------------------------------------------------------- - -template -struct Spec > -{ - typedef TMatrixSpec Type; -}; - -template -struct Spec const>: - Spec >{}; - - -// ---------------------------------------------------------------------------- -// Metafunction Value -// ---------------------------------------------------------------------------- - -template -struct Value > -{ - typedef TValue Type; -}; - -template -struct Value const> -{ - typedef TValue const Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Reference -// ---------------------------------------------------------------------------- - -template -struct Reference > -{ - typedef TValue & Type; -}; - -template -struct Reference const> -{ - typedef TValue const & Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction GetValue -// ---------------------------------------------------------------------------- - -template -struct GetValue >: - Reference >{}; - -template -struct GetValue const>: - Reference const>{}; - -// ---------------------------------------------------------------------------- -// Metafunction Position -// ---------------------------------------------------------------------------- - -template -struct Position > -{ - typedef typename DPMatrix_::THost TDataMatrix_; - typedef typename Position::Type Type; -}; - -template -struct Position const>: - Position >{}; - -// ---------------------------------------------------------------------------- -// Metafunction Size -// ---------------------------------------------------------------------------- - -template -struct Size > -{ - typedef typename DPMatrix_::THost TDataMatrix_; - typedef typename Size::Type Type; -}; - -template -struct Size const>: - Size >{}; - -// ---------------------------------------------------------------------------- -// Metafunction Host -// ---------------------------------------------------------------------------- - -template -struct Host > -{ - typedef DPMatrix_ TDPMatrix_; - typedef typename _DataHost::Type TDataMatrix_; - typedef typename Host::Type Type; -}; - -template -struct Host const> -{ - typedef DPMatrix_ TDPMatrix_; - typedef typename _DataHost::Type TDataMatrix_; - typedef typename Host::Type const Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Iterator -// ---------------------------------------------------------------------------- - -// There are two iterator types. The standard iterator returns a -// non-rooted iterator to the underlying vector of the hosted two-dimensional -// matrix. The rooted iterator returns the iterator defined by the -// hosted matrix object which is a position iterator. -template -struct Iterator, Standard const> -{ - typedef DPMatrix_ TDPMatrix_; - typedef typename Host::Type THost_; - typedef typename Iterator::Type Type; -}; - -template -struct Iterator const, Standard const> -{ - typedef DPMatrix_ const TDPMatrix_; - typedef typename Host::Type THost_; - typedef typename Iterator::Type Type; -}; - -template -struct Iterator, Rooted const> -{ - typedef DPMatrix_ TDPMatrix_; - typedef typename _DataHost::Type TDataMatrix_; - typedef typename Iterator::Type Type; -}; - -template -struct Iterator const, Rooted const> -{ - typedef DPMatrix_ TDPMatrix_; - typedef typename _DataHost::Type TDataMatrix_; - typedef typename Iterator::Type Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _checkCorrectDimension() -// ---------------------------------------------------------------------------- - -// Checks whether a given value applies to the correct dimension. -inline bool _checkCorrectDimension(DPMatrixDimension_::TValue dim) -{ - return dim < DPMatrixDimension_::DIMENSION; -} - -// ---------------------------------------------------------------------------- -// Function _dataHost() -// ---------------------------------------------------------------------------- - -// Returns a reference to the hosted matrix. -template -inline typename _DataHost >::Type & -_dataHost(DPMatrix_&dpMatrix) -{ - return value(dpMatrix._dataHost); -} - -template -inline typename _DataHost const>::Type & -_dataHost(DPMatrix_ const & dpMatrix) -{ - return value(dpMatrix._dataHost); -} - -// ---------------------------------------------------------------------------- -// Function _dataLengths() -// ---------------------------------------------------------------------------- - -// Returns a reference to the _dataLengths container of the hosted matrix. -template -inline typename _SizeArr >::Type & -_dataLengths(DPMatrix_&dpMatrix) -{ - return _dataLengths(_dataHost(dpMatrix)); -} - -template -inline typename _SizeArr const>::Type & -_dataLengths(DPMatrix_ const & dpMatrix) -{ - return _dataLengths(_dataHost(dpMatrix)); -} - -// ---------------------------------------------------------------------------- -// Function _dataFactors() -// ---------------------------------------------------------------------------- - -// Returns a reference to the _dataFactors container of the hosted matrix. -template -inline typename _SizeArr >::Type & -_dataFactors(DPMatrix_&dpMatrix) -{ - return _dataFactors(_dataHost(dpMatrix)); -} - -template -inline typename _SizeArr const>::Type & -_dataFactors(DPMatrix_ const & dpMatrix) -{ - return _dataFactors(_dataHost(dpMatrix)); -} - -// ---------------------------------------------------------------------------- -// Function host() -// ---------------------------------------------------------------------------- - -// Returns a reference to the underlying vector of the hosted matrix. -template -inline typename Host >::Type & -host(DPMatrix_&dpMatrix) -{ - return host(_dataHost(dpMatrix)); -} - -template -inline typename Host const>::Type & -host(DPMatrix_ const & dpMatrix) -{ - return host(_dataHost(dpMatrix)); -} - -// ---------------------------------------------------------------------------- -// Function setHost() -// ---------------------------------------------------------------------------- - -// Sets a new value to the underlying vector of the hosted matrix. -template -inline void -setHost(DPMatrix_ & dpMatrix, - THost & newHost) -{ - setHost(_dataHost(dpMatrix), newHost); -} - -template -inline void -setHost(DPMatrix_ & dpMatrix, - THost const & newHost) -{ - setHost(_dataHost(dpMatrix), newHost); -} - -// ---------------------------------------------------------------------------- -// Function value() -// ---------------------------------------------------------------------------- - -// Returns the value of the matrix at the given host position. -template -inline typename Reference >::Type -value(DPMatrix_ & dpMatrix, - TPosition const & pos) -{ - return value(_dataHost(dpMatrix), pos); -} - -template -inline typename Reference const>::Type -value(DPMatrix_ const & dpMatrix, - TPosition const & pos) -{ - return value(_dataHost(dpMatrix), pos); -} - -// Returns the value of the matrix at the two given coordinates. -template -inline typename Reference >::Type -value(DPMatrix_ & dpMatrix, - TPositionV const & posDimV, - TPositionH const & posDimH) -{ - return value(_dataHost(dpMatrix), posDimV, posDimH); -} - -template -inline typename Reference const>::Type -value(DPMatrix_ const & dpMatrix, - TPositionV const & posDimV, - TPositionH const & posDimH) -{ - return value(_dataHost(dpMatrix), posDimV, posDimH); -} - -// ---------------------------------------------------------------------------- -// Function length() -// ---------------------------------------------------------------------------- - -// Returns the length of a given dimension. -template -inline typename Size const>::Type -length(DPMatrix_ const & dpMatrix, - unsigned int dimension) -{ - SEQAN_ASSERT(_checkCorrectDimension(dimension)); - - return length(_dataHost(dpMatrix), dimension); -} - -// Returns the overall length of the underlying vector of the hosted matrix. -template -inline typename Size const>::Type -length(DPMatrix_ const & dpMatrix) -{ - return length(_dataHost(dpMatrix)); // Note that even if the dimensional lengths are set but the matrix was not resized - // this function returns 0 or the previous length of the host before the resize. -} - -// ---------------------------------------------------------------------------- -// Function clear() -// ---------------------------------------------------------------------------- - -template -inline void -clear(DPMatrix_ & dpMatrix) -{ - clear(_dataLengths(dpMatrix)); - resize(_dataLengths(dpMatrix), 2, 0); - clear(_dataFactors(dpMatrix)); - resize(_dataFactors(dpMatrix), 2, 0); - _dataFactors(dpMatrix)[DPMatrixDimension_::VERTICAL] = 1u; - clear(host(dpMatrix)); -} - -// ---------------------------------------------------------------------------- -// Function empty() -// ---------------------------------------------------------------------------- - -template -inline bool -empty(DPMatrix_ const & dpMatrix) -{ - return empty(host(dpMatrix)); -} - -// ---------------------------------------------------------------------------- -// Function setLength() -// ---------------------------------------------------------------------------- - -// Sets the new length of a given dimension. -template -inline void -setLength(DPMatrix_ & dpMatrix, - unsigned int dimension, - TSize const & newLength) -{ - SEQAN_ASSERT(_checkCorrectDimension(dimension)); - setLength(_dataHost(dpMatrix), dimension, newLength); -} - -// ---------------------------------------------------------------------------- -// Function resize() -// ---------------------------------------------------------------------------- - -// Resizes the matrix. Note, the lengths of the dimensions have to be set before. -template -inline void -resize(DPMatrix_ & dpMatrix) -{ - resize(_dataHost(dpMatrix)); -} - -template -inline void -resize(DPMatrix_ & dpMatrix, - TValue const & fillValue) -{ - resize(_dataHost(dpMatrix), fillValue); -} - -// ---------------------------------------------------------------------------- -// Function begin() -// ---------------------------------------------------------------------------- - -template -inline typename Iterator, Standard const>::Type -begin(DPMatrix_ & dpMatrix, Standard const) -{ - return begin(host(dpMatrix)); -} - -template -inline typename Iterator const, Standard const>::Type -begin(DPMatrix_ const & dpMatrix, Standard const) -{ - return begin(host(dpMatrix)); -} - -template -inline typename Iterator, Rooted const>::Type -begin(DPMatrix_ & dpMatrix, Rooted const) -{ - return begin(_dataHost(dpMatrix)); -} - -template -inline typename Iterator const, Rooted const>::Type -begin(DPMatrix_ const & dpMatrix, Rooted const) -{ - return begin(_dataHost(dpMatrix)); -} - -// ---------------------------------------------------------------------------- -// Function end() -// ---------------------------------------------------------------------------- - -template -inline typename Iterator, Standard const>::Type -end(DPMatrix_ & dpMatrix, Standard const) -{ - return end(host(dpMatrix)); -} - -template -inline typename Iterator const, Standard const>::Type -end(DPMatrix_ const & dpMatrix, Standard const) -{ - return end(host(dpMatrix)); -} - -template -inline typename Iterator, Rooted const>::Type -end(DPMatrix_ & dpMatrix, Rooted const) -{ - return end(_dataHost(dpMatrix)); -} - -template -inline typename Iterator const, Rooted const>::Type -end(DPMatrix_ const & dpMatrix, Rooted const) -{ - return end(_dataHost(dpMatrix)); -} - -// ---------------------------------------------------------------------------- -// Function coordinate() -// ---------------------------------------------------------------------------- - -// Returns the coordinate of a host positio in a given dimension. -template -inline typename Position >::Type -coordinate(DPMatrix_ const & dpMatrix, - TPosition hostPos, - typename DPMatrixDimension_::TValue dimension) -{ - return coordinate(_dataHost(dpMatrix), hostPos, dimension); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_H_ diff --git a/seqan/align/dp_matrix_navigator.h b/seqan/align/dp_matrix_navigator.h deleted file mode 100644 index 56c6725..0000000 --- a/seqan/align/dp_matrix_navigator.h +++ /dev/null @@ -1,230 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// Implements the DPMatrixNavigator. -// This is the parent class for all navigators that parse over a dp-matrix. -// This class facilitates the correct navigation through the dp-matrix for -// all kind of standard dp-algorithms. At the moment there only exists the -// NavigateColumnWise but this can be complemented by other navigation -// structures like anti-diagonals or in tiles. -// The Navigator can be specialized with three parameters. The first one is -// the used specialization of the dp-matrix (FullDPMatrix or SparseDPMatrix). -// the second parameter decides if it is a navigator for a score matrix or -// a trace matrix. And the last parameter determines the sort of navigation. -// ========================================================================== - -// TODO(holtgrew): Documentation in this header necessary or internal only? - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Tag DPScoreMatrix -// ---------------------------------------------------------------------------- - -// Used to select a navigator for the score matrix. -struct DPScoreMatrix_; -typedef Tag DPScoreMatrix; - -// ---------------------------------------------------------------------------- -// Tag DPTraceMatrix -// ---------------------------------------------------------------------------- - -// Used to select a navigator for the trace matrix. -template -struct DPTraceMatrix {}; - -// ---------------------------------------------------------------------------- -// Tag NavigateColumnWise -// ---------------------------------------------------------------------------- - -// Facilitates column wise navigation through the dp-matrix. -struct NavigateColumnWise_; -typedef Tag NavigateColumnWise; - -// ---------------------------------------------------------------------------- -// Class DPMatrixNavigator_ -// ---------------------------------------------------------------------------- - -template -class DPMatrixNavigator_; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction Value -// ---------------------------------------------------------------------------- - -template -struct Value > -{ - typedef typename Value::Type Type; -}; - -template -struct Value const> -{ - typedef typename Value::Type Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Reference -// ---------------------------------------------------------------------------- - -template -struct Reference > -{ - typedef typename Reference::Type Type; -}; - -template -struct Reference const> -{ - typedef typename Reference::Type Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Container -// ---------------------------------------------------------------------------- - -template -struct Container > -{ - typedef TDPMatrix Type; -}; - -template -struct Container const> -{ - typedef TDPMatrix const Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function assignValue() -// ---------------------------------------------------------------------------- - -template -inline void -assignValue(DPMatrixNavigator_ & dpNavigator, - TValue const & element) -{ - assignValue(dpNavigator._activeColIterator, element); -} - -// ---------------------------------------------------------------------------- -// Function value() -// ---------------------------------------------------------------------------- - -template -inline typename Reference >::Type -value(DPMatrixNavigator_ & dpNavigator) -{ - return value(dpNavigator._activeColIterator); -} - -template -inline typename Reference const>::Type -value(DPMatrixNavigator_ const & dpNavigator) -{ - return value(dpNavigator._activeColIterator); -} - -template -inline typename Reference >::Type -value(DPMatrixNavigator_ & dpNavigator, - TCoordinateH const & coordinateV, - TCoordinateV const & coordinateH) -{ - return value(container(dpNavigator), coordinateV, coordinateH); -} - -template -inline typename Reference const>::Type -value(DPMatrixNavigator_ const & dpNavigator, - TCoordinateV const & coordinateV, - TCoordinateH const & coordinateH) -{ - return value(container(dpNavigator), coordinateV, coordinateH); -} - -// ---------------------------------------------------------------------------- -// Function coordinate() -// ---------------------------------------------------------------------------- - -template -inline typename DPMatrixDimension_::TValue -coordinate(DPMatrixNavigator_ const & dpNavigator, - typename DPMatrixDimension_::TValue const & dimension) -{ - // Simply delegate to coordinate of underlying matrix. - return coordinate(value(dpNavigator._ptrDataContainer), - dpNavigator._activeColIterator - begin(*dpNavigator._ptrDataContainer, Standard()), dimension); -} - -// ---------------------------------------------------------------------------- -// Function container() -// ---------------------------------------------------------------------------- - -template -inline typename Container >::Type & -container(DPMatrixNavigator_ & dpNavigator) -{ - return *dpNavigator._ptrDataContainer; -} - -template -inline typename Container const>::Type & -container(DPMatrixNavigator_ const & dpNavigator) -{ - return *dpNavigator._ptrDataContainer; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_H_ diff --git a/seqan/align/dp_matrix_navigator_score_matrix.h b/seqan/align/dp_matrix_navigator_score_matrix.h deleted file mode 100644 index 574377b..0000000 --- a/seqan/align/dp_matrix_navigator_score_matrix.h +++ /dev/null @@ -1,417 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// The navigator for the full score dp-matrix. We need two iterators over the -// current column and the previous column. We also store the three neighboring -// cells needed for the recursion formula. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_SCORE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_SCORE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class DPMatrixNavigator [FullDPMatrix, ScoreMatrix] -// ---------------------------------------------------------------------------- - -// The navigator for the score matrix. -// -// This navigator runs on a FullDPMatrix while it navigates column wise. -template -class DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> -{ -public: - typedef DPMatrix_ TDPMatrix_; - typedef typename Pointer_::Type TDPMatrixPointer_; - typedef typename Iterator::Type TDPMatrixIterator; - - TDPMatrixPointer_ _ptrDataContainer; // Pointer to the matrix this navigator is working on. - int _laneLeap; // Stores the jump to the next column - TDPMatrixIterator _activeColIterator; // The active column iterator. - TDPMatrixIterator _prevColIterator; // The previous column iterator. - TValue _prevCellDiagonal; // The previous diagonal cell - TValue _prevCellHorizontal; // The previous Horizontal cell - TValue _prevCellVertical; // The previous Vertical cell - - - - DPMatrixNavigator_() : - _ptrDataContainer(TDPMatrixPointer_(0)), - _laneLeap(0), - _activeColIterator(), - _prevColIterator(), - _prevCellDiagonal(), - _prevCellHorizontal(), - _prevCellVertical() - {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _init() -// ---------------------------------------------------------------------------- - -// Initializes the navigator for an unbanded alignment. -template -inline void -_init(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & navigator, - DPMatrix_ & dpMatrix, - DPBand_ const &) -{ - navigator._ptrDataContainer = &dpMatrix; - navigator._activeColIterator = begin(dpMatrix, Standard()); - navigator._prevColIterator = navigator._activeColIterator - _dataFactors(dpMatrix)[DPMatrixDimension_::HORIZONTAL]; - navigator._laneLeap = 1; -} - -// Initializes the navigator for a banded alignment. -template -inline void -_init(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & navigator, - DPMatrix_ & dpMatrix, - DPBand_ const & band) -{ - typedef typename Size >::Type TMatrixSize; - typedef typename MakeSigned::Type TSignedSize; - navigator._ptrDataContainer = &dpMatrix; - - - // Band begins within the first row. - if (lowerDiagonal(band) >= 0) - { - navigator._laneLeap = _min(length(dpMatrix, DPMatrixDimension_::VERTICAL), bandSize(band)); - navigator._activeColIterator = begin(dpMatrix, Standard()) + _dataLengths(dpMatrix)[DPMatrixDimension_::VERTICAL] - 1; - } - else if (upperDiagonal(band) <= 0) // Band begins within the first column. - { - navigator._laneLeap = 1; - navigator._activeColIterator = begin(dpMatrix, Standard()); - } - else // Band intersects with the point of origin. - { - TMatrixSize lengthVertical = length(dpMatrix, DPMatrixDimension_::VERTICAL); - int lastPos = _max(-static_cast(lengthVertical - 1), lowerDiagonal(band)); - navigator._laneLeap = lengthVertical + lastPos; - navigator._activeColIterator = begin(dpMatrix, Standard()) + navigator._laneLeap - 1; - } - // Set previous iterator to same position, one column left. - navigator._prevColIterator = navigator._activeColIterator - _dataFactors(dpMatrix)[DPMatrixDimension_::HORIZONTAL]; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [DPInitialColumn, FirstCell] -// ---------------------------------------------------------------------------- - -// In the initial column we don't need to do anything because, the navigagtor is already initialized. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & /*dpNavigator*/, - MetaColumnDescriptor const &, - FirstCell const &) -{ - // no-op -} - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & /*dpNavigator*/, - MetaColumnDescriptor const &, - FirstCell const &) -{ - // no-op -} - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & /*dpNavigator*/, - MetaColumnDescriptor const &, - FirstCell const &) -{ - // no-op -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [PartialColumnTop, FirstCell] -// ---------------------------------------------------------------------------- - -// We are in the banded case, where the band crosses the first row. -// The left cell of the active cell is not valid, beacause we only can come from horizontal direction. -// The lower left cell of the active cell is the horizontal direction. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - FirstCell const &) -{ - --dpNavigator._laneLeap; - dpNavigator._activeColIterator += dpNavigator._laneLeap; - dpNavigator._prevColIterator += dpNavigator._laneLeap; - dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator); -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [FullColumn, FirstCell] -// ---------------------------------------------------------------------------- - -// We are in the unbanded case or in the middle phase of the wide band. -// The left cell of the active cell represents horizontal direction. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - FirstCell const &) -{ - dpNavigator._activeColIterator += dpNavigator._laneLeap; - dpNavigator._prevColIterator += dpNavigator._laneLeap; - dpNavigator._prevCellHorizontal = value(dpNavigator._prevColIterator); -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [PartialColumnMiddle, PartialColumnBottom, FirstCell] -// ---------------------------------------------------------------------------- - -// We are in the banded case. -// The left cell of the active cell represents diagonal direction. The lower left diagonal represents the horizontal direction. - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - FirstCell const &) -{ - dpNavigator._activeColIterator += dpNavigator._laneLeap; - dpNavigator._prevColIterator += dpNavigator._laneLeap; - dpNavigator._prevCellDiagonal = value(dpNavigator._prevColIterator); - dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator); -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [DPInitialColumn, InnerCell] -// ---------------------------------------------------------------------------- - -// If we are in the initial column, we only need to represent the vertical direction. -// But we still have to update the previous column iterator. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - InnerCell const &) -{ - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; - ++dpNavigator._prevColIterator; // Do we have to increase the prevColIterator.... -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [AnyColumn, InnerCell] -// ---------------------------------------------------------------------------- - -// For any other column type and location we can use the same navigation procedure. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - InnerCell const &) -{ - dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal; - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator); - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [DPInitialColumn, LastCell] -// ---------------------------------------------------------------------------- - -// If we are in the initial column we only need to represent the vertical direction. -// But we still have to update the previous column iterator. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; - ++dpNavigator._prevColIterator; -} - -// We need this function to avoid ambiguous function calls. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; - ++dpNavigator._prevColIterator; -} - -// We need this function to avoid ambiguous function calls. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; - ++dpNavigator._prevColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [FullColumn, LastCell] -// ---------------------------------------------------------------------------- - -// If we are in a full column the values correspond to standard dp directions. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal; - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator); - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [PartialColumnBottom, LastCell] -// ---------------------------------------------------------------------------- - -// If we are in banded case and are the band crosses the last row, we have to update -// the additional leap for the current track. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal; - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator); - ++dpNavigator._activeColIterator; - ++dpNavigator._laneLeap; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [PartialColumnTop & PartialColumnBottom, LastCell] -// ---------------------------------------------------------------------------- - -// If we are in the banded case the left cell of the active represents the diagonal direction. -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal; - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function previousCellDiagonal() -// ---------------------------------------------------------------------------- - -template -inline typename Reference >::Type -previousCellDiagonal(DPMatrixNavigator_ & dpNavigator) -{ - return dpNavigator._prevCellDiagonal; -} - -template -inline typename Reference const>::Type -previousCellDiagonal(DPMatrixNavigator_ const & dpNavigator) -{ - return dpNavigator._prevCellDiagonal; -} - -// ---------------------------------------------------------------------------- -// Function previousCellHorizontal() -// ---------------------------------------------------------------------------- - -template -inline typename Reference >::Type -previousCellHorizontal(DPMatrixNavigator_ & dpNavigator) -{ - return dpNavigator._prevCellHorizontal; -} - -template -inline typename Reference const>::Type -previousCellHorizontal(DPMatrixNavigator_ const & dpNavigator) -{ - return dpNavigator._prevCellHorizontal; -} - -// ---------------------------------------------------------------------------- -// Function previousCellVertical() -// ---------------------------------------------------------------------------- - -template -inline typename Reference >::Type -previousCellVertical(DPMatrixNavigator_ & dpNavigator) -{ - return dpNavigator._prevCellVertical; -} - -template -inline typename Reference const>::Type -previousCellVertical(DPMatrixNavigator_ const & dpNavigator) -{ - return dpNavigator._prevCellVertical; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_SCORE_H_ diff --git a/seqan/align/dp_matrix_navigator_score_matrix_sparse.h b/seqan/align/dp_matrix_navigator_score_matrix_sparse.h deleted file mode 100644 index 3784961..0000000 --- a/seqan/align/dp_matrix_navigator_score_matrix_sparse.h +++ /dev/null @@ -1,379 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// The navigator for the sparse score dp-matrix. This class also provides an -// iterator for the active and the previous column. It stores the neighbouring -// cells needed for the recursion formula. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_SCORE_SPARSE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_SCORE_SPARSE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class DPMatrixNavigator [SparseDPMatrix, ScoreMatrix] -// ---------------------------------------------------------------------------- - -// Specialization of the score matrix navigator for a sparse dp matrix. -template -class DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> -{ -public: - typedef DPMatrix_ TDPMatrix_; - typedef typename Pointer_::Type TDPMatrixPointer_; - typedef typename Iterator::Type TDPMatrixIterator; - - TDPMatrixPointer_ _ptrDataContainer; // Pointer to the underlying matrix to navigate on. - int _laneLeap; // The distance to leap when going to the next column. - TDPMatrixIterator _activeColIterator; // The iterator over the active column. - TDPMatrixIterator _prevColIterator; // The iterator over the previous column. - TValue _prevCellDiagonal; // The previous value in diagonal direction. - TValue _prevCellHorizontal; // The previous value in horizontal direction. - TValue _prevCellVertical; // The previous value in vertical direction. - - - - DPMatrixNavigator_() : - _ptrDataContainer(TDPMatrixPointer_(0)), - _laneLeap(0), - _activeColIterator(), - _prevColIterator(), - _prevCellDiagonal(), - _prevCellHorizontal(), - _prevCellVertical() - {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _init() -// ---------------------------------------------------------------------------- - - -// Initializes the navigator for unbanded alignments -template -inline void -_init(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & navigator, - DPMatrix_ & dpMatrix, - DPBand_ const &) -{ - navigator._ptrDataContainer = &dpMatrix; - navigator._activeColIterator = begin(dpMatrix, Standard()); - navigator._prevColIterator = navigator._activeColIterator; - navigator._laneLeap = 1 - _dataLengths(dpMatrix)[DPMatrixDimension_::VERTICAL]; -} - -// Initializes the navigator for banded alignments -template -inline void -_init(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & navigator, - DPMatrix_ & dpMatrix, - DPBand_ const & band) -{ - typedef DPMatrix_ TSparseDPMatrix; - typedef typename Size::Type TSize; - typedef typename MakeSigned::Type TSignedSize; - navigator._ptrDataContainer = &dpMatrix; - - // Band begins within the first row. - if (lowerDiagonal(band) >= 0) - { - navigator._laneLeap = 0; - navigator._activeColIterator = begin(dpMatrix, Standard()) + length(dpMatrix, DPMatrixDimension_::VERTICAL) - 1; - } - else if (upperDiagonal(band) <= 0) // Band begins within the first column - { - navigator._laneLeap = 1 - _dataLengths(dpMatrix)[DPMatrixDimension_::VERTICAL]; - navigator._activeColIterator = begin(dpMatrix, Standard()); - } - else // Band intersects with the point of origin. - { - navigator._laneLeap = _max(lowerDiagonal(band), 1 - static_cast(length(dpMatrix, DPMatrixDimension_::VERTICAL))); - navigator._activeColIterator = begin(dpMatrix, Standard()) + length(dpMatrix, DPMatrixDimension_::VERTICAL) + navigator._laneLeap - 1; - } - navigator._prevColIterator = navigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [DPInitialColumn, PartialColumnTop, FirstCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & /*dpNavigator*/, - MetaColumnDescriptor const &, - FirstCell const &) -{ - // no-op -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [DPInitialColumn, FullColumn, FirstCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & /*dpNavigator*/, - MetaColumnDescriptor const &, - FirstCell const &) -{ - // no-op -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [DPInitialColumn, FirstCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & /*dpNavigator*/, - MetaColumnDescriptor const &, - FirstCell const &) -{ - // no-op -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [PartialColumnTop, FirstCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - FirstCell const &) -{ - --dpNavigator._laneLeap; - dpNavigator._activeColIterator += dpNavigator._laneLeap; - dpNavigator._prevColIterator = dpNavigator._activeColIterator; - dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator); -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [FullColumn, FirstCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - FirstCell const &) -{ - dpNavigator._activeColIterator += dpNavigator._laneLeap; - dpNavigator._prevCellHorizontal = value(dpNavigator._activeColIterator); -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [FirstCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - FirstCell const &) -{ - dpNavigator._activeColIterator += dpNavigator._laneLeap; - dpNavigator._prevColIterator = dpNavigator._activeColIterator; - dpNavigator._prevCellDiagonal = value(dpNavigator._prevColIterator); - dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator); -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [DPInitialColumn, InnerCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - InnerCell const &) -{ - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [DPInitialColumn, FullColumn, InnerCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - InnerCell const &) -{ - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [InnerCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - InnerCell const &) -{ - dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal; - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator); - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [FullColumn, InnerCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - InnerCell const &) -{ - dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal; - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - dpNavigator._prevCellHorizontal = value(++dpNavigator._activeColIterator); -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [DPInitialColumn, LastCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [DPInitialColumn, PartialColumnBottom, LastCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [DPInitialColumn, FullColumn, LastCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [LastCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal; - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [PartialColumnBottom, LastCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal; - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - dpNavigator._prevCellHorizontal = value(++dpNavigator._prevColIterator); - ++dpNavigator._activeColIterator; - ++dpNavigator._laneLeap; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [FullColumn, LastCell] -// ---------------------------------------------------------------------------- - - -template -inline void -_goNextCell(DPMatrixNavigator_, DPScoreMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - dpNavigator._prevCellDiagonal = dpNavigator._prevCellHorizontal; - dpNavigator._prevCellVertical = value(dpNavigator._activeColIterator); - dpNavigator._prevCellHorizontal = value(++dpNavigator._activeColIterator); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_SCORE_SPARSE_H_ diff --git a/seqan/align/dp_matrix_navigator_trace_matrix.h b/seqan/align/dp_matrix_navigator_trace_matrix.h deleted file mode 100644 index 8b48c82..0000000 --- a/seqan/align/dp_matrix_navigator_trace_matrix.h +++ /dev/null @@ -1,468 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// This specialization is used to navigate through the traceback matrix -// of any standard dp-alignment algorithm. The DPTraceMatrix gets the -// traceback flag TracebackOn or TracebackOff. A traceback is only computed -// if the traceback is switched on. If this is not the case, the void -// functions will be compiled as no-op functions, while in functions that try -// to access a value of the underlying matrix via the navigator an assertion -// is thrown. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_TRACE_MATRIX_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_TRACE_MATRIX_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class DPMatrixNavigator [FullDPMatrix, DPTraceMatrix] -// ---------------------------------------------------------------------------- - -// The matrix navigator for the trace-back matrix. -// -// It takes three types to be specialized. The first type defines the underlying -// dp-matrix it is working on. This has to be a FullDPMatrix. The second type, -// specifies that this is a trace-matrix navigator while the TTraceFlag can either -// be TracebackOn to enable the navigator or TracebackOff to disable it. -// The last parameter specifies the kind of navigation. -template -class DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> -{ -public: - - typedef DPMatrix_ TDPMatrix_; - typedef typename Pointer_::Type TDPMatrixPointer_; - typedef typename Iterator::Type TDPMatrixIterator; - - TDPMatrixPointer_ _ptrDataContainer; // The pointer to the underlying Matrix. - int _laneLeap; // Keeps track of the jump size from one column to another. - TDPMatrixIterator _activeColIterator; // The current column iterator. - - - DPMatrixNavigator_() : - _ptrDataContainer(TDPMatrixPointer_(0)), - _laneLeap(0), - _activeColIterator() - {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _init() -// ---------------------------------------------------------------------------- - -// Initializes the navigator for unbanded alignments. -template -inline void -_init(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & navigator, - DPMatrix_ & dpMatrix, - DPBand_ const &) -{ - if (IsSameType::VALUE) - return; // Leave navigator uninitialized because it is never used. - - navigator._ptrDataContainer = &dpMatrix; - navigator._activeColIterator = begin(dpMatrix, Standard()); - navigator._laneLeap = 1; -} - -// Initializes the navigator for banded alignments. -// Note, the band size has a maximal width of length of the vertical sequence. -template -inline void -_init(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & navigator, - DPMatrix_ & dpMatrix, - DPBand_ const & band) -{ - typedef typename Size >::Type TMatrixSize; - typedef typename MakeSigned::Type TSignedSize; - - if (IsSameType::VALUE) - return; // Leave navigator as is because it should never be used. - - navigator._ptrDataContainer = &dpMatrix; - - // Band begins within the first row. - if (lowerDiagonal(band) >= 0) - { - // The first cell of the first column starts at the last cell in the matrix of the current column. - navigator._laneLeap = _min(length(dpMatrix, DPMatrixDimension_::VERTICAL), bandSize(band)); - navigator._activeColIterator = begin(dpMatrix, Standard()) + _dataLengths(dpMatrix)[DPMatrixDimension_::VERTICAL] - 1; - } - else if (upperDiagonal(band) <= 0) // Band begins within the first column. - { - // The first cell starts at the beginning of the current column. - navigator._laneLeap = 1; - navigator._activeColIterator = begin(dpMatrix, Standard()); - } - else // Band intersects with the point of origin. - { - // First cell starts at position i, such that i + abs(lowerDiagonal) = length(seqV). - TMatrixSize lengthVertical = length(dpMatrix, DPMatrixDimension_::VERTICAL); - int lastPos = _max(-static_cast(lengthVertical - 1), lowerDiagonal(band)); - navigator._laneLeap = lengthVertical + lastPos; - navigator._activeColIterator = begin(dpMatrix, Standard()) + navigator._laneLeap - 1; - } -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [DPInitialColumn, FirstCell] -// ---------------------------------------------------------------------------- - -// In the initial column we don't need to do anything because, the navigagtor is already initialized. -template -inline void -_goNextCell(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & /*dpNavigator*/, - MetaColumnDescriptor const &, - FirstCell const &) -{ - // no-op -} - -template -inline void -_goNextCell(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & /*dpNavigator*/, - MetaColumnDescriptor const &, - FirstCell const &) -{ - // no-op -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [PartialColumnTop, FirstCell] -// ---------------------------------------------------------------------------- - -// We are in the banded case, where the band crosses the first row. -// The left cell of the active cell is not valid, beacause we only can come from horizontal direction. -// The lower left cell of the active cell is the horizontal direction. - -template -inline void -_goNextCell(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - FirstCell const &) -{ - if (IsSameType::VALUE) - return; // Do nothing since no trace back is computed. - - --dpNavigator._laneLeap; - dpNavigator._activeColIterator += dpNavigator._laneLeap; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell() [other column types, FirstCell] -// ---------------------------------------------------------------------------- - -// We are in the banded case. -// The left cell of the active cell represents diagonal direction. The lower left diagonal represents the horizontal direction. - -template -inline void -_goNextCell(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - FirstCell const &) -{ - if (IsSameType::VALUE) - return; // Do nothing since no trace back is computed. - - dpNavigator._activeColIterator += dpNavigator._laneLeap; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [any column, InnerCell] -// ---------------------------------------------------------------------------- - -// For any other column type and location we can use the same navigation procedure. -template -inline void -_goNextCell(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - InnerCell const &) -{ - if (IsSameType::VALUE) - return; // Do nothing since no trace back is computed. - - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [PartialColumnBottom, LastCell] -// ---------------------------------------------------------------------------- - -template -inline void -_goNextCell(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - if (IsSameType::VALUE) - return; // Do nothing since no trace back is computed. - - ++dpNavigator._activeColIterator; -} - -// If we are in banded case and the band crosses the last row, we have to update -// the additional leap for the current track. -template -inline void -_goNextCell(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - if (IsSameType::VALUE) - return; // Do nothing since no trace back is computed. - - ++dpNavigator._activeColIterator; - ++dpNavigator._laneLeap; -} - -// ---------------------------------------------------------------------------- -// Function _goNextCell [any other column, LastCell] -// ---------------------------------------------------------------------------- - -// If we are in the banded case the left cell of the active represents the diagonal direction. -template -inline void -_goNextCell(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - MetaColumnDescriptor const &, - LastCell const &) -{ - if (IsSameType::VALUE) - return; // Do nothing since no trace back is computed. - - ++dpNavigator._activeColIterator; -} - -// ---------------------------------------------------------------------------- -// Function _traceHorizontal() -// ---------------------------------------------------------------------------- - -template -inline void -_traceHorizontal(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - bool isBandShift) -{ - if (IsSameType::VALUE) - return; // Do nothing since no trace back is computed. - - if (isBandShift) - dpNavigator._activeColIterator -= _dataFactors(*dpNavigator._ptrDataContainer)[DPMatrixDimension_::HORIZONTAL] - 1; - else - dpNavigator._activeColIterator -= _dataFactors(*dpNavigator._ptrDataContainer)[DPMatrixDimension_::HORIZONTAL]; - -} - -// ---------------------------------------------------------------------------- -// Function _traceDiagonal() -// ---------------------------------------------------------------------------- - -template -inline void -_traceDiagonal(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - bool isBandShift) -{ - if (IsSameType::VALUE) - return; // Do nothing since no trace back is computed. - - if (isBandShift) - dpNavigator._activeColIterator -= _dataFactors(*dpNavigator._ptrDataContainer)[DPMatrixDimension_::HORIZONTAL]; - else - dpNavigator._activeColIterator -= _dataFactors(*dpNavigator._ptrDataContainer)[DPMatrixDimension_::HORIZONTAL] + 1; - -} - -// ---------------------------------------------------------------------------- -// Function _traceVertical() -// ---------------------------------------------------------------------------- - -template -inline void -_traceVertical(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - bool /*isBandShift*/) -{ - if (IsSameType::VALUE) - return; // Do nothing since no trace back is computed. - - dpNavigator._activeColIterator -= _dataFactors(*dpNavigator._ptrDataContainer)[DPMatrixDimension_::VERTICAL]; -} - -// ---------------------------------------------------------------------------- -// Function setToPosition() -// ---------------------------------------------------------------------------- - -template -inline void -_setToPosition(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - TPosition const & hostPosition) -{ - if (IsSameType::VALUE) - return; - - dpNavigator._activeColIterator = begin(*dpNavigator._ptrDataContainer, Standard()) + hostPosition; -} - - -// Sets the host position based on the given horizontal and vertical position. Note that the horizontal and -// vertical positions must correspond to the correct size of the underlying matrix. -// For banded matrices the vertical dimension might not equal the length of the vertical sequence. -template -inline void -_setToPosition(DPMatrixNavigator_, DPTraceMatrix, NavigateColumnWise> & dpNavigator, - TPositionH const & horizontalPosition, - TPositionV const & verticalPosition) -{ - if (IsSameType::VALUE) - return; - - TPositionH hostPosition = horizontalPosition * _dataFactors(container(dpNavigator))[+DPMatrixDimension_::HORIZONTAL] + verticalPosition; - dpNavigator._activeColIterator = begin(*dpNavigator._ptrDataContainer, Standard()) + hostPosition; -} - -// ---------------------------------------------------------------------------- -// Function assignValue() -// ---------------------------------------------------------------------------- - -template -inline void -assignValue(DPMatrixNavigator_, TNavigationSpec> & dpNavigator, - TValue const & element) -{ - if (IsSameType::VALUE) - return; // Do nothing since no trace back is computed. - - assignValue(dpNavigator._activeColIterator, element); -} - -// ---------------------------------------------------------------------------- -// Function value() -// ---------------------------------------------------------------------------- - -template -inline typename Reference, TNavigationSpec> >::Type -value(DPMatrixNavigator_, TNavigationSpec> & dpNavigator) -{ - if (IsSameType::VALUE) - SEQAN_ASSERT_FAIL("Try to access uninitialized object!"); - - return value(dpNavigator._activeColIterator); -} - -template -inline typename Reference, TNavigationSpec> const>::Type -value(DPMatrixNavigator_, TNavigationSpec> const & dpNavigator) -{ - if (IsSameType::VALUE) - SEQAN_ASSERT_FAIL("Try to access uninitialized object!"); - - return value(dpNavigator._activeColIterator); -} - -template -inline typename Reference, TNavigationSpec> >::Type -value(DPMatrixNavigator_, TNavigationSpec> & dpNavigator, - TPosition const & postition) -{ - if (IsSameType::VALUE) - SEQAN_ASSERT_FAIL("Try to access uninitialized object!"); - - return value(begin(*dpNavigator._ptrDataContainer) + postition); -} - -template -inline typename Reference, TNavigationSpec> const>::Type -value(DPMatrixNavigator_, TNavigationSpec> const & dpNavigator, - TPosition const & position) -{ - if (IsSameType::VALUE) - SEQAN_ASSERT_FAIL("Try to access uninitialized object!"); - - return value(begin(*dpNavigator._ptrDataContainer) + position); -} - -// ---------------------------------------------------------------------------- -// Function coordinate() -// ---------------------------------------------------------------------------- - -// Returns the coordinate of the given dimension for the current position of the -// navigator within the matrix. -template -inline typename DPMatrixDimension_::TValue -coordinate(DPMatrixNavigator_, TNavigationSpec> const & dpNavigator, - typename DPMatrixDimension_::TValue const & dimension) -{ - if (IsSameType::VALUE) - SEQAN_ASSERT_FAIL("Try to access uninitialized object!"); - SEQAN_ASSERT_EQ(_checkCorrectDimension(dimension), true); - - if (IsSameType::VALUE) - return _dataLengths(*dpNavigator._ptrDataContainer)[dimension]; // Return lengths of given dimension. - - return coordinate(value(dpNavigator._ptrDataContainer), position(dpNavigator), dimension); // Simply delegate to coordinate of underlying matrix. -} - -// ---------------------------------------------------------------------------- -// Function position() -// ---------------------------------------------------------------------------- - -// Returns the current position of the navigator within the matrix. -template -inline typename Position, TNavigationSpec> >::Type -position(DPMatrixNavigator_, TNavigationSpec> const & dpNavigator) -{ - // Return 0 when traceback is not enabled. This is necessary to still track the score even - // the traceback is not enabled. - if (IsSameType::VALUE) - return 0; - - return position(dpNavigator._activeColIterator, *dpNavigator._ptrDataContainer); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_NAVIGATOR_TRACE_MATRIX_H_ diff --git a/seqan/align/dp_matrix_sparse.h b/seqan/align/dp_matrix_sparse.h deleted file mode 100644 index 7fdf290..0000000 --- a/seqan/align/dp_matrix_sparse.h +++ /dev/null @@ -1,165 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_SPARSE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_SPARSE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class DPMatrix [SparseDPMatrix] -// ---------------------------------------------------------------------------- - -template -class DPMatrix_ -{ -public: - - typedef Matrix THost; - - Holder _dataHost; // The host containing the actual matrix. - - DPMatrix_() : - _dataHost() - { - create(_dataHost); - } - - DPMatrix_(DPMatrix_ const & other) : - _dataHost(other._dataHost) {} - - ~DPMatrix_() {} - - DPMatrix_ & operator=(DPMatrix_ const & other) - { - if (this != &other) - { - _dataHost = other._dataHost; - } - return *this; - } - -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function resize() -// ---------------------------------------------------------------------------- - -template -inline void -resize(DPMatrix_ & dpMatrix) -{ - typedef DPMatrix_ TDPMatrix; - typedef typename Size::Type TSize; - - TSize _dimVertical = length(dpMatrix, DPMatrixDimension_::VERTICAL); - - if (_dimVertical > 0) - resize(host(dpMatrix), _dimVertical, Exact()); -} - -template -inline void -resize(DPMatrix_ & dpMatrix, - TValue const & fillValue) -{ - typedef DPMatrix_ TDPMatrix; - typedef typename Size::Type TSize; - - TSize _dimVertical = length(dpMatrix, DPMatrixDimension_::VERTICAL); - - if (_dimVertical > 0) - resize(host(dpMatrix), _dimVertical, fillValue, Exact()); -} - -// ---------------------------------------------------------------------------- -// Function value() -// ---------------------------------------------------------------------------- - -template -inline typename Reference >::Type -value(DPMatrix_ & dpMatrix, - TPositionV const & posV, - TPositionH const &) -{ - return value(dpMatrix, posV); -} - -template -inline typename Reference const>::Type -value(DPMatrix_ const & dpMatrix, - TPositionV const & posV, - TPositionH const &) -{ - return value(dpMatrix, posV); -} - -// ---------------------------------------------------------------------------- -// Function coordinate() -// ---------------------------------------------------------------------------- - - -template -inline typename Position >::Type -coordinate(DPMatrix_ const & /*dpMatrix*/, - TPosition hostPos, - typename DPMatrixDimension_::TValue dimension) -{ - SEQAN_ASSERT(_checkCorrectDimension(dimension)); - - if (dimension == DPMatrixDimension_::VERTICAL) - return hostPos; - - return 0u; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_MATRIX_SPARSE_H_ diff --git a/seqan/align/dp_meta_info.h b/seqan/align/dp_meta_info.h deleted file mode 100644 index e89b423..0000000 --- a/seqan/align/dp_meta_info.h +++ /dev/null @@ -1,453 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Ren� Rahn -// ========================================================================== -// Here are defined the strategies for the different alignment algorithms. -// All classes are only used to determine the correct computational state -// of a particular alignment algorithm depending on its profile at a -// particular time. -// All classes are only used on a meta-level. -// ========================================================================== - -// TODO(holtgrew): Documentation in this header necessary or internal only? - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_META_INFO_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_META_INFO_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Tag DPInitialColumn -// ---------------------------------------------------------------------------- - -// Specifies the first column of the dp matrix. -struct DPInitialColumn_; -typedef Tag DPInitialColumn; - -// ---------------------------------------------------------------------------- -// Tag DPInnerColumn -// ---------------------------------------------------------------------------- - -// Specifies any inner column of the dp matrix between the first and the last -// column. -struct DPInnerColumn_; -typedef Tag DPInnerColumn; - -// ---------------------------------------------------------------------------- -// Tag DPFinalColumn -// ---------------------------------------------------------------------------- - -// Specifies the last column of a dp matrix. -struct DPFinalColumn_; -typedef Tag DPFinalColumn; - - -// The TColumnProperty determines the property of the column (if it is initial, inner, or last column) -// The TLocation determines how the column is organized in the matrix. -// It can have the values: FullColumn, PartialColumnTop, PartialColumnMiddle, PartialColumnBottom. -template -struct MetaColumnDescriptor -{ - typedef TColumnProperty_ TColumnProperty; - typedef TLocation_ TLocation; -}; - -// ---------------------------------------------------------------------------- -// Tag FullColumn -// ---------------------------------------------------------------------------- - -// Columns that span over the complete dp-matrix. (Unbanded alignemnts) -struct FullColumn_; -typedef Tag FullColumn; - -// ---------------------------------------------------------------------------- -// Tag PartialColumnTop -// ---------------------------------------------------------------------------- - -// Columns that begin in the first row, but does not at the last row of the dp-matrix -struct PartialColumnTop_; -typedef Tag PartialColumnTop; - -// ---------------------------------------------------------------------------- -// Tag PartialColumnMiddle -// ---------------------------------------------------------------------------- - -// Columns that are not attached to the begin or end of the dp-matrix. -struct PartialColumnMiddle_; -typedef Tag PartialColumnMiddle; - -// ---------------------------------------------------------------------------- -// Tag PartialColumnBottom -// ---------------------------------------------------------------------------- - -// Columns that end in the last row of the dp-matrix but do not start in the first row. -struct PartialColumnBottom_; -typedef Tag PartialColumnBottom; - - -// The cell specifiers are used to determine the cell of a column. -// There are three different cell specifiers used for the first cell, the -// inner cell and the last cell of a column. - -// ---------------------------------------------------------------------------- -// Tag FirstCell -// ---------------------------------------------------------------------------- - -struct FirstCell_; -typedef Tag FirstCell; - -// ---------------------------------------------------------------------------- -// Tag InnerCell -// ---------------------------------------------------------------------------- - -struct InnerCell_; -typedef Tag InnerCell; - -// ---------------------------------------------------------------------------- -// Tag LastCell -// ---------------------------------------------------------------------------- - -struct LastCell_; -typedef Tag LastCell; - - -// ---------------------------------------------------------------------------- -// Class DPMetaCell_ -// ---------------------------------------------------------------------------- - -// Keeps meta-information of a cell in the dp-matrix. It stores the recursion direction -// for a particular cell type and whether it can be tracked or not. - -template -struct DPMetaCell_ {}; - -// ---------------------------------------------------------------------------- -// Class DPMetaColumn_ -// ---------------------------------------------------------------------------- - -// Keeps meta-information of an entire column in the dp-matrix. Depending on the chosen -// DPProfile and the current column descriptor it selects for the different column locations and -// cell specifiers the correct meta-information about how is which cell computed and which cell is -// tracked. - -template -struct DPMetaColumn_ {}; - - -// ---------------------------------------------------------------------------- -// Class DPMetaColumn_ [FullColumn] -// ---------------------------------------------------------------------------- - -template -struct DPMetaColumn_ > -{ - typedef typename IsLocalAlignment_::Type TIsLocal; - - // If InitialColumn -> Zero, Vertical | Zero, Vertical | Zero // Within the algorithm we need to define the first row as only one cell if it is no initial column - // If InnerColumn -> Horizontal | Zero, All, All - // If FinalColumn -> Horizontal | Zero, All, All - - typedef typename If, - IsFreeEndGap_ >, RecursionDirectionZero, RecursionDirectionHorizontal>::Type TRecursionTypeFirstCell_; - typedef typename If, - typename If, RecursionDirectionZero, RecursionDirectionVertical>::Type, - RecursionDirectionAll>::Type TRecursionTypeInnerCell_; - typedef typename If, - typename If, RecursionDirectionZero, RecursionDirectionVertical>::Type, - RecursionDirectionAll>::Type TRecursionTypeLastCell_; - - // If Local - // If InitialColumn -> True, True, True - // If InnerColumn -> True, True, True - // If FinalColumn -> True, True, True - - // If Global - // If InitialColumn -> False, False, False | True (if DPLastRow) - // If InnerColumn -> False, False, False | True (if DPLastRow) - // If FinalColumn -> False | True, False | True (if DPLastColumn), True - - typedef typename If, - And, - IsFreeEndGap_ > // check this if he is really entitled to find the maximum here. - >, True, False>::Type TrackFlagFirstCell_; - typedef typename If, - And, - IsFreeEndGap_ > - >, True, False>::Type TrackFlagInnerCell_; - typedef typename If, - Or, - IsFreeEndGap_ > >, True, False>::Type TrackFlagLastCell_; - - typedef DPMetaCell_ TFirstCell_; - typedef DPMetaCell_ TInnerCell_; - typedef DPMetaCell_ TLastCell_; -}; - -// ---------------------------------------------------------------------------- -// Class DPMetaColumn_ [PartialColumnTop] -// ---------------------------------------------------------------------------- - -template -struct DPMetaColumn_ > -{ - typedef typename IsLocalAlignment_::Type TIsLocal; - - // How does the recursion directions look like? - - // If InitialColumn -> Zero, Vertical | Zero, Vertical | Zero // Within the algorithm we need to define the first row as only one cell if it is no initial column - // If InnerColumn -> Horizontal | Zero, All, LowerBand - // If FinalColumn -> Horizontal | Zero, All, LowerBand - - typedef typename If, - IsFreeEndGap_ >, RecursionDirectionZero, RecursionDirectionHorizontal>::Type TRecursionTypeFirstCell_; - typedef typename If, - typename If, RecursionDirectionZero, RecursionDirectionVertical>::Type, - RecursionDirectionAll>::Type TRecursionTypeInnerCell_; - typedef typename If, - typename If, RecursionDirectionZero, RecursionDirectionVertical>::Type, - RecursionDirectionLowerDiagonal>::Type TRecursionTypeLastCell_; - - // If Local - // If InitialColumn -> True, True, True - // If InnerColumn -> True, True, True - // If FinalColumn -> True, True, True - - // If Global - // If InitialColumn -> False, False, False - // If InnerColumn -> False, False, False - // If FinalColumn -> False | True, False | True, False | True (if DPLastColumn True) - - typedef typename If, - And, - IsFreeEndGap_ > - >, True, False>::Type TrackFlagFirstCell_; - typedef typename If, - And, - IsFreeEndGap_ > - >, True, False>::Type TrackFlagInnerCell_; - typedef typename If, - And, - IsFreeEndGap_ > - >, True, False>::Type TrackFlagLastCell_; - - typedef DPMetaCell_ TFirstCell_; - typedef DPMetaCell_ TInnerCell_; - typedef DPMetaCell_ TLastCell_; -}; - -// ---------------------------------------------------------------------------- -// Class DPMetaColumn_ [PartialColumnMiddle] -// ---------------------------------------------------------------------------- - -template -struct DPMetaColumn_ > -{ - typedef typename IsLocalAlignment_::Type TIsLocal; - - // If InitialColumn -> Zero, Vertical | Zero, Vertical | Zero // Within the algorithm we need to define the first row as only one cell if it is no initial column - // If InnerColumn -> UpperDiagonal, All, LowerDiagonal - // If FinalColumn -> UpperDiagonal, All, LowerDiagonal - - typedef typename If, RecursionDirectionZero, RecursionDirectionUpperDiagonal>::Type TRecursionTypeFirstCell_; - typedef typename If, - typename If, RecursionDirectionZero, RecursionDirectionVertical>::Type, - RecursionDirectionAll>::Type TRecursionTypeInnerCell_; - typedef typename If, - typename If, RecursionDirectionZero, RecursionDirectionVertical>::Type, - RecursionDirectionLowerDiagonal>::Type TRecursionTypeLastCell_; - - // If Local - // If InitialColumn -> True, True, True - // If InnerColumn -> True, True, True - // If FinalColumn -> True, True, True - - // If Global - // If InitialColumn -> False, False, False - // If InnerColumn -> False, False, False - // If FinalColumn -> False | True, False | True, False | True (if DPLastColumn True) - - typedef typename If, - And, - IsFreeEndGap_ > - >, True, False>::Type TrackFlagFirstCell_; - typedef typename If, - And, - IsFreeEndGap_ > - >, True, False>::Type TrackFlagInnerCell_; - typedef typename If, - And, - IsFreeEndGap_ > - >, True, False>::Type TrackFlagLastCell_; - - typedef DPMetaCell_ TFirstCell_; - typedef DPMetaCell_ TInnerCell_; - typedef DPMetaCell_ TLastCell_; -}; - -// ---------------------------------------------------------------------------- -// Class DPMetaColumn_ [PartialColumnBottom] -// ---------------------------------------------------------------------------- - -template -struct DPMetaColumn_ > -{ - typedef typename IsLocalAlignment_::Type TIsLocal; - - // If InitialColumn -> Zero, Vertical | Zero, Vertical | Zero // Within the algorithm we need to define the first row as only one cell if it is no initial column - // If InnerColumn -> UpperDiagonal, All, All - // If FinalColumn -> UpperDiagonal, All, All - - typedef typename If, RecursionDirectionZero, RecursionDirectionUpperDiagonal>::Type TRecursionTypeFirstCell_; - typedef typename If, - typename If, RecursionDirectionZero, RecursionDirectionVertical>::Type, - RecursionDirectionAll>::Type TRecursionTypeInnerCell_; - typedef typename If, - typename If, RecursionDirectionZero, RecursionDirectionVertical>::Type, - RecursionDirectionAll>::Type TRecursionTypeLastCell_; - - // If Local - // If InitialColumn -> True, True, True - // If InnerColumn -> True, True, True - // If FinalColumn -> True, True, True - - // If Global - // If InitialColumn -> False, False, False | True (if DPLastRow) - // If InnerColumn -> False, False, False | True (if DPLastRow) - // If FinalColumn -> False | True, False | True (if DPLastColumn), True (last is always true) - - typedef typename If, - And, - IsFreeEndGap_ > - >, True, False>::Type TrackFlagFirstCell_; - typedef typename If, - And, - IsFreeEndGap_ > - >, True, False>::Type TrackFlagInnerCell_; - typedef typename If, - Or, - IsFreeEndGap_ > >, True, False>::Type TrackFlagLastCell_; - - typedef DPMetaCell_ TFirstCell_; - typedef DPMetaCell_ TInnerCell_; - typedef DPMetaCell_ TLastCell_; -}; - - -// ---------------------------------------------------------------------------- -// Metafunction GetRecursionDirection_ -// ---------------------------------------------------------------------------- - -// Returns the type of recursion for a given DPMetaCell object. -template -struct GetRecursionDirection_ -{ - typedef Nothing Type; -}; - -template -struct GetRecursionDirection_ > -{ - typedef TRecursionDirection Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction RecursionDirection_ -// ---------------------------------------------------------------------------- - -// Returns the type of recursion for a given DPMetaColumn object and a given cell specifier. -template -struct RecursionDirection_ {}; - -template -struct RecursionDirection_ -{ - typedef typename GetRecursionDirection_::Type Type; -}; - -template -struct RecursionDirection_ -{ - typedef typename GetRecursionDirection_::Type Type; -}; - -template -struct RecursionDirection_ -{ - typedef typename GetRecursionDirection_::Type Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction IsTrackingEnabled_ -// ---------------------------------------------------------------------------- - -// Returns an object that evaluates to true if for a given cell description the -// tracking was enabled. Otherwise the object evaluates to false. -template -struct IsTrackingEnabled_ : - False {}; - -template -struct IsTrackingEnabled_ >: - True {}; - - -template -struct TrackingEnabled_ : - False {}; - -template -struct TrackingEnabled_: - IsTrackingEnabled_{}; - -template -struct TrackingEnabled_: - IsTrackingEnabled_{}; - -template -struct TrackingEnabled_: - IsTrackingEnabled_{}; - -// ============================================================================ -// Functions -// ============================================================================ - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_META_INFO_H_ diff --git a/seqan/align/dp_profile.h b/seqan/align/dp_profile.h deleted file mode 100644 index e3b0fb6..0000000 --- a/seqan/align/dp_profile.h +++ /dev/null @@ -1,456 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// This header contains all tags, structures and meta-functions that are -// used to define the meta-profile of an alignment algorithm. -// With the meta-profile the sort of alignment can be selected such as -// a global or a local alignment. It further structures the different -// specializations of global and local alignments or selects the gap cost -// function, or enables or disables the trace-back function. -// ========================================================================== - -// TODO(holtgrew): Documentation in this header necessary or internal only? - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_PROFILE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_PROFILE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class FreeEndGaps_ -// ---------------------------------------------------------------------------- - -// Used to determine which end-gaps are free. -template -struct FreeEndGaps_ {}; - -// ---------------------------------------------------------------------------- -// Class SplitBreakpointAlignment -// ---------------------------------------------------------------------------- -// TODO(rmaerker): maybe in a different header -// Used to specify the global alignment for split breakpoint computation. -struct AlignmentSplitBreakpoint_; -typedef Tag SplitBreakpointAlignment; - -// ---------------------------------------------------------------------------- -// Class GlobalAlignment_ -// ---------------------------------------------------------------------------- - -// This is used to select global alignments. The default is the standard global -// dp-algorithm. -// -// Note, all global alignments have to be specialized versions of GlobalAlignment_<> -template > -struct GlobalAlignment_; - -// ---------------------------------------------------------------------------- -// Class SuboptimalAlignment -// ---------------------------------------------------------------------------- - -// TODO(rmaerker): maybe in a different header -// Used to specify the WatermanEggert algorithm. -struct AlignmentSuboptimal_; -typedef Tag SuboptimalAlignment; - -// ---------------------------------------------------------------------------- -// Class LocalAlignment_ -// ---------------------------------------------------------------------------- - -// This is used to select local alignments. The default is the standard local -// dp-algorithm. -// -// Note, all local alignments have to be specialized versions of LocalAlignment_<> - -template -struct LocalAlignment_; - - -// ---------------------------------------------------------------------------- -// Class TraceBitMap_ -// ---------------------------------------------------------------------------- - -// Used to globally ditinguish different traceback directions and the underlying -// type to store the values. -struct TraceBitMap_ -{ - typedef uint8_t TTraceValue; - static const TTraceValue NONE = 0u; //0000000 - static const TTraceValue DIAGONAL = 1u; //0000001 - static const TTraceValue HORIZONTAL = 2u; //0000010 - static const TTraceValue VERTICAL = 4u; //0000100 - static const TTraceValue HORIZONTAL_OPEN = 8u; //0001000 - static const TTraceValue VERTICAL_OPEN = 16u; //0010000 - static const TTraceValue MAX_FROM_HORIZONTAL_MATRIX = 32u; //0100000 - static const TTraceValue MAX_FROM_VERTICAL_MATRIX = 64u; //1000000 - static const TTraceValue NO_VERTICAL_TRACEBACK = ~(VERTICAL | VERTICAL_OPEN); - static const TTraceValue NO_HORIZONTAL_TRACEBACK = ~(HORIZONTAL | HORIZONTAL_OPEN); -}; - -// ---------------------------------------------------------------------------- -// Tag GapsLeft -// ---------------------------------------------------------------------------- - -struct GapsLeft_; -typedef Tag GapsLeft; - -// ---------------------------------------------------------------------------- -// Tag GapsRight -// ---------------------------------------------------------------------------- - -struct GapsRight_; -typedef Tag GapsRight; - - -// ---------------------------------------------------------------------------- -// Tag SingleTrace -// ---------------------------------------------------------------------------- - -struct SingleTrace_; -typedef Tag SingleTrace; - -// ---------------------------------------------------------------------------- -// Tag CompleteTrace -// ---------------------------------------------------------------------------- - -struct CompleteTrace_; -typedef Tag CompleteTrace; - -// ---------------------------------------------------------------------------- -// Tag TracebackConfig_ -// ---------------------------------------------------------------------------- - -template -struct TracebackConfig_ {}; - -// ---------------------------------------------------------------------------- -// Tag TracebackOn -// ---------------------------------------------------------------------------- - -template > -struct TracebackOn {}; - -// ---------------------------------------------------------------------------- -// Tag TracebackOff -// ---------------------------------------------------------------------------- - -struct TracebackOff_ {}; -typedef Tag TracebackOff; - -// ---------------------------------------------------------------------------- -// Tag LinearGaps -// ---------------------------------------------------------------------------- - -struct LinearGaps_; -typedef Tag LinearGaps; - -// ---------------------------------------------------------------------------- -// Tag AffineGaps -// ---------------------------------------------------------------------------- - -struct AffineGaps_; -typedef Tag AffineGaps; - -// ---------------------------------------------------------------------------- -// Class DPProfile -// ---------------------------------------------------------------------------- - -// This meta-object takes three types to be specialized. -// -// TAlignment: The type to select the pairwise alignment algorithm. -// TGapCosts: The gap cost function (LinearGaps or AffineGaps). -// TTraceback: The traceback switch (TracebackOn or TracebackOff). -template -struct DPProfile_ {}; - - -// ---------------------------------------------------------------------------- -// Tag DPFirstRow -// ---------------------------------------------------------------------------- - -// These tags are used to specify the four locations of a dp-matrix where -// free gaps can occur. -struct DPFirstRow_; -typedef Tag DPFirstRow; - -// ---------------------------------------------------------------------------- -// Tag DPFirstColumn -// ---------------------------------------------------------------------------- - -struct DPFirstColumn_; -typedef Tag DPFirstColumn; - -// ---------------------------------------------------------------------------- -// Tag DPLastRow -// ---------------------------------------------------------------------------- - -struct DPLastRow_; -typedef Tag DPLastRow; - -// ---------------------------------------------------------------------------- -// Tag DPLastColumn -// ---------------------------------------------------------------------------- - -struct DPLastColumn_; -typedef Tag DPLastColumn; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction IsGlobalAlignment -// ---------------------------------------------------------------------------- - -// Checks if the dp profile is a global alignment. -template -struct IsGlobalAlignment_ : - False {}; - -template -struct IsGlobalAlignment_ >: - True {}; - -template -struct IsGlobalAlignment_ const>: - True {}; - -template -struct IsGlobalAlignment_ >: - IsGlobalAlignment_{}; - -template -struct IsGlobalAlignment_ const>: - IsGlobalAlignment_{}; - -// ---------------------------------------------------------------------------- -// Metafunction TraceTail_ -// ---------------------------------------------------------------------------- - -// define whether to include the 'tail' of an alignment in the trace -template -struct TraceTail_ : - IsGlobalAlignment_{}; - -// ---------------------------------------------------------------------------- -// Metafunction TraceHead_ -// ---------------------------------------------------------------------------- - -// define whether to include the 'head' of an alignment in the trace -template -struct TraceHead_ : - IsGlobalAlignment_{}; - -// ---------------------------------------------------------------------------- -// Metafunction HasTerminationCriterium_ -// ---------------------------------------------------------------------------- - -// check whether an algorithm has an early termination criterium -// if an algorithm has this, it will get a DPscout that can be terminated -// see dp_scout.h for more info -template -struct HasTerminationCriterium_ : - False {}; - -// ---------------------------------------------------------------------------- -// Metafunction IsLocalAlignment_ -// ---------------------------------------------------------------------------- - -// Checks if the dp profile is a local alignment. -template -struct IsLocalAlignment_ : - False {}; - -template -struct IsLocalAlignment_ >: - True {}; - -template -struct IsLocalAlignment_ const>: - True {}; - -template -struct IsLocalAlignment_ >: - IsLocalAlignment_{}; - -template -struct IsLocalAlignment_ const>: - IsLocalAlignment_{}; - -// ---------------------------------------------------------------------------- -// Metafunction IsTracebackEnabled_ -// ---------------------------------------------------------------------------- - -// Checks if the trace-back for the current dp profile is enabled. -template -struct IsTracebackEnabled_ : - False {}; - -template -struct IsTracebackEnabled_ >: - True {}; - -template -struct IsTracebackEnabled_ const>: - True {}; - -template -struct IsTracebackEnabled_ >: - IsTracebackEnabled_{}; - -template -struct IsTracebackEnabled_ const>: - IsTracebackEnabled_{}; - -// ---------------------------------------------------------------------------- -// Metafunction IsGapsLeft_ -// ---------------------------------------------------------------------------- - -template -struct IsGapsLeft_ : False{}; - -template -struct IsGapsLeft_ > > - : True{}; - -template -struct IsGapsLeft_ > - : IsGapsLeft_{}; - -// ---------------------------------------------------------------------------- -// Metafunction IsSingleTrace_ -// ---------------------------------------------------------------------------- - -template -struct IsSingleTrace_ : False{}; - -template -struct IsSingleTrace_ > > -: True{}; - -template -struct IsSingleTrace_ > -: IsSingleTrace_{}; - -// ---------------------------------------------------------------------------- -// Metafunction IsFreeEndGap_ -// ---------------------------------------------------------------------------- - -// Checks if for the current dp profile and a given gap location the algorithm uses free gaps. -template -struct IsFreeEndGap_ : - False {}; - -template -struct IsFreeEndGap_ const, TDPSide>: - IsFreeEndGap_{}; - -template -struct IsFreeEndGap_, TDPSide>: - IsFreeEndGap_{}; - -template -struct IsFreeEndGap_ const, TDPSide>: - True -{}; - -template -struct IsFreeEndGap_, TDPSide>: - True -{}; - -template -struct IsFreeEndGap_ const, TDPSide>: - IsFreeEndGap_ -{}; - -template -struct IsFreeEndGap_, TDPSide>: - IsFreeEndGap_ -{}; - -template -struct IsFreeEndGap_, DPFirstRow>: - True -{}; - -template -struct IsFreeEndGap_ const, DPFirstRow>: - True -{}; - -template -struct IsFreeEndGap_, DPFirstColumn>: - True -{}; - -template -struct IsFreeEndGap_ const, DPFirstColumn>: - True -{}; - -template -struct IsFreeEndGap_, DPLastRow>: - True -{}; - -template -struct IsFreeEndGap_ const, DPLastRow>: - True -{}; - -template -struct IsFreeEndGap_, DPLastColumn>: - True -{}; - -template -struct IsFreeEndGap_ const, DPLastColumn>: - True -{}; - -// ============================================================================ -// Functions -// ============================================================================ - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_PROFILE_H_ diff --git a/seqan/align/dp_scout.h b/seqan/align/dp_scout.h deleted file mode 100644 index 1a6283c..0000000 --- a/seqan/align/dp_scout.h +++ /dev/null @@ -1,269 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// The dp scout is a structure that stores the current maximal score and its -// host position in the underlying dp-matrix. -// This class can be overloaded to implement different behaviors of tracking -// the maximal score, e.g., for the split breakpoint computation. -// ========================================================================== -// Author: Hannes Hauswedell -// ========================================================================== -// The terminator specialization of dp scout offers the possibility to have -// dp generation stop, if specified criteria are met. -// To do this, define HasTerminationCriterium_<> for your algorithm and -// implement a DPScoutState for your terminator specialization. In your -// overloaded _scoutBestScore() or _computeCell() you can call -// terminateScout() on your Scout to have DP-generation stop. -// see dp_scout_xdrop.h for an example. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_TEST_ALIGNMENT_DP_SCOUT_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_TEST_ALIGNMENT_DP_SCOUT_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class Terminator_ -// ---------------------------------------------------------------------------- - -template -struct Terminator_; - -// ---------------------------------------------------------------------------- -// Class DPScoutState_ -// ---------------------------------------------------------------------------- - -template -class DPScoutState_; - -template <> -class DPScoutState_ : public Nothing // empty member optimization -{}; - -// ---------------------------------------------------------------------------- -// Class DPScout_ -// ---------------------------------------------------------------------------- - -template -class DPScout_; - -// The default implementation of the dp scout simply stores one maximum -// and its corresponding position. -// -// The state must be a Nothing and is left untouched and unused. -template -class DPScout_ -{ -public: - typedef typename Value::Type TScoreValue; -// TScoreValue _maxScore; // The maximal score. - TDPCell _maxScore; - unsigned int _maxHostPosition; // The corresponding host position within the underlying dp-matrix. - - DPScout_() : _maxScore(), _maxHostPosition(0) {} - - DPScout_(DPScoutState_ const & /*state*/) : - _maxScore(), _maxHostPosition(0) {} - - DPScout_(DPScout_ const & other) : - _maxScore(other._maxScore), _maxHostPosition(other._maxHostPosition) {} - - DPScout_ & operator=(DPScout_ const & other) - { - if (this != &other) - { - _maxScore = other._maxScore; - _maxHostPosition = other._maxHostPosition; - } - return *this; - } - -}; - -// Terminator_ Specialization -template -class DPScout_ > - : public DPScout_ -{ -public: - typedef DPScout_ TParent; - bool terminationCriteriumMet; - DPScoutState_ > * state; - - DPScout_() - : TParent(), - terminationCriteriumMet(false), - state(0) - {} - - DPScout_(DPScoutState_ > & state) - : TParent(), - terminationCriteriumMet(false), - state(&state) - {} - - DPScout_(DPScout_ const & other) - : TParent(static_cast(other)), - terminationCriteriumMet(other.terminationCriteriumMet), - state(other.state) - {} - - DPScout_ & operator=(DPScout_ const & other) - { - if (this != &other) - { - *static_cast(this) = other; - terminationCriteriumMet = other.terminationCriteriumMet; - state = other.state; - } - return *this; - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction ScoutSpecForAlignmentAlgorithm_ -// ---------------------------------------------------------------------------- - -// Given an alignment algorithm tag such as GlobalAlignment_ or LocalAlignment_, returns the specialization tag for the -// corresponding DPScout_ specialization. - -template -struct ScoutSpecForAlignmentAlgorithm_ -{ - typedef If, - Terminator_<>, - Default> Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction ScoutStateSpecForScout_ -// ---------------------------------------------------------------------------- - -// Given an dp scout this meta-function returns the appropriate specialization for the scout state. - -template -struct ScoutStateSpecForScout_ -{ - typedef Default Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _scoutBestScore() -// ---------------------------------------------------------------------------- - -// Tracks the new score, if it is the new maximum. -template -inline void -_scoutBestScore(DPScout_ & dpScout, - TDPCell const & activeCell, - TTraceMatrixNavigator const & navigator, - bool isLastColumn = false, - bool isLastRow = false) -{ - (void)isLastColumn; - (void)isLastRow; - - if (_scoreOfCell(activeCell) > _scoreOfCell(dpScout._maxScore)) - { - dpScout._maxScore = activeCell; - dpScout._maxHostPosition = position(navigator); - } -} - -// ---------------------------------------------------------------------------- -// Function maxScore() -// ---------------------------------------------------------------------------- - -// Returns the current maximal score. -template -inline typename Value::Type const -maxScore(DPScout_ const & dpScout) -{ - return _scoreOfCell(dpScout._maxScore); -} - -// ---------------------------------------------------------------------------- -// Function maxHostPosition() -// ---------------------------------------------------------------------------- - -// Returns the host position that holds the current maximum score. -template -inline unsigned int -maxHostPosition(DPScout_ const & dpScout) -{ - return dpScout._maxHostPosition; -} - -// ---------------------------------------------------------------------------- -// Function _terminationCriteriumIsMet() -// ---------------------------------------------------------------------------- - -template -inline bool -_terminationCriteriumIsMet(DPScout_ > const & scout) -{ - return scout.terminationCriteriumMet; -} - -// ---------------------------------------------------------------------------- -// Function terminateScout() -// ---------------------------------------------------------------------------- - -template -inline void -terminateScout(DPScout_ > & scout) -{ - scout.terminationCriteriumMet = true; -} - - - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_TEST_ALIGNMENT_DP_SCOUT_H_ diff --git a/seqan/align/dp_setup.h b/seqan/align/dp_setup.h deleted file mode 100644 index 63f802c..0000000 --- a/seqan/align/dp_setup.h +++ /dev/null @@ -1,904 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_SETUP_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_SETUP_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// SubstituteAlignConfig_ -// ---------------------------------------------------------------------------- - -template -struct SubstituteAlignConfig_; - -// 0000 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - -// 0001 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - -// 0010 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 0011 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 0100 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 0101 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 0110 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 0111 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 1000 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 1001 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 1010 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 1011 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 1100 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 1101 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - - -// 1110 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - -// 1111 -template -struct SubstituteAlignConfig_ > -{ - typedef FreeEndGaps_ Type; -}; - -// ---------------------------------------------------------------------------- -// SetUpAlignmentProfile -// ---------------------------------------------------------------------------- - -template -struct SetupAlignmentProfile_; - -// Profile for Needleman-Wunsch algorithm. -template -struct SetupAlignmentProfile_ -{ - typedef typename SubstituteAlignConfig_::Type TFreeEndGaps_; - typedef DPProfile_, LinearGaps, TTraceSwitch> Type; -}; - -// Profile for Gotoh algorithm. -template -struct SetupAlignmentProfile_ -{ - typedef typename SubstituteAlignConfig_::Type TFreeEndGaps_; - typedef DPProfile_, AffineGaps, TTraceSwitch> Type; -}; - -// Profile for Smith-Waterman algorithm. -template -struct SetupAlignmentProfile_ -{ - typedef DPProfile_, TGapCosts, TTraceSwitch> Type; -}; - -// Profile for Waterman-Eggert algorithm -template -struct SetupAlignmentProfile_ -{ - typedef DPProfile_, TGapCosts, TracebackOn > > Type; -}; - - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _setUpAndRunAlignment() [Unbanded] -// ---------------------------------------------------------------------------- - -// Interface without AlignConfig. -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlgoTag const &, - TGapsTag const &) -{ - typedef Score TScoringScheme; - typedef typename SequenceEntryForScore::Type TSequenceHEntry; - typedef typename SequenceEntryForScore::Type TSequenceVEntry; - - SEQAN_ASSERT_GEQ(length(seqH), 1u); - SEQAN_ASSERT_GEQ(length(seqV), 1u); - - TSequenceHEntry seqHEntry = sequenceEntryForScore(scoringScheme, seqH, 0); - TSequenceVEntry seqVEntry = sequenceEntryForScore(scoringScheme, seqV, 0); - - if (scoreGapExtendHorizontal(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenHorizontal(scoringScheme, seqHEntry, seqVEntry) || - scoreGapExtendVertical(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenVertical(scoringScheme, seqHEntry, seqVEntry)) - { - typedef typename SetupAlignmentProfile_, AffineGaps, TracebackOn >::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(), TDPProfile()); - } - else - { - typedef typename SetupAlignmentProfile_, LinearGaps, TracebackOn >::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(), TDPProfile()); - } -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlgoTag const & algoTag, - TGapsTag const & gapsTag) -{ - DPScoutState_ noState; - return _setUpAndRunAlignment(traceSegments, noState, seqH, seqV, scoringScheme, algoTag, gapsTag); -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlgoTag const & algoTag) -{ - return _setUpAndRunAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, algoTag, TracebackConfig_()); -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlgoTag const & algoTag) -{ - DPScoutState_ noState; - return _setUpAndRunAlignment(traceSegments, noState, seqH, seqV, scoringScheme, algoTag, TracebackConfig_()); -} - -// Interface with AlignConfig. -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const &, - TAlgoTag const &, - TGapsTag const &) -{ - typedef Score TScoringScheme; - typedef typename SequenceEntryForScore::Type TSequenceHEntry; - typedef typename SequenceEntryForScore::Type TSequenceVEntry; - typedef AlignConfig TAlignConfig; - - SEQAN_ASSERT_GEQ(length(seqH), 1u); - SEQAN_ASSERT_GEQ(length(seqV), 1u); - - TSequenceHEntry seqHEntry = sequenceEntryForScore(scoringScheme, seqH, 0); - TSequenceVEntry seqVEntry = sequenceEntryForScore(scoringScheme, seqV, 0); - - if (scoreGapExtendHorizontal(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenHorizontal(scoringScheme, seqHEntry, seqVEntry) || - scoreGapExtendVertical(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenVertical(scoringScheme, seqHEntry, seqVEntry)) - { - typedef typename SetupAlignmentProfile_ >::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(), TDPProfile()); - } - else - { - typedef typename SetupAlignmentProfile_ >::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(), TDPProfile()); - } -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag) -{ - return _setUpAndRunAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, alignConfig, algoTag, - TracebackConfig_()); -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag, - TGapsTag const & gapsTag) -{ - DPScoutState_ noState; - return _setUpAndRunAlignment(traceSegments, noState, seqH, seqV, scoringScheme, alignConfig, algoTag, gapsTag); -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag) -{ - DPScoutState_ noState; - return _setUpAndRunAlignment(traceSegments, noState, seqH, seqV, scoringScheme, alignConfig, algoTag, TracebackConfig_()); -} - -// Interface without AlignConfig and with traceback disabled. -template -typename Value >::Type -_setUpAndRunAlignment(DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlgoTag const &, - TGapsTag const & /*unused*/) -{ - typedef Score TScoringScheme; - typedef typename SequenceEntryForScore::Type TSequenceHEntry; - typedef typename SequenceEntryForScore::Type TSequenceVEntry; - - SEQAN_ASSERT_GEQ(length(seqH), 1u); - SEQAN_ASSERT_GEQ(length(seqV), 1u); - - String > traceSegments; - - TSequenceHEntry seqHEntry = sequenceEntryForScore(scoringScheme, seqH, 0); - TSequenceVEntry seqVEntry = sequenceEntryForScore(scoringScheme, seqV, 0); - - if (scoreGapExtendHorizontal(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenHorizontal(scoringScheme, seqHEntry, seqVEntry) || - scoreGapExtendVertical(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenVertical(scoringScheme, seqHEntry, seqVEntry)) - { - typedef typename SetupAlignmentProfile_, AffineGaps, TracebackOff>::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(), TDPProfile()); - } - else - { - typedef typename SetupAlignmentProfile_, LinearGaps, TracebackOff>::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(), TDPProfile()); - } -} - -template -typename Value >::Type -_setUpAndRunAlignment(DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlgoTag const & algoTag) -{ - return _setUpAndRunAlignment(dpScoutState, seqH, seqV, scoringScheme, algoTag, TracebackConfig_()); -} - -template -typename Value >::Type -_setUpAndRunAlignment(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlgoTag const &, - TGapsTag const & gapsTag) -{ - DPScoutState_ noState; - return _setUpAndRunAlignment(noState, seqH, seqV, scoringScheme, gapsTag); -} - -template -typename Value >::Type -_setUpAndRunAlignment(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlgoTag const &) -{ - // Note that GapsLeft could be nothing, is unused in callee without traceback. - DPScoutState_ noState; - return _setUpAndRunAlignment(noState, seqH, seqV, scoringScheme, TracebackConfig_()); -} - -// Interface with AlignConfig and with traceback disabled. -template -typename Value >::Type -_setUpAndRunAlignment(DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const &, - TAlgoTag const &, - TGapsTag const & /*unused*/) -{ - typedef AlignConfig TAlignConfig; - typedef Score TScoringScheme; - typedef typename SequenceEntryForScore::Type TSequenceHEntry; - typedef typename SequenceEntryForScore::Type TSequenceVEntry; - - SEQAN_ASSERT_GEQ(length(seqH), 1u); - SEQAN_ASSERT_GEQ(length(seqV), 1u); - - String > traceSegments; - - TSequenceHEntry seqHEntry = sequenceEntryForScore(scoringScheme, seqH, 0); - TSequenceVEntry seqVEntry = sequenceEntryForScore(scoringScheme, seqV, 0); - - if (scoreGapExtendHorizontal(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenHorizontal(scoringScheme, seqHEntry, seqVEntry) || - scoreGapExtendVertical(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenVertical(scoringScheme, seqHEntry, seqVEntry)) - { - typedef typename SetupAlignmentProfile_::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(), TDPProfile()); - } - else - { - typedef typename SetupAlignmentProfile_::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(), TDPProfile()); - } -} - -template -typename Value >::Type -_setUpAndRunAlignment(DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const &) -{ - // Note that GapsLeft could be nothing, is unused in callee without traceback. - return _setUpAndRunAlignment(dpScoutState, seqH, seqV, scoringScheme, alignConfig, TracebackConfig_()); -} - -template -typename Value >::Type -_setUpAndRunAlignment(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag, - TGapsTag const & gapsTag) -{ - DPScoutState_ noState; - return _setUpAndRunAlignment(noState, seqH, seqV, scoringScheme, alignConfig, algoTag, gapsTag); -} - -template -typename Value >::Type -_setUpAndRunAlignment(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag) -{ - DPScoutState_ noState; - // Note that GapsLeft could be nothing, is unused in callee without traceback. - return _setUpAndRunAlignment(noState, seqH, seqV, scoringScheme, alignConfig, algoTag, TracebackConfig_()); -} - -// ---------------------------------------------------------------------------- -// Function _setUpAndRunAlignment() [Banded] -// ---------------------------------------------------------------------------- - -// Interface without AlignConfig. -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const &, - TGapsTag const &) -{ - typedef Score TScoringScheme; - typedef typename SequenceEntryForScore::Type TSequenceHEntry; - typedef typename SequenceEntryForScore::Type TSequenceVEntry; - - SEQAN_ASSERT_GEQ(length(seqH), 1u); - SEQAN_ASSERT_GEQ(length(seqV), 1u); - - TSequenceHEntry seqHEntry = sequenceEntryForScore(scoringScheme, seqH, 0); - TSequenceVEntry seqVEntry = sequenceEntryForScore(scoringScheme, seqV, 0); - - if (scoreGapExtendHorizontal(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenHorizontal(scoringScheme, seqHEntry, seqVEntry) || - scoreGapExtendVertical(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenVertical(scoringScheme, seqHEntry, seqVEntry)) - { - typedef typename SetupAlignmentProfile_, AffineGaps, TracebackOn >::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(lowerDiagonal, upperDiagonal), TDPProfile()); - } - else - { - typedef typename SetupAlignmentProfile_, LinearGaps, TracebackOn >::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(lowerDiagonal, upperDiagonal), TDPProfile()); - } -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag) -{ - // Note that GapsLeft could be nothing, is unused in callee without traceback. - return _setUpAndRunAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, lowerDiagonal, upperDiagonal, - algoTag, TracebackConfig_()); -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag, - TGapsTag const & /*ignored*/) -{ - DPScoutState_ noState; - return _setUpAndRunAlignment(traceSegments, noState, seqH, seqV, scoringScheme, lowerDiagonal, upperDiagonal, algoTag); -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag) -{ - // Note that GapsLeft could be nothing, is unused in callee without traceback. - return _setUpAndRunAlignment(traceSegments, seqH, seqV, scoringScheme, lowerDiagonal, upperDiagonal, algoTag, TracebackConfig_()); -} - -// Interface with AlignConfig. -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlignConfig const &, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const &, - TGapsTag const &) -{ - typedef Score TScoringScheme; - typedef typename SequenceEntryForScore::Type TSequenceHEntry; - typedef typename SequenceEntryForScore::Type TSequenceVEntry; - - SEQAN_ASSERT_GEQ(length(seqH), 1u); - SEQAN_ASSERT_GEQ(length(seqV), 1u); - - TSequenceHEntry seqHEntry = sequenceEntryForScore(scoringScheme, seqH, 0); - TSequenceVEntry seqVEntry = sequenceEntryForScore(scoringScheme, seqV, 0); - - if (scoreGapExtendHorizontal(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenHorizontal(scoringScheme, seqHEntry, seqVEntry) || - scoreGapExtendVertical(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenVertical(scoringScheme, seqHEntry, seqVEntry)) - { - typedef typename SetupAlignmentProfile_ >::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(lowerDiagonal, upperDiagonal), TDPProfile()); - } - else - { - typedef typename SetupAlignmentProfile_ >::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(lowerDiagonal, upperDiagonal), TDPProfile()); - } -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlignConfig const & alignConfig, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag) -{ - return _setUpAndRunAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, alignConfig, - lowerDiagonal, upperDiagonal, algoTag, TracebackConfig_()); -} - - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlignConfig const & alignConfig, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag, - TGapsTag const & gapsTag) -{ - DPScoutState_ noState; - return _setUpAndRunAlignment(traceSegments, noState, seqH, seqV, scoringScheme, alignConfig, lowerDiagonal, - upperDiagonal, algoTag, gapsTag); -} - -template -typename Value >::Type -_setUpAndRunAlignment(String & traceSegments, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlignConfig const & alignConfig, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag) -{ - return _setUpAndRunAlignment(traceSegments, seqH, seqV, scoringScheme, alignConfig, lowerDiagonal, upperDiagonal, - algoTag, TracebackConfig_()); -} - -// Interface without AlignConfig and with traceback disabled. -template -typename Value >::Type -_setUpAndRunAlignment(DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const &, - TGapsTag const &) -{ -// typedef String const TSequenceH; -// typedef String const TSequenceV; - typedef Score TScoringScheme; - typedef typename SequenceEntryForScore::Type TSequenceHEntry; - typedef typename SequenceEntryForScore::Type TSequenceVEntry; - - SEQAN_ASSERT_GEQ(length(seqH), 1u); - SEQAN_ASSERT_GEQ(length(seqV), 1u); - - String > traceSegments; - - TSequenceHEntry seqHEntry = sequenceEntryForScore(scoringScheme, seqH, 0); - TSequenceVEntry seqVEntry = sequenceEntryForScore(scoringScheme, seqV, 0); - - if (scoreGapExtendHorizontal(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenHorizontal(scoringScheme, seqHEntry, seqVEntry) || - scoreGapExtendVertical(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenVertical(scoringScheme, seqHEntry, seqVEntry)) - { - typedef typename SetupAlignmentProfile_, AffineGaps, TracebackOff>::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(lowerDiagonal, upperDiagonal), TDPProfile()); - } - else - { - typedef typename SetupAlignmentProfile_, LinearGaps, TracebackOff>::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(lowerDiagonal, upperDiagonal), TDPProfile()); - } -} - -template -typename Value >::Type -_setUpAndRunAlignment(DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag) -{ - // Note that GapsLeft could be nothing, is unused in callee without traceback. - return _setUpAndRunAlignment(dpScoutState, seqH, seqV, scoringScheme, lowerDiagonal, upperDiagonal, algoTag, - TracebackConfig_()); -} - -template -typename Value >::Type -_setUpAndRunAlignment(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag) -{ - DPScoutState_ noState; - return _setUpAndRunAlignment(noState, seqH, seqV, scoringScheme, lowerDiagonal, upperDiagonal, algoTag, TracebackConfig_()); -} - -// Interface with AlignConfig and with traceback disabled. -template -typename Value >::Type -_setUpAndRunAlignment(DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const &, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const &, - TGapsTag const & /*ignored*/) -{ - typedef AlignConfig TAlignConfig; -// typedef String const TSequenceH; -// typedef String const TSequenceV; - typedef Score TScoringScheme; - typedef typename SequenceEntryForScore::Type TSequenceHEntry; - typedef typename SequenceEntryForScore::Type TSequenceVEntry; - - SEQAN_ASSERT_GEQ(length(seqH), 1u); - SEQAN_ASSERT_GEQ(length(seqV), 1u); - - String > traceSegments; - - TSequenceHEntry seqHEntry = sequenceEntryForScore(scoringScheme, seqH, 0); - TSequenceVEntry seqVEntry = sequenceEntryForScore(scoringScheme, seqV, 0); - - if (scoreGapExtendHorizontal(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenHorizontal(scoringScheme, seqHEntry, seqVEntry) || - scoreGapExtendVertical(scoringScheme, seqHEntry, seqVEntry) != - scoreGapOpenVertical(scoringScheme, seqHEntry, seqVEntry)) - { - typedef typename SetupAlignmentProfile_::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(lowerDiagonal, upperDiagonal), TDPProfile()); - } - else - { - typedef typename SetupAlignmentProfile_::Type TDPProfile; - return _computeAlignment(traceSegments, dpScoutState, seqH, seqV, scoringScheme, DPBand_(lowerDiagonal, upperDiagonal), TDPProfile()); - } -} - -template -typename Value >::Type -_setUpAndRunAlignment(DPScoutState_ & dpScoutState, - TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag) -{ - // Note that GapsLeft could be nothing, is unused in callee without traceback. - return _setUpAndRunAlignment(dpScoutState, seqH, seqV, scoringScheme, alignConfig, lowerDiagonal, upperDiagonal, - algoTag, TracebackConfig_()); -} - -template -typename Value >::Type -_setUpAndRunAlignment(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag, - TGapsTag const & /*ignored*/) -{ - DPScoutState_ noState; - return _setUpAndRunAlignment(noState, seqH, seqV, scoringScheme, alignConfig, lowerDiagonal, upperDiagonal, - algoTag); -} - -template -typename Value >::Type -_setUpAndRunAlignment(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiagonal, - int upperDiagonal, - TAlgoTag const & algoTag) -{ - // Note that GapsLeft could be nothing, is unused in callee without traceback. - return _setUpAndRunAlignment(seqH, seqV, scoringScheme, alignConfig, lowerDiagonal, upperDiagonal, algoTag, TracebackConfig_()); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_SETUP_H_ diff --git a/seqan/align/dp_trace_segment.h b/seqan/align/dp_trace_segment.h deleted file mode 100644 index c2fb366..0000000 --- a/seqan/align/dp_trace_segment.h +++ /dev/null @@ -1,341 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// -// The TraceSegment structure is used to store the traceback in a common -// structure such that we can easiely adapt them afterwards in the -// user-defined structure, such as Align or AlignmentGraph objects. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_TRACE_SEGMENT_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_TRACE_SEGMENT_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class TraceSegment -// ---------------------------------------------------------------------------- - -// TraceSegments are used as a common interface to all structures that can represent an alignment. -// -// See alignment_dp_traceback_adaptor.h to find methods for adaption. -template -class TraceSegment_ -{ -public: - typedef typename TraceBitMap_::TTraceValue TTraceValue; - - TPosition _horizontalBeginPos; // the begin position in horizontal dimension - TPosition _verticalBeginPos; // the begin position in vertical dimension - TSize _length; // the length of the segment - TTraceValue _traceValue; // the trace direction - - TraceSegment_() : - _horizontalBeginPos(0), _verticalBeginPos(0), _length(0), _traceValue(+TraceBitMap_::NONE){} - - TraceSegment_(TraceSegment_ const & other) : - _horizontalBeginPos(other._horizontalBeginPos), - _verticalBeginPos(other._verticalBeginPos), - _length(other._length), - _traceValue(other._traceValue) {} - - TraceSegment_(TPosition const & horizontalBeginPos, TPosition const & verticalBeginPos, TSize const & length, - TTraceValue const & traceValue) : - _horizontalBeginPos(horizontalBeginPos), - _verticalBeginPos(verticalBeginPos), - _length(length), - _traceValue(traceValue) {} - - TraceSegment_ & - operator=(TraceSegment_ const & other) - { - if (this != &other) - { - _horizontalBeginPos = other._horizontalBeginPos; - _verticalBeginPos = other._verticalBeginPos; - _length = other._length; - _traceValue = other._traceValue; - } - return *this; - } - -}; - - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction Position -// ---------------------------------------------------------------------------- - -template -struct Position > -{ - typedef TPosition Type; -}; - -template -struct Position const>: - Position >{}; - -// ---------------------------------------------------------------------------- -// Metafunction Size -// ---------------------------------------------------------------------------- - -template -struct Size > -{ - typedef TSize Type; -}; - -template -struct Size const>: - Size >{}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _getBeginHorizontal() -// ---------------------------------------------------------------------------- - -// The begin position of the segment in horizontal dimension. -template -inline TPosition -_getBeginHorizontal(TraceSegment_ const & traceSegment) -{ - return traceSegment._horizontalBeginPos; -} - -// ---------------------------------------------------------------------------- -// Function _getBeginVertical() -// ---------------------------------------------------------------------------- - -// The begin position of the segment in vertical dimension. -template -inline TPosition -_getBeginVertical(TraceSegment_ const & traceSegment) -{ - return traceSegment._verticalBeginPos; -} - -// ---------------------------------------------------------------------------- -// Function _getEndHorizontal() -// ---------------------------------------------------------------------------- - -// The end position of the segment in horizontal dimension. -template -inline TPosition -_getEndHorizontal(TraceSegment_ const & traceSegment) -{ - if (traceSegment._traceValue & (TraceBitMap_::HORIZONTAL | TraceBitMap_::DIAGONAL)) - { - return traceSegment._horizontalBeginPos + traceSegment._length; - } - return traceSegment._horizontalBeginPos; -} - -// ---------------------------------------------------------------------------- -// Function _getEndVertical() -// ---------------------------------------------------------------------------- - -// The end position of the segment in vertical dimension. -template -inline TPosition -_getEndVertical(TraceSegment_ const & traceSegment) -{ - if (traceSegment._traceValue & (TraceBitMap_::VERTICAL | TraceBitMap_::DIAGONAL)) - { - return traceSegment._verticalBeginPos + traceSegment._length; - } - return traceSegment._verticalBeginPos; -} - -// ---------------------------------------------------------------------------- -// Function _getTraceValue() -// ---------------------------------------------------------------------------- - -// The end position of the segment in vertical dimension. -template -inline typename TraceSegment_::TTraceValue -_getTraceValue(TraceSegment_ const & traceSegment) -{ - return traceSegment._traceValue; -} - -// ---------------------------------------------------------------------------- -// Function length() -// ---------------------------------------------------------------------------- - -// The length of the segment. -template -inline TSize -length(TraceSegment_ const & traceSegment) -{ - return traceSegment._length; -} - -// ---------------------------------------------------------------------------- -// Function _setLength() -// ---------------------------------------------------------------------------- - -// The length of the segment. -template -inline void -_setLength(TraceSegment_ & traceSegment, TSize newLength) -{ - traceSegment._length = newLength; -} - - - -// ---------------------------------------------------------------------------- -// Function _translateTraceValue() -// ---------------------------------------------------------------------------- - -// Translates the trace value into a human-readable format. -// -// Note, used for debugging reasons only. -template -String _translateTraceValue(TTraceValue const & traceValue) -{ - String transcript; - - if ((traceValue & TraceBitMap_::DIAGONAL) == TraceBitMap_::DIAGONAL) - append(transcript, 'D'); - if ((traceValue & TraceBitMap_::VERTICAL) == TraceBitMap_::VERTICAL) - append(transcript, 'V'); - if ((traceValue & TraceBitMap_::HORIZONTAL) == TraceBitMap_::HORIZONTAL) - append(transcript, 'H'); - if ((traceValue & TraceBitMap_::VERTICAL_OPEN) == TraceBitMap_::VERTICAL_OPEN) - append(transcript, 'v'); - if ((traceValue & TraceBitMap_::HORIZONTAL_OPEN) == TraceBitMap_::HORIZONTAL_OPEN) - append(transcript, 'h'); - if ((traceValue & TraceBitMap_::MAX_FROM_VERTICAL_MATRIX) == TraceBitMap_::MAX_FROM_VERTICAL_MATRIX) - append(transcript, '|'); - if ((traceValue & TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX) == TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX) - append(transcript, '-'); - - if ((traceValue) == TraceBitMap_::NONE) - append(transcript, '0'); - return transcript; -} - -// ---------------------------------------------------------------------------- -// Function oerpator<<() -// ---------------------------------------------------------------------------- - -template -TStream & operator<<(TStream & stream, TraceSegment_ const & traceSegment) -{ - stream << _translateTraceValue(traceSegment._traceValue) << "-"; - stream << "(" << traceSegment._horizontalBeginPos << ", " << traceSegment._verticalBeginPos << ", " << - traceSegment._length << ")"; - return stream; -} - -// ---------------------------------------------------------------------------- -// Function oerpator==() -// ---------------------------------------------------------------------------- - -template -inline bool operator==(TraceSegment_ const & left, TraceSegment_ const & right) -{ - if (left._horizontalBeginPos != right._horizontalBeginPos) - return false; - - if (left._verticalBeginPos != right._verticalBeginPos) - return false; - - if (left._length != right._length) - return false; - - if (left._traceValue != right._traceValue) - return false; - - return true; -} - -// ---------------------------------------------------------------------------- -// Function oerpator!=() -// ---------------------------------------------------------------------------- - -template -inline bool operator!=(TraceSegment_ const & left, TraceSegment_ const & right) -{ - return !(left == right); -} - -// ---------------------------------------------------------------------------- -// Function recordSegment() -// ---------------------------------------------------------------------------- - -// Records a segment given the horizontal and vertical begin position, the length, -// and the corrsponding trace value. -// -// The first parameter is the container the segment is recorded to. -template -inline void _recordSegment(TTraceSegments & traceSegments, - TPositionH const & horizontalBeginPos, - TPositionV const & verticalBeginPos, - TSize const & segmentLength, - TTraceValue const & traceValue) -{ - typedef typename Value::Type TTraceSegment; - - if (segmentLength == 0) - return; // we don't store empty segments - - if (traceValue & TraceBitMap_::DIAGONAL) - appendValue(traceSegments, TTraceSegment(horizontalBeginPos, verticalBeginPos, segmentLength, +TraceBitMap_::DIAGONAL)); - else if (traceValue & TraceBitMap_::VERTICAL) - appendValue(traceSegments, TTraceSegment(horizontalBeginPos, verticalBeginPos, segmentLength, +TraceBitMap_::VERTICAL)); - else if (traceValue & TraceBitMap_::HORIZONTAL) - appendValue(traceSegments, TTraceSegment(horizontalBeginPos, verticalBeginPos, segmentLength, +TraceBitMap_::HORIZONTAL)); - // everything else is not tracked. -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_TRACE_SEGMENT_H_ diff --git a/seqan/align/dp_traceback_adaptor.h b/seqan/align/dp_traceback_adaptor.h deleted file mode 100644 index e06674f..0000000 --- a/seqan/align/dp_traceback_adaptor.h +++ /dev/null @@ -1,342 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Rene Rahn -// ========================================================================== -// Adaptor methods to transcribe a set of trace segments into the -// alignment representing structure. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_TRACEBACK_ADAPTOR_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_TRACEBACK_ADAPTOR_H_ - -namespace seqan { - -// ---------------------------------------------------------------------------- -// Function _writeTraceSegmentToFile() -// ---------------------------------------------------------------------------- - -template -inline void _writeTraceSegmentToFile(TFile & file, TSeq0Value const & seq0Val, TSeq1Value const & seq1Val) -{ - streamPut(file, '('); - streamPut(file, seq0Val); - streamPut(file, ','); - streamPut(file, seq1Val); - streamPut(file, ')'); - streamPut(file, '\n'); -} - -// ---------------------------------------------------------------------------- -// Function _adaptTraceSegmentsTo() [Gaps] -// ---------------------------------------------------------------------------- - -template -void -_adaptTraceSegmentsTo(Gaps & gapsHorizontal, - Gaps & gapsVertical, - String, TStringSpec> const & traceSegments) -{ - typedef Gaps TGapsHorizontal; - typedef Gaps TGapsVertical; - typedef typename Iterator::Type TIteratorHorizontal; - typedef typename Iterator::Type TIteratorVertical; - typedef TraceSegment_ TTraceSegment; - typedef typename Iterator const>::Type TTraceIterator; - - clearGaps(gapsHorizontal); - clearClipping(gapsHorizontal); - - clearGaps(gapsVertical); - clearClipping(gapsVertical); - - // Set clipping to 0 - if (empty(traceSegments)) - { - setClippedBeginPosition(gapsHorizontal, 0); - setClippedEndPosition(gapsHorizontal, 0); - setClippedBeginPosition(gapsVertical, 0); - setClippedEndPosition(gapsVertical, 0); - return; - } - - TTraceIterator srcIter = end(traceSegments) - 1; - TTraceIterator srcEnd = begin(traceSegments) - 1; - - // we build the gap structure here. - // set the clipped begin position of the alignment. - setBeginPosition(gapsHorizontal, _getBeginHorizontal(value(srcIter))); // begin of source - setBeginPosition(gapsVertical, _getBeginVertical(value(srcIter))); - - TIteratorHorizontal it0 = begin(gapsHorizontal); - TIteratorVertical it1 = begin(gapsVertical); - - while (srcIter != srcEnd) - { - TSize segmentSize = value(srcIter)._length; - switch (value(srcIter)._traceValue) - { - case TraceBitMap_::HORIZONTAL: - insertGaps(it1, segmentSize); - break; - - case TraceBitMap_::VERTICAL: - insertGaps(it0, segmentSize); - break; - } - goFurther(it0, segmentSize); - goFurther(it1, segmentSize); - --srcIter; - } - setClippedEndPosition(gapsHorizontal, position(it0) + clippedBeginPosition(gapsHorizontal)); - setClippedEndPosition(gapsVertical, position(it1) + clippedBeginPosition(gapsVertical)); -} - -// ---------------------------------------------------------------------------- -// Function _adaptTraceSegmentsTo() [AlignmentGraph] -// ---------------------------------------------------------------------------- - -template -inline void -_adaptTraceSegmentsTo(Graph > & g, - TSequenceIdH const & seqHId, - TSequenceIdV const & seqVId, - String, TStringSpec> const & traceSegments) -{ - typedef TraceSegment_ TTraceSegment; - // check begin and end positions of the graph. - - // Not safe! - - if (empty(traceSegments)) - return; - - // insert leading gaps - TTraceSegment traceBegin = traceSegments[length(traceSegments) - 1]; - if (_getBeginVertical(traceBegin) != 0) - { - addVertex(g, seqVId, 0, _getBeginVertical(traceBegin)); - } - if (_getBeginHorizontal(traceBegin) != 0) - { - addVertex(g, seqHId, 0, _getBeginHorizontal(traceBegin)); - } - - - for (TSize i = 0; i < length(traceSegments); ++i) - { - - switch (traceSegments[i]._traceValue) - { - case TraceBitMap_::DIAGONAL: - addEdge(g, addVertex(g, seqHId, traceSegments[i]._horizontalBeginPos, traceSegments[i]._length), - addVertex(g, seqVId, traceSegments[i]._verticalBeginPos, traceSegments[i]._length)); - break; - - case TraceBitMap_::VERTICAL: - addVertex(g, seqVId, traceSegments[i]._verticalBeginPos, traceSegments[i]._length); - break; - - case TraceBitMap_::HORIZONTAL: - addVertex(g, seqHId, traceSegments[i]._horizontalBeginPos, traceSegments[i]._length); - break; - } - } - - // insert trailing gaps - TTraceSegment traceEnd = traceSegments[0]; - if (_getEndVertical(traceEnd) != length(value(stringSet(g), idToPosition(stringSet(g), seqVId)))) - { - addVertex(g, seqVId, _getEndVertical(traceEnd), - length(value(stringSet(g), idToPosition(stringSet(g), seqVId))) - _getEndVertical(traceEnd)); - } - if (_getEndHorizontal(traceEnd) != length(value(stringSet(g), idToPosition(stringSet(g), seqHId)))) - { - addVertex(g, seqHId, _getEndHorizontal(traceEnd), - length(value(stringSet(g), idToPosition(stringSet(g), seqHId))) - _getEndHorizontal(traceEnd)); - } -} - -// ---------------------------------------------------------------------------- -// Function _adaptTraceSegmentsTo() [File] -// ---------------------------------------------------------------------------- - -template -inline void -_adaptTraceSegmentsTo(TFile & file, - TSequenceH const & seqH, - TSequenceV const & seqV, - String, TStringSpec> const & traceSegments) -{ - for (TSize k = length(traceSegments); k > (TSize) 0; --k) - { - switch (traceSegments[k - 1]._traceValue) - { - case TraceBitMap_::DIAGONAL: - { - int j = traceSegments[k - 1]._verticalBeginPos; - for (int i = traceSegments[k - 1]._horizontalBeginPos; i < (int) (traceSegments[k - 1]._horizontalBeginPos + traceSegments[k - 1]._length); ++i) - { - _writeTraceSegmentToFile(file, seqH[i], seqV[j]); - ++j; - } - break; - } - - case TraceBitMap_::VERTICAL: - { - for (int i = traceSegments[k - 1]._verticalBeginPos; i < (int) (traceSegments[k - 1]._verticalBeginPos + traceSegments[k - 1]._length); ++i) - { - _writeTraceSegmentToFile(file, gapValue(), seqV[i]); - } - break; - } - - case TraceBitMap_::HORIZONTAL: - { - for (int i = traceSegments[k - 1]._horizontalBeginPos; i < (int) (traceSegments[k - 1]._horizontalBeginPos + traceSegments[k - 1]._length); ++i) - { - _writeTraceSegmentToFile(file, seqH[i], gapValue()); - } - break; - } - } - } -} - -// ---------------------------------------------------------------------------- -// Function _adaptTraceSegmentsTo() [Fragments] -// ---------------------------------------------------------------------------- - -template -inline void -_adaptTraceSegmentsTo(String, TStringSpec> & matches, - TSequenceH const & seqHId, - TSequenceV const & seqVId, - String, TStringSpec2> const & traceSegments) -{ - typedef Fragment TFragment; - - for (TSize2 i = 0; i < length(traceSegments); ++i) - { - if (traceSegments[i]._traceValue == TraceBitMap_::DIAGONAL) - { - appendValue( - matches, - TFragment(seqHId, traceSegments[i]._horizontalBeginPos, seqVId, - traceSegments[i]._verticalBeginPos, traceSegments[i]._length), - Generous()); - } - } -} - -// ---------------------------------------------------------------------------- -// Function _adaptTraceSegmentsTo() [VertexDescriptor] -// ---------------------------------------------------------------------------- - -//// TODO (rmaerker): Check if we really need this! -//template -//inline void -//_adaptTraceSegmentsTo(String > & /*nodeString*/, -// TSequence0 const & /*seq0*/, -// TSequence1 const & /*seq1*/, -// String, TStringSpec> const & /*traceSegments*/) -//{ -// typedef String TVertexDescriptorString; -// typedef typename Size::Type TSize; -// typedef typename Iterator::Type TStringIter; -// TVertexDescriptor nilVertex = getNil(); - - -// TODO (rmaerker): see how to adapt this code here for the new structure. -// // TraceBack values -// TTraceValue Diagonal = 0; TTraceValue Horizontal = 1; TTraceValue Vertical = 2; -// -// if (segLen == 0) return; -// // Number of vertex descriptors in the first string at any position (e.g., group of 5 sequences = group of 5 vertex descriptors) -// TSize len1 = length(getValue(getValue(str,0), 0)); -// // Number of vertex descriptors in the second string at any position (e.g., group of 5 sequences = group of 5 vertex descriptors) -// TSize len2 = length(getValue(getValue(str,1), 0)); -// -// // Resize the node string -// TSize index = length(nodeString); -// resize(nodeString, index + segLen); -// -// if (tv == Horizontal) { -// for (int i = pos1 + segLen - 1; i>= (int) pos1;--i) { -// resize(value(nodeString, index), len1 + len2, nilVertex); -// TStringIter it = beSEQAN_CHECKPOINTgin(value(nodeString, index)); -// for(TPos all = 0;all= (int) pos2;--i) { -// resize(value(nodeString, index), len1 + len2, nilVertex); -// TStringIter it = begin(value(nodeString, index)); -// it+=len1; -// for(TPos all = 0;all= (int) pos1;--i) { -// resize(value(nodeString, index), len1 + len2); -// TStringIter it = begin(value(nodeString, index)); -// for(TPos all = 0;all -// ========================================================================== -// Implements the traceback algorithm. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_TRACEBACK_IMPL_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_TRACEBACK_IMPL_H_ - -// TODO(holtgrew): GapsRight traceback is currently untested. -// TODO(rmaerker): Change Tracback to TraceConfig | TraceBackOff - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class TracebackCoordinator_ -// ---------------------------------------------------------------------------- - -template -class TracebackCoordinator_ -{ -public: - TPosition _currColumn; - TPosition _currRow; - TPosition _endColumn; - TPosition _endRow; - TPosition _breakpoint1; // First breakpoint where banded trace switches to unbanded trace. - TPosition _breakpoint2; // Second breakpoint where unbanded trace switches back to banded trace. Only if begin of upper diagonal is bigger than end of lower diagonal. - bool _isInBand; - - template - TracebackCoordinator_(TPosition currColumn, - TPosition currRow, - DPBand_ const & band, - TSizeH seqHSize, - TSizeV seqVSize) - : _currColumn(currColumn), - _currRow(currRow), - _endColumn(0u), - _endRow(0u), - _breakpoint1(0u), - _breakpoint2(0u), - _isInBand(false) - { - _initTracebackCoordinator(*this, band, seqHSize, seqVSize); - } - - template - TracebackCoordinator_(TPosition currColumn, - TPosition currRow, - TPosition endColumn, - TPosition endRow, - DPBand_ const & band, - TSizeH seqHSize, - TSizeV seqVSize) - : _currColumn(currColumn), - _currRow(currRow), - _endColumn(endColumn), - _endRow(endRow), - _breakpoint1(0u), - _breakpoint2(0u), - _isInBand(false) - { - _initTracebackCoordinator(*this, band, seqHSize, seqVSize); - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction PreferGapsAtEnd_ -// ---------------------------------------------------------------------------- - -// Checks whether the gaps at the end should be preferred over a matching area. -template -struct PreferGapsAtEnd_ : False{}; - -template -struct PreferGapsAtEnd_ > : True{}; - -template -struct PreferGapsAtEnd_ > > > : True{}; - - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _hasReachedEnd() -// ---------------------------------------------------------------------------- - -template -inline bool -_hasReachedEnd(TracebackCoordinator_ const & coordinator) -{ - return coordinator._currColumn <= coordinator._endColumn || coordinator._currRow <= coordinator._endRow; -} - -// ---------------------------------------------------------------------------- -// Function _initTracebackCoordinator() -// ---------------------------------------------------------------------------- - -template -inline void -_initTracebackCoordinator(TracebackCoordinator_ & coordinator, - DPBand_ const & band, - TSizeH seqHSize, - TSizeV seqVSize) -{ - typedef typename Position >::Type TBandPosition; - if (IsSameType::VALUE) - { - // Adapt the current column value when the lower diagonal is positive (shift right in horizontal direction). - if (lowerDiagonal(band) >= 0) - coordinator._currColumn += static_cast(lowerDiagonal(band)); - // Adapt the current row value when the current column comes after the upper diagonal (shift down in vertical direction). - if (static_cast(coordinator._currColumn) > upperDiagonal(band)) - coordinator._currRow += coordinator._currColumn - upperDiagonal(band); - // Adapt the end row value when the end column comes after the upper diagonal (shift down in vertical direction). - if (static_cast(coordinator._endColumn) > upperDiagonal(band)) - coordinator._endRow += coordinator._endColumn - upperDiagonal(band); - - coordinator._breakpoint1 = _min(seqHSize, static_cast(_max(0, upperDiagonal(band)))); - coordinator._breakpoint2 = _min(seqHSize, static_cast(_max(0, static_cast(seqVSize) + - lowerDiagonal(band)))); - // Update the current row if the current column is before the upper diagoal or the first column where the maximal band size is reached. - if (coordinator._currColumn < _min(coordinator._breakpoint1, coordinator._breakpoint2)) - coordinator._currRow -= _min(coordinator._breakpoint1, coordinator._breakpoint2) - coordinator._currColumn; - coordinator._isInBand = true; - } -} - -// ---------------------------------------------------------------------------- -// Function _isInBand() -// ---------------------------------------------------------------------------- - -template -inline bool -_isInBand(TracebackCoordinator_ const & coordinator) -{ - if (!coordinator._isInBand) - return coordinator._isInBand; - return (coordinator._currColumn > coordinator._breakpoint1 || coordinator._currColumn <= coordinator._breakpoint2); -} - - -// ---------------------------------------------------------------------------- -// Function _doTracebackGoDiagonal() -// ---------------------------------------------------------------------------- - -template -inline void -_doTracebackGoDiagonal(TTarget & target, - TDPTraceMatrixNavigator & matrixNavigator, - TTraceValue & traceValue, - TTraceValue & lastTraceValue, - TSize & fragmentLength, - TracebackCoordinator_ & tracebackCoordinator, - TGapCosts const &) -{ - if (!(lastTraceValue & TraceBitMap_::DIAGONAL)) // the old trace value was not diagonal - { - _recordSegment(target, tracebackCoordinator._currColumn, tracebackCoordinator._currRow, fragmentLength, - lastTraceValue); - - lastTraceValue = TraceBitMap_::DIAGONAL; - fragmentLength = 0; - } - _traceDiagonal(matrixNavigator, _isInBand(tracebackCoordinator)); - traceValue = value(matrixNavigator); - --tracebackCoordinator._currColumn; - --tracebackCoordinator._currRow; - ++fragmentLength; -} - -// ---------------------------------------------------------------------------- -// Function _doTracebackGoVertical() -// ---------------------------------------------------------------------------- - -template -inline void -_doTracebackGoVertical(TTarget & target, - TDPTraceMatrixNavigator & matrixNavigator, - TTraceValue & traceValue, - TTraceValue & lastTraceValue, - TSize & fragmentLength, - TracebackCoordinator_ & tracebackCoordinator, - TGapCosts const &) -{ - if (!(lastTraceValue & TraceBitMap_::VERTICAL)) // the old trace value was not diagonal - { - _recordSegment(target, tracebackCoordinator._currColumn, tracebackCoordinator._currRow, fragmentLength, - lastTraceValue); - - lastTraceValue = TraceBitMap_::VERTICAL; - fragmentLength = 0; - } - // We are in a vertical gap. So continue after we reach the end of the vertical gap. - if (IsSameType::VALUE) - { - while ((!(traceValue & TraceBitMap_::VERTICAL_OPEN) || (traceValue & TraceBitMap_::VERTICAL)) && (tracebackCoordinator._currRow != 1)) - { - _traceVertical(matrixNavigator, _isInBand(tracebackCoordinator)); - traceValue = value(matrixNavigator); - --tracebackCoordinator._currRow; - ++fragmentLength; - } - // We have to ensure, that we do not continue in vertical direction if we reached a vertical_open sign. - _traceVertical(matrixNavigator, _isInBand(tracebackCoordinator)); - // Forbid continuing in vertical direction. - traceValue = value(matrixNavigator); // & (TraceBitMap_::NO_VERTICAL_TRACEBACK | TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX); - --tracebackCoordinator._currRow; - ++fragmentLength; - } - else - { - _traceVertical(matrixNavigator, _isInBand(tracebackCoordinator)); - traceValue = value(matrixNavigator); - --tracebackCoordinator._currRow; - ++fragmentLength; - } -} - -// ---------------------------------------------------------------------------- -// Function _doTracebackMaxFromVertical() -// ---------------------------------------------------------------------------- - -template -inline void -_doTracebackMaxFromVertical(TTarget & target, - TDPTraceMatrixNavigator & matrixNavigator, - TTraceValue & traceValue, - TTraceValue & lastTraceValue, - TSize & fragmentLength, - TracebackCoordinator_ & tracebackCoordinator, - TGapCosts const &) -{ - if (!(lastTraceValue & TraceBitMap_::VERTICAL)) // the old trace value was not diagonal - { - _recordSegment(target, tracebackCoordinator._currColumn, tracebackCoordinator._currRow, fragmentLength, - lastTraceValue); - lastTraceValue = TraceBitMap_::VERTICAL; - fragmentLength = 0; - } - _traceVertical(matrixNavigator, _isInBand(tracebackCoordinator)); - // Forbid continuing in vertical direction. - traceValue = value(matrixNavigator); // & (TraceBitMap_::NO_VERTICAL_TRACEBACK | TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX); - --tracebackCoordinator._currRow; - ++fragmentLength; -} - -// ---------------------------------------------------------------------------- -// Function _doTracebackGoHorizontal() -// ---------------------------------------------------------------------------- - -template -inline void -_doTracebackGoHorizontal(TTarget & target, - TDPTraceMatrixNavigator & matrixNavigator, - TTraceValue & traceValue, - TTraceValue & lastTraceValue, - TSize & fragmentLength, - TracebackCoordinator_ & tracebackCoordinator, - TGapCosts const &) -{ - if (!(lastTraceValue & TraceBitMap_::HORIZONTAL)) // the old trace value was not diagonal - { - _recordSegment(target, tracebackCoordinator._currColumn, tracebackCoordinator._currRow, fragmentLength, - lastTraceValue); - - lastTraceValue = TraceBitMap_::HORIZONTAL; - fragmentLength = 0; - } - if (IsSameType::VALUE) - { - while ((!(traceValue & TraceBitMap_::HORIZONTAL_OPEN) || (traceValue & TraceBitMap_::HORIZONTAL)) && (tracebackCoordinator._currColumn != 1)) - { - _traceHorizontal(matrixNavigator, _isInBand(tracebackCoordinator)); - traceValue = value(matrixNavigator); - --tracebackCoordinator._currColumn; - ++fragmentLength; - } - _traceHorizontal(matrixNavigator, _isInBand(tracebackCoordinator)); - // Forbid continuing in horizontal direction. - traceValue = value(matrixNavigator); // & (TraceBitMap_::NO_HORIZONTAL_TRACEBACK | TraceBitMap_::MAX_FROM_VERTICAL_MATRIX); - --tracebackCoordinator._currColumn; - ++fragmentLength; - } - else - { - _traceHorizontal(matrixNavigator, _isInBand(tracebackCoordinator)); - traceValue = value(matrixNavigator); - --tracebackCoordinator._currColumn; - ++fragmentLength; - } -} - -// ---------------------------------------------------------------------------- -// Function _doTracebackMaxFromHorizontal() -// ---------------------------------------------------------------------------- - -template -inline void -_doTracebackMaxFromHorizontal(TTarget & target, - TDPTraceMatrixNavigator & matrixNavigator, - TTraceValue & traceValue, - TTraceValue & lastTraceValue, - TSize & fragmentLength, - TracebackCoordinator_ & tracebackCoordinator, - TGapCosts const &) -{ - if (!(lastTraceValue & TraceBitMap_::HORIZONTAL)) // the old trace value was not diagonal - { - _recordSegment(target, tracebackCoordinator._currColumn, tracebackCoordinator._currRow, fragmentLength, - lastTraceValue); - lastTraceValue = TraceBitMap_::HORIZONTAL; - fragmentLength = 0; - } - _traceHorizontal(matrixNavigator, _isInBand(tracebackCoordinator)); - // Forbid continuing in horizontal direction. - traceValue = value(matrixNavigator); // & (TraceBitMap_::NO_HORIZONTAL_TRACEBACK | TraceBitMap_::MAX_FROM_VERTICAL_MATRIX); - --tracebackCoordinator._currColumn; - ++fragmentLength; -} - -// ---------------------------------------------------------------------------- -// Function _doTraceback() -// ---------------------------------------------------------------------------- - -template -inline void -_doTraceback(TTarget & target, - TDPTraceMatrixNavigator & matrixNavigator, - TTraceValue & traceValue, - TTraceValue & lastTraceValue, - TSize & fragmentLength, - TracebackCoordinator_ & tracebackCoordinator, - TGapCosts const & gapsCost, - TIsGapsLeft const & /*isGapsLeft*/) -{ - if (TIsGapsLeft::VALUE) // Gaps should be placed on the left. - { - if (traceValue & TraceBitMap_::DIAGONAL) - { - _doTracebackGoDiagonal(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, gapsCost); - } // In case of Gotoh we prefer the longest possible way in this direction. - else if (traceValue & TraceBitMap_::MAX_FROM_VERTICAL_MATRIX && traceValue & TraceBitMap_::VERTICAL) - { - _doTracebackGoVertical(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, gapsCost); - } - else if (traceValue & TraceBitMap_::MAX_FROM_VERTICAL_MATRIX && traceValue & TraceBitMap_::VERTICAL_OPEN) - { - _doTracebackMaxFromVertical(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, gapsCost); - } - else if (traceValue & TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX && traceValue & TraceBitMap_::HORIZONTAL) - { - _doTracebackGoHorizontal(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, gapsCost); - } - else if (traceValue & TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX && traceValue & TraceBitMap_::HORIZONTAL_OPEN) - { - _doTracebackMaxFromHorizontal(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, gapsCost); - } // In case of Gotoh we prefer the longest possible way in this direction. - else // the trace back is either NONE or something else - { - if (traceValue == TraceBitMap_::NONE) - { - return; - } - SEQAN_ASSERT_FAIL("Reached undefined traceback value!"); - } - } - else // Gaps should be placed on the right. - { - if (traceValue & TraceBitMap_::MAX_FROM_VERTICAL_MATRIX && traceValue & TraceBitMap_::VERTICAL) - { - _doTracebackGoVertical(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, gapsCost); - } - else if (traceValue & TraceBitMap_::MAX_FROM_VERTICAL_MATRIX && traceValue & TraceBitMap_::VERTICAL_OPEN) - { - _doTracebackMaxFromVertical(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, gapsCost); - } - else if (traceValue & TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX && traceValue & TraceBitMap_::HORIZONTAL) - { - _doTracebackGoHorizontal(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, gapsCost); - } - else if (traceValue & TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX && traceValue & TraceBitMap_::HORIZONTAL_OPEN) - { - _doTracebackMaxFromHorizontal(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, gapsCost); - } // In case of Gotoh we prefer the longest possible way in this direction. - else if (traceValue & TraceBitMap_::DIAGONAL) - { - _doTracebackGoDiagonal(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, gapsCost); - } // In case of Gotoh we prefer the longest possible way in this direction. - else // the trace back is either NONE or something else - { - if (traceValue == TraceBitMap_::NONE) - { - return; - } - SEQAN_ASSERT_FAIL("Reached undefined traceback value!"); - } - } -} - -// ---------------------------------------------------------------------------- -// Function _retrieveInitialTraceDirection() -// ---------------------------------------------------------------------------- - -template -inline TTraceValue -_retrieveInitialTraceDirection(TTraceValue & traceValue, TDPProfile const & /*dpProfile*/) -{ - if (PreferGapsAtEnd_::VALUE) - { - if (traceValue & TraceBitMap_::MAX_FROM_VERTICAL_MATRIX) - { - traceValue &= (TraceBitMap_::VERTICAL | TraceBitMap_::VERTICAL_OPEN | TraceBitMap_::MAX_FROM_VERTICAL_MATRIX); - return TraceBitMap_::VERTICAL; - } - else if (traceValue & TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX) - { - traceValue &= (TraceBitMap_::HORIZONTAL | TraceBitMap_::HORIZONTAL_OPEN | TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX); - return TraceBitMap_::HORIZONTAL; - } - return TraceBitMap_::DIAGONAL; // We set the last value to the - } - - if (traceValue & TraceBitMap_::DIAGONAL) - return TraceBitMap_::DIAGONAL; - if (traceValue & (TraceBitMap_::VERTICAL | TraceBitMap_::MAX_FROM_VERTICAL_MATRIX)) - return TraceBitMap_::VERTICAL; - if (traceValue & (TraceBitMap_::HORIZONTAL | TraceBitMap_::MAX_FROM_HORIZONTAL_MATRIX)) - return TraceBitMap_::HORIZONTAL; - - return TraceBitMap_::NONE; -} - -// ---------------------------------------------------------------------------- -// Function _computeTraceback() -// ---------------------------------------------------------------------------- - -template -void _computeTraceback(TTarget & target, - TDPTraceMatrixNavigator & matrixNavigator, - unsigned maxHostPosition, - TSequenceH const & seqH, - TSequenceV const & seqV, - DPBand_ const & band, - DPProfile_ const & dpProfile) -{ - typedef typename Container::Type TContainer; - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef typename TraceBitMap_::TTraceValue TTraceValue; - typedef typename Size::Type TSizeH; - typedef typename Size::Type TSizeV; - - if (IsSameType::VALUE) - return; - - // Determine whether or not we place gaps to the left. - typedef typename IsGapsLeft_::Type TIsGapsLeft; - - TSizeH seqHSize = length(seqH); - TSizeV seqVSize = length(seqV); - - // Set the navigator to the position where the maximum was found. - _setToPosition(matrixNavigator, maxHostPosition); - - SEQAN_ASSERT_LEQ(coordinate(matrixNavigator, +DPMatrixDimension_::HORIZONTAL), seqHSize); - SEQAN_ASSERT_LEQ(coordinate(matrixNavigator, +DPMatrixDimension_::VERTICAL), seqVSize); - - TTraceValue traceValue = value(matrixNavigator); - TTraceValue lastTraceValue = _retrieveInitialTraceDirection(traceValue, dpProfile); - - TracebackCoordinator_ tracebackCoordinator(coordinate(matrixNavigator, +DPMatrixDimension_::HORIZONTAL), - coordinate(matrixNavigator, +DPMatrixDimension_::VERTICAL), - band, seqHSize, seqVSize); - - if (TraceTail_::VALUE) - { - if (tracebackCoordinator._currRow != seqVSize) - _recordSegment(target, seqHSize, tracebackCoordinator._currRow, seqVSize - tracebackCoordinator._currRow, - +TraceBitMap_::VERTICAL); - if (tracebackCoordinator._currColumn != seqHSize) - _recordSegment(target, tracebackCoordinator._currColumn, tracebackCoordinator._currRow, seqHSize - - tracebackCoordinator._currColumn, +TraceBitMap_::HORIZONTAL); - } - - TSize fragmentLength = 0; - while (!_hasReachedEnd(tracebackCoordinator) && traceValue != TraceBitMap_::NONE) - _doTraceback(target, matrixNavigator, traceValue, lastTraceValue, fragmentLength, tracebackCoordinator, TGapCosts(), TIsGapsLeft()); - - - // Record last detected fragment. - _recordSegment(target, tracebackCoordinator._currColumn, tracebackCoordinator._currRow, fragmentLength, lastTraceValue); - if (TraceHead_::VALUE) - { - // Record leading gaps if any. - if (tracebackCoordinator._currRow != 0u) - _recordSegment(target, 0, 0, tracebackCoordinator._currRow, +TraceBitMap_::VERTICAL); - if (tracebackCoordinator._currColumn != 0u) - _recordSegment(target, 0, 0, tracebackCoordinator._currColumn, +TraceBitMap_::HORIZONTAL); - } -} - -// Needed as a delegation method to allow invocation of both methods with host position and dpScout. -template -void _computeTraceback(TTarget & target, - TDPTraceMatrixNavigator & matrixNavigator, - DPScout_ const & dpScout, - TSequenceH const & seqH, - TSequenceV const & seqV, - DPBand_ const & band, - DPProfile_ const & dpProfile) -{ - _computeTraceback(target, matrixNavigator, maxHostPosition(dpScout), seqH, seqV, band, dpProfile); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_DP_TRACEBACK_IMPL_H_ diff --git a/seqan/align/evaluate_alignment.h b/seqan/align/evaluate_alignment.h deleted file mode 100644 index 076a446..0000000 --- a/seqan/align/evaluate_alignment.h +++ /dev/null @@ -1,257 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Compute alignment score given a pairwise alignment. -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_ALIGN_EVALUATE_ALIGNMENT_H_ -#define CORE_INCLUDE_SEQAN_ALIGN_EVALUATE_ALIGNMENT_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class AlignmentStats -// ---------------------------------------------------------------------------- - -/*! - * @class AlignmentStats - * @headerfile - * @brief Statistics about a tabular alignment. - * - * The default constructor initializes all members to 0. - * - * @var unsigned AlignmentStats::numGapOpens; - * @brief Number of gap open events. - * - * @var unsigned AlignmentStats::numGapExtensions; - * @brief Number of gap extension events. - * - * @var unsigned AlignmentStats::numMatches; - * @brief Number of match (identity) events. - * - * @var unsigned AlignmentStats::numMismatches; - * @brief Number of mismatch (not identity) events. - * - * @var unsigned AlignmentStats::numPositiveScores; - * @brief Number of residues aligned with positive score (0 is counted as positive). - * - * @var unsigned AlignmentStats::numNegativeScores; - * @brief Number of residues aligned with negative score. - * - * @var int AlignmentStats::alignmentScore; - * @brief The resulting alignment score. - */ - -struct AlignmentStats -{ - // Number of gap opens/gap extensions. - unsigned numGapOpens; - unsigned numGapExtensions; - // Number of matches, mismatches. - unsigned numMatches; - unsigned numMismatches; - // Number of aligned residues with positive/negative scores. - unsigned numPositiveScores; - unsigned numNegativeScores; - - // The alignment score. - int alignmentScore; - - AlignmentStats() : numGapOpens(0), numGapExtensions(0), numMatches(0), numMismatches(0), - numPositiveScores(0), numNegativeScores(0), alignmentScore(0) - {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function clear() -// ---------------------------------------------------------------------------- - -/*! - * @fn AlignmentStats#clear - * @brief Clear AlignmentStats object. - * - * @signature void clear(stats); - * - * @param[in,out] stats AlignmentStats object to clear. - */ - -inline -void clear(AlignmentStats & stats) -{ - stats.numGapOpens = 0; - stats.numGapExtensions = 0; - stats.numMatches = 0; - stats.numMismatches = 0; - stats.numPositiveScores = 0; - stats.numNegativeScores = 0; - stats.alignmentScore = 0; -} - -// ---------------------------------------------------------------------------- -// Function computeAlignmentStats() -// ---------------------------------------------------------------------------- - -/*! - * @fn computeAlignmentStats - * @headerfile - * @brief Compute alignment statistics. - * - * @signature TScoreVal computeAlignmentStats([stats, ]align, scoringScheme); - * - * @param[out] stats The @link AlignmentStats @endlink object to store alignment statistics in. - * @param[in] align The @link Align @endlink object to score. - * @param[in] score The @link Score @endlink object to use for the scoring scheme. - * - * @see AlignmentStats - * - * @section Examples - * - * @include demos/align/compute_alignment_stats.cpp - * - * The output is as follows: - * - * @include demos/align/compute_alignment_stats.cpp.stdout - */ - -template -TScoreVal computeAlignmentStats(AlignmentStats & stats, - Align const & align, - Score const & scoringScheme) -{ - SEQAN_ASSERT_EQ_MSG(length(rows(align)), 2u, "Only works with pairwise alignments."); - SEQAN_ASSERT_EQ_MSG(length(row(align, 0)), length(row(align, 1)), "Invalid alignment!"); - clear(stats); - - typedef Align const TAlign; - typedef typename Row::Type TGaps; - typedef typename Iterator::Type TGapsIter; - typedef typename Value::Type>::Type TAlphabet; - - // Get iterators. - TGapsIter it0 = begin(row(align, 0)); - TGapsIter itEnd0 = end(row(align, 0)); - TGapsIter it1 = begin(row(align, 1)); - TGapsIter itEnd1 = end(row(align, 1)); - - // State whether we have already opened a gap. - bool isGapOpen0 = false, isGapOpen1 = false; - - for (; it0 != itEnd0 && it1 != itEnd1; ++it0, ++it1) - { - if (isGap(it0)) - { - if (isGapOpen0) - { - stats.numGapOpens += 1; - stats.alignmentScore += scoreGapOpen(scoringScheme); - } - else - { - stats.numGapExtensions += 1; - stats.alignmentScore += scoreGapExtend(scoringScheme); - } - isGapOpen0 = true; - } - else - { - isGapOpen0 = false; - } - - if (isGap(it1)) - { - if (!isGapOpen1) - { - stats.numGapOpens += 1; - stats.alignmentScore += scoreGapOpen(scoringScheme); - } - else - { - stats.numGapExtensions += 1; - stats.alignmentScore += scoreGapExtend(scoringScheme); - } - isGapOpen1 = true; - } - else - { - isGapOpen1 = false; - } - - if (!isGap(it0) && !isGap(it1)) - { - // Compute the alignment score and register in stats. - TAlphabet c0 = *it0, c1 = *it1; - TScoreVal scoreVal = score(scoringScheme, c0, c1); - stats.alignmentScore += scoreVal; - // Register other statistics. - bool isMatch = (c0 == c1); - bool isPositive = (scoreVal >= 0); - stats.numMatches += isMatch; - stats.numMismatches += !isMatch; - stats.numPositiveScores += isPositive; - stats.numNegativeScores += !isPositive; - } - } - SEQAN_ASSERT(it0 == itEnd0); - SEQAN_ASSERT(it1 == itEnd1); - - return stats.alignmentScore; -} - -template -TScoreVal computeAlignmentStats(Align const & align, - Score const & scoringScheme) -{ - AlignmentStats stats; - (void)stats; - return computeAlignmentStats(stats, align, scoringScheme); -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_ALIGN_EVALUATE_ALIGNMENT_H_ diff --git a/seqan/align/gap_anchor.h b/seqan/align/gap_anchor.h deleted file mode 100644 index 7e82f38..0000000 --- a/seqan/align/gap_anchor.h +++ /dev/null @@ -1,402 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: David Weese -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAP_ANCHOR_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAP_ANCHOR_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// TODO(holtgrew): Document? -// Sorting tags (just for lower_bound and upper_bound, positions are always sorted) - -struct SortSeqPos_; -typedef Tag const SortSeqPos; - -struct SortGapPos_; -typedef Tag const SortGapPos; - -// ---------------------------------------------------------------------------- -// Specialization GapAnchor -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Make a class instead of a struct? - -/*! - * @class GapAnchor - * @headerfile - * @brief Stores the position of an alignment character in sequence-space and in gap-space. - * - * @signature template - * struct GapAnchor; - * - * @tparam TPos Type to store gapped/ungapped positions. - * - * @section Remarks - * - * Value types of the gaps strings in @link ReadStoreElement @endlink and @link ContigStoreElement @endlink. - */ - -/** -.Class.GapAnchor -..summary:Stores the position of an alignment character in sequence-space and in gap-space. -..cat:Alignments -..signature:GapAnchor -..param.TPos:Type to store gapped/ungapped positions. -..remarks:Value types of the $gaps$ strings in @Class.ReadStoreElement@ and @Class.ContigStoreElement@. - -.Memfunc.GapAnchor#GapAnchor -..summary:Constructor -..signature:GapAnchor () -..signature:GapAnchor (TPos seqPos, TPos gapPos) -..param.seqPos:Sequence character position in the ungapped sequence. -..param.gapPos:Sequence character position in the gapped sequence. -..remarks:Default constructor sets both positions to $0$. -..class:Class.GapAnchor -.Memvar.GapAnchor#seqPos -..summary:Sequence character position in the ungapped sequence. -..class:Class.GapAnchor -.Memvar.GapAnchor#gapPos -..summary:Sequence character position in the gapped sequence. -..class:Class.GapAnchor -..include:seqan/store.h -*/ - -// We store gap anchors only for the first text character behind a gap or a clipped sequence character - -template -struct GapAnchor -{ -/*! - * @var VariableType GapAnchor::seqPos - * @brief Sequence character position in the ungapped sequence. - */ - TPos seqPos; // sequence character position in the ungapped sequence - -/*! - * @var VariableType GapAnchor::gapPos - * @brief Sequence character position in the gapped sequence. - */ - TPos gapPos; // sequence character position in the gapped sequence - -/*! - * @fn GapAnchor::GapAnchor - * - * @brief Constructor - * - * @signature GapAnchor::GapAnchor([other]) - * @signature GapAnchor::GapAnchor(seqPos, gapPos) - * - * @param other GapAnchor object to copy from. - * @param seqPos Sequence character position in the ungapped sequence. - * @param gapPos Sequence character position in the gapped sequence. - * - * @section Remarks - * - * Default constructor sets both positions to 0. - */ - - GapAnchor() : seqPos(0), gapPos(0) {} - GapAnchor(TPos sP, TPos gP) : seqPos(sP), gapPos(gP) {} - - template - GapAnchor(GapAnchor const &other) - { - seqPos = other.seqPos; - gapPos = other.gapPos; - } - - template - inline GapAnchor const & - operator = (GapAnchor const &other) - { - seqPos = other.seqPos; - gapPos = other.gapPos; - return *this; - } - - template - inline bool - operator == (TOther const &other) const - { - return seqPos == other.seqPos && gapPos == other.gapPos; - } - - template - inline bool - operator != (TOther const &other) const - { - return !(*this == other); - } - - template - inline bool - operator < (TOther const &other) const - { - return seqPos < other.seqPos || gapPos < other.gapPos; - } - - template - inline bool - operator > (TOther const &other) const - { - return seqPos > other.seqPos || gapPos > other.gapPos; - } - - template - inline bool - operator <= (TOther const &other) const - { - return seqPos < other.seqPos || gapPos <= other.gapPos; - } - - template - inline bool - operator >= (TOther const &other) const - { - return seqPos > other.seqPos || gapPos >= other.gapPos; - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction Size [GapAnchor] -// ---------------------------------------------------------------------------- - -template -struct Size > -{ - typedef TPos Type; -}; - -template -struct Size const> : public Size > -{}; - -// ---------------------------------------------------------------------------- -// Metafunction Position [GapAnchor] -// ---------------------------------------------------------------------------- - -template -struct Position > -{ - typedef TPos Type; -}; - -template -struct Position const> : public Position > -{}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Functor _LessGapAnchor -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Leading underscore should become a trailing one. - -template -struct _LessGapAnchor; - -template -struct _LessGapAnchor : - public ::std::binary_function -{ - inline bool - operator() (TGapAnchor const& a1, TGapAnchor const& a2) const { - return (a1.seqPos) < (a2.seqPos); - } -}; - -template -struct _LessGapAnchor : - public ::std::binary_function -{ - inline bool - operator() (TGapAnchor const& a1, TGapAnchor const& a2) const { - return (a1.gapPos) < (a2.gapPos); - } -}; - -// ---------------------------------------------------------------------------- -// Function lowerBoundGapAnchor() -// ---------------------------------------------------------------------------- - -template -inline typename Iterator::Type -lowerBoundGapAnchor(TGapAnchor const & gaps, - TSearchValue const val, - SortSeqPos) -{ - typedef typename Value::Type TGapAnchorElement; - TGapAnchorElement el; - el.seqPos = val; - return ::std::lower_bound( - begin(gaps, Standard()), - end(gaps, Standard()), - el, - _LessGapAnchor::Type, SortSeqPos const>() ); -} - -template -inline typename Iterator::Type -lowerBoundGapAnchor(TGapAnchor & gaps, - TSearchValue const val, - SortSeqPos) -{ - typedef typename Value::Type TGapAnchorElement; - TGapAnchorElement el; - el.seqPos = val; - return ::std::lower_bound( - begin(gaps, Standard()), - end(gaps, Standard()), - el, - _LessGapAnchor::Type, SortSeqPos const>() ); -} - -template -inline typename Iterator::Type -lowerBoundGapAnchor(TGapAnchor const & gaps, - TSearchValue const val, - SortGapPos) -{ - typedef typename Value::Type TGapAnchorElement; - TGapAnchorElement el; - el.gapPos = val; - return ::std::lower_bound( - begin(gaps, Standard()), - end(gaps, Standard()), - el, - _LessGapAnchor::Type, SortGapPos const>() ); -} - -template -inline typename Iterator::Type -lowerBoundGapAnchor(TGapAnchor & gaps, - TSearchValue const val, - SortGapPos) -{ - typedef typename Value::Type TGapAnchorElement; - TGapAnchorElement el; - el.gapPos = val; - return ::std::lower_bound( - begin(gaps, Standard()), - end(gaps, Standard()), - el, - _LessGapAnchor::Type, SortGapPos const>() ); -} - -// ---------------------------------------------------------------------------- -// Function upperBoundGapAnchor() -// ---------------------------------------------------------------------------- - -template -inline typename Iterator::Type -upperBoundGapAnchor(TGapAnchors const & gaps, - TSearchValue const val, - SortSeqPos) -{ - typedef typename Value::Type TGapAnchorElement; - TGapAnchorElement el; - el.seqPos = val; - return ::std::upper_bound( - begin(gaps, Standard()), - end(gaps, Standard()), - el, - _LessGapAnchor::Type, SortSeqPos const>() ); -} - -template -inline typename Iterator::Type -upperBoundGapAnchor(TGapAnchors & gaps, - TSearchValue const val, - SortSeqPos) -{ - typedef typename Value::Type TGapAnchorElement; - TGapAnchorElement el; - el.seqPos = val; - return ::std::upper_bound( - begin(gaps, Standard()), - end(gaps, Standard()), - el, - _LessGapAnchor::Type, SortSeqPos const>() ); -} - -template -inline typename Iterator::Type -upperBoundGapAnchor(TGapAnchors const & gaps, - TSearchValue const val, - SortGapPos) -{ - typedef typename Value::Type TGapAnchorElement; - TGapAnchorElement el; - el.gapPos = val; - return ::std::upper_bound( - begin(gaps, Standard()), - end(gaps, Standard()), - el, - _LessGapAnchor::Type, SortGapPos const>() ); -} - -template -inline typename Iterator::Type -upperBoundGapAnchor(TGapAnchors & gaps, - TSearchValue const val, - SortGapPos) -{ - typedef typename Value::Type TGapAnchorElement; - TGapAnchorElement el; - el.gapPos = val; - return ::std::upper_bound( - begin(gaps, Standard()), - end(gaps, Standard()), - el, - _LessGapAnchor::Type, SortGapPos const>() ); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAP_ANCHOR_H_ diff --git a/seqan/align/gapped_value_type.h b/seqan/align/gapped_value_type.h deleted file mode 100644 index 9e98bbc..0000000 --- a/seqan/align/gapped_value_type.h +++ /dev/null @@ -1,98 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPPED_VALUE_TYPE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPPED_VALUE_TYPE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -/*! - * @mfn GappedValueType - * @headerfile - * @brief Returns a value type that contains a black value '-'. - * - * @signature GappedValueType::Type - * - * @tparam T The value type that should be expanded (if needed) by '-'. - * - * @return Type A type that can store the values of T and the value '-'. - */ - -/** -.Metafunction.GappedValueType: -..cat:Alignments -..summary:Returns a value type that contains a blank value '-'. -..signature:GappedValueType::Type -..param.T:The value type that should be expanded (if needed) by '-'. -..returns.param.Type:A value type that can be used to store store values in $T$ and the value '-'. -..remarks:The default implementation returns $T$. -..include:seqan/align.h -*/ - -// TODO(holtgrew): Would it be enough to define it for Nothing instead of having a default implementation. - -// We need a default implementation since we need it for Nothing. -template -struct GappedValueType -{ - typedef T Type; -}; - -template -struct GappedValueType > -{ - typedef SimpleType THost_; - typedef ModifiedAlphabet > Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPPED_VALUE_TYPE_H_ diff --git a/seqan/align/gaps_anchor.h b/seqan/align/gaps_anchor.h deleted file mode 100644 index ca25d50..0000000 --- a/seqan/align/gaps_anchor.h +++ /dev/null @@ -1,1046 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: David Weese -// ========================================================================== -// Implementation of Gaps class using pairs of gapped sequence and source -// sequence position as anchors. -// ========================================================================== - -// TODO(holtgrew): Clipping in leading and trailing gaps is not possible right now. Dave and I have to discuss this further. -// TODO(holtgrew): Also, inserting gaps in the front changes the clipped begin position which is unexpected. - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ANCHOR_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ANCHOR_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -/*! - * @tag GapsSpecTag#AnchorGaps - * @headerfile - * @brief Tag for the Anchor Gaps specialization. - * - * @signature template - * struct AnchorGaps; - */ - -template -struct AnchorGaps; - -template -inline void _reinitAnchorGaps(Gaps > & gaps); - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Specialization AnchorGaps -// ---------------------------------------------------------------------------- - -/*! - * @class AnchorGaps - * @extends Gaps - * @headerfile - * @brief Stores gaps as anchors of the first characters behind gaps. - * - * @signature template > > - * class Gaps >; - * - * @tparam TSource The type of the underling sequence. - * @tparam TGapAnchors The type of the string of @link GapAnchor @endlink objects. - */ - -/*! - * @fn AnchorGaps::Gaps - * @brief Constructor - * - * @signature Gaps::Gaps([other]); - * @signature Gaps::Gaps(source[, anchors]); - * @signature Gaps::Gaps(anchors); - * - * @param other Another @link AnchorGaps @endlink object to copy from. - * @param source The underling sequence to construct the Gaps object from. - * @param anchors The string of anchors to construct with. - * - * An AnchorGaps object has a default constructor, can be constructed from the underlying source, and/or a string of - * gap anchors. - */ - -/** -.Spec.AnchorGaps: -..cat:Alignments -..general:Class.Gaps -..summary:Stores gaps anchors of the first characters behind gaps. -..signature:Gaps > -..param.TSource:Type of the ungapped sequence. -...metafunction:Metafunction.Source -..param.TGapAnchors:Type of the sequence of gap anchors, e.g. a string of $Class.GapAnchor$. -..include:seqan/store.h - -.Memfunc.Gaps#Gaps -..class:Class.Gaps -..summary:Constructor -..signature:Gaps > () -..signature:Gaps > (source[, anchors]) -..signature:Gaps > (anchors) -..param.source:The underlying ungapped sequence. -..param.anchors:The sequence of gap anchors, e.g. the $gaps$ members in $Class.ReadStoreElement$ or $Class.ContigStoreElement$. -*/ - -template > > -struct AnchorGaps -{}; - -template -class Gaps > -{ -public: - // ----------------------------------------------------------------------- - // Internal Typedefs - // ----------------------------------------------------------------------- - - typedef typename Value::Type TGapAnchor_; - typedef typename Position::Type TViewPosition_; - typedef typename Position::Type TPosition_; - typedef typename Value::Type TValue_; - - // ----------------------------------------------------------------------- - // Member Variables - // ----------------------------------------------------------------------- - - Holder data_source; - Holder data_gaps; - int data_cutBegin; // number of gap positions cut from the beginning - int data_cutEnd; // number of gap positions cut from the end - int data_viewCutBegin; // how many alignment chars should be clipped at the beginning (can be negative too) - int data_viewCutEnd; // how ... end ... - - // ----------------------------------------------------------------------- - // Constructors - // ----------------------------------------------------------------------- - - Gaps() : - data_cutBegin(0), - data_cutEnd(0), - data_viewCutBegin(0), - data_viewCutEnd(0) - { - } - - Gaps(TSource & source) : - data_source(source), - data_cutBegin(0), - data_cutEnd(0), - data_viewCutBegin(0), - data_viewCutEnd(0) - { - } - - Gaps(TGapAnchors & anchors) : - data_gaps(anchors), - data_cutBegin(0), - data_cutEnd(0), - data_viewCutBegin(0), - data_viewCutEnd(0) - { - } - - Gaps(TGapAnchors const & anchors) : - data_gaps(anchors), - data_cutBegin(0), - data_cutEnd(0), - data_viewCutBegin(0), - data_viewCutEnd(0) - { - } - - // Note: We need the variants with the first parameter "TSource const &" here because TSource can be a Segment which - // is often given as a temporary. - - Gaps(TSource & source, TGapAnchors & anchors) : - data_source(source), - data_gaps(anchors), - data_cutBegin(0), - data_cutEnd(0), - data_viewCutBegin(0), - data_viewCutEnd(0) - { - } - - Gaps(TSource & source, TGapAnchors const & anchors) : - data_source(source), - data_gaps(anchors), - data_cutBegin(0), - data_cutEnd(0), - data_viewCutBegin(0), - data_viewCutEnd(0) - { - } - - // TODO(holtgrew): These constructors are only here because of const-Holder issues. - - template - Gaps(TSource2 & source, TGapAnchors & anchors) : - data_source(source), - data_gaps(anchors), - data_cutBegin(0), - data_cutEnd(0), - data_viewCutBegin(0), - data_viewCutEnd(0) - { - } - - template - Gaps(TSource2 & source, TGapAnchors const & anchors) : - data_source(source), - data_gaps(anchors), - data_cutBegin(0), - data_cutEnd(0), - data_viewCutBegin(0), - data_viewCutEnd(0) - { - } - - template - Gaps(TSource2 const & source, TGapAnchors & anchors) : - data_source(source), - data_gaps(anchors), - data_cutBegin(0), - data_cutEnd(0), - data_viewCutBegin(0), - data_viewCutEnd(0) - { - } - - template - Gaps(TSource2 const & source, TGapAnchors const & anchors) : - data_source(source), - data_gaps(anchors), - data_cutBegin(0), - data_cutEnd(0), - data_viewCutBegin(0), - data_viewCutEnd(0) - { - } - - // ----------------------------------------------------------------------- - // Array Subscript Operator - // ----------------------------------------------------------------------- - - inline TValue_ - operator[](TPosition_ clippedViewPos) const - { - return value(*this, clippedViewPos); - } - -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Helper Function _reinitAnchorGaps() -// ---------------------------------------------------------------------------- - -// Reset the array gaps DS such that represents the ungapped sequence. - -template -inline void _reinitAnchorGaps(Gaps > & gaps) -{ - clear(value(gaps.data_gaps)); - gaps.data_cutBegin = 0; - gaps.data_cutEnd = 0; - gaps.data_viewCutBegin = 0; - gaps.data_viewCutEnd = 0; -} - -// ---------------------------------------------------------------------------- -// Function _dataSource() -// ---------------------------------------------------------------------------- - -template -inline Holder & -_dataSource(Gaps > & me) -{ - return me.data_source; -} - -template -inline Holder const & -_dataSource(Gaps > const & me) -{ - return me.data_source; -} - -// ---------------------------------------------------------------------------- -// Function _assignSourceLength() -// ---------------------------------------------------------------------------- - -template -inline void -_assignSourceLength(TSize & size, Gaps > const & me) -{ - if (IsSameType::VALUE) - size = maxValue() / 2; - else - size = length(value(me.data_source)); -} - -// ---------------------------------------------------------------------------- -// Function _dataAnchors() -// ---------------------------------------------------------------------------- - -template -inline TGapAnchors & -_dataAnchors(Gaps > & me) -{ - return value(me.data_gaps); -} - -template -inline TGapAnchors const & -_dataAnchors(Gaps > const & me) -{ - return value(const_cast &>(me.data_gaps)); -} - -// ---------------------------------------------------------------------------- -// Function _getAnchor() -// ---------------------------------------------------------------------------- - -template -inline void -_getAnchor(TAnchor & anchor, Gaps > const & me, TIdx idx) -{ - if (idx > (TIdx)length(_dataAnchors(me))) - { - _assignSourceLength(anchor.seqPos, me); - if (empty(_dataAnchors(me)) && idx == 1) - anchor.gapPos = anchor.seqPos; - else - { - // for the sick case that an anchor seq position is beyond the sequence end - if (!empty(_dataAnchors(me))) - { - // if there is no sequence but anchors -> assume infinite sequence - if (anchor.seqPos == 0) - anchor.seqPos = maxValue(anchor.gapPos); - // if the sequence has a length > 0, but there is an anchor behind the end - // -> elongate sequence - else if ((__int64)anchor.seqPos < (__int64)back(_dataAnchors(me)).seqPos) - anchor.seqPos = back(_dataAnchors(me)).seqPos; - } - anchor.gapPos = maxValue(anchor.gapPos); - } - } - else if (idx > 0) - anchor = _dataAnchors(me)[idx - 1]; - else - { - anchor.seqPos = 0; - if (idx == 0) - anchor.gapPos = 0; - else - anchor.gapPos = minValue(anchor.gapPos); - } -} - -// ---------------------------------------------------------------------------- -// Function _unclippedLength() -// ---------------------------------------------------------------------------- - -template -inline typename Size > >::Type -_unclippedLength(Gaps > const & me) -{ - typedef typename Value::Type TAnchor; - typedef typename Size::Type TSize; - TSize len; - _assignSourceLength(len, me); - if (!empty(_dataAnchors(me))) - { - TAnchor const & last = back(_dataAnchors(me)); - len += last.gapPos - last.seqPos; - } - return len - (me.data_cutBegin + me.data_cutEnd); -} - -// ---------------------------------------------------------------------------- -// Function unclippedLength() -// ---------------------------------------------------------------------------- - -template -inline typename Size > >::Type -unclippedLength(Gaps > const & me) -{ - // TODO(holtgrew): Merge into one public function. - return _unclippedLength(me); -} - -// ---------------------------------------------------------------------------- -// Function clearClipping() -// ---------------------------------------------------------------------------- - -template -inline void -clearClipping(Gaps > & gaps) -{ - gaps.data_viewCutBegin = 0; - gaps.data_viewCutEnd = 0; -} - -// ---------------------------------------------------------------------------- -// Function clearGaps() -// ---------------------------------------------------------------------------- - -template -inline void -clearGaps(Gaps > & gaps) -{ - _reinitAnchorGaps(gaps); -} - -// ---------------------------------------------------------------------------- -// Function isGap() -// ---------------------------------------------------------------------------- - -template -inline bool -isGap(Gaps > const & gaps, TPosition clippedViewPos) -{ - // TODO(holtgrew): Implement without iterator? - return isGap(iter(gaps, clippedViewPos)); -} - -// ---------------------------------------------------------------------------- -// Function insertGaps() -// ---------------------------------------------------------------------------- - -template -inline void -insertGaps(Gaps > & gaps, TPosition clippedViewPos, TCount count) -{ - // TODO(holtgrew): Implement without iterator? - typedef Gaps > TGaps; - typedef typename Iterator::Type TIter; - - TIter it = iter(gaps, clippedViewPos); - insertGaps(it, count); -} - -// ---------------------------------------------------------------------------- -// Function value() -// ---------------------------------------------------------------------------- - -template -inline typename Value > >::Type -value(Gaps > const & gaps, TPosition clippedViewPos) -{ - // TODO(holtgrew): Implement without iterator? - typedef Gaps > TGaps; - typedef typename Iterator::Type TIter; - - TIter it = iter(gaps, clippedViewPos); - if (isGap(it)) - return '-'; - return *it; -} - -// ---------------------------------------------------------------------------- -// Function removeGaps() -// ---------------------------------------------------------------------------- - -template -inline typename Size > >::Type -removeGaps(Gaps > & gaps, TPosition clippedViewPos, TCount count) -{ - // TODO(holtgrew): Implement without iterator? - return removeGaps(iter(gaps, clippedViewPos), count); -} - -// ---------------------------------------------------------------------------- -// Function length() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): We would rather like to have the const version only :( -template -inline typename Size > >::Type -length(Gaps > & me) -{ - return _unclippedLength(me) - (me.data_viewCutBegin + me.data_viewCutEnd); -} - -template -inline typename Size > >::Type -length(Gaps > const & me) -{ - return _unclippedLength(me) - (me.data_viewCutBegin + me.data_viewCutEnd); -} - -// ---------------------------------------------------------------------------- -// Function begin() -// ---------------------------------------------------------------------------- - -template -inline typename Iterator > >::Type -begin(Gaps > & me, Standard) -{ - SEQAN_CHECKPOINT - return typename Iterator > >::Type(me); -} - -template -inline typename Iterator > const>::Type -begin(Gaps > const & me, Standard) -{ - SEQAN_CHECKPOINT - return typename Iterator > const>::Type(me); -} - -template -inline typename Iterator > >::Type -begin(Gaps > & me, Rooted) -{ - SEQAN_CHECKPOINT - return typename Iterator > >::Type(me); -} - -template -inline typename Iterator > const>::Type -begin(Gaps > const & me, Rooted) -{ - SEQAN_CHECKPOINT - return typename Iterator > const>::Type(me); -} - -// ---------------------------------------------------------------------------- -// Function end() -// ---------------------------------------------------------------------------- - -template -inline typename Iterator > >::Type -end(Gaps > & me, Standard) -{ - SEQAN_CHECKPOINT - return typename Iterator > >::Type(me, length(me)); -} - -template -inline typename Iterator > const>::Type -end(Gaps > const & me, Standard) -{ - SEQAN_CHECKPOINT - return typename Iterator > const>::Type(me, length(me)); -} - -template -inline typename Iterator > >::Type -end(Gaps > & me, Rooted) -{ - SEQAN_CHECKPOINT - return typename Iterator > >::Type(me, length(me)); -} - -template -inline typename Iterator > const>::Type -end(Gaps > const & me, Rooted) -{ - SEQAN_CHECKPOINT - return typename Iterator > const>::Type(me, length(me)); -} - -// ---------------------------------------------------------------------------- -// Function beginPosition() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): We would rather like to have the const version only :( -template -inline typename Position::Type -beginPosition(Gaps > & gaps) -{ - return toSourcePosition(gaps, 0); -} - -template -inline typename Position::Type -beginPosition(Gaps > const & gaps) -{ - return toSourcePosition(gaps, 0); -} - -// ---------------------------------------------------------------------------- -// Function endPosition() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): We would rather like to have the const version only :( -template -inline typename Position::Type -endPosition(Gaps > & gaps) -{ - return toSourcePosition(gaps, _unclippedLength(gaps) - (gaps.data_viewCutEnd + gaps.data_viewCutBegin)); -} - -template -inline typename Position::Type -endPosition(Gaps > const & gaps) -{ - return toSourcePosition(gaps, _unclippedLength(gaps) - (gaps.data_viewCutEnd + gaps.data_viewCutBegin)); -} - -// ---------------------------------------------------------------------------- -// Function setBeginPosition() -// ---------------------------------------------------------------------------- - -template -inline void -setBeginPosition(Gaps > & gaps, TPosition sourcePosition) -{ - setClippedBeginPosition(gaps, toViewPosition(gaps, sourcePosition) + clippedBeginPosition(gaps)); -} - -// ---------------------------------------------------------------------------- -// Function setEndPosition() -// ---------------------------------------------------------------------------- - -template -inline void -setEndPosition(Gaps > & gaps, TPosition sourcePosition) -{ - setClippedEndPosition(gaps, toViewPosition(gaps, sourcePosition) + clippedBeginPosition(gaps)); -} - -// ---------------------------------------------------------------------------- -// Function createSource() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Remove? Switch to Hosted Type Interface? - -template -inline void createSource(Gaps > & gaps) -{ - create(gaps.data_source); -} - -// ---------------------------------------------------------------------------- -// Function source() -// ---------------------------------------------------------------------------- - -template -inline typename Source > >::Type & -source(Gaps > const & gaps) -{ - return value(gaps.data_source); -} - -// ---------------------------------------------------------------------------- -// Function setSource() -// ---------------------------------------------------------------------------- - -template -inline void -setSource(Gaps > & gaps, TSequence & source) -{ - setValue(gaps.data_source, source); -} - -template -inline void -setSource(Gaps > & gaps, TSequence & source) -{ - setValue(gaps.data_source, source); -} - -// ---------------------------------------------------------------------------- -// Function assignSource() -// ---------------------------------------------------------------------------- - -template -inline void -assignSource(Gaps > & gaps, TSequence2 const & source) -{ - value(gaps.data_source) = source; -} - -// ---------------------------------------------------------------------------- -// Helper Function _helperIsNegative() -// ---------------------------------------------------------------------------- - -// to remove '... < 0 is always false' warning -template -inline bool -_helperIsNegative(T, False) -{ - return false; -} - -template -inline bool -_helperIsNegative(T t, True) -{ - return t < 0; -} - -// ---------------------------------------------------------------------------- -// Function positionGapToSeq() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Deprecate in favour of toViewPosition/toSourcePosition? - -/*! - * @fn AnchorGaps#positionGapsToSeq - * @brief Convert from gap space in the global alignment to the sequence space on the reference. - * - * @signature TPos positionGapToSeq(gaps, pos); - * - * @param gaps Contig AnchorGaps (e.g. from FragmentStore). - * @param pos Position in gap space. - * - * @return Position in sequence space. - * - * See the example below to construct the Gaps ojbect. Note that this construction is fast since it ionly a thing wrapper - * around underlying objects. - * - * @section Example - * - * Convert from gap space to positions pace when the contig required to be loaded. * Converts position aligned read with - * index idx in the aligned read store. - * - * @code - * typedef typename TFragmentStore::TContigStore TContigStore; - * typedef typename Value::Type TContig; - * typedef typename TFragmentStore::TContigSeq TContigSeq; - * typedef Gaps > TContigGaps; - * - * typedef typename TFragmentStore::TAlignedReadStore TAlignedReadStore; - * typedef typename Value::Type TAlignedRead; - * typedef typename TAlignedRead::TPos TAlignedReadPos; - * - * unsigned contigId = alignedReadStore[idx].contigId; - * TContigGaps contigGaps(contigStore[contigId].seq, contigStore[contigId].gaps); - * TAlignedRead const & alignedRead = alignedReadStore[idx]; - * // Translate end position from aligned read record to sequence space in reference. - * TAlignedReadPos endPos = positionGapToSeq(contigGaps, alignedRead.endPos); - * ..example.text:Convert from gap space to position space when the contigs are not required. - * ..example.text:Converts position aligned read with index $idx$ in the aligned read store. - * ..example.code: - * typedef typename TFragmentStore::TContigStore TContigStore; - * typedef typename Value::Type TContig; - * typedef Gaps > TContigGaps; - * - * typedef typename TFragmentStore::TAlignedReadStore TAlignedReadStore; - * typedef typename Value::Type TAlignedRead; - * typedef typename TAlignedRead::TPos TAlignedReadPos; - * - * unsigned contigId = alignedReadStore[idx].contigId; - * TContigGaps contigGaps(Nothing(), contigStore[contigId].gaps); - * TAlignedRead const & alignedRead = alignedReadStore[idx]; - * // Translate end position from aligned read record to sequence space in reference. - * TAlignedReadPos endPos = positionGapToSeq(contigGaps, alignedRead.endPos); - * @endcode - */ - -/** -.Function.positionGapToSeq -..cat:Fragment Store -..signature:positionGapToSeq(gaps, pos) -..summary:Convert from gap-space in the global alignment to the sequence-space on the reference. -..param.gaps:Contig gaps from fragment store. -...type:Spec.AnchorGaps -..param.pos:Position in gap space. -..returns:Position in sequence space. -..remarks:See the example below to construct the gaps object. Note that this construction is fast since it is only a thin wrapper around underlying objects. -..include:seqan/store.h -..example.text:Convert from gap space to position space when the contigs required to be loaded. -..example.text:Converts position aligned read with index $idx$ in the aligned read store. -..example.code: -typedef typename TFragmentStore::TContigStore TContigStore; -typedef typename Value::Type TContig; -typedef typename TFragmentStore::TContigSeq TContigSeq; -typedef Gaps > TContigGaps; - -typedef typename TFragmentStore::TAlignedReadStore TAlignedReadStore; -typedef typename Value::Type TAlignedRead; -typedef typename TAlignedRead::TPos TAlignedReadPos; - -unsigned contigId = alignedReadStore[idx].contigId; -TContigGaps contigGaps(contigStore[contigId].seq, contigStore[contigId].gaps); -TAlignedRead const & alignedRead = alignedReadStore[idx]; -// Translate end position from aligned read record to sequence space in reference. -TAlignedReadPos endPos = positionGapToSeq(contigGaps, alignedRead.endPos); -..example.text:Convert from gap space to position space when the contigs are not required. -..example.text:Converts position aligned read with index $idx$ in the aligned read store. -..example.code: -typedef typename TFragmentStore::TContigStore TContigStore; -typedef typename Value::Type TContig; -typedef Gaps > TContigGaps; - -typedef typename TFragmentStore::TAlignedReadStore TAlignedReadStore; -typedef typename Value::Type TAlignedRead; -typedef typename TAlignedRead::TPos TAlignedReadPos; - -unsigned contigId = alignedReadStore[idx].contigId; -TContigGaps contigGaps(Nothing(), contigStore[contigId].gaps); -TAlignedRead const & alignedRead = alignedReadStore[idx]; -// Translate end position from aligned read record to sequence space in reference. -TAlignedReadPos endPos = positionGapToSeq(contigGaps, alignedRead.endPos); -..see:Function.positionSeqToGap - */ - -template -inline TPosition -positionGapToSeq(Gaps > const & me, TPosition pos) -{ - typedef typename Position::Type>::Type TAnchorPos; - - GapAnchor<__int64> prevAnchor, nextAnchor; - TPosition seqPos; - int anchorIdx; - - if (_helperIsNegative(pos, typename IsSameType::Type>::Type())) - anchorIdx = -1; - else - { - TGapAnchors const & anchors = _dataAnchors(me); - TAnchorPos seqLength; - _assignSourceLength(seqLength, me); - if (!empty(anchors)) - { - anchorIdx = upperBoundGapAnchor(anchors, pos, SortGapPos()) - begin(anchors, Standard()); - if (anchorIdx < (int)length(anchors)) - if (anchors[anchorIdx].gapPos == (TAnchorPos)pos && anchors[anchorIdx].seqPos != seqLength) - ++anchorIdx; - } - else - anchorIdx = ((TAnchorPos)pos < seqLength) ? 0 : 1; - } - _getAnchor(prevAnchor, me, anchorIdx); - _getAnchor(nextAnchor, me, anchorIdx + 1); - - if (nextAnchor.seqPos - prevAnchor.seqPos > (int)pos - prevAnchor.gapPos) - seqPos = prevAnchor.seqPos + (pos - prevAnchor.gapPos); - else - seqPos = nextAnchor.seqPos; - return seqPos; -} - -// ---------------------------------------------------------------------------- -// Function positionSeqToGap() -// ---------------------------------------------------------------------------- - -/*! - * @fn Gaps#positionSeqToGap - * @brief Convert from sequence space on the reference to gap space in the global alignment. - * - * @signature TPosition positionSeqToGap(gaps, pos); - * - * @param gaps The AnchorGaps object to use for the translation. - * @param pos The gap space position to conver to sequence space. - * - * @return TPosition The resulting position in sequence space. - * - * See the example below to construct the gaps object. Note that this construction is fast since it is only a thin - * wrapper around underlying objects. - * - * @section Example - * - * Convert from gap space to position space on contig $contigId$ when the contigs required to be loaded. - * - * @code - * typedef typename TFragmentStore::TContigStore TContigStore; - * typedef typename Value::Type TContig; - * typedef typename TFragmentStore::TContigSeq TContigSeq; - * typedef Gaps > TContigGaps; - * - * TContigGaps contigGaps(contigStore[contigId].seq, contigStore[contigId].gaps); - * TAlignedReadPos pos = positionGapToSeq(contigGaps, 33); - * @endcode - * - * Convert from gap space to position space on contig $contigId$ when the contigs are not required. - * - * @code - * typedef typename TFragmentStore::TContigStore TContigStore; - * typedef typename Value::Type TContig; - * typedef Gaps > TContigGaps; - * - * TContigGaps contigGaps(Nothing(), contigStore[contigId].gaps); - * TAlignedReadPos endPos = positionGapToSeq(contigGaps, 33); - * @endcode - */ - -/** -.Function.positionSeqToGap -..cat:Fragment Store -..signature:positionGapToSeq(gaps, pos) -..summary:Convert from sequence space on the reference to gap space in the global alignment. -..param.gaps:Contig gaps from fragment store. -...type:Spec.AnchorGaps -..param.pos:Position in the reference. -..returns:Position in the gap space of the global alignment space. -..remarks:See the example below to construct the gaps object. Note that this construction is fast since it is only a thin wrapper around underlying objects. -..include:seqan/store.h -..example.text:Convert from gap space to position space on contig $contigId$ when the contigs required to be loaded. -..example.code: -typedef typename TFragmentStore::TContigStore TContigStore; -typedef typename Value::Type TContig; -typedef typename TFragmentStore::TContigSeq TContigSeq; -typedef Gaps > TContigGaps; - -TContigGaps contigGaps(contigStore[contigId].seq, contigStore[contigId].gaps); -TAlignedReadPos pos = positionGapToSeq(contigGaps, 33); -..example.text:Convert from gap space to position space on contig $contigId$ when the contigs are not required. -..example.code: -typedef typename TFragmentStore::TContigStore TContigStore; -typedef typename Value::Type TContig; -typedef Gaps > TContigGaps; - -TContigGaps contigGaps(Nothing(), contigStore[contigId].gaps); -TAlignedReadPos endPos = positionGapToSeq(contigGaps, 33); -..see:Function.positionSeqToGap - */ - -template -inline TPosition -positionSeqToGap(Gaps > const & me, TPosition pos) -{ - typedef typename Position::Type>::Type TAnchorPos; - - GapAnchor<__int64> prevAnchor, nextAnchor; - TPosition gapPos; - int anchorIdx; - - if (_helperIsNegative(pos, typename IsSameType::Type>::Type())) - anchorIdx = -1; - else - { - TGapAnchors const & anchors = _dataAnchors(me); - TAnchorPos seqLength; - _assignSourceLength(seqLength, me); - if (!empty(anchors)) - { - anchorIdx = upperBoundGapAnchor(anchors, pos, SortSeqPos()) - begin(anchors, Standard()); - if (anchorIdx < (int)length(anchors)) - if (anchors[anchorIdx].seqPos == (TAnchorPos)pos) - ++anchorIdx; - } - else - anchorIdx = ((TAnchorPos)pos < seqLength) ? 0 : 1; - } - _getAnchor(prevAnchor, me, anchorIdx); - _getAnchor(nextAnchor, me, anchorIdx + 1); - - if (nextAnchor.gapPos - prevAnchor.gapPos > (int)pos - prevAnchor.seqPos) - gapPos = prevAnchor.gapPos + (pos - prevAnchor.seqPos); - else - gapPos = nextAnchor.gapPos; - return gapPos; -} - -// ---------------------------------------------------------------------------- -// Function toViewPosition() -// ---------------------------------------------------------------------------- - -template -inline typename Position > >::Type -toViewPosition(Gaps > const & gaps, TPosition sourcePosition) -{ - return positionSeqToGap(gaps, sourcePosition) - gaps.data_viewCutBegin - gaps.data_cutBegin; -} - -// ---------------------------------------------------------------------------- -// Function toSourcePosition() -// ---------------------------------------------------------------------------- - -template -inline typename Position::Type -toSourcePosition(Gaps > const & gaps, TPosition clippedViewPos) -{ - // TODO(weese): possibly change positionGapToSeq interface to consider a different zero - // shifted by data_cutBegin - return positionGapToSeq(gaps, clippedViewPos + gaps.data_viewCutBegin + gaps.data_cutBegin); -} - -// ---------------------------------------------------------------------------- -// Function setClippedBeginPosition() -// ---------------------------------------------------------------------------- - -template -inline void -setClippedBeginPosition(Gaps > & gaps, TPosition unclippedViewPosition) -{ - gaps.data_viewCutBegin = unclippedViewPosition; -} - -// ---------------------------------------------------------------------------- -// Function setClippedEndPosition() -// ---------------------------------------------------------------------------- - -template -inline void -setClippedEndPosition(Gaps > & gaps, TPosition unclippedViewPosition) -{ - gaps.data_viewCutEnd = _unclippedLength(gaps) - unclippedViewPosition; -} - -// ---------------------------------------------------------------------------- -// Function clippedBeginPosition() -// ---------------------------------------------------------------------------- - -template -inline typename Position > >::Type -clippedBeginPosition(Gaps > const & gaps) -{ - return gaps.data_viewCutBegin; -} - -// ---------------------------------------------------------------------------- -// Function clippedEndPosition() -// ---------------------------------------------------------------------------- - -template -inline typename Position > >::Type -clippedEndPosition(Gaps > const & gaps) -{ - return _unclippedLength(gaps) - gaps.data_viewCutEnd; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ANCHOR_H_ diff --git a/seqan/align/gaps_array.h b/seqan/align/gaps_array.h deleted file mode 100644 index af128b7..0000000 --- a/seqan/align/gaps_array.h +++ /dev/null @@ -1,847 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// Author: Manuel Holtgrewe -// ========================================================================== - -// SEQAN_NO_GENERATED_FORWARDS - -// TODO(holtgrew): Currently, operations are a function of the whole gap count, could be of clipped region only. -// TODO(holtgrew): Problem with the gap value, getValue(), value(). - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ARRAY_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ARRAY_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// Internally used tag for creating iterators at the begin of containers. -struct Begin__; -typedef Tag Begin_; - -// Internally used tag for creating iterators at the end of containers. -struct End__; -typedef Tag End_; - -// Internally used tag for creating iterators inside of containers. -struct Position__; -typedef Tag Position_; - -struct ArrayGaps_; -typedef Tag ArrayGaps; - -template class Gaps; - -template -inline void _reinitArrayGaps(Gaps & gaps); - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -struct ArrayGaps_; -typedef Tag ArrayGaps; - -/*! - * @class ArrayGaps - * @headerfile - * @brief Stores length of gap- and non-gap runs in an array. - * - * @signature template - * class Gaps - * - * @tparam TSequence The type of the underling sequence. - */ - -/** -.Spec.ArrayGaps -..cat:Alignments -..general:Class.Gaps -..summary:Stores length of gap- and non-gapped runs in an array. -..signature:Gaps -..param.TSequence:Type of the ungapped sequence. -...metafunction:Metafunction.Source -..include:seqan/align.h -*/ - -template -class Gaps -{ -public: - // ----------------------------------------------------------------------- - // Internal Typedefs - // ----------------------------------------------------------------------- - - typedef typename Size::Type TSize_; - typedef typename Size::Type TSequenceSize_; - typedef typename Position::Type TPosition_; - typedef typename Position::Type TSequencePosition_; - typedef typename Value::Type TValue_; - - typedef String TArray_; - typedef typename Position::Type TArrayPos_; - - // ----------------------------------------------------------------------- - // Member Variables - // ----------------------------------------------------------------------- - - // Holder of the underlying sequence. - Holder _source; - - // The array with the alternating gap/source char counts. - TArray_ _array; - - // Begin and end position in the source. - TSequencePosition_ _sourceBeginPos, _sourceEndPos; - // Begin and end position in the view. - TPosition_ _clippingBeginPos, _clippingEndPos; - // TODO(holtgrew): The following is a possible optimization. - // // Index of clipping begin and end in the _array seq/gap char count array. - // // This identifies a slice of the view. - // TArrayPos_ _clippingBeginIdx, _clippingEndIdx; - // // Offset within the slice. - // TSequenceSize_ _clippingBeginOffset, _clippingEndOffset; - - // ----------------------------------------------------------------------- - // Constructors - // ----------------------------------------------------------------------- - - Gaps() : _sourceBeginPos(0), _sourceEndPos(0), _clippingBeginPos(0), _clippingEndPos(0)//, - // _clippingBeginIdx(0), _clippingEndIdx(0), _clippingBeginOffset(0), _clippingEndOffset(0) - {} - - explicit - Gaps(TSequence & seq) : - _source(seq), _sourceBeginPos(0), _sourceEndPos(length(seq)), - _clippingBeginPos(0), _clippingEndPos(length(seq))//, - // _clippingBeginIdx(0), _clippingEndIdx(0), _clippingBeginOffset(0), - // _clippingEndOffset(0) - { - // Initialize array gaps object for ungapped sequence. - _reinitArrayGaps(*this); - } - - Gaps(Gaps const & other) : - _source(other._source), _array(other._array), _sourceBeginPos(other._sourceBeginPos), - _sourceEndPos(other._sourceEndPos), _clippingBeginPos(other._clippingBeginPos), - _clippingEndPos(other._clippingEndPos) - {} - - // ----------------------------------------------------------------------- - // Array Subscript Operator - // ----------------------------------------------------------------------- - - inline Gaps & - operator=(Gaps const & other) - { - setValue(_source, source(other)); - _array = other._array; - _sourceBeginPos = other._sourceBeginPos; - _sourceEndPos = other._sourceEndPos; - _clippingBeginPos = other._clippingBeginPos; - _clippingEndPos = other._clippingEndPos; - return *this; - } - - // ----------------------------------------------------------------------- - // Array Subscript Operator - // ----------------------------------------------------------------------- - - inline TValue_ - operator[](TPosition_ clippedViewPos) const - { - return value(*this, clippedViewPos); - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function detach() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Remove? Only used by module blast. - -template -void detach(Gaps & gaps) -{ - detach(gaps._source); -} - -// ---------------------------------------------------------------------------- -// Function _setLength() -// ---------------------------------------------------------------------------- - -// Set the length, only use if TSequence is Nothing. - -template -inline void _setLength(Gaps & gaps, TSize newLen) -{ - // Reset array. - resize(gaps._array, 3); - gaps._array[0] = 0; - gaps._array[1] = newLen; - gaps._array[2] = 0; - // Reset clipping information. - gaps._clippingBeginPos = 0; - gaps._clippingEndPos = newLen; - gaps._sourceBeginPos = 0; - gaps._sourceEndPos = gaps._clippingEndPos; - // gaps._clippingBeginIdx = 1; - // gaps._clippingBeginOffset = 0; - // gaps._clippingEndIdx = 1; - // gaps._clippingEndOffset = value(gaps._source)[1]; -} - -// ---------------------------------------------------------------------------- -// Helper Function _reinitArrayGaps() -// ---------------------------------------------------------------------------- - -// Reset the array gaps DS such that represents the ungapped sequence. - -template -inline void _reinitArrayGaps(Gaps & gaps) -{ - _setLength(gaps, length(value(gaps._source))); -} - -// ---------------------------------------------------------------------------- -// Function begin() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): We'd rather have "TTag const &" here. -template -inline typename Iterator >::Type -begin(Gaps & gaps, Tag const /*tag*/) -{ - typedef typename Iterator >::Type TIter; - return TIter(gaps, Begin_()); -} - -// TODO(holtgrew): We'd rather have "TTag const &" here. -template -inline typename Iterator const>::Type -begin(Gaps const & gaps, Tag const /*tag*/) -{ - typedef typename Iterator const>::Type TIter; - return TIter(gaps, Begin_()); -} - -// ---------------------------------------------------------------------------- -// Function end() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): We'd rather have "TTag const &" here. -template -inline typename Iterator >::Type -end(Gaps & gaps, Tag const /*tag*/) -{ - typedef typename Iterator >::Type TIter; - return TIter(gaps, End_()); -} - -// TODO(holtgrew): We'd rather have "TTag const &" here. -template -inline typename Iterator const>::Type -end(Gaps const & gaps, Tag const /*tag*/) -{ - typedef typename Iterator const>::Type TIter; - return TIter(gaps, End_()); -} - -// ---------------------------------------------------------------------------- -// Function iter() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): We'd rather have "TTag const &" here. -template -inline typename Iterator >::Type -iter(Gaps & gaps, TPosition pos, Tag const /*tag*/) -{ - typedef typename Iterator >::Type TIter; - return TIter(gaps, pos, Position_()); -} - -// TODO(holtgrew): We'd rather have "TTag const &" here. -template -inline typename Iterator const>::Type -iter(Gaps const & gaps, TPosition pos, Tag const /*tag*/) -{ - typedef typename Iterator const>::Type TIter; - return TIter(gaps, pos, Position_()); -} - -// ---------------------------------------------------------------------------- -// Function length() -// ---------------------------------------------------------------------------- - -template -inline typename Size >::Type -length(Gaps const & gaps) -{ - SEQAN_ASSERT_GEQ(gaps._clippingEndPos, gaps._clippingBeginPos); - return gaps._clippingEndPos - gaps._clippingBeginPos; -} - -// ---------------------------------------------------------------------------- -// Function unclippedLength() -// ---------------------------------------------------------------------------- - -template -inline typename Size >::Type -unclippedLength(Gaps const & gaps) -{ - typedef typename Size >::Type TSize; - - TSize result = 0; - for (unsigned i = 0; i < length(gaps._array); ++i) - result += gaps._array[i]; - - return result; -} - -// ---------------------------------------------------------------------------- -// Function createSource() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Remove? Switch to Hosted Type Interface? - -template -inline void createSource(Gaps & gaps) -{ - create(gaps._source); -} - -// ---------------------------------------------------------------------------- -// Function source() -// ---------------------------------------------------------------------------- - -template -inline typename Source const>::Type & -source(Gaps const & gaps) -{ - return value(gaps._source); -} - -template -inline typename Source >::Type & -source(Gaps & gaps) -{ - return value(gaps._source); -} - -// ---------------------------------------------------------------------------- -// Function setSource() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Test with clippings, also for AnchorGaps. - -template -inline void -setSource(Gaps & gaps, TSequence & source) -{ - setValue(gaps._source, source); - _reinitArrayGaps(gaps); -} - -template -inline void -setSource(Gaps & gaps, TSequence & source) -{ - setValue(gaps._source, source); - _reinitArrayGaps(gaps); -} - -// ---------------------------------------------------------------------------- -// Function assignSource() -// ---------------------------------------------------------------------------- - -template -inline void -assignSource(Gaps & gaps, TSequence2 const & source) -{ - value(gaps._source) = source; - _reinitArrayGaps(gaps); -} - -// ---------------------------------------------------------------------------- -// Function toSourcePosition() -// ---------------------------------------------------------------------------- - -template -inline typename Position::Type -toSourcePosition(Gaps const & gaps, TPosition clippedViewPos) -{ - typedef Gaps TGaps; - typedef typename Position::Type TGapsPos; - typedef typename TGaps::TArrayPos_ TArrayPos; - typedef typename Position::Type TSourcePos; - - // Translate from clipped view position to unclipped view position. - TGapsPos unclippedViewPos = clippedViewPos + clippedBeginPosition(gaps); - - // Get index i of the according bucket and offset within bucket. - TSourcePos result = 0; - TArrayPos i = 0; - TSourcePos const iEnd = length(gaps._array); - for (TSourcePos counter = unclippedViewPos; counter > TGapsPos(0) && i < iEnd;) - { - if (counter > gaps._array[i]) - { - if (i % 2) // character bucket - result += gaps._array[i]; - counter -= gaps._array[i]; - i += 1; - } - else if (counter <= gaps._array[i]) - { - if (i % 2) // character bucket - { - result += counter; - } - counter = 0; - } - } - - return result; -} - -// ---------------------------------------------------------------------------- -// Function toViewPosition() -// ---------------------------------------------------------------------------- - -// Parameter rightOfGaps moves to the right end of gaps if the character at sourcePosition is followed by a gap in the -// view. -template -inline typename Position >::Type -toViewPosition(Gaps const & gaps, TPosition sourcePosition, bool rightOfGaps = true) -{ - typedef Gaps TGaps; - typedef typename Position::Type TGapsPosition; - typedef typename TGaps::TArray_ TArray; - typedef typename TGaps::TArrayPos_ TArrayPos; - typedef typename Value::Type TArrayValue; - - if (sourcePosition == TPosition(0)) - return gaps._array[0] - clippedBeginPosition(gaps); - - // First, convert to unclipped source position. - TGapsPosition unclippedViewPosition = 0; - TArrayPos i = 0; - for (TArrayValue counter = sourcePosition; counter > TArrayValue(0); ++i) - { - if (i % 2 /*== 1*/) // sequence bucket - { - if (counter > gaps._array[i]) - { - unclippedViewPosition += gaps._array[i]; - counter -= gaps._array[i]; - } - else if (counter < gaps._array[i]) - { - unclippedViewPosition += counter; - counter = 0; - } - else // counter == gaps._array[i] - { - unclippedViewPosition += counter; - if (rightOfGaps && i + 2 < length(gaps._array)) - unclippedViewPosition += gaps._array[i + 1]; - counter = 0; - } - } - else // gaps bucket - { - unclippedViewPosition += gaps._array[i]; - } - } - - // Return after clipping. - return unclippedViewPosition - clippedBeginPosition(gaps); -} - -// ---------------------------------------------------------------------------- -// Function insertGaps() -// ---------------------------------------------------------------------------- - -template -inline void -insertGaps(Gaps & gaps, TPosition clippedViewPos, TCount count) -{ - typedef Gaps TGaps; - typedef typename Position::Type TGapsPosition; - typedef typename TGaps::TArray_ TArray; - typedef typename TGaps::TArrayPos_ TArrayPos; - typedef typename Position::Type TSeqPos; - - // Translate from clipped view position to unclipped view position. - TGapsPosition unclippedViewPos = clippedViewPos + clippedBeginPosition(gaps); - - // Get index i of the according bucket and offset within bucket. - TArrayPos i = 0; - TSeqPos offset = 0; - for (TSeqPos counter = unclippedViewPos; counter > 0;) - { - SEQAN_ASSERT_LT(i, length(gaps._array)); - if (counter > gaps._array[i]) - { - counter -= gaps._array[i]; - i += 1; - } - else - { - offset = counter; - counter = 0; - } - } - - SEQAN_ASSERT_GEQ(gaps._array[i], offset); - - // Insert gaps, simple and fast if we are in a gaps bucket, a bit harder - // otherwise. - if (i % 2) // character bucket - { - if (gaps._array[i] > offset) // In the middle of the bucket. - { - TArray arr; - resize(arr, 2, 0); - arr[0] = count; - arr[1] = gaps._array[i] - offset; - gaps._array[i] = offset; - insert(gaps._array, i + 1, arr); - } - else // At the end of the bucket. - { - if (i + 1 < length(gaps._array)) // Not at end of array. - { - gaps._array[i + 1] += count; - } - else // At end of array. - { - resize(gaps._array, length(gaps._array) + 2, 0); - gaps._array[i + 1] = count; - gaps._array[i + 2] = 0; - } - } - } - else // gap bucket - { - gaps._array[i] += count; - } - - // Adjust clipping information. - gaps._clippingEndPos += count; -} - -// ---------------------------------------------------------------------------- -// Function value() -// ---------------------------------------------------------------------------- - -template -inline typename Value >::Type -value(Gaps const & gaps, TPosition clippedViewPos) -{ - if (isGap(gaps, clippedViewPos)) - return '-'; - else - return value(source(gaps), toSourcePosition(gaps, clippedViewPos)); - return typename Value >::Type(); -} - -// ---------------------------------------------------------------------------- -// Function removeGaps() -// ---------------------------------------------------------------------------- - -template -inline typename Size >::Type -removeGaps(Gaps & gaps, TPosition clippedViewPos, TCount count) -{ - typedef Gaps TGaps; - typedef typename Position::Type TGapsPosition; - typedef typename TGaps::TArray_ TArray; - typedef typename TGaps::TArrayPos_ TArrayPos; - typedef typename Value::Type TArrayValue; - typedef typename Position::Type TSeqPos; - - // Translate from clipped view position to unclipped view position. - TGapsPosition pos = clippedViewPos + clippedBeginPosition(gaps); - - // Get index i of the according bucket and offset within bucket. - SEQAN_ASSERT_GEQ(length(gaps._array), 2u); - // Start at position 1 if there are no leading gaps. - TArrayPos i = (gaps._array[0] == 0); - TSeqPos offset = 0; - for (TSeqPos counter = pos; counter > 0;) - { - SEQAN_ASSERT_LT(i, length(gaps._array)); - if (counter > gaps._array[i]) - { - counter -= gaps._array[i]; - i += 1; - } - else - { - offset = counter; - counter = 0; - } - } - - // Advance into next bucket if at end of current. - if (offset > 0 && offset == gaps._array[i]) - { - i += 1; - offset = 0; - } - - // If we are inside a non-gap bucket then we cannot remove any gaps. - if (i % 2) - return 0; - - // Otherwise, we can remove gaps right of the current position but not - // more than there are. - TSeqPos toRemove = count; - if (toRemove > gaps._array[i] - offset) - toRemove = gaps._array[i] - offset; - gaps._array[i] -= toRemove; - // In some cases, we remove the whole gap and merge the character buckets. - if (gaps._array[i] == TArrayValue(0)) - { - // No merging for leading and trailing gap. - if (i != TArrayPos(0) && i != TArrayPos(length(gaps._array) - 1)) - { - gaps._array[i - 1] += gaps._array[i + 1]; - erase(gaps._array, i, i + 2); - } - } - - // Also update the right clipping position. - gaps._clippingEndPos -= toRemove; - - // Finally, return number of removed gaps. - return toRemove; -} - -// ---------------------------------------------------------------------------- -// Function clearGaps() -// ---------------------------------------------------------------------------- - -template -inline void -clearGaps(Gaps & gaps) -{ - _reinitArrayGaps(gaps); -} - -// ---------------------------------------------------------------------------- -// Function isGap() -// ---------------------------------------------------------------------------- - -template -inline bool -isGap(Gaps const & gaps, TPosition clippedViewPos) -{ - typedef Gaps TGaps; - typedef typename Position::Type TGapsPosition; - typedef typename TGaps::TArrayPos_ TArrayPos; - typedef typename Position::Type TSeqPos; - - // Translate from clipped view position to unclipped view position. - TGapsPosition pos = clippedViewPos + clippedBeginPosition(gaps); - - // Get index i of the according bucket and offset within bucket. - SEQAN_ASSERT_GEQ(length(gaps._array), 2u); - // Start at position 1 if there are no leading gaps. - TArrayPos i = (gaps._array[0] == 0); - TSeqPos offset = 0; - for (TSeqPos counter = pos; counter > TSeqPos(0);) - { - SEQAN_ASSERT_LT(i, length(gaps._array)); - if (counter > gaps._array[i]) - { - counter -= gaps._array[i]; - i += 1; - } - else - { - offset = counter; - counter = 0; - } - } - - // Advance into next bucket if at end of current. - if (offset > TSeqPos(0) && offset == gaps._array[i]) - i += 1; - - return !(i % 2); -} - -// ---------------------------------------------------------------------------- -// Function clearClipping() -// ---------------------------------------------------------------------------- - -template -inline void -clearClipping(Gaps & gaps) -{ - typedef Gaps TGaps; - typedef typename TGaps::TArrayPos_ TArrayPos; - - gaps._sourceBeginPos = 0; - gaps._sourceEndPos = length(value(gaps._source)); - gaps._clippingBeginPos = 0; - gaps._clippingEndPos = 0; - for (TArrayPos i = 0; i < length(gaps._array); ++i) - gaps._clippingEndPos += gaps._array[i]; - - SEQAN_ASSERT_LEQ(static_cast(gaps._sourceEndPos), static_cast(gaps._clippingEndPos)); -} - -// ---------------------------------------------------------------------------- -// Function setClippedBeginPosition() -// ---------------------------------------------------------------------------- - -template -inline void -setClippedBeginPosition(Gaps & gaps, TPosition unclippedViewPosition) -{ - gaps._sourceBeginPos = toSourcePosition(gaps, unclippedViewPosition - clippedBeginPosition(gaps)); - gaps._clippingBeginPos = unclippedViewPosition; -} - -// ---------------------------------------------------------------------------- -// Function setClippedEndPosition() -// ---------------------------------------------------------------------------- - -template -inline void -setClippedEndPosition(Gaps & gaps, TPosition unclippedViewPosition) -{ - gaps._sourceEndPos = toSourcePosition(gaps, unclippedViewPosition - clippedBeginPosition(gaps)); - //if (isGap(gaps, unclippedViewPosition - clippedBeginPosition(gaps))) - // gaps._sourceEndPos += 1; - gaps._clippingEndPos = unclippedViewPosition; -} - -// ---------------------------------------------------------------------------- -// Function clippedBeginPosition() -// ---------------------------------------------------------------------------- - -template -inline typename Position >::Type -clippedBeginPosition(Gaps const & gaps) -{ - return gaps._clippingBeginPos; -} - -// ---------------------------------------------------------------------------- -// Function clippedEndPosition() -// ---------------------------------------------------------------------------- - -template -inline typename Position >::Type -clippedEndPosition(Gaps const & gaps) -{ - return gaps._clippingEndPos; -} - -// ---------------------------------------------------------------------------- -// Function setBeginPosition() -// ---------------------------------------------------------------------------- - -template -inline void -setBeginPosition(Gaps & gaps, TPosition sourcePosition) -{ - setClippedBeginPosition(gaps, toViewPosition(gaps, sourcePosition) + clippedBeginPosition(gaps)); -} - -// ---------------------------------------------------------------------------- -// Function setEndPosition() -// ---------------------------------------------------------------------------- - -template -inline void -setEndPosition(Gaps & gaps, TPosition sourcePosition) -{ - setClippedEndPosition(gaps, toViewPosition(gaps, sourcePosition) + clippedBeginPosition(gaps)); -} - -// ---------------------------------------------------------------------------- -// Function beginPosition() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): We would rather like to have the const version only :( -template -inline typename Position::Type -beginPosition(Gaps const & gaps) -{ - return gaps._sourceBeginPos; -} - -template -inline typename Position::Type -beginPosition(Gaps & gaps) -{ - return gaps._sourceBeginPos; -} - -// ---------------------------------------------------------------------------- -// Function endPosition() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): We would rather like to have the const version only :( -template -inline typename Position::Type -endPosition(Gaps const & gaps) -{ - return gaps._sourceEndPos; -} - -template -inline typename Position::Type -endPosition(Gaps & gaps) -{ - return gaps._sourceEndPos; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ARRAY_H_ diff --git a/seqan/align/gaps_base.h b/seqan/align/gaps_base.h deleted file mode 100644 index e667600..0000000 --- a/seqan/align/gaps_base.h +++ /dev/null @@ -1,1485 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -// TODO(holtgrew): Switch to Host interface. - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_BASE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_BASE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -template -struct GapsIterator; - -/*! - * @defgroup GapsSpecTag Gaps Specialization Tags - * @brief Tags for specializing the Gaps class. - */ - -/*! - * @tag GapsSpecTag#ArrayGaps - * @headerfile - * @brief Tag for the Array Gaps specialization. - * - * @signature struct ArrayGaps_; - * @signature typedef Tag ArrayGaps; - */ - -struct ArrayGaps_; -typedef Tag ArrayGaps; - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class Gaps -// ---------------------------------------------------------------------------- - -/*! - * @class Gaps - * @implements SequenceConcept - * @headerfile - * @brief Store the gapped version of a sequence. - * - * @signature template - * class Gaps; - * - * @tparam TSequence The type of the underlying sequence. - * @tparam TSpec Tag for specialization. - * - * Gaps wrap a @link SequenceConcept Sequence @endlink and allows to (1) insert gaps into the sequence and (2) select - * an infix of the gapped sequence (clipping). The gaps are not inserted into the underlying sequence (source) but - * stored separately. Using the clipping is optional and meant for selecting parts of the alignment as a part of the - * result of a local alignment algorithm. - * - * -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ITERATOR_ANCHOR_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ITERATOR_ANCHOR_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// Iterator for AnchorGaps objects. - -template //Gaps > -class Iter > > -{ -public: - typedef TGaps_ TGaps; - typedef typename Source::Type TSource; - typedef TGapAnchors_ TGapAnchors; - - // TODO(holtgrew): Why is the following commented out? -// typedef typename Value::Type TGapAnchor; - typedef typename Size::Type>::Type TGapAnchorSize_; - typedef GapAnchor::Type> TGapAnchor; - typedef typename MakeSigned::Type>::Type TGapPos; - typedef typename Iterator::Type TAnchorIter; - - TGaps * data_container; //the gaps object - TGapPos seqLength; - mutable TGapAnchor current; - mutable TGapAnchor prevAnchor; - mutable TGapAnchor nextAnchor; - mutable TGapAnchor viewBegin; - mutable TGapAnchor viewEnd; - mutable int anchorIdx; - -public: - Iter() - { -SEQAN_CHECKPOINT - data_container = NULL; - seqLength = 0; - } -/* Iter(Iter const & other_): - data_container(other_.data_container), - seqLength(other_.seqLength), - current(other_.current), - prevAnchor(other_.prevAnchor), - nextAnchor(other_.nextAnchor), - anchorIdx(other_.anchorIdx) - { -SEQAN_CHECKPOINT - } -*/ Iter(TGaps & container_): - data_container(&container_) - { -SEQAN_CHECKPOINT - _assignSourceLength(seqLength, container_); - _goToGapAnchorIterator(*this, data_container->data_viewCutBegin + data_container->data_cutBegin); - viewBegin = current; - viewEnd.gapPos = _unclippedLength(*data_container) + data_container->data_cutBegin - data_container->data_viewCutEnd; - viewEnd.seqPos = positionGapToSeq(*data_container, viewEnd.gapPos); - } - Iter(TGaps & container_, TGapPos clippedViewPosition): - data_container(&container_) - { -SEQAN_CHECKPOINT - _assignSourceLength(seqLength, container_); - _goToGapAnchorIterator(*this, clippedViewPosition + data_container->data_viewCutBegin + data_container->data_cutBegin); - viewBegin.gapPos = data_container->data_viewCutBegin + data_container->data_cutBegin; - viewEnd.gapPos = _unclippedLength(*data_container) + data_container->data_cutBegin - data_container->data_viewCutEnd; - viewBegin.seqPos = positionGapToSeq(*data_container, viewBegin.gapPos); - viewEnd.seqPos = positionGapToSeq(*data_container, viewEnd.gapPos); - } - ~Iter() - { -SEQAN_CHECKPOINT - } - - Iter const & operator = (Iter const & other_) - { -SEQAN_CHECKPOINT - data_container = other_.data_container; - seqLength = other_.seqLength; - current = other_.current; - prevAnchor = other_.prevAnchor; - nextAnchor = other_.nextAnchor; - anchorIdx = other_.anchorIdx; - viewBegin = other_.viewBegin; - viewEnd = other_.viewEnd; - return *this; - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function container() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Can go if data_container were _container, dupe in _base.h - -template -inline TGaps & -container(Iter > > & me) -{ - return *me.data_container; -} - -template -inline TGaps & -container(Iter > > const & me) -{ - return *me.data_container; -} - -// ---------------------------------------------------------------------------- -// Function source() -// ---------------------------------------------------------------------------- - -template -inline typename Source > > const>::Type -source(Iter > > & me) -{ - return begin(source(*me.data_container), Rooted()) + me.current.seqPos; -} - -template -inline typename Source > > >::Type -source(Iter > > const & me) -{ - return begin(source(*me.data_container), Rooted()) + me.current.seqPos; -} - -// ---------------------------------------------------------------------------- -// Function getValue() -// ---------------------------------------------------------------------------- - -template -inline typename GetValue< Iter > > >::Type -getValue(Iter > > & me) -{ - typedef typename Value > >::Type TValue; - if (isGap(me)) return gapValue(); - else if (isUnknown(me)) return unknownValue(); - else return getValue(source(me)); -} - -template -inline typename GetValue< Iter > > const>::Type -getValue(Iter > > const & me) -{ - typedef typename Value > const>::Type TValue; - if (isGap(me)) return gapValue(); - else if (isUnknown(me)) return unknownValue(); - else return getValue(source(me)); -} - -// ---------------------------------------------------------------------------- -// Function value() -// ---------------------------------------------------------------------------- - -template -inline typename Reference< Iter > > >::Type -value(Iter > > & it) -{ - typedef typename Reference > > >::Type TProxy; - return TProxy(it); -} - -template -inline typename Reference< Iter > > const>::Type -value(Iter > > const & it) -{ - typedef typename Reference > > const>::Type TProxy; - return TProxy(it); -} - -// ---------------------------------------------------------------------------- -// Function isGap() -// ---------------------------------------------------------------------------- - -template -inline bool -isGap(Iter > > const & me) -{ - return me.current.seqPos == me.nextAnchor.seqPos; -} - -// ---------------------------------------------------------------------------- -// Function isUnknown() -// ---------------------------------------------------------------------------- - -template -inline bool -isUnknown(Iter > > const & me) -{ - int len; - _assignSourceLength(len, *me.data_container); - return me.current.seqPos < 0 || me.current.seqPos >= len; -} - -// ---------------------------------------------------------------------------- -// Function isClipped() -// ---------------------------------------------------------------------------- - -template -inline bool -isClipped(Iter > > const & me) -{ - return me.current.gapPos == me.nextAnchor.gapPos; -} - -// ---------------------------------------------------------------------------- -// Function countGaps() -// ---------------------------------------------------------------------------- - -template -inline typename Size::Type -countGaps(Iter > > const & me) -{ - if (!isGap(me)) - return 0; - if (me.nextAnchor.gapPos > me.viewEnd.gapPos) - return me.viewEnd.gapPos - me.current.gapPos; - return me.nextAnchor.gapPos - me.current.gapPos; -} - -// ---------------------------------------------------------------------------- -// Function countCharacters() -// ---------------------------------------------------------------------------- - -template -inline typename Size::Type -countCharacters(Iter > > const & me) -{ - if (isGap(me)) - return 0; - if (me.nextAnchor.seqPos > me.viewEnd.seqPos) - return me.viewEnd.seqPos - me.current.seqPos; - return me.nextAnchor.seqPos - me.current.seqPos; -} - -// ---------------------------------------------------------------------------- -// Function blockLength() -// ---------------------------------------------------------------------------- - -template -inline typename Size::Type -blockLength(Iter > > & me) -{ - if (isGap(me)) - return countGaps(me); - else - return countCharacters(me); -} - -// ---------------------------------------------------------------------------- -// Function atBegin() -// ---------------------------------------------------------------------------- - -template -inline bool -atBegin(Iter > > & me) -{ -// return me.current.seqPos == 0 && me.current.gapPos == 0; - return me.current <= me.viewBegin; -} - -template -inline bool -atBegin(Iter > > const & me) -{ -// return me.current.seqPos == 0 && me.current.gapPos == 0; - return me.current <= me.viewBegin; -} - -// ---------------------------------------------------------------------------- -// Function atEnd() -// ---------------------------------------------------------------------------- - -template -inline bool -atEnd(Iter > > & me) -{ -// return me.current == me.nextAnchor; - return me.current >= me.viewEnd; -} - -template -inline bool -atEnd(Iter > > const & me) -{ -// return me.current == me.nextAnchor; - return me.current >= me.viewEnd; -} - -// ---------------------------------------------------------------------------- -// Function operator==() -// ---------------------------------------------------------------------------- - -template -inline bool -operator == ( - Iter > > const & left, - Iter > > const & right) -{ - return left.current == right.current; -} - -// ---------------------------------------------------------------------------- -// Function operator!=() -// ---------------------------------------------------------------------------- - -template -inline bool -operator != ( - Iter > > const & left, - Iter > > const & right) -{ - return left.current != right.current; -} - -// ---------------------------------------------------------------------------- -// Function operator<() -// ---------------------------------------------------------------------------- - -template -inline bool -operator < ( - Iter > > const & left, - Iter > > const & right) -{ - return left.current < right.current; -} - -// ---------------------------------------------------------------------------- -// Function operator<=() -// ---------------------------------------------------------------------------- - -template -inline bool -operator<=( - Iter > > const & left, - Iter > > const & right) -{ - return !(left.current > right.current); -} - -// ---------------------------------------------------------------------------- -// Function operator>() -// ---------------------------------------------------------------------------- - -template -inline bool -operator > ( - Iter > > const & left, - Iter > > const & right) -{ - return left.current > right.current; -} - -// ---------------------------------------------------------------------------- -// Function operator>=() -// ---------------------------------------------------------------------------- - -template -inline bool -operator>=(Iter > > const & lhs, - Iter > > const & rhs) -{ - return !(lhs < rhs); -} - -// ---------------------------------------------------------------------------- -// Function insertGaps() -// ---------------------------------------------------------------------------- - -template -inline void -insertGaps(Iter > > const & me, - TCount size) -{ - TGapAnchors & anchors = _dataAnchors(*me.data_container); - typedef typename Iterator::Type TIter; - - if (size <= 0) return; - - // insert a new anchor - if (!isGap(me)) - { - if (me.prevAnchor.gapPos == me.current.gapPos) - { - me.nextAnchor = me.prevAnchor; - _getAnchor(me.prevAnchor, *me.data_container, --me.anchorIdx); - } - else - { - me.nextAnchor = me.current; - insertValue(anchors, me.anchorIdx, me.nextAnchor, Generous()); - } - } - else - { - if (me.anchorIdx >= (int)length(anchors)) - { - // add gap after the sequence and in (or at the right boundary of) the view - if (me.current.gapPos <= me.viewEnd.gapPos) - { - container(me).data_cutEnd -= size; - me.viewEnd.gapPos += size; - } - return; - } - if (empty(anchors)) - appendValue(anchors, me.nextAnchor, Generous()); - } - if (me.anchorIdx < (int)length(anchors)) - { - if (me.anchorIdx >= 0) - { - me.nextAnchor.gapPos += size; - TIter it = begin(anchors, Standard()); - TIter itEnd = end(anchors, Standard()); - if (me.anchorIdx >= 0) - it += me.anchorIdx; - for (; it != itEnd; ++it) - (*it).gapPos += size; - } - else - // add gap before the sequence and in (or at the left boundary of) the view - if (me.current.gapPos >= me.viewBegin.gapPos) - { - container(me).data_cutBegin -= size; - me.viewBegin.gapPos -= size; - me.current.gapPos -= size; - return; - } - } - if (me.current.gapPos <= me.viewEnd.gapPos) - me.viewEnd.gapPos += size; - -/* - Iter > > it2 = begin(*me.data_container) + me.current.gapPos; - if (me.current != it2.current || me.prevAnchor != it2.prevAnchor || me.nextAnchor != it2.nextAnchor || me.anchorIdx != it2.anchorIdx) - std::cout<<"*"; -*/ -} - -// ---------------------------------------------------------------------------- -// Function removeGaps() -// ---------------------------------------------------------------------------- - -template -inline typename Size::Type -removeGaps(Iter > > const & it, - TCount size_) -{ - TGapAnchors & anchors = _dataAnchors(*it.data_container); - typedef typename Iterator::Type TAnchorsIter; - - typedef Iter > > TIter; - typedef typename TIter::TGapAnchor TGapAnchor; - // typedef typename Value::Type TGapAnchor; - typedef typename Position::Type TPos; - - if (size_ <= 0 || !isGap(it)) - return 0; - TPos size = size_; - - // static_cast(Nothing()); - // static_cast(Nothing()); - if (it.current.gapPos + size > it.nextAnchor.gapPos) - size = it.nextAnchor.gapPos - it.current.gapPos; - - if (it.prevAnchor.gapPos + it.current.seqPos == it.current.gapPos + it.prevAnchor.seqPos && - it.current.gapPos + size == it.nextAnchor.gapPos) - { - // remove the gap - if (it.anchorIdx < (int)length(anchors)) - erase(anchors, it.anchorIdx); - _getAnchor(it.nextAnchor, *it.data_container, it.anchorIdx); - } - - // shift anchors - if (it.anchorIdx < (int)length(anchors)) - { - if (it.anchorIdx >= 0) - { - it.nextAnchor.gapPos -= size; - TAnchorsIter itA = begin(anchors, Standard()); - TAnchorsIter itAEnd = end(anchors, Standard()); - if (it.anchorIdx >= 0) - itA += it.anchorIdx; - for (; itA != itAEnd; ++itA) - (*itA).gapPos -= size; - } - else - // remove gap before the sequence and in (or at the left boundary of) the view - if (it.current.gapPos >= it.viewBegin.gapPos) - { - // assure that we don't remove more gaps than available - if (size > it.nextAnchor.gapPos - it.current.gapPos) - size = it.nextAnchor.gapPos - it.current.gapPos; - container(it).data_cutBegin += size; - it.viewBegin.gapPos += size; - it.current.gapPos += size; - return size; - } - } - else - { - if (it.current.gapPos <= it.viewEnd.gapPos) - container(it).data_cutEnd += size; - } - if (it.current.gapPos <= it.viewEnd.gapPos) - it.viewEnd.gapPos -= size; - - return size; -/* - Iter > > it2 = begin(*me.data_container) + me.current.gapPos; - if (me.current != it2.current || me.prevAnchor != it2.prevAnchor || me.nextAnchor != it2.nextAnchor || me.anchorIdx != it2.anchorIdx) - std::cout<<"*"; -*/ -} - -// ---------------------------------------------------------------------------- -// Helper Function _goNextGapAnchorIterator() -// ---------------------------------------------------------------------------- - -template -inline void -_goNextGapAnchorIterator(T & me) -{ - if (me.current.gapPos < me.nextAnchor.gapPos) - { - ++me.current.gapPos; - if (me.current.seqPos < me.nextAnchor.seqPos) - ++me.current.seqPos; - } - while (me.current.gapPos == me.nextAnchor.gapPos) - { - me.current = me.prevAnchor = me.nextAnchor; - _getAnchor(me.nextAnchor, *me.data_container, ++me.anchorIdx + 1); - } -} - -// ---------------------------------------------------------------------------- -// Helper Function _goPreviousGapAnchorIterator() -// ---------------------------------------------------------------------------- - -template -inline void -_goPreviousGapAnchorIterator(T & me) -{ - while (me.current.gapPos == me.prevAnchor.gapPos) - { - me.current = me.nextAnchor = me.prevAnchor; - _getAnchor(me.prevAnchor, *me.data_container, --me.anchorIdx); - } - --me.current.gapPos; - if (me.nextAnchor.seqPos - me.prevAnchor.seqPos > me.current.gapPos - me.prevAnchor.gapPos) - me.current.seqPos = me.prevAnchor.seqPos + (me.current.gapPos - me.prevAnchor.gapPos); - else - me.current.seqPos = me.nextAnchor.seqPos; -} - -// ---------------------------------------------------------------------------- -// Helper Function _goToGapAnchorIterator() -// ---------------------------------------------------------------------------- - -template -inline void -_goToGapAnchorIterator(T & me, TPos pos) -{ - typedef typename T::TGapAnchors TGapAnchors; - typedef typename Value::Type TGapAnchor; - typedef typename Position::Type TAnchorPos; - typedef typename MakeSigned::Type TAnchorSPos; - - if (_helperIsNegative(pos, typename IsSameType::Type>::Type())) - me.anchorIdx = -1; - else - { - TGapAnchors const & anchors = _dataAnchors(*me.data_container); - if (!empty(anchors)) - { - me.anchorIdx = upperBoundGapAnchor(anchors, pos, SortGapPos()) - begin(anchors, Standard()); - if (me.anchorIdx < (int)length(anchors)) - if (anchors[me.anchorIdx].gapPos == (TAnchorPos)pos && anchors[me.anchorIdx].seqPos != (TAnchorPos)me.seqLength) - ++me.anchorIdx; - } - else - { - me.anchorIdx = ((TAnchorSPos)pos < me.seqLength)? 0: 1; - } - } - _getAnchor(me.prevAnchor, *me.data_container, me.anchorIdx); - _getAnchor(me.nextAnchor, *me.data_container, me.anchorIdx + 1); - - me.current.gapPos = pos; - if (me.nextAnchor.seqPos - me.prevAnchor.seqPos > (int)pos - me.prevAnchor.gapPos) - me.current.seqPos = me.prevAnchor.seqPos + ((int)pos - me.prevAnchor.gapPos); - else - me.current.seqPos = me.nextAnchor.seqPos; -} - -// ---------------------------------------------------------------------------- -// Function goNext() -// ---------------------------------------------------------------------------- - -template -inline void -goNext(Iter > > & me) -{ - _goNextGapAnchorIterator(me); -} - -// ---------------------------------------------------------------------------- -// Function goPrevious() -// ---------------------------------------------------------------------------- - -template -inline void -goPrevious(Iter > > & me) -{ - _goPreviousGapAnchorIterator(me); -} - -// ---------------------------------------------------------------------------- -// Function goFurther() -// ---------------------------------------------------------------------------- - -template -inline void -goFurther(Iter > > & me, TSize steps) -{ - _goToGapAnchorIterator(me, me.current.gapPos + steps); -} - -// ---------------------------------------------------------------------------- -// Function position() -// ---------------------------------------------------------------------------- - -// Returns clipped view position of gaps iterator. - -template -inline typename Position > > >::Type -position(Iter > > const & it) -{ - return it.current.gapPos - it.viewBegin.gapPos; -} - -// ---------------------------------------------------------------------------- -// Function difference() -// ---------------------------------------------------------------------------- - -template -inline typename Difference > > >::Type -difference(Iter > > const & lhs, - Iter > > const & rhs) -{ - return lhs.current.gapPos - rhs.current.gapPos; -} - -// ---------------------------------------------------------------------------- -// Function operator-() [difference] -// ---------------------------------------------------------------------------- - -template -inline typename Difference > > >::Type -operator-(Iter > > const & lhs, - Iter > > const & rhs) -{ - return difference(lhs, rhs); -} - -// ---------------------------------------------------------------------------- -// Function operator-() [copy movement] -// ---------------------------------------------------------------------------- - -template -inline Iter > > -operator-(Iter > > const & lhs, TDifference d) -{ - Iter > > result = lhs; - result -= d; - return result; -} - -// ---------------------------------------------------------------------------- -// Function operator+() [copy movement] -// ---------------------------------------------------------------------------- - -template -inline Iter > > -operator+(Iter > > const & lhs, TDifference d) -{ - Iter > > result = lhs; - result += d; - return result; -} - - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ITERATOR_ANCHOR_H_ diff --git a/seqan/align/gaps_iterator_array.h b/seqan/align/gaps_iterator_array.h deleted file mode 100644 index 6d8da0c..0000000 --- a/seqan/align/gaps_iterator_array.h +++ /dev/null @@ -1,741 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ITERATOR_ARRAY_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ITERATOR_ARRAY_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -template -class Iter > -{ -public: - // ----------------------------------------------------------------------- - // Internal Typedefs - // ----------------------------------------------------------------------- - - typedef typename TGaps::TArrayPos_ TArrayPos_; - typedef typename TGaps::TArray_ TArray_; - typedef typename Value::Type TArrayValue_; - typedef typename Position::Type TGapsPos_; - typedef typename Source::Type TSource_; - typedef typename Position::Type TSourcePos_; - - // ----------------------------------------------------------------------- - // Member Variables - // ----------------------------------------------------------------------- - - // The following index and position members must be mutable since the - // insertion and deletion of gaps does not modify the iterator conceptually. - - // Pointer to the iterated container / gaps object. - TGaps * _container; - // Index in the bucket array of the gaps object. - mutable TArrayPos_ _bucketIndex; - // Offset within the current bucket. - mutable TArrayValue_ _bucketOffset; - // Source position of the iterator. - mutable TSourcePos_ _sourcePosition; - // View position of the iterator. - mutable TGapsPos_ _unclippedViewPosition; - - // ----------------------------------------------------------------------- - // Constructors - // ----------------------------------------------------------------------- - - // Default constructor. - Iter() : _container(0), _bucketIndex(0), _bucketOffset(0), _sourcePosition(0), _unclippedViewPosition(0) - {} - - // Copy constructor, required since we specify the one with complemented const below. - Iter(Iter const & other) : - _container(other._container), _bucketIndex(other._bucketIndex), _bucketOffset(other._bucketOffset), - _sourcePosition(other._sourcePosition), _unclippedViewPosition(other._unclippedViewPosition) - {} - - // Copy construtor for iterator -> const iterator conversion. - // TODO(holtgrew): Think of something smarter, to restrict source types? - template - Iter(TOtherIter const & other) : - _container(other._container), _bucketIndex(other._bucketIndex), _bucketOffset(other._bucketOffset), - _sourcePosition(other._sourcePosition), _unclippedViewPosition(other._unclippedViewPosition) - {} - - // Create at begin of gaps. - Iter(TGaps & container_, Begin_ const &) : - _container(&container_), _bucketIndex(0), _bucketOffset(0), _sourcePosition(0), - _unclippedViewPosition(0) - { - if (_container->_array[0] == 0u) - _bucketIndex = 1; - // Go to beginning of clipping. - goFurther(*this, container_._clippingBeginPos); - } - - // Create at end of gaps. - Iter(TGaps & container_, End_ const &) : - _container(&container_), _bucketIndex(0), _bucketOffset(0), _sourcePosition(0), - _unclippedViewPosition(0) - { - if (_container->_array[0] == 0u) - _bucketIndex = 1; - // Go to end of clipping position. - goFurther(*this, container_._clippingEndPos); - } - - // Create with position. - // TODO(holtgrew): Chain constructor call to Begin_() here in C++11. - template - Iter(TGaps & container_, TPos pos, Position_ const &) : - _container(&container_), _bucketIndex(0), _bucketOffset(0), _sourcePosition(0), - _unclippedViewPosition(0) - { - if (_container->_array[0] == 0u) - _bucketIndex = 1; - // pos is an unclipped view position, make it clipped. - pos += container_._clippingBeginPos; - // Initialized for begin position. Now, advance. - goFurther(*this, pos); - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function isGap() -// ---------------------------------------------------------------------------- - -template -inline bool -isGap(Iter > const & it) -{ - return !(it._bucketIndex % 2); -} - -// ---------------------------------------------------------------------------- -// Function value() -// ---------------------------------------------------------------------------- - -template -inline typename Reference > >::Type -value(Iter > & it) -{ - typedef typename Reference > >::Type TProxy; - return TProxy(it); -} - -template -inline typename Reference > const>::Type -value(Iter > const & it) -{ - typedef typename Reference > const>::Type TProxy; - return TProxy(it); -} - -// ---------------------------------------------------------------------------- -// Function getValue() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Ideally, we would only have one here. - -template -inline typename GetValue > >::Type -getValue(Iter > & it) -{ - typedef typename Value::Type TAlphabet; - if (isGap(it)) - return gapValue(); - else - return value(source(container(it)), it._sourcePosition); -} - -template -inline typename GetValue > const>::Type -getValue(Iter > const & it) -{ - typedef typename Value::Type TAlphabet; - if (isGap(it)) - return gapValue(); - else - return value(source(container(it)), it._sourcePosition); -} - -// ---------------------------------------------------------------------------- -// Function position() -// ---------------------------------------------------------------------------- - -// Returns clipped view position of gaps iterator. - -template -inline typename Position > >::Type -position(Iter > const & it) -{ - if (it._container == 0) - return 0; - - typedef Iter > TIter; - typedef typename Position::Type TPosition; - typedef typename TIter::TArrayPos_ TArrayPos; - - TPosition unclippedViewPosition = 0; - for (TArrayPos i = 0; i < it._bucketIndex; ++i) - unclippedViewPosition += it._container->_array[i]; - unclippedViewPosition += it._bucketOffset; - - // TODO(holtgrew): Simply return it._unclippedViewPosition? - SEQAN_ASSERT_EQ(it._unclippedViewPosition, unclippedViewPosition); - - return unclippedViewPosition - clippedBeginPosition(*it._container); -} - -// ---------------------------------------------------------------------------- -// Function countGaps() -// ---------------------------------------------------------------------------- - -template -inline typename Size::Type -countGaps(Iter > const & it) -{ - if (!isGap(it) || atEnd(it)) - return 0; // Not on a gap or at end, no gap here. - - typedef typename Size::Type TSize; - TSize result = it._container->_array[it._bucketIndex] - it._bucketOffset; - // Check whether gaps reach behind the clipping and trim gaps for counting. - if ((TSize)(it._unclippedViewPosition + result) > (TSize)it._container->_clippingEndPos) - result = it._container->_clippingEndPos - it._unclippedViewPosition; - return result; -} - -// ---------------------------------------------------------------------------- -// Function countCharacters() -// ---------------------------------------------------------------------------- - -template -inline typename Size::Type -countCharacters(Iter > const & it) -{ - if (isGap(it) || atEnd(it)) - return 0; // On a gap or at end, no characters here. - - typedef typename Size::Type TSize; - TSize result = it._container->_array[it._bucketIndex] - it._bucketOffset; - // Check whether gaps reach behind the clipping and trim gaps for counting. - if ((TSize)(it._unclippedViewPosition + result) > (TSize)it._container->_clippingEndPos) - result = it._container->_clippingEndPos - it._unclippedViewPosition; - return result; -} - -// ---------------------------------------------------------------------------- -// Function goPrevious() -// ---------------------------------------------------------------------------- - -template -inline bool -goPrevious(Iter > & it) -{ - typedef typename Position::Type TGapsPos; - - if (atBegin(it)) // Handle case of being at the beginning of the gaps. - return false; - - if (it._bucketOffset > TGapsPos(0)) - { - // Not at the beginning of a bucket. - it._bucketOffset -= 1; - } - else - { - // At the beginning of a bucket. - it._bucketIndex -= 1; - SEQAN_ASSERT_GT(it._container->_array[it._bucketIndex], 0u); - it._bucketOffset = it._container->_array[it._bucketIndex] - 1; - } - - // Adjust source position. - if (!isGap(it)) - it._sourcePosition -= 1; - // Adjust clipped view position. - it._unclippedViewPosition -= 1; - - return true; -} - -// ---------------------------------------------------------------------------- -// Function goNext() -// ---------------------------------------------------------------------------- - -template -inline bool -goNext(Iter > & it) -{ - if (atEnd(it)) // Handle case of being at the end of the gaps. - return false; - - // Adjust source position. - if (!isGap(it)) - it._sourcePosition += 1; - // Adjust clipped view position. - it._unclippedViewPosition += 1; - - if (it._bucketOffset + 1 != it._container->_array[it._bucketIndex]) - { - // Not on last entry of a bucket. - it._bucketOffset += 1; - } - else - { - // On last entry of a bucket. If we are not in the last bucket then go - // to next bucket. Otherwise, go over the bucket, marks iterator-at-end. - if (it._bucketIndex + 1 != length(it._container->_array)) - { - // Go to next. - it._bucketIndex += 1; - if (it._bucketIndex > length(it._container->_array)) - SEQAN_ASSERT_GT(it._container->_array[it._bucketIndex], 0u); - it._bucketOffset = 0; - } - else - { - // Go to end of bucket. - it._bucketOffset += 1; - SEQAN_ASSERT_EQ(it._bucketIndex + 1, length(it._container->_array)); - SEQAN_ASSERT_EQ(it._bucketOffset, back(it._container->_array)); - } - } - - return true; -} - - -// ---------------------------------------------------------------------------- -// Function goNext() -// ---------------------------------------------------------------------------- - -template -inline void -goFurther(Iter > & it, - TDifference delta) -{ - // TODO(holtgrew): Handle going backwards more efficiently. - if (delta == TDifference(0)) - return; - if ((int)delta < 0) - { - typedef typename MakeSigned::Type TSignedDifference; - for (; -static_cast(delta); ++delta) - goPrevious(it); - return; - } - - // Do nothing if we want are already at the end. - if (atEnd(it)) - return; - - // Case: Going forward. - - // Get shortcut to new unclipped view position that we want to go to and - // limit this to the clipping end pos of the gaps object. - unsigned posEnd = it._unclippedViewPosition + delta; - if (posEnd > static_cast(it._container->_clippingEndPos)) - posEnd = it._container->_clippingEndPos; - - // The variable counter is the number of view positions to go forward. - for (unsigned counter = posEnd - it._unclippedViewPosition; counter > 0u;) - { - // Number of elements in bucket and number of remaining (behind offset in bucket). - unsigned count = it._container->_array[it._bucketIndex]; - unsigned shift = count - it._bucketOffset; - - if (shift < counter) - { - it._unclippedViewPosition += shift; - if (it._bucketIndex % 2) - it._sourcePosition += shift; - it._bucketOffset = 0; - it._bucketIndex += 1; - counter -= shift; - } - else if (shift == counter) - { - it._unclippedViewPosition += shift; - if (it._bucketIndex % 2) - it._sourcePosition += shift; - - // On last entry of a bucket. If we are not in the last bucket then go to next bucket. - // Otherwise, go over the bucket, marks iterator-at-end. - if (it._bucketIndex + 1 != length(it._container->_array)) - { - // Go to next. - it._bucketIndex += 1; - if (it._bucketIndex > length(it._container->_array)) - SEQAN_ASSERT_GT(it._container->_array[it._bucketIndex], 0u); - it._bucketOffset = 0; - } - else - { - // Go to end of bucket. - it._bucketOffset += shift; - SEQAN_ASSERT_EQ(it._bucketIndex + 1, length(it._container->_array)); - SEQAN_ASSERT_EQ(it._bucketOffset, back(it._container->_array)); - } - counter = 0; - } - else // shift > counter - { - it._unclippedViewPosition += counter; - if (it._bucketIndex % 2) - it._sourcePosition += counter; - it._bucketOffset += counter; - counter = 0; - } - } -} - -// ---------------------------------------------------------------------------- -// Function atBegin() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Non-const version is superflous :( -template -inline bool -atBegin(Iter > const & it) -{ - return it._unclippedViewPosition == it._container->_clippingBeginPos; -} - -template -inline bool -atBegin(Iter > & it) -{ - return it._unclippedViewPosition == it._container->_clippingBeginPos; -} - -// ---------------------------------------------------------------------------- -// Function atEnd() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Non-const version is superflous :( -template -inline bool -atEnd(Iter > const & it) -{ - return it._unclippedViewPosition == it._container->_clippingEndPos; -} - -template -inline bool -atEnd(Iter > & it) -{ - return it._unclippedViewPosition == it._container->_clippingEndPos; -} - -// ---------------------------------------------------------------------------- -// Function insertGaps() -// ---------------------------------------------------------------------------- - -template -inline void -insertGaps(Iter > const & it, - TCount count) -{ - if (count == TCount(0)) - return; // Do nothing! - - typedef typename TGaps::TArray_ TArray; - typedef typename Position::Type TArrayPos; - - // Get shortcut to gaps. - TGaps & gaps = *it._container; - TArrayPos idx = it._bucketIndex; - - // Handle case of being at the start of a character bucket. - if (idx % 2 && it._bucketOffset == 0) - { - idx -= 1; - it._bucketIndex -= 1; - it._bucketOffset = gaps._array[idx]; - } - - // Insert gaps, simple and fast if we are in a gaps bucket, a bit harder - // otherwise. - if (idx % 2) // character bucket - { - if (gaps._array[idx] > it._bucketOffset) // In the middle of the bucket. - { - TArray arr; - resize(arr, 2, 0); - arr[0] = count; - arr[1] = gaps._array[idx] - it._bucketOffset; - gaps._array[idx] = it._bucketOffset; - insert(gaps._array, idx + 1, arr); - - // Update iterator. - it._bucketIndex += 1; - it._bucketOffset = 0; - } - else // At the end of the bucket. - { - if (idx + 1 < length(gaps._array)) // Not at end of array. - { - gaps._array[idx + 1] += count; - } - else // At end of array. - { - resize(gaps._array, length(gaps._array) + 2, 0); - gaps._array[idx + 1] = count; - gaps._array[idx + 2] = 0; - } - } - } - else // gap bucket - { - gaps._array[idx] += count; - } - - // Adjust clipping information. - gaps._clippingEndPos += count; -} - -// ---------------------------------------------------------------------------- -// Function removeGaps() -// ---------------------------------------------------------------------------- - -template -inline typename Size::Type -removeGaps(Iter > const & it, TCount count) -{ - typedef typename TGaps::TArray_ TArray; - typedef typename Position::Type TArrayPos; - typedef typename Value::Type TArrayValue; - typedef typename Source::Type TSource; - typedef typename Position::Type TSeqPos; - - if (count == TCount(0)) - return 0; // Do nothing! - - // Get shortcuts. - TGaps & gaps = *it._container; - TArrayPos idx = it._bucketIndex; - TSeqPos offset = it._bucketOffset; - - // If we are inside a non-gap bucket then we cannot remove any gaps. - if (idx % 2) - return 0; - - // Otherwise, we can remove gaps right of the current position but not - // more than there are. - TSeqPos toRemove = count; - if (toRemove > gaps._array[idx] - offset) - toRemove = gaps._array[idx] - offset; - gaps._array[idx] -= toRemove; - // TODO(holtgrew): We have to decrement idx and adjust offset in case of merging! - // In some cases, we remove the whole gap and merge the character buckets. - if (gaps._array[idx] == TArrayValue(0)) - { - // No merging for leading and trailing gap. - if (idx == TArrayPos(0) || idx == TArrayPos(length(gaps._array) - 1)) - { - gaps._array[idx - 1] += gaps._array[idx + 1]; - erase(gaps._array, idx, idx + 2); - } - } - - // Also update the right clipping position. - gaps._clippingEndPos -= toRemove; - - // Finally, return number of removed gaps. - return toRemove; -} - -// ---------------------------------------------------------------------------- -// Function operator<() -// ---------------------------------------------------------------------------- - -template -inline bool -operator<(Iter > const & lhs, - Iter > const & rhs) -{ - return lhs._bucketIndex < rhs._bucketIndex || - (lhs._bucketIndex == rhs._bucketIndex && lhs._bucketOffset < rhs._bucketOffset); -} - -// ---------------------------------------------------------------------------- -// Function operator>() -// ---------------------------------------------------------------------------- - -template -inline bool -operator>(Iter > const & lhs, - Iter > const & rhs) -{ - return lhs._bucketIndex > rhs._bucketIndex || - (lhs._bucketIndex == rhs._bucketIndex && lhs._bucketOffset > rhs._bucketOffset); -} - -// ---------------------------------------------------------------------------- -// Function operator<=() -// ---------------------------------------------------------------------------- - -template -inline bool -operator<=(Iter > const & lhs, - Iter > const & rhs) -{ - return !(lhs > rhs); -} - -// ---------------------------------------------------------------------------- -// Function operator>=() -// ---------------------------------------------------------------------------- - -template -inline bool -operator>=(Iter > const & lhs, - Iter > const & rhs) -{ - return !(lhs < rhs); -} - -// ---------------------------------------------------------------------------- -// Function operator==() -// ---------------------------------------------------------------------------- - -template -inline bool -operator==(Iter > const & _lhs, - Iter > const & _rhs) -{ - return _lhs._container == _rhs._container && - _lhs._bucketIndex == _rhs._bucketIndex && - _lhs._bucketOffset == _rhs._bucketOffset; -} - -// ---------------------------------------------------------------------------- -// Function operator!=() -// ---------------------------------------------------------------------------- - -template -inline bool -operator!=(Iter > const & _lhs, - Iter > const & _rhs) -{ - return _lhs._container != _rhs._container || - _lhs._bucketIndex != _rhs._bucketIndex || - _lhs._bucketOffset != _rhs._bucketOffset; -} - -// ---------------------------------------------------------------------------- -// Function difference() -// ---------------------------------------------------------------------------- - -template -inline typename Difference > >::Type -difference(Iter > const & lhs, - Iter > const & rhs) -{ - // TODO(holtgrew): Implementation could be more efficient. - // We only need to solve the case lhs < rhs. - if (lhs > rhs) - return -difference(rhs, lhs); - if (lhs == rhs) - return 0; - SEQAN_ASSERT(lhs < rhs); // Makes code below simpler. - - typedef Iter > TIter; - typedef typename Difference::Type TDifference; - TDifference d = 0; - for (TIter it = lhs; it != rhs; ++it) - ++d; - - return -d; -} - -// ---------------------------------------------------------------------------- -// Function operator-() [difference] -// ---------------------------------------------------------------------------- - -template -inline typename Difference > >::Type -operator-(Iter > const & lhs, - Iter > const & rhs) -{ - return difference(lhs, rhs); -} - -// ---------------------------------------------------------------------------- -// Function operator-() [copy movement] -// ---------------------------------------------------------------------------- - -template -inline Iter > -operator-(Iter > const & lhs, TDifference d) -{ - Iter > result = lhs; - result -= d; - return result; -} - -// ---------------------------------------------------------------------------- -// Function operator+() [copy movement] -// ---------------------------------------------------------------------------- - -template -inline Iter > -operator+(Iter > const & lhs, TDifference d) -{ - Iter > result = lhs; - result += d; - return result; -} - -} // namespace seqan - -#endif // SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ITERATOR_ARRAY_H_ diff --git a/seqan/align/gaps_iterator_base.h b/seqan/align/gaps_iterator_base.h deleted file mode 100644 index 1501e17..0000000 --- a/seqan/align/gaps_iterator_base.h +++ /dev/null @@ -1,372 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// Author: Manuel Holtgrewe -// ========================================================================== - -// TODO(holtgrew): Switch to Host interface. - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ITERATOR_BASE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ITERATOR_BASE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// Internally used tag for creating iterators at the begin of containers. -struct Begin__; -typedef Tag Begin_; - -// Internally used tag for creating iterators at the end of containers. -struct End__; -typedef Tag End_; - -// Internally used tag for creating iterators inside of containers. -struct Position__; -typedef Tag Position_; - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -template -struct GapsIterator; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction Position -// ---------------------------------------------------------------------------- - -template -struct Position > > : - Position -{}; - -template -struct Position > const> : - Position > > -{}; - -// ---------------------------------------------------------------------------- -// Metafunction Difference -// ---------------------------------------------------------------------------- - -template -struct Difference > > : - Difference -{}; - -template -struct Difference > const> : - Difference > > -{}; - -// ---------------------------------------------------------------------------- -// Metafunction Source -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Should this be Host? or SourceIterator? - -template -struct Source > > -{ - typedef typename Source::Type TSource_; - typedef typename Iterator::Type Type; -}; - -template -struct Source > const> -{ - typedef typename Source::Type TSource_; - typedef typename Iterator::Type Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Value -// ---------------------------------------------------------------------------- - -template -struct Value > > -{ - typedef typename Source > >::Type TSource_; - typedef typename Value::Type TSourceValue_; - //typedef TSourceValue_ Type; - // TODO(holtgrew): We really want gapped values here but there are issues... - typedef typename GappedValueType::Type Type; -}; - -template -struct Value > const> : - Value > > {}; - -// ---------------------------------------------------------------------------- -// Metafunction GetValue -// ---------------------------------------------------------------------------- - -template -struct GetValue > > : - Value > > -{ -}; - -template -struct GetValue > const> : - Value > const> -{ -}; - -// ---------------------------------------------------------------------------- -// Metafunction Reference -// ---------------------------------------------------------------------------- - -template -struct Reference > > -{ - typedef Iter > TIterator_; - typedef Proxy > Type; -}; - -template -struct Reference > const> -{ - typedef Iter const > TIterator_; - typedef Proxy > Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function operator++ -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Could be general forward - -template -inline Iter > & -operator++(Iter > & it) -{ - goNext(it); - return it; -} - -template -inline Iter > -operator++(Iter > & it, int) -{ - Iter > ret = it; - goNext(it); - return ret; -} - -// ---------------------------------------------------------------------------- -// Function operator-- -// ---------------------------------------------------------------------------- - -template -inline Iter > & -operator--(Iter > & it) -{ - goPrevious(it); - return it; -} - -template -inline Iter > -operator--(Iter > & it, int) -{ - Iter > ret = it; - goPrevious(it); - return ret; -} - -// ---------------------------------------------------------------------------- -// Function insertGap() -// ---------------------------------------------------------------------------- - -// Forward to insertGaps() which has to be implemented by the specific gap -// iterator. - -template -inline void -insertGap(Iter > & it) -{ - insertGaps(it, 1); -} - -// ---------------------------------------------------------------------------- -// Function removeGap() -// ---------------------------------------------------------------------------- - -// Forward to removeGaps() which has to be implemented by the specific gap -// iterator. - -template -inline typename Size::Type -removeGap(Iter > & it) -{ - return removeGaps(it, 1); -} - -// ---------------------------------------------------------------------------- -// Function assignValue() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Const consistency problems. - -template -inline void -assignValue(Iter > & me, - TValue const & val) -{ - if (!isGap(me)) - { - assignValue(source(me), val); - } - // TODO(holtgrew): Else, inserting gaps is problematic... -} - -template -inline void -assignValue(Iter > const & me, - TValue const & val) -{ - if (!isGap(me)) - { - assignValue(source(me), val); - } -} - -// ---------------------------------------------------------------------------- -// Function container() -// ---------------------------------------------------------------------------- - -template -inline TGaps & -container(Iter > & me) -{ - return *me._container; -} - -template -inline TGaps & -container(Iter > const & me) -{ - return *me._container; -} - -// ---------------------------------------------------------------------------- -// Function source -// ---------------------------------------------------------------------------- - -// Returns host iterator. - -// TODO(holtgrew): Non-const version is superflous. -template -inline typename Source > >::Type /*returns copy*/ -source(Iter > & it) -{ - return iter(container(it), toSourcePosition(container(it), position(it))); -} - -template -inline typename Source > const>::Type /*returns copy*/ -source(Iter > const & it) -{ - return iter(container(source(it)), toSourcePosition(container(it), position(it))); -} - -// TODO(holtgrew): setSource? setContainer? - -// ---------------------------------------------------------------------------- -// Function operator+= -// ---------------------------------------------------------------------------- - -template -inline Iter > & -operator+=(Iter > & it, TDiff diff) -{ - goFurther(it, diff); - return it; -} - -// ---------------------------------------------------------------------------- -// Function operator-= -// ---------------------------------------------------------------------------- - -template -inline Iter > & -operator-=(Iter > & it, TDiff diff) -{ - goFurther(it, -(__int64)(diff)); - return it; -} - -// ---------------------------------------------------------------------------- -// Function goFurther -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Implementation could be faster. -template -inline void -goFurther(Iter > & it, - TDifference steps) -{ - typedef typename MakeSigned::Type TSignedDifference; - if (steps > TDifference(0)) - for (; steps; --steps) - goNext(it); - else - for (; -static_cast(steps); ++steps) - goPrevious(it); -} - -// ---------------------------------------------------------------------------- -// Function isClipped() -// ---------------------------------------------------------------------------- - -template -inline bool -isClipped(Iter > const &) -{ - return false; -} - -} // namespace seqan - -#endif // SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GAPS_ITERATOR_BASE_H_ diff --git a/seqan/align/global_alignment_banded.h b/seqan/align/global_alignment_banded.h deleted file mode 100644 index dabfcec..0000000 --- a/seqan/align/global_alignment_banded.h +++ /dev/null @@ -1,531 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Global alignment interface for the banded Needleman-Wunsch and Gotoh -// algorithms. -// -// We define the interface functions pretty explicitely (versus just TAlign, -// TFragments etc.) so the candidates the compiler gives when resolution to -// the globalFunction() fails is actually meaningful. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_BANDED_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_BANDED_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -template -class Score; -template -class Graph; -template -struct Alignment; -template -class Fragment; - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [banded, Align] -// ---------------------------------------------------------------------------- - -template -TScoreValue globalAlignment(Align & align, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - typedef Align TAlign; - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String trace; - - // We do not need string ids for this variant and set them to 0u. They are - // only required for the Fragment String and the Alignment Graph variant. - TScoreValue res = _setUpAndRunAlignment(trace, source(row(align, 0)), source(row(align, 1)), scoringScheme, - alignConfig, lowerDiag, upperDiag, algoTag); - _adaptTraceSegmentsTo(row(align, 0), row(align, 1), trace); - return res; -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignment(Align & align, - Score const & scoringScheme, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - AlignConfig<> alignConfig; - return globalAlignment(align, scoringScheme, alignConfig, lowerDiag, upperDiag, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignment(Align & align, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag) -{ - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignment(align, scoringScheme, alignConfig, lowerDiag, upperDiag, NeedlemanWunsch()); - else - return globalAlignment(align, scoringScheme, alignConfig, lowerDiag, upperDiag, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignment(Align & align, - Score const & scoringScheme, - int lowerDiag, - int upperDiag) -{ - AlignConfig<> alignConfig; - return globalAlignment(align, scoringScheme, alignConfig, lowerDiag, upperDiag); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [banded, Gaps] -// ---------------------------------------------------------------------------- - -template -TScoreValue globalAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - - // We do not need string ids for this variant and set them to 0u. They are - // only required for the Fragment String and the Alignment Graph variant. - TScoreValue res = _setUpAndRunAlignment(traceSegments, source(gapsH), source(gapsV), scoringScheme, alignConfig, - lowerDiag, upperDiag, algoTag); - _adaptTraceSegmentsTo(gapsH, gapsV, traceSegments); - return res; -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - AlignConfig<> alignConfig; - return globalAlignment(gapsH, gapsV, scoringScheme, alignConfig, lowerDiag, upperDiag, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag) -{ - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignment(gapsH, gapsV, scoringScheme, alignConfig, lowerDiag, upperDiag, NeedlemanWunsch()); - else - return globalAlignment(gapsH, gapsV, scoringScheme, alignConfig, lowerDiag, upperDiag, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme, - int lowerDiag, - int upperDiag) -{ - AlignConfig<> alignConfig; - return globalAlignment(gapsH, gapsV, scoringScheme, alignConfig, lowerDiag, upperDiag); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [banded, Graph >] -// ---------------------------------------------------------------------------- - -// Full interface. - -template -TScoreValue globalAlignment(Graph > & alignmentGraph, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - typedef Graph > TGraph; - typedef typename Position::Type TPosition; - typedef typename Size::Type TSize; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - - TScoreValue res = _setUpAndRunAlignment(traceSegments, value(stringSet(alignmentGraph), 0), - value(stringSet(alignmentGraph), 1), scoringScheme, alignConfig, lowerDiag, - upperDiag, algoTag); - _adaptTraceSegmentsTo(alignmentGraph, positionToId(stringSet(alignmentGraph), 0), - positionToId(stringSet(alignmentGraph), 1), traceSegments); - return res; -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignment(Graph > & alignmentGraph, - Score const & scoringScheme, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - AlignConfig<> alignConfig; - return globalAlignment(alignmentGraph, scoringScheme, alignConfig, lowerDiag, upperDiag, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignment(Graph > & alignmentGraph, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag) -{ - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignment(alignmentGraph, scoringScheme, alignConfig, lowerDiag, upperDiag, NeedlemanWunsch()); - else - return globalAlignment(alignmentGraph, scoringScheme, alignConfig, lowerDiag, upperDiag, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignment(Graph > & alignmentGraph, - Score const & scoringScheme, - int lowerDiag, - int upperDiag) -{ - AlignConfig<> alignConfig; - return globalAlignment(alignmentGraph, scoringScheme, alignConfig, lowerDiag, upperDiag); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [banded, String >] -// ---------------------------------------------------------------------------- - -// Full interface. - -template -TScoreValue globalAlignment(String, TStringSpec> & fragmentString, - StringSet const & strings, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - typedef String, TStringSpec> TFragments; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - - TScoreValue res = _setUpAndRunAlignment(traceSegments, value(strings, 0), value(strings, 1), scoringScheme, - alignConfig, lowerDiag, upperDiag, algoTag); - _adaptTraceSegmentsTo(fragmentString, positionToId(strings, 0), positionToId(strings, 1), traceSegments); - return res; -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignment(String, TStringSpec> & fragmentString, - StringSet const & strings, - Score const & scoringScheme, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - AlignConfig<> alignConfig; - return globalAlignment(fragmentString, strings, scoringScheme, alignConfig, lowerDiag, upperDiag, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignment(String, TStringSpec> & fragmentString, - StringSet const & strings, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag) -{ - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignment(fragmentString, strings, scoringScheme, alignConfig, lowerDiag, upperDiag, NeedlemanWunsch()); - else - return globalAlignment(fragmentString, strings, scoringScheme, alignConfig, lowerDiag, upperDiag, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignment(String, TStringSpec> & fragmentString, - StringSet const & strings, - Score const & scoringScheme, - int lowerDiag, - int upperDiag) -{ - AlignConfig<> alignConfig; - return globalAlignment(fragmentString, strings, scoringScheme, alignConfig, lowerDiag, upperDiag); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignmentScore() [banded, 2 Strings] -// ---------------------------------------------------------------------------- - -template -TScoreValue globalAlignmentScore(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - return _setUpAndRunAlignment(seqH, seqV, scoringScheme, alignConfig, lowerDiag, upperDiag, algoTag); -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignmentScore(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - AlignConfig<> alignConfig; - return globalAlignmentScore(seqH, seqV, scoringScheme, alignConfig, lowerDiag, upperDiag, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignmentScore(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag) -{ - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignmentScore(seqH, seqV, scoringScheme, alignConfig, lowerDiag, upperDiag, NeedlemanWunsch()); - else - return globalAlignmentScore(seqH, seqV, scoringScheme, alignConfig, lowerDiag, upperDiag, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignmentScore(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - int lowerDiag, - int upperDiag) -{ - AlignConfig<> alignConfig; - return globalAlignmentScore(seqH, seqV, scoringScheme, alignConfig, lowerDiag, upperDiag); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignmentScore() [banded, StringSet] -// ---------------------------------------------------------------------------- - -template -TScoreValue globalAlignmentScore(StringSet const & strings, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - return _setUpAndRunAlignment(strings[0], strings[1], scoringScheme, alignConfig, lowerDiag, upperDiag, algoTag); -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignmentScore(StringSet const & strings, - Score const & scoringScheme, - int lowerDiag, - int upperDiag, - TAlgoTag const & algoTag) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - - AlignConfig<> alignConfig; - return globalAlignmentScore(strings[0], strings[1], scoringScheme, alignConfig, lowerDiag, upperDiag, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignmentScore(StringSet const & strings, - Score const & scoringScheme, - AlignConfig const & alignConfig, - int lowerDiag, - int upperDiag) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignmentScore(strings[0], strings[1], scoringScheme, alignConfig, lowerDiag, upperDiag, NeedlemanWunsch()); - else - return globalAlignmentScore(strings[0], strings[1], scoringScheme, alignConfig, lowerDiag, upperDiag, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignmentScore(StringSet const & strings, - Score const & scoringScheme, - int lowerDiag, - int upperDiag) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - - AlignConfig<> alignConfig; - return globalAlignmentScore(strings[0], strings[1], scoringScheme, alignConfig, lowerDiag, upperDiag); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_BANDED_H_ diff --git a/seqan/align/global_alignment_hirschberg_impl.h b/seqan/align/global_alignment_hirschberg_impl.h deleted file mode 100644 index 7e05496..0000000 --- a/seqan/align/global_alignment_hirschberg_impl.h +++ /dev/null @@ -1,729 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Stephan Aiche -// ========================================================================== - -#include - -// TODO(holtgrew): Get rid of this? -//#define SEQAN_HIRSCHBERG_DEBUG_CUT - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_HIRSCHBERG_IMPL_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_HIRSCHBERG_IMPL_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -struct Hirschberg_; -typedef Tag Hirschberg; - -// ---------------------------------------------------------------------------- -// Helper Class HirschbergSet_ -// ---------------------------------------------------------------------------- - -// State for the implementation of Hirschberg's algorithm. - -class HirschbergSet_ -{ -public: - int x1,x2,y1,y2; - int score; - - HirschbergSet_() - : x1(0),x2(0),y1(0),y2(0) - { - } - - HirschbergSet_(int a1,int a2,int b1,int b2,int sc) - : x1(a1),x2(a2),y1(b1),y2(b2),score(sc) - { - SEQAN_ASSERT_LEQ(a1, a2); - SEQAN_ASSERT_LEQ(b1, b2); - } - - HirschbergSet_ & - operator=(HirschbergSet_ const & other_) - { - x1 = other_.x1; - x2 = other_.x2; - y1 = other_.y1; - y2 = other_.y2; - score = other_.score; - return *this; - } - -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _begin1() -// ---------------------------------------------------------------------------- - -inline int& -_begin1(HirschbergSet_ & me) { - return me.x1; -} - - -inline int const& -_begin1(HirschbergSet_ const & me) { - return me.x1; -} - -// ---------------------------------------------------------------------------- -// Function _setBegin1() -// ---------------------------------------------------------------------------- - -inline void -_setBegin1(HirschbergSet_ & me, int const & new_begin) { - me.x1 = new_begin; -} - -// ---------------------------------------------------------------------------- -// Function _end1() -// ---------------------------------------------------------------------------- - -inline int& -_end1(HirschbergSet_ & me) { - return me.x2; -} - -inline int const& -_end1(HirschbergSet_ const & me) { - return me.x2; -} - -// ---------------------------------------------------------------------------- -// Function _setEnd1() -// ---------------------------------------------------------------------------- - -inline void -_setEnd1(HirschbergSet_ & me, int const & new_end) { - me.x2 = new_end; -} - -// ---------------------------------------------------------------------------- -// Function _begin2() -// ---------------------------------------------------------------------------- - -inline int& -_begin2(HirschbergSet_ & me) { - return me.y1; -} - -inline int const& -_begin2(HirschbergSet_ const & me) { - return me.y1; -} - -// ---------------------------------------------------------------------------- -// Function _setBegin2() -// ---------------------------------------------------------------------------- - -inline void -_setBegin2(HirschbergSet_ & me, int const & new_begin) { - me.y1 = new_begin; -} - -// ---------------------------------------------------------------------------- -// Function _end2() -// ---------------------------------------------------------------------------- - -inline int& -_end2(HirschbergSet_ & me) { - return me.y2; -} - -inline int const& -_end2(HirschbergSet_ const & me) { - return me.y2; -} - -// ---------------------------------------------------------------------------- -// Function _setEnd2() -// ---------------------------------------------------------------------------- - -inline void -_setEnd2(HirschbergSet_ & me, int const & new_end) { - me.y2 = new_end; -} - -// ---------------------------------------------------------------------------- -// Function _score() -// ---------------------------------------------------------------------------- - -inline int& -_score(HirschbergSet_ & me) { - return me.score; -} - -// ---------------------------------------------------------------------------- -// Function _score() -// ---------------------------------------------------------------------------- - -inline int const& -_score(HirschbergSet_ const & me) -{ - return me.score; -} - -// ---------------------------------------------------------------------------- -// Function _setScore() -// ---------------------------------------------------------------------------- - -inline void -_setScore(HirschbergSet_ & me,int new_score) { - me.score = new_score; -} - -// ---------------------------------------------------------------------------- -// Function _setBegin2() -// ---------------------------------------------------------------------------- - -// ////////////////////////////////////////////////////////////////////////////////////////////// -// Debug Methods -// functions are only used for debugging or verbose output, therefore they -// are only active in SEQAN_DEBUG -// ////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef SEQAN_DEBUG - -inline -void -print(HirschbergSet_ const & me) -{ - std::cout << me.x1 << " " << me.x2 << "\t" << me.y1 << " " << me.y2 << std::endl; -} -#endif - -// ---------------------------------------------------------------------------- -// Function operator==() -// ---------------------------------------------------------------------------- - -inline bool -operator==(HirschbergSet_ const & lhs, - HirschbergSet_ const & rhs) -{ - return ((_begin1(lhs) == _begin1(rhs)) && (_end1(lhs) == _end1(rhs)) && - (_begin2(lhs) == _begin2(rhs)) && (_end2(lhs) == _end2(rhs))); -} - -// ---------------------------------------------------------------------------- -// Function _writeDebugMatrix() -// ---------------------------------------------------------------------------- - -#ifdef SEQAN_HIRSCHBERG_DEBUG_CUT - template - void _writeDebugMatrix(TSource s1,TSource s2) - { - int l1 = length(s1); - int l2 = length(s2); - - int i,j,sg,sd; - - String > fMatrix,rMatrix,tMatrix; - - resize(fMatrix,l1 + 1); - resize(rMatrix,l1 + 1); - resize(tMatrix,l1 + 1); - - for(i = 0;i <= l1;++i) - { - resize(fMatrix[i],l2 + 1); - resize(rMatrix[i],l2 + 1); - resize(tMatrix[i],l2 + 1); - } - - for(i = 0;i <= l1;++i) - fMatrix[i][0] = i * (-1); - - for(i = l1;i >= 0;--i) - rMatrix[i][l2] = (l1 - i) * (-1); - - // calculate forward matrix - for(j = 1;j <= l2;++j) - { - fMatrix[0][j] = j*(-1); - for(i = 1;i <= l1;++i) - { - sg = -1 + ((fMatrix[i-1][j] > fMatrix[i][j-1]) ? fMatrix[i-1][j] : fMatrix[i][j-1]); - sd = fMatrix[i-1][j-1] + ((s1[i - 1] == s2[j-1]) ? 0 : -1 ); - - fMatrix[i][j] = ((sg > sd) ? sg : sd); - } - } - - // calculate reverse matrix - for(j = l2 - 1;j >= 0;--j) - { - rMatrix[l1][j] = (l2 - j)*(-1); - for(i = l1 - 1;i >= 0;--i) - { - sg = -1 + ((rMatrix[i+1][j] > rMatrix[i][j+1]) ? rMatrix[i+1][j] : rMatrix[i][j+1]); - sd = rMatrix[i+1][j+1] + ((s1[i] == s2[j]) ? 0 : -1 ); - - rMatrix[i][j] = ((sg > sd) ? sg : sd); - } - } - - // print fMatrix - std::cout << ";-;"; - for(i = 0;i < l1;++i) - std::cout << s1[i] << ";"; - - std::cout << std::endl << "-;"; - for(j = 0;j <= l2;++j) - { - if(j != 0) std::cout << s2[j-1] << ";"; - for(i = 0;i <= l1;++i) - { - std::cout << fMatrix[i][j] << ";"; - } - std::cout << std::endl; - } - // print rMatrix - std::cout << ";"; - for(i = 0;i < l1;++i) - std::cout << s1[i] << ";"; - std::cout << "-;" << std::endl; - - for(j = 0;j <= l2;++j) - { - if(j != l2) std::cout << s2[j] << ";"; - else std::cout << "-;"; - for(i = 0;i <= l1;++i) - { - std::cout << rMatrix[i][j] << ";"; - } - std::cout << std::endl; - } - - // fill and print target matrix - std::cout << ";-;"; - for(i = 0;i < l1;++i) - std::cout << s1[i] << ";"; - - std::cout << std::endl << "-;"; - for(j = 0;j <= l2;++j) - { - if(j != 0) std::cout << s2[j-1] << ";"; - for(i = 0;i <= l1;++i) - { - tMatrix[i][j] = fMatrix[i][j] + rMatrix[i][j]; - std::cout << tMatrix[i][j] << ";"; - } - std::cout << std::endl; - } - } - -#endif - -// debug flag .. define to see where Hirschberg cuts the sequences -//#define SEQAN_HIRSCHBERG_DEBUG_CUT - -/*DISABLED -.Function.hirschberg: -..cat:Alignment -..summary:Computes a global Alignment for the passed Alignment-Container with the specified scoring scheme -..signature:hirschberg(Align & align,Score const & score) -..param.align: Reference to the Alignment-Object -..param.score: Const Reference to the Scoring Scheme -..remarks: The alignment is based on the algorithm proposed by Hirschberg. The general idea is to divide the DP (dynamic programming) matrix, -to compute a global alignment in linear space. Instead of computing half of the -DP matrix in forward direction and the other half in reverse, a pointer to the cell of the DP matrix, were the actual, optimal alignment -passes the mid column ist saved, during the computation of the second part of the Matrix. -..include:seqan/align.h -*/ - -// ---------------------------------------------------------------------------- -// Function globalAlignment() -// ---------------------------------------------------------------------------- - -template -TScoreValue -_globalAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & score_, - Hirschberg const & /*algorithmTag*/) -{ - TSequenceH const & s1 = source(gapsH); - TSequenceV const & s2 = source(gapsV); - - TScoreValue total_score = 0; - - typedef typename Value::Type TValueV; - - typedef typename Size::Type TStringSize; - - typedef typename Iterator::Type TSequenceHIter; - typedef typename Iterator::Type TSequenceVIter; - - typedef typename Iterator >::Type TGapsHIter; - typedef typename Iterator >::Type TGapsVIter; - - TGapsHIter target_0 = begin(gapsH); - TGapsVIter target_1 = begin(gapsV); - - typedef typename Iterator >::Type TMatrixIterator; - - TValueV v; - - TStringSize len1 = length(s1); - TStringSize len2 = length(s2); - - // string to store the score values for the currently active cell - String c_score; - resize(c_score,len2 + 1); - // string to strore the backpointers - String pointer; - resize(pointer,len2 + 1); - - // scoring-scheme specific score values - TScoreValue score_match = scoreMatch(score_); - TScoreValue score_mismatch = scoreMismatch(score_); - TScoreValue score_gap = scoreGapExtend(score_); - - TScoreValue border,s,sg,sd,sg1,sg2; - int dp; - - std::stack to_process; - HirschbergSet_ target; - - int i,j; - - HirschbergSet_ hs_complete(0,len1,0,len2,0); - to_process.push(hs_complete); - - while(!to_process.empty()) - { - target = to_process.top(); - to_process.pop(); - - if(_begin2(target) == _end2(target)) - { - for(i = 0;i < (_end1(target) - _begin1(target));++i) - { - insertGap(target_1); - ++target_0; - ++target_1; - } - } - if(_begin1(target) == _end1(target)) - { - for(i = 0;i < (_end2(target) - _begin2(target));++i) - { - insertGap(target_0); - ++target_0; - ++target_1; - } - } - else if(_begin1(target) + 1 == _end1(target) || _begin2(target) + 1 == _end2(target)) - { - /* ALIGN */ -#ifdef SEQAN_HIRSCHBERG_DEBUG_CUT - std::cout << "align s1 " << _begin1(target) << " to " << _end1(target) << " and s2 " << _begin2(target) << " to " << _end2(target) << std::endl; - std::cout << "align " << infix(s1,_begin1(target),_end1(target)) << " and " << infix(s2,_begin2(target),_end2(target)) << std::endl << std::endl; -#endif - - TStringSize len_1 = _end1(target) - _begin1(target); - TStringSize len_2 = _end2(target) - _begin2(target); - - Matrix matrix_; - - setDimension(matrix_, 2); - setLength(matrix_, 0, len_1 + 1); - setLength(matrix_, 1, len_2 + 1); - resize(matrix_); - - /* init matrix */ - TSequenceHIter x_begin = iter(s1, _begin1(target), Standard()) - 1; - TSequenceHIter x_end = iter(s1, _end1(target), Standard()) - 1; - TSequenceVIter y_begin = iter(s2, _begin2(target), Standard()) - 1; - TSequenceVIter y_end = iter(s2, _end2(target), Standard()) - 1; - - TSequenceHIter x = x_end; - TSequenceVIter y; - - TMatrixIterator col_ = end(matrix_) - 1; - TMatrixIterator finger1; - TMatrixIterator finger2; - - - TScoreValue h = 0; - TScoreValue border_ = score_gap; - TScoreValue v = border_; - - - //------------------------------------------------------------------------- - // init - - finger1 = col_; - *finger1 = 0; - for (x = x_end; x != x_begin; --x) - { - goPrevious(finger1, 0); - *finger1 = border_; - border_ += score_gap; - } - - //------------------------------------------------------------------------- - //fill matrix - border_ = 0; - for (y = y_end; y != y_begin; --y) - { - TValueV cy = *y; - h = border_; - border_ += score_gap; - v = border_; - - finger2 = col_; - goPrevious(col_, 1); - finger1 = col_; - - *finger1 = v; - - for (x = x_end; x != x_begin; --x) - { - goPrevious(finger1, 0); - goPrevious(finger2, 0); - if (*x == cy) - { - v = h + score_match; - h = *finger2; - } - else - { - TScoreValue s1 = h + score_mismatch; - h = *finger2; - TScoreValue s2 = score_gap + ((h > v) ? h : v); - v = (s1 > s2) ? s1 : s2; - } - *finger1 = v; - } - } - total_score += value(matrix_, 0,0); -#ifdef SEQAN_HIRSCHBERG_DEBUG_CUT - std::cout << "alignment score is " << total_score << std::endl << std::endl; -#endif - - /* TRACE BACK */ - finger1 = begin(matrix_); - x = iter(s1,_begin1(target)); - y = iter(s2,_begin2(target)); - x_end = iter(s1,_end1(target)); - y_end = iter(s2,_end2(target)); - - while ((x != x_end) && (y != y_end)) - { - bool gv; - bool gh; - - if (*x == *y) - { - gv = gh = true; - } - else - { - TMatrixIterator it_ = finger1; - - goNext(it_, 0); - TScoreValue v = *it_; - - goNext(it_, 1); - TScoreValue d = *it_; - - it_ = finger1; - goNext(it_, 1); - TScoreValue h = *it_; - - gv = (v >= h) | (d >= h); - gh = (h >= v) | (d >= v); - } - - if (gv) - { - ++x; - goNext(finger1, 0); - } - else - { - insertGap(target_0); - } - - if (gh) - { - ++y; - goNext(finger1, 1); - } - else - { - insertGap(target_1); - } - - ++target_0; - ++target_1; - } - - // if x or y did not reached there end position, fill the rest with gaps - while(x != x_end) - { - insertGap(target_1); - ++target_0; - ++target_1; - ++x; - } - - while(y != y_end) - { - insertGap(target_0); - ++target_0; - ++target_1; - ++y; - } - /* END ALIGN */ - } - else - { - /* - Calculate cut using the algorithm as proposed in the lecture of Clemens Gröpl - using a backpointer to remember the position where the optimal alignment passes - the mid column - */ - int mid = static_cast(floor( static_cast((_begin1(target) + _end1(target))/2) )); - -#ifdef SEQAN_HIRSCHBERG_DEBUG_CUT - std::cout << "calculate cut for s1 " << _begin1(target) << " to " << _end1(target) << " and s2 " << _begin2(target) << " to " << _end2(target) << std::endl; - std::cout << "calculate cut for " << infix(s1,_begin1(target),_end1(target)) << " and " << infix(s2,_begin2(target),_end2(target)) << std::endl; - std::cout << "cut is in row " << mid << " symbol is " << getValue(s1,mid-1) << std::endl << std::endl; - - - _writeDebugMatrix(infix(s1,_begin1(target),_end1(target)),infix(s2,_begin2(target),_end2(target))); -#endif - - border = 0; - for(i = _begin2(target);i <= _end2(target);++i) - { - c_score[i] = border; - border += score_gap; - pointer[i] = i; - } - - // iterate over s1 until the mid column is reached - border = score_gap; - for(i = _begin1(target) + 1;i <= mid;++i) - { - s = c_score[_begin2(target)]; - c_score[_begin2(target)] = border; - border += score_gap; - v = getValue(s1,i-1); - for(j = _begin2(target) + 1;j <= _end2(target);++j) - { - sg = score_gap + ((c_score[j] > c_score[j - 1]) ? c_score[j] : c_score[j - 1]); - sd = s + ((v == getValue(s2,j-1)) ? score_match : score_mismatch); - - s = c_score[j]; - c_score[j] = (sg > sd) ? sg : sd; - } - } - - // from here, rememeber the cell of mid-column, where optimal alignment passed - for(i = mid + 1;i <= _end1(target);++i) - { - s = c_score[_begin2(target)]; - c_score[_begin2(target)] = border; - border += score_gap; - v = getValue(s1,i-1); - - dp = _begin2(target); - - for(j = _begin2(target) + 1;j <= _end2(target);++j) - { - sg1 = score_gap + c_score[j]; - sg2 = score_gap + c_score[j - 1]; - - sd = s + ((v == getValue(s2,j-1)) ? score_match : score_mismatch); - - s = c_score[j]; - sg = pointer[j]; - if(sd >= _max(sg1,sg2)) - { - c_score[j] = sd; - pointer[j] = dp; - } - else - { - if(sg2 > sg1) - { - c_score[j] = sg2; - pointer[j] = pointer[j-1]; - } - else - { - // gap introduced from left - // no update for the pointer - c_score[j] = sg1; - } - } - dp = sg; - } - } - -#ifdef SEQAN_HIRSCHBERG_DEBUG_CUT - std::cout << "hirschberg calculates cut in column " << mid << " and row " << pointer[_end2(target)] << std::endl; - std::cout << "requested position in c_score and pointer is " << _end2(target) << std::endl; - std::cout << "alignment score is " << c_score[_end2(target)] << std::endl << std::endl; -#endif - to_process.push(HirschbergSet_(mid,_end1(target),pointer[_end2(target)],_end2(target),0)); - to_process.push(HirschbergSet_(_begin1(target),mid,_begin2(target),pointer[_end2(target)],0)); - } - /* END CUT */ - } - return total_score; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_HIRSCHBERG_IMPL_H_ diff --git a/seqan/align/global_alignment_myers_hirschberg_impl.h b/seqan/align/global_alignment_myers_hirschberg_impl.h deleted file mode 100644 index c56fce7..0000000 --- a/seqan/align/global_alignment_myers_hirschberg_impl.h +++ /dev/null @@ -1,750 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Stephan Aiche -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_MYERS_HIRSCHBERG_IMPL_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_MYERS_HIRSCHBERG_IMPL_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _writeDebugMatrix() -// ---------------------------------------------------------------------------- - -#ifdef MYERS_HIRSCHBERG_VERBOSE - template - void _writeDebugMatrix(TSource s1,TSource s2) - { -//IOREV _notio_ not relevant for iorev - int l1 = length(s1); - int l2 = length(s2); - - int i,j,sg,sd; - - String > fMatrix,rMatrix,tMatrix; - - resize(fMatrix,l1 + 1); - resize(rMatrix,l1 + 1); - resize(tMatrix,l1 + 1); - - for(i = 0;i <= l1;++i) - { - resize(fMatrix[i],l2 + 1); - resize(rMatrix[i],l2 + 1); - resize(tMatrix[i],l2 + 1); - } - - for(i = 0;i <= l1;++i) - fMatrix[i][0] = i * (-1); - - for(i = l1;i >= 0;--i) - rMatrix[i][l2] = (l1 - i) * (-1); - - // calculate forward matrix - for(j = 1;j <= l2;++j) - { - fMatrix[0][j] = j*(-1); - for(i = 1;i <= l1;++i) - { - sg = -1 + ((fMatrix[i-1][j] > fMatrix[i][j-1]) ? fMatrix[i-1][j] : fMatrix[i][j-1]); - sd = fMatrix[i-1][j-1] + ((s1[i - 1] == s2[j-1]) ? 0 : -1 ); - - fMatrix[i][j] = ((sg > sd) ? sg : sd); - } - } - - // calculate reverse matrix - for(j = l2 - 1;j >= 0;--j) - { - rMatrix[l1][j] = (l2 - j)*(-1); - for(i = l1 - 1;i >= 0;--i) - { - sg = -1 + ((rMatrix[i+1][j] > rMatrix[i][j+1]) ? rMatrix[i+1][j] : rMatrix[i][j+1]); - sd = rMatrix[i+1][j+1] + ((s1[i] == s2[j]) ? 0 : -1 ); - - rMatrix[i][j] = ((sg > sd) ? sg : sd); - } - } - - // print fMatrix - std::cout << ";-;"; - for(i = 0;i < l1;++i) - std::cout << s1[i] << ";"; - - std::cout << std::endl << "-;"; - for(j = 0;j <= l2;++j) - { - if(j != 0) std::cout << s2[j-1] << ";"; - for(i = 0;i <= l1;++i) - { - std::cout << fMatrix[i][j] << ";"; - } - std::cout << std::endl; - } - // print rMatrix - std::cout << ";"; - for(i = 0;i < l1;++i) - std::cout << s1[i] << ";"; - std::cout << "-;" << std::endl; - - for(j = 0;j <= l2;++j) - { - if(j != l2) std::cout << s2[j] << ";"; - else std::cout << "-;"; - for(i = 0;i <= l1;++i) - { - std::cout << rMatrix[i][j] << ";"; - } - std::cout << std::endl; - } - - // fill and print target matrix - std::cout << ";-;"; - for(i = 0;i < l1;++i) - std::cout << s1[i] << ";"; - - std::cout << std::endl << "-;"; - for(j = 0;j <= l2;++j) - { - if(j != 0) std::cout << s2[j-1] << ";"; - for(i = 0;i <= l1;++i) - { - tMatrix[i][j] = fMatrix[i][j] + rMatrix[i][j]; - std::cout << tMatrix[i][j] << ";"; - } - std::cout << std::endl; - } - } -#endif - -// ---------------------------------------------------------------------------- -// Function globalAlignment() -// ---------------------------------------------------------------------------- - -// When using different alphabets, we will internally use the pattern alphabet -// for the comparison. This means that the text character is converted to the -// pattern alphabet. Here, the "pattern" is the shorter source sequence. - -template -int -_globalAlignment(Gaps & gapsH, - Gaps & gapsV, - MyersHirschberg const & algorithmTag) -{ - // Switch horizontal and vertical gap roles, gapsV should be the shorter one - // to fit into less words. - if (length(source(gapsH)) < length(source(gapsV))) - return _globalAlignment(gapsV, gapsH, algorithmTag); - - clearGaps(gapsH); - clearGaps(gapsV); - clearClipping(gapsH); - clearClipping(gapsV); - - typedef int TScoreValue; - - // use size of unsigned int as blocksize for bit-vectors - const unsigned int BLOCK_SIZE = BitsPerValue::VALUE; - - // saves the score value that will be returned - TScoreValue score,total_score = 0; - - typedef typename Value::Type TPatternAlphabet; - typedef typename Size::Type TStringSize; - - typedef typename Iterator::Type TSequenceHIterator; - typedef typename Iterator::Type TSequenceVIterator; - typedef Gaps TGapsH; - typedef Gaps TGapsV; - typedef typename Iterator::Type TGapsHIterator; - typedef typename Iterator::Type TGapsVIterator; - - typedef typename Iterator, Rooted>::Type TMatrixIterator; - - TGapsHIterator target_0 = begin(gapsH); - TGapsVIterator target_1 = begin(gapsV); - - TSequenceH const & x = source(gapsH); - TSequenceV const & y = source(gapsV); - - TStringSize len_x = length(x); - TStringSize len_y = length(y); - - // string to store the score values for the currently active cell - String c_score; - resize(c_score, len_x + 1, 0); - - // scoring-scheme specific score values - TScoreValue score_match = 0; - TScoreValue score_mismatch = -1; - TScoreValue score_gap = -1; - - // additional vars - int i; - - // stack with parts of matrix that have to be processed - std::stack to_process; - HirschbergSet_ target; - - // myers specific vars and preprocessing - unsigned int patternAlphabetSize = ValueSize::VALUE; - unsigned int blockCount = (len_y + BLOCK_SIZE - 1) / BLOCK_SIZE; // maximal count of blocks - - String VP; - String VN; - String forwardBitMask; - String reverseBitMask; - - resize(VP, blockCount, maxValue()); - resize(VN, blockCount, 0); - - // first bitMask will be constructed from the shorter sequence - resize(forwardBitMask, patternAlphabetSize * blockCount, 0); - resize(reverseBitMask, patternAlphabetSize * blockCount, 0); - - // encoding the letters as bit-vectors - for (unsigned int j = 0; j < len_y; j++){ - forwardBitMask[blockCount * ordValue(getValue(y,j)) + j/BLOCK_SIZE] = forwardBitMask[blockCount * ordValue(getValue(y,j)) + j/BLOCK_SIZE] | 1 << (j%BLOCK_SIZE); - reverseBitMask[blockCount * ordValue(getValue(y,len_y - j - 1)) + j/BLOCK_SIZE] = reverseBitMask[blockCount * ordValue(getValue(y,len_y - j - 1)) + j/BLOCK_SIZE] | 1 << (j%BLOCK_SIZE); - } - - HirschbergSet_ hs_complete(0,len_x,0,len_y,1); - to_process.push(hs_complete); - - while(!to_process.empty()) - { - target = to_process.top(); - to_process.pop(); - /* if score is zero, the whole part of the sequence can be simply skipped */ - if(_score(target) == 0) - { - /* coukd work faster */ - for(i = 0;i < (_end1(target) - _begin1(target));++i) - { - ++target_0; - ++target_1; - } - -#ifdef MYERS_HIRSCHBERG_VERBOSE - printf("skipped %i to %i in first sequence\n",_begin1(target),_end1(target)); -#endif - } - else if(_begin1(target) == _end1(target)) - { - -#ifdef MYERS_HIRSCHBERG_VERBOSE - std::cout << "align y " << _begin2(target) << " to " << _end2(target) << std::endl; - std::cout << "align " << infix(y,_begin2(target),_end2(target)) << std::endl << std::endl; -#endif - for(i = 0;i < (_end2(target) - _begin2(target));++i) - { - insertGap(target_0); - ++target_0; - ++target_1; - } - } - else if(_begin2(target) + 1 == _end2(target)) - { - /* ALIGN */ -#ifdef MYERS_HIRSCHBERG_VERBOSE - std::cout << "align x " << _begin1(target) << " to " << _end1(target) << " and y " << _begin2(target) << " to " << _end2(target) << std::endl; - std::cout << "align " << infix(x,_begin1(target),_end1(target)) << " and " << infix(y,_begin2(target),_end2(target)) << std::endl << std::endl; -#endif - - TStringSize len_1 = _end1(target) - _begin1(target); - TStringSize len_2 = _end2(target) - _begin2(target); - - Matrix matrix_; - - setDimension(matrix_, 2); - setLength(matrix_, 0, len_1 + 1); - setLength(matrix_, 1, len_2 + 1); - resize(matrix_); - - /* init matrix */ - TSequenceHIterator xs_begin = iter(x,_begin1(target)) - 1; - TSequenceHIterator xs_end = iter(x,_end1(target)) - 1; - TSequenceVIterator ys_begin = iter(y,_begin2(target)) - 1; - TSequenceVIterator ys_end = iter(y,_end2(target)) - 1; - - TSequenceHIterator xs = xs_end; - TSequenceVIterator ys; - - TMatrixIterator col_ = end(matrix_) - 1; - TMatrixIterator finger1; - TMatrixIterator finger2; - - - TScoreValue h = 0; - TScoreValue border_ = score_gap; - TScoreValue v = border_; - - - //------------------------------------------------------------------------- - // init - - finger1 = col_; - *finger1 = 0; - for (xs = xs_end; xs != xs_begin; --xs) - { - goPrevious(finger1, 0); - *finger1 = border_; - border_ += score_gap; - } - - //------------------------------------------------------------------------- - //fill matrix - - border_ = 0; - for (ys = ys_end; ys != ys_begin; --ys) - { - TPatternAlphabet cy = *ys; - h = border_; - border_ += score_gap; - v = border_; - - finger2 = col_; - goPrevious(col_, 1); - finger1 = col_; - - *finger1 = v; - - for (xs = xs_end; xs != xs_begin; --xs) - { - goPrevious(finger1, 0); - goPrevious(finger2, 0); - if (*xs == cy) - { - v = h + score_match; - h = *finger2; - } - else - { - TScoreValue s1 = h + score_mismatch; - h = *finger2; - TScoreValue s2 = score_gap + ((h > v) ? h : v); - v = (s1 > s2) ? s1 : s2; - } - *finger1 = v; - } - } - - // if computed the whole matrix last value of v = alignment score - if(target == hs_complete) total_score = v; - - /* TRACE BACK */ - finger1 = begin(matrix_); - xs = iter(x,_begin1(target)); - ys = iter(y,_begin2(target)); - xs_end = iter(x,_end1(target)); - ys_end = iter(y,_end2(target)); - - while ((xs != xs_end) && (ys != ys_end)) - { - bool gv; - bool gh; - - if (*xs == *ys) - { - gv = gh = true; - } - else - { - TMatrixIterator it_ = finger1; - - goNext(it_, 0); - TScoreValue v = *it_; - - goNext(it_, 1); - TScoreValue d = *it_; - - it_ = finger1; - goNext(it_, 1); - TScoreValue h = *it_; - - gv = (v >= h) | (d >= h); - gh = (h >= v) | (d >= v); - } - - if (gv) - { - ++xs; - goNext(finger1, 0); - } - else - { - insertGap(target_0); - } - - if (gh) - { - ++ys; - goNext(finger1, 1); - } - else - { - insertGap(target_1); - } - - ++target_0; - ++target_1; - } - - // if x or y did not reached there end position, fill the rest with gaps - while(xs != xs_end) - { - insertGap(target_1); - ++target_0; - ++target_1; - ++xs; - } - - while(ys != ys_end) - { - insertGap(target_0); - ++target_0; - ++target_1; - ++ys; - } - /* END ALIGN */ - - -#ifdef MYERS_HIRSCHBERG_VERBOSE - std::cout << std::endl << align_ << std::endl << std::endl; -#endif - - } - else - { - /* - --------------------------------------------------------------- - Calculate cut position using extended Myers-Bitvector-Algorithm - --------------------------------------------------------------- - */ - - /* declare variables */ - unsigned int X, D0, HN, HP; - - /* compute cut position */ - int mid = static_cast(floor( static_cast((_begin2(target) + _end2(target))/2) )); - - /* debug infos */ -#ifdef MYERS_HIRSCHBERG_VERBOSE - std::cout << "calculate cut for x " << _begin1(target) << " to " << _end1(target) << " and y " << _begin2(target) << " to " << _end2(target) << std::endl; - std::cout << "calculate cut for " << infix(x,_begin1(target),_end1(target)) << " and " << infix(y,_begin2(target),_end2(target)) << std::endl; - std::cout << "cut is in row " << mid << " symbol is " << getValue(x,mid-1) << std::endl << std::endl; - - std::cout << std::endl; - _writeDebugMatrix(infix(x,_begin1(target),_end1(target)),infix(y,_begin2(target),_end2(target))); - std::cout << std::endl; -#endif - /* compute blocks and score masks */ - int fStartBlock = _begin2(target) / BLOCK_SIZE; - int fEndBlock = (mid - 1) / BLOCK_SIZE; - int fSpannedBlocks = (fEndBlock - fStartBlock) + 1; - - unsigned int fScoreMask = 1 << ((mid - 1) % BLOCK_SIZE); - - unsigned int fOffSet = _begin2(target) % BLOCK_SIZE; - unsigned int fSilencer = ~0; - fSilencer <<= fOffSet; - - /* reset v-bitvectors */ - std::fill(begin(VP, Standard()) + fStartBlock, end(VP, Standard()) + fEndBlock + 1, maxValue()); - std::fill(begin(VN, Standard()) + fStartBlock, end(VN, Standard()) + fEndBlock + 1, 0); - - /* determine start-position and start-score */ - int pos = _begin1(target); - score = (mid - _begin2(target)) * score_gap; - c_score[pos] = score; - - /* compute with myers - forward - begin */ - if(fSpannedBlocks == 1) - { - while (pos < _end1(target)) { - X = (fSilencer & forwardBitMask[(blockCount * ordValue(static_cast(getValue(x,pos)))) + fStartBlock]) | VN[fStartBlock]; - - D0 = ((VP[fStartBlock] + (X & VP[fStartBlock])) ^ VP[fStartBlock]) | X; - HN = VP[fStartBlock] & D0; - HP = VN[fStartBlock] | ~(VP[fStartBlock] | D0); - - X = (HP << 1) | (1 << fOffSet); - VN[fStartBlock] = X & D0; - VP[fStartBlock] = (HN << 1) | ~(X | D0); - - if (HP & fScoreMask) - score--; - else if (HN & fScoreMask) - score++; - - c_score[pos + 1] = score; - - ++pos; - } - } /* end - short patten */ - else - { - int shift, currentBlock; - unsigned int temp, carryD0, carryHP, carryHN; - - while (pos < _end1(target)) - { - carryD0 = carryHP = carryHN = 0; - shift = blockCount * ordValue(static_cast(getValue(x,pos))); - - // computing first the top most block - X = (fSilencer & forwardBitMask[shift + fStartBlock]) | VN[fStartBlock]; - - temp = VP[fStartBlock] + (X & VP[fStartBlock]); - carryD0 = temp < VP[fStartBlock]; - - D0 = (temp ^ VP[fStartBlock]) | X; - HN = VP[fStartBlock] & D0; - HP = VN[fStartBlock] | ~(VP[fStartBlock] | D0); - - X = (HP << 1) | (1 << fOffSet); - carryHP = HP >> (BLOCK_SIZE - 1); - - VN[fStartBlock] = X & D0; - - temp = (HN << 1); - carryHN = HN >> (BLOCK_SIZE - 1); - - VP[fStartBlock] = temp | ~(X | D0); - - // compute the remaining blocks - for (currentBlock = fStartBlock + 1; currentBlock <= fEndBlock; currentBlock++) { - X = forwardBitMask[shift + currentBlock] | VN[currentBlock]; - - temp = VP[currentBlock] + (X & VP[currentBlock]) + carryD0; - - carryD0 = ((carryD0) ? temp <= VP[currentBlock] : temp < VP[currentBlock]); - - D0 = (temp ^ VP[currentBlock]) | X; - HN = VP[currentBlock] & D0; - HP = VN[currentBlock] | ~(VP[currentBlock] | D0); - - X = (HP << 1) | carryHP; - carryHP = HP >> (BLOCK_SIZE-1); - - VN[currentBlock] = X & D0; - - temp = (HN << 1) | carryHN; - carryHN = HN >> (BLOCK_SIZE - 1); - - VP[currentBlock] = temp | ~(X | D0); - } - - /* update score */ - if (HP & fScoreMask) - score--; - else if (HN & fScoreMask) - score++; - - c_score[pos + 1] = score; - - ++pos; - } - - } /* end - long patten */ - /* compute with myers - forward - end */ - - /* compute blocks and score masks */ - int rStartBlock = (len_y - _end2(target)) / BLOCK_SIZE; - int rEndBlock = (len_y - mid - 1) / BLOCK_SIZE; - int rSpannedBlocks = (rEndBlock - rStartBlock) + 1; - - unsigned int rScoreMask = 1 << ((len_y - mid - 1) % BLOCK_SIZE); - unsigned int rOffSet = (len_y - _end2(target)) % BLOCK_SIZE; - unsigned int rSilencer = ~0; - rSilencer <<= rOffSet; - - /* reset v-bitvectors */ - std::fill(begin(VP, Standard()) + rStartBlock, end(VP, Standard()) + rEndBlock + 1, maxValue()); - std::fill(begin(VN, Standard()) + rStartBlock, end(VN, Standard()) + rEndBlock + 1, 0); - - /* determine start-position and start-score */ - pos = _end1(target)-1; - score = (_end2(target) - mid) * score_gap; - - /* set start score */ - c_score[_end1(target)] += score; - - /* determine optimal cut position -- score extension */ - TScoreValue max = c_score[_end1(target)]; - TScoreValue rmax = score; - unsigned int pos_max = _end1(target); - - /* compute with myers - reverse - begin */ - if(rSpannedBlocks == 1) - { - while (pos >= _begin1(target)) { - X = (rSilencer & reverseBitMask[(blockCount * ordValue(static_cast(getValue(x,pos)))) + rStartBlock]) | VN[rStartBlock]; - - D0 = ((VP[rStartBlock] + (X & VP[rStartBlock])) ^ VP[rStartBlock]) | X; - HN = VP[rStartBlock] & D0; - HP = VN[rStartBlock] | ~(VP[rStartBlock] | D0); - - X = (HP << 1) | (1 << rOffSet); - VN[rStartBlock] = X & D0; - VP[rStartBlock] = (HN << 1) | ~(X | D0); - - if (HP & rScoreMask) - --score; - else if (HN & rScoreMask) - ++score; - - c_score[pos] += score; - - /* check for optimality -- score extension */ - if(c_score[pos]> max) - { - pos_max = pos; - max = c_score[pos]; - rmax = score; - } - - --pos; - } - } /* end - short pattern */ - else - { - int shift, currentBlock; - unsigned int temp, carryD0, carryHP, carryHN; - - while (pos >= _begin1(target)) - { - carryD0 = carryHP = carryHN = 0; - shift = blockCount * ordValue(static_cast(getValue(x,pos))); - - // compute first the top most block - X = (rSilencer & reverseBitMask[shift + rStartBlock]) | VN[rStartBlock]; - - temp = VP[rStartBlock] + (X & VP[rStartBlock]); - carryD0 = temp < VP[rStartBlock]; - - D0 = (temp ^ VP[rStartBlock]) | X; - HN = VP[rStartBlock] & D0; - HP = VN[rStartBlock] | ~(VP[rStartBlock] | D0); - - X = (HP << 1) | (1 << rOffSet); - carryHP = HP >> (BLOCK_SIZE - 1); - - VN[rStartBlock] = X & D0; - - temp = (HN << 1); - carryHN = HN >> (BLOCK_SIZE - 1); - - VP[rStartBlock] = temp | ~(X | D0); - - // compute the remaining blocks - for (currentBlock = rStartBlock + 1; currentBlock <= rEndBlock; currentBlock++) { - X = reverseBitMask[shift + currentBlock] | VN[currentBlock]; - - temp = VP[currentBlock] + (X & VP[currentBlock]) + carryD0; - - carryD0 = ((carryD0) ? temp <= VP[currentBlock] : temp < VP[currentBlock]); - - D0 = (temp ^ VP[currentBlock]) | X; - HN = VP[currentBlock] & D0; - HP = VN[currentBlock] | ~(VP[currentBlock] | D0); - - X = (HP << 1) | carryHP; - carryHP = HP >> (BLOCK_SIZE-1); - - VN[currentBlock] = X & D0; - - temp = (HN << 1) | carryHN; - carryHN = HN >> (BLOCK_SIZE - 1); - - VP[currentBlock] = temp | ~(X | D0); - } - - if (HP & rScoreMask) - --score; - else if (HN & rScoreMask) - ++score; - - c_score[pos] += score; - - /* check for optimality -- score extension*/ - if(c_score[pos] > max) - { - pos_max = pos; - max = c_score[pos]; - rmax = score; - } - - --pos; - } - - } /* end - long pattern */ - /* compute with myers - reverse - end */ - - // if computed the whole matrix max = alignment score - if(target == hs_complete) - total_score = max; - -#ifdef MYERS_HIRSCHBERG_VERBOSE - printf("Optimal cut is at %i and %i with forward score %i and reverse score %i\n\n",mid,pos_max,(max - rmax),rmax); -#endif - /* push the two computed parts of the dp-matrix on process stack */ - to_process.push(HirschbergSet_(pos_max,_end1(target),mid,_end2(target),rmax)); - to_process.push(HirschbergSet_(_begin1(target),pos_max,_begin2(target),mid,max - rmax)); - - } - /* END CUT */ - } - - return total_score; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_MYERS_HIRSCHBERG_IMPL_H_ diff --git a/seqan/align/global_alignment_myers_impl.h b/seqan/align/global_alignment_myers_impl.h deleted file mode 100644 index ddf2743..0000000 --- a/seqan/align/global_alignment_myers_impl.h +++ /dev/null @@ -1,201 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Stephan Aiche -// ========================================================================== - -// TODO(holtgrew): Should be called _globalAlignmentScore()! - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_MYERS_IMPL_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_MYERS_IMPL_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// When using different alphabets, we will internally use the pattern alphabet -// for the comparison. This means that the text character is converted to the -// pattern alphabet. Here, the "pattern" is the shorter source sequence. - -template -int -_globalAlignmentScore(String const & seqH, - String const & seqV, - MyersBitVector const & algorithmTag) -{ - // Switch horizontal and vertical gap roles, gapsV should be the shorter one - // to fit into less words. - if (length(seqH) < length(seqV)) - return _globalAlignmentScore(seqV, seqH, algorithmTag); - - // Use size of unsigned int as blocksize for bit-vectors. - const unsigned int BLOCK_SIZE = BitsPerValue::VALUE; - - typedef String const TSequenceH; - typedef String const TSequenceV; - - typedef typename Value::Type TPatternAlphabet; - typedef typename Size::Type TSourceSize; - - TSequenceH const & x = seqH; - TSequenceV const & y = seqV; - - TSourceSize len_x = length(x); - unsigned int pos = 0; - - // init variables - unsigned int len_y = length(y); - int score = (-1)*len_y; - unsigned int patternAlphabetSize = ValueSize::VALUE; - unsigned int blockCount = (len_y + BLOCK_SIZE - 1) / BLOCK_SIZE; - - unsigned int scoreMask = 1 << ((len_y % BLOCK_SIZE) - 1); // the mask with a bit set at the position of the last active cell - - String VP; - resize(VP, blockCount, maxValue()); - String VN; - resize(VN, blockCount, 0); - String bitMask; - resize(bitMask, patternAlphabetSize * blockCount, 0); - - // encoding the letters as bit-vectors - for (unsigned int j = 0; j < len_y; j++) - bitMask[blockCount * ordValue(getValue(y,j)) + j/BLOCK_SIZE] = bitMask[blockCount * ordValue(getValue(y,j)) + j/BLOCK_SIZE] | 1 << (j%BLOCK_SIZE); - - // compute score - unsigned int X, D0, HN, HP; - if(blockCount == 1) - { - while (pos < len_x) { - X = bitMask[ordValue(static_cast(getValue(x,pos)))] | VN[0]; - - D0 = ((VP[0] + (X & VP[0])) ^ VP[0]) | X; - HN = VP[0] & D0; - HP = VN[0] | ~(VP[0] | D0); - - // customized to compute edit distance - X = (HP << 1) | 1; - VN[0] = X & D0; - VP[0] = (HN << 1) | ~(X | D0); - - if (HP & scoreMask) - score--; - else if (HN & scoreMask) - score++; - - ++pos; - } - } // end compute score - short pattern - else - { - unsigned int temp, shift, currentBlock; - unsigned int carryD0, carryHP, carryHN; - - while (pos < len_x) - { - // set vars - carryD0 = carryHP = carryHN = 0; - shift = blockCount * ordValue(static_cast(getValue(x,pos))); - - // computing first the top most block - X = bitMask[shift] | VN[0]; - - temp = VP[0] + (X & VP[0]); - carryD0 = temp < VP[0]; - - D0 = (temp ^ VP[0]) | X; - HN = VP[0] & D0; - HP = VN[0] | ~(VP[0] | D0); - - // customized to compute edit distance - X = (HP << 1) | 1; - carryHP = HP >> (BLOCK_SIZE - 1); - - VN[0] = X & D0; - - temp = (HN << 1); - carryHN = HN >> (BLOCK_SIZE - 1); - - VP[0] = temp | ~(X | D0); - - // computing the necessary blocks, carries between blocks following one another are stored - for (currentBlock = 1; currentBlock < blockCount; currentBlock++) { - X = bitMask[shift + currentBlock] | VN[currentBlock]; - - temp = VP[currentBlock] + (X & VP[currentBlock]) + carryD0; - - carryD0 = ((carryD0) ? temp <= VP[currentBlock] : temp < VP[currentBlock]); - - D0 = (temp ^ VP[currentBlock]) | X; - HN = VP[currentBlock] & D0; - HP = VN[currentBlock] | ~(VP[currentBlock] | D0); - - X = (HP << 1) | carryHP; - carryHP = HP >> (BLOCK_SIZE-1); - - VN[currentBlock] = X & D0; - - temp = (HN << 1) | carryHN; - carryHN = HN >> (BLOCK_SIZE - 1); - - VP[currentBlock] = temp | ~(X | D0); - } - - // update score with the HP and HN values of the last block the last block - if (HP & scoreMask) - score--; - else if (HN & scoreMask) - score++; - ++pos; - } - - } // end compute score - long pattern - - return score; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_MYERS_IMPL_H_ diff --git a/seqan/align/global_alignment_specialized.h b/seqan/align/global_alignment_specialized.h deleted file mode 100644 index 783e260..0000000 --- a/seqan/align/global_alignment_specialized.h +++ /dev/null @@ -1,199 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Test for globalAlignmentScore() implementations that use Hirschberg and -// MyersBitVector, MyersHirschberg. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_SPECIALIZED_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_SPECIALIZED_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [Hirschberg] -// ---------------------------------------------------------------------------- - -template -TScoreValue globalAlignment(Align & align, - Score const & scoringScheme, - Hirschberg const & algorithmTag) -{ - SEQAN_ASSERT_EQ(length(rows(align)), 2u); - return _globalAlignment(row(align, 0), row(align, 1), scoringScheme, algorithmTag); -} - -template -TScoreValue globalAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme, - Hirschberg const & algorithmTag) -{ - return _globalAlignment(gapsH, gapsV, scoringScheme, algorithmTag); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [Myers-Hirschberg] -// ---------------------------------------------------------------------------- - -template -int globalAlignment(Align & align, - MyersHirschberg const & algorithmTag) -{ - SEQAN_ASSERT_EQ(length(rows(align)), 2u); - return _globalAlignment(row(align, 0), row(align, 1), algorithmTag); -} - -template -int globalAlignment(Gaps & gapsH, - Gaps & gapsV, - MyersHirschberg const & algorithmTag) -{ - return _globalAlignment(gapsH, gapsV, algorithmTag); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [MyersBitVector] -// ---------------------------------------------------------------------------- - -template -int globalAlignment(Align & align, - MyersBitVector const & algorithmTag) -{ - SEQAN_ASSERT_EQ(length(rows(align)), 2u); - return _globalAlignment(row(align, 0), row(align, 1), algorithmTag); -} - -template -int globalAlignment(Gaps & gapsH, - Gaps & gapsV, - MyersBitVector const & algorithmTag) -{ - return _globalAlignment(gapsH, gapsV, algorithmTag); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignmentScore() [Hirschberg] -// ---------------------------------------------------------------------------- - -template -TScoreValue globalAlignmentScore(String const & seqH, - String const & seqV, - Score const & scoringScheme, - Hirschberg const & algorithmTag) -{ - Gaps const, ArrayGaps> gapsH(seqH); - Gaps const, ArrayGaps> gapsV(seqV); - return globalAlignment(gapsH, gapsV, scoringScheme, algorithmTag); -} - -template -TScoreValue globalAlignmentScore(StringSet const & strings, - Score const & scoringScheme, - Hirschberg const & algorithmTag) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - return globalAlignmentScore(strings[0], strings[1], scoringScheme, algorithmTag); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignmentScore() [Myers-Hirschberg] -// ---------------------------------------------------------------------------- - -template -int globalAlignmentScore(String const & seqH, - String const & seqV, - MyersHirschberg const & algorithmTag) -{ - Gaps const, ArrayGaps> gapsH(seqH); - Gaps const, ArrayGaps> gapsV(seqV); - return _globalAlignment(gapsH, gapsV, algorithmTag); -} - -template -int globalAlignmentScore(StringSet const & strings, - MyersHirschberg const & algorithmTag) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - return globalAlignmentScore(strings[0], strings[1], algorithmTag); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignmentScore() [MyersBitVector] -// ---------------------------------------------------------------------------- - -template -int globalAlignmentScore(String const & seqH, - String const & seqV, - MyersBitVector const & algorithmTag) -{ - return _globalAlignmentScore(seqH, seqV, algorithmTag); -} - -template -int globalAlignmentScore(StringSet const & strings, - MyersBitVector const & algorithmTag) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - return _globalAlignmentScore(strings[0], strings[1], algorithmTag); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_SPECIALIZED_H_ diff --git a/seqan/align/global_alignment_unbanded.h b/seqan/align/global_alignment_unbanded.h deleted file mode 100644 index 190a9f8..0000000 --- a/seqan/align/global_alignment_unbanded.h +++ /dev/null @@ -1,740 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Global alignment interface for the unbanded Needleman-Wunsch and Gotoh -// algorithms. -// -// We define the interface functions pretty explicitely (versus just TAlign, -// TFragments etc.) so the candidates the compiler gives when resolution to -// the globalFunction() fails is actually meaningful. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_UNBANDED_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_UNBANDED_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -template -class Score; -template -class Graph; -template -struct Alignment; -template -class Fragment; - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function globalAlignment() -// ---------------------------------------------------------------------------- - -/*! - * @fn globalAlignment - * - * @headerfile seqan/align.h - * - * @brief Computes the best global pairwise alignment. - * - * @signature TScoreVal globalAlignment(align, scoringScheme, [alignConfig,] [lowerDiag, upperDiag,] [algorithmTag]); - * @signature TScoreVal globalAlignment(gapsH, gapsV, scoringScheme, [alignConfig,] [lowerDiag, upperDiag,] [algorithmTag]); - * @signature TScoreVal globalAlignment(frags, strings, scoringScheme, [alignConfig,] [lowerDiag, upperDiag,] [algorithmTag]); - * @signature TScoreVal globalAlignment(alignGraph, scoringScheme, [alignConfig,] [lowerDiag, upperDiag,] [algorithmTag]); - * - * @param align The @link Align @endlink object to use for storing the pairwise alignment. - * @param gapsH The @link Gaps @endlink object for the first row (horizontal in the DP matrix). - * @param gapsV The @link Gaps @endlink object for the second row (vertical in the DP matrix). - * @param frags String of @link Fragment @endlink objects to store alignment in. - * @param strings StringSet of length two with the strings to align. - * @param alignGraph Alignment Graph for the resulting alignment. Must be initialized with two strings. - * @param scoringScheme The @link Score scoring scheme @endlink to use for the alignment. Note that - * the user is responsible for ensuring that the scoring scheme is compatible with algorithmTag. - * @param alignConfig @link AlignConfig @endlink instance to use for the alignment configuration. - * @param lowerDiag Optional lower diagonal (int). - * @param upperDiag Optional upper diagonal (int). - * @param algorithmTag Tag to select the alignment algorithm (see @link AlignmentAlgorithmTags @endlink). - * - * @return TScoreVal Score value of the resulting alignment. Of type Value<TScore>::Type where - * TScore is the type of scoringScheme. - * - * There exist multiple overloads for this function with four configuration dimensions. - * - * First, you can select whether begin and end gaps are free in either sequence using alignConfig. - * - * Second, you can select the type of the target storing the alignment. This can be either an @link Align @endlink - * object, two @link Gaps @endlink objects, a @link AlignmentGraph @endlink, or a string of @link Fragment @endlink - * objects. @link Align @endlink objects provide an interface to tabular alignments with the restriction of all rows - * having the same type. Using two @link Gaps @endlink objects has the advantage that you an align sequences with - * different types, for example @link DnaString @endlink and @link Dna5String @endlink. @link AlignmentGraph Alignment - * Graphs @endlink provide a graph-based representation of segment-based colinear alignments. Using @link Fragment - * @endlink strings is useful for collecting many pairwise alignments, for example in the construction of @link - * AlignmentGraph Alignment Graphs @endlink for multiple-sequence alignments (MSA). - * - * Third, you can optionally give a band for the alignment using lowerDiag and upperDiag. The center - * diagonal has index 0, the ith diagonal below has index -i, the ith above has - * index i. - * - * Fourth, you can select the algorithm to use with algorithmTag. This can be one of @link - * AlignmentAlgorithmTags#NeedlemanWunsch @endlink and @link AlignmentAlgorithmTags#Gotoh @endlink. The - * Needleman-Wunsch algorithm supports scoring schemes with linear gap costs only while Gotoh's algorithm also allows - * affine gap costs. - * - * The available alignment algorithms all have some restrictions. Gotoh's algorithm can handle arbitrary substitution - * and affine gap scores. Needleman-Wunsch is limited to linear gap scores. The implementation of Hirschberg's - * algorithm is further limited that it does not support alignConfig objects or banding. The implementation of - * the Myers-Hirschberg algorithm further limits this to only support edit distance (as scores, matches are scored with - * 0, mismatches are scored with -1). - * - * The examples below show some common use cases. - * - * @section Examples - * - * Global alignment of two sequences using an @link Align @endlink object and - * the Needleman-Wunsch algorithm. - * - * @include demos/align/global_alignment_unbanded.cpp - * - * The output is as follows: - * - * @include demos/align/global_alignment_unbanded.cpp.stdout - * - * Global banded alignment of two sequences using two @link Gaps @endlink objects and the Gotoh algorithm. - * - * @include demos/align/global_alignment_banded.cpp - * - * The output is as follows: - * - * @include demos/align/global_alignment_banded.cpp.stdout - * - * http://trac.seqan.de/wiki/Tutorial/PairwiseSequenceAlignment - * - * @section References - * - *
    - *
  • Needleman SB, Wunsch CD: A general method applicable to the search for similarities in the amino acid sequence - * of two proteins. J Mol Biol 1970, 48(3): 443-53.
  • - *
  • Gotoh O: An improved algorithm for matching biological sequences. J Mol Biol 1982, 162(3):705-8
  • - *
- * - * @see localAlignment - * @see globalAlignmentScore - * @see AlignmentAlgorithmTags - */ - -/** -.Function.globalAlignment -..summary:Computes the best global pairwise alignment. -..cat:Alignments -..signature:globalAlignment(align, scoringScheme, [alignConfig,] [lowerDiag, upperDiag,] [algorithmTag]) -..signature:globalAlignment(gapsH, gapsV, scoringScheme, [alignConfig,] [lowerDiag, upperDiag,] [algorithmTag]) -..signature:globalAlignment(frags, strings, scoringScheme, [alignConfig,] [lowerDiag, upperDiag,] [algorithmTag]) -..signature:globalAlignment(alignmentGraph, scoringScheme, [alignConfig,] [lowerDiag, upperDiag,] [algorithmTag]) -..param.align: -An @Class.Align@ object that stores the alignment. -The number of rows must be 2 and the sequences must have already been set. -$row(align, 0)$ is the horizontal one in the alignment matrix alignment, $row(align, 1)$ is the vertical one. -...type:Class.Align -..param.gapsH:Horizontal gapped sequence in alignment matrix. -...type:Class.Gaps -..param.gapsV:Vertical gapped sequence in alignment matrix. -...type:Class.Gaps -..param.frags: -String of @Class.Fragment@ objects. -The sequence with id $0$ is the horizontal one, the sequence with id $1$ is the vertical one. -..param.alignmentGraph: -@Spec.Alignment Graph@ object to store the alignment in. -...type:Spec.Alignment Graph -...remarks:The underlying @Class.StringSet@ must be an @Spec.Owner|Owner StringSet@. -..param.strings:A @Class.StringSet@ containing two sequences. -...type:Class.StringSet -..param.scoringScheme: -The scoring scheme to use for the alignment. -Note that the user is responsible for ensuring that the scoring scheme is compatible with $algorithmTag$. -...type:Class.Score -..param.alignConfig:The @Class.AlignConfig@ to use for the alignment. -...type:Class.AlignConfig -..param.lowerDiag:Optional lower diagonal. -...type:nolink:$int$ -..param.upperDiag:Optional upper diagonal. -...type:nolink:$int$ -..param.algorithmTag:The Tag for picking the alignment algorithm. -...type:Tag.Pairwise Global Alignment Algorithms.tag.Gotoh -...type:Tag.Pairwise Global Alignment Algorithms.tag.NeedlemanWunsch -...type:Tag.Pairwise Global Alignment Algorithms.tag.Hirschberg -...type:Tag.Pairwise Global Alignment Algorithms.tag.MyersHirschberg -..returns:An integer with the alignment score, as given by the @Metafunction.Value@ metafunction of the @Class.Score@ type. -..remarks: -There exist multiple overloads for this function with four configuration dimensions. -..remarks: -First, you can select whether begin and end gaps are free in either sequence using $alignConfig$. -..remarks: -Second, you can select the type of the target storing the alignment. -This can be either an @Class.Align@ object, two @Class.Gaps@ objects, a @Spec.Alignment Graph@, or a string of @Class.Fragment@ objects. -@Class.Align@ objects provide an interface to tabular alignments with the restriction of all rows having the same type. -Using two @Class.Gaps@ objects has the advantage that you an align sequences with different types, for example @Shortcut.DnaString@ and @Shortcut.Dna5String@. -@Spec.Alignment Graph|Alignment Graphs@ provide a graph-based representation of segment-based colinear alignments. -Using @Class.Fragment@ strings is useful for collecting many pairwise alignments, for example in the construction of @Spec.Alignment Graph|Alignment Graphs@ for multiple-sequence alignments (MSA). -..remarks: -Third, you can optionally give a band for the alignment using $lowerDiag$ and $upperDiag$. -The center diagonal has index $0$, the $i$th diagonal below has index $-i$, the $i$th above has index $i$. -..remarks: -Fourth, you can select the algorithm to use with $algorithmTag$. -This can be one of @Tag.Pairwise Global Alignment Algorithms.value.NeedlemanWunsch@ and @Tag.Pairwise Global Alignment Algorithms.value.Gotoh@. -The Needleman-Wunsch algorithm supports scoring schemes with linear gap costs only while Gotoh's algorithm also allows affine gap costs. -..remarks: -The available alignment algorithms all have some restrictions. -Gotoh's algorithm can handle arbitrary substitution and affine gap scores. -Needleman-Wunsch is limited to linear gap scores. -The implementation of Hirschberg's algorithm is further limited that it does not support $alignConfig$ objects or banding. -The implementation of the Myers-Hirschberg algorithm further limits this to only support edit distance (as scores, matches are scored with 0, mismatches are scored with -1). -..remarks: -The examples below show some common use cases. -..example.text:Global alignment of two sequences using an @Class.Align@ object and the Needleman-Wunsch algorithm. The Needleman-Wunsch algorithm is automatically selected since the scoring scheme uses linear gap costs. -..example.file:demos/align/global_alignment_unbanded.cpp -..example.text:Global banded alignment of two sequences using two @Class.Gaps@ objects and the Gotoh algorithm. The Gotoh algorithm is automatically selected since the scoring scheme uses affine gap costs. -..example.file:demos/align/global_alignment_banded.cpp -..see:Function.localAlignment -..see:Function.globalAlignmentScore -..include:seqan/align.h -..wiki:Tutorial/PairwiseSequenceAlignment -..cite:Needleman SB, Wunsch CD: A general method applicable to the search for similarities in the amino acid sequence of two proteins. J Mol Biol 1970, 48(3): 443-53. -..cite:Gotoh O: An improved algorithm for matching biological sequences. J Mol Biol 1982, 162(3):705-8 -. -*/ - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [unbanded, Align] -// ---------------------------------------------------------------------------- - -template -TScoreValue globalAlignment(Align & align, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag) -{ - typedef Align TAlign; - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String trace; - - // We do not need string ids for this variant and set them to 0u. They are - // only required for the Fragment String and the Alignment Graph variant. - TScoreValue res = _setUpAndRunAlignment(trace, source(row(align, 0)), source(row(align, 1)), scoringScheme, - alignConfig, algoTag); - _adaptTraceSegmentsTo(row(align, 0), row(align, 1), trace); - return res; -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignment(Align & align, - Score const & scoringScheme, - TAlgoTag const & algoTag) -{ - AlignConfig<> alignConfig; - return globalAlignment(align, scoringScheme, alignConfig, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignment(Align & align, - Score const & scoringScheme, - AlignConfig const & alignConfig) -{ - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignment(align, scoringScheme, alignConfig, NeedlemanWunsch()); - else - return globalAlignment(align, scoringScheme, alignConfig, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignment(Align & align, - Score const & scoringScheme) -{ - AlignConfig<> alignConfig; - return globalAlignment(align, scoringScheme, alignConfig); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [unbanded, Gaps] -// ---------------------------------------------------------------------------- - -template -TScoreValue globalAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag) -{ - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - - // We do not need string ids for this variant and set them to 0u. They are - // only required for the Fragment String and the Alignment Graph variant. - TScoreValue res = _setUpAndRunAlignment(traceSegments, source(gapsH), source(gapsV), scoringScheme, alignConfig, - algoTag); - _adaptTraceSegmentsTo(gapsH, gapsV, traceSegments); - return res; -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme, - TAlgoTag const & algoTag) -{ - AlignConfig<> alignConfig; - return globalAlignment(gapsH, gapsV, scoringScheme, alignConfig, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme, - AlignConfig const & alignConfig) -{ - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignment(gapsH, gapsV, scoringScheme, alignConfig, NeedlemanWunsch()); - else - return globalAlignment(gapsH, gapsV, scoringScheme, alignConfig, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme) -{ - AlignConfig<> alignConfig; - return globalAlignment(gapsH, gapsV, scoringScheme, alignConfig); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [unbanded, Graph >] -// ---------------------------------------------------------------------------- - -// Full interface. - -template -TScoreValue globalAlignment(Graph > & alignmentGraph, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag) -{ - typedef Graph > TGraph; - typedef typename Position::Type TPosition; - typedef typename Size::Type TSize; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - - TScoreValue res = _setUpAndRunAlignment(traceSegments, value(stringSet(alignmentGraph), 0), - value(stringSet(alignmentGraph), 1), scoringScheme, alignConfig, algoTag); - _adaptTraceSegmentsTo(alignmentGraph, positionToId(stringSet(alignmentGraph), 0), - positionToId(stringSet(alignmentGraph), 1), traceSegments); - return res; -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignment(Graph > & alignmentGraph, - Score const & scoringScheme, - TAlgoTag const & algoTag) -{ - AlignConfig<> alignConfig; - return globalAlignment(alignmentGraph, scoringScheme, alignConfig, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignment(Graph > & alignmentGraph, - Score const & scoringScheme, - AlignConfig const & alignConfig) -{ - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignment(alignmentGraph, scoringScheme, alignConfig, NeedlemanWunsch()); - else - return globalAlignment(alignmentGraph, scoringScheme, alignConfig, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignment(Graph > & alignmentGraph, - Score const & scoringScheme) -{ - AlignConfig<> alignConfig; - return globalAlignment(alignmentGraph, scoringScheme, alignConfig); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignment() [unbanded, String >] -// ---------------------------------------------------------------------------- - -// Full interface. - -template -TScoreValue globalAlignment(String, TStringSpec> & fragmentString, - StringSet const & strings, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag) -{ - typedef String, TStringSpec> TFragments; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - - TScoreValue res = _setUpAndRunAlignment(traceSegments, value(strings, 0), value(strings, 1), scoringScheme, - alignConfig, algoTag); - _adaptTraceSegmentsTo(fragmentString, positionToId(strings, 0), positionToId(strings, 1), traceSegments); - return res; -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignment(String, TStringSpec> & fragmentString, - StringSet const & strings, - Score const & scoringScheme, - TAlgoTag const & algoTag) -{ - AlignConfig<> alignConfig; - return globalAlignment(fragmentString, strings, scoringScheme, alignConfig, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignment(String, TStringSpec> & fragmentString, - StringSet const & strings, - Score const & scoringScheme, - AlignConfig const & alignConfig) -{ - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignment(fragmentString, strings, scoringScheme, alignConfig, NeedlemanWunsch()); - else - return globalAlignment(fragmentString, strings, scoringScheme, alignConfig, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignment(String, TStringSpec> & fragmentString, - StringSet const & strings, - Score const & scoringScheme) -{ - AlignConfig<> alignConfig; - return globalAlignment(fragmentString, strings, scoringScheme, alignConfig); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignmentScore() -// ---------------------------------------------------------------------------- - -/*! - * @fn globalAlignmentScore - * @brief Computes the best global pairwise alignment score. - * - * @signature TScoreVal globalAlignmentScore(seqH, seqV, scoringScheme[, alignConfig][, lowerDiag, upperDiag][, algorithmTag]); - * @signature TScoreVal globalAlignmentScore(strings, scoringScheme[, alignConfig][, lowerDiag, upperDiag][, algorithmTag]); - * @signature TScoreVal globalAlignmentScore(seqH, seqV, {MyersBitVector | MyersHirschberg}); - * @signature TScoreVal globalAlignmentScore(strings, {MyersBitVector | MyersHirschberg}); - * - * @param[in] seqH Horizontal gapped sequence in alignment matrix. Types: String - * @param[in] seqV Vertical gapped sequence in alignment matrix. Types: String - * @param[in] strings A @link StringSet @endlink containing two sequences. Type: StringSet. - * @param[in] alignConfig The @link AlignConfig @endlink to use for the alignment. Type: AlignConfig - * @param[in] scoringScheme The scoring scheme to use for the alignment. Note that the user is responsible for ensuring - * that the scoring scheme is compatible with algorithmTag. Type: @link Score @endlink. - * @param[in] lowerDiag Optional lower diagonal. Types: int - * @param[in] upperDiag Optional upper diagonal. Types: int - * @param[in] algorithmTag The Tag for picking the alignment algorithm. Types: @link PairwiseLocalAlignmentAlgorithms - * @endlink. - * - * @return TScoreValue The score value with the alignment score, as given by the @link Score#Value @endlink metafunction - * of the scoringScheme type. - * - * @section Remarks - * - * This function does not perform the (linear time) traceback step after the (mostly quadratic time) dynamic programming - * step. Note that Myers' bit-vector algorithm does not compute an alignment (only in the Myers-Hirschberg variant) but - * scores can be computed using globalAlignmentScore. - * - * The same limitations to algorithms as in @link globalAlignment @endlink apply. Furthermore, the - * MyersBitVector and MyersHirschberg variants can only be used without any other parameter. - * - * @see http://trac.seqan.de/wiki/Tutorial/PairwiseSequenceAlignment - * @see globalAlignment - */ - -/** -.Function.globalAlignmentScore -..summary:Computes the best global pairwise alignment score. -..cat:Alignments -..signature:globalAlignmentScore(seqH, seqV, scoringScheme, [alignConfig,] [lowerDiag, upperDiag,] [algorithmTag]) -..signature:globalAlignmentScore(strings, scoringScheme, [alignConfig,] [lowerDiag, upperDiag,] [algorithmTag]) -..signature:globalAlignmentScore(seqH, seqV, {MyersBitVector | MyersHirschberg}) -..signature:globalAlignmentScore(strings, {MyersBitVector | MyersHirschberg}) -..param.seqH:Horizontal gapped sequence in alignment matrix. -...type:Class.String -..param.seqV:Vertical gapped sequence in alignment matrix. -...type:Class.String -..param.strings:A @Class.StringSet@ containing two sequences. -...type:Class.StringSet -..param.scoringScheme: -The scoring scheme to use for the alignment. -Note that the user is responsible for ensuring that the scoring scheme is compatible with $algorithmTag$. -...type:Class.Score -..param.alignConfig:The @Class.AlignConfig@ to use for the alignment. -...type:Class.AlignConfig -..param.lowerDiag:Optional lower diagonal. -...type:nolink:$int$ -..param.upperDiag:Optional upper diagonal. -...type:nolink:$int$ -..param.algorithmTag:The Tag for picking the alignment algorithm. -...type:Tag.Pairwise Global Alignment Algorithms.tag.Gotoh -...type:Tag.Pairwise Global Alignment Algorithms.tag.NeedlemanWunsch -...type:Tag.Pairwise Global Alignment Algorithms.tag.Hirschberg -...type:Tag.Pairwise Global Alignment Algorithms.tag.MyersHirschberg -...type:Tag.Pairwise Global Alignment Algorithms.tag.MyersBitVector -..returns:An integer with the alignment score, as given by the @Metafunction.Value@ metafunction of the @Class.Score@ type. -..remarks: -This function does not perform the (linear time) traceback step after the (mostly quadratic time) dynamic programming step. -Note that Myers' bit-vector algorithm does not compute an alignment (only in the Myers-Hirschberg variant) but scores can be computed using $globalAlignmentScore$. -..remarks: -The same limitations to algorithms as in @Function.globalAlignment@ apply. -Furthermore, the $MyersBitVector$ and $MyersHirschberg$ variants can only be used without any other parameter. -..see:Function.globalAlignment -..wiki:Tutorial/PairwiseSequenceAlignment -*/ - -// ---------------------------------------------------------------------------- -// Function globalAlignmentScore() [unbanded, 2 Strings] -// ---------------------------------------------------------------------------- - -template -TScoreValue globalAlignmentScore(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag) -{ - return _setUpAndRunAlignment(seqH, seqV, scoringScheme, alignConfig, algoTag); -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignmentScore(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - TAlgoTag const & algoTag) -{ - AlignConfig<> alignConfig; - return globalAlignmentScore(seqH, seqV, scoringScheme, alignConfig, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignmentScore(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme, - AlignConfig const & alignConfig) -{ - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignmentScore(seqH, seqV, scoringScheme, alignConfig, NeedlemanWunsch()); - else - return globalAlignmentScore(seqH, seqV, scoringScheme, alignConfig, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignmentScore(TSequenceH const & seqH, - TSequenceV const & seqV, - Score const & scoringScheme) -{ - AlignConfig<> alignConfig; - return globalAlignmentScore(seqH, seqV, scoringScheme, alignConfig); -} - -// ---------------------------------------------------------------------------- -// Function globalAlignmentScore() [unbanded, StringSet] -// ---------------------------------------------------------------------------- - -template -TScoreValue globalAlignmentScore(StringSet const & strings, - Score const & scoringScheme, - AlignConfig const & alignConfig, - TAlgoTag const & algoTag) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - return _setUpAndRunAlignment(strings[0], strings[1], scoringScheme, alignConfig, algoTag); -} - -// Interface without AlignConfig<>. - -template -TScoreValue globalAlignmentScore(StringSet const & strings, - Score const & scoringScheme, - TAlgoTag const & algoTag) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - - AlignConfig<> alignConfig; - return globalAlignmentScore(strings[0], strings[1], scoringScheme, alignConfig, algoTag); -} - -// Interface without algorithm tag. - -template -TScoreValue globalAlignmentScore(StringSet const & strings, - Score const & scoringScheme, - AlignConfig const & alignConfig) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - - if (scoreGapOpen(scoringScheme) == scoreGapExtend(scoringScheme)) - return globalAlignmentScore(strings[0], strings[1], scoringScheme, alignConfig, NeedlemanWunsch()); - else - return globalAlignmentScore(strings[0], strings[1], scoringScheme, alignConfig, Gotoh()); -} - -// Interface without AlignConfig<> and algorithm tag. - -template -TScoreValue globalAlignmentScore(StringSet const & strings, - Score const & scoringScheme) -{ - SEQAN_ASSERT_EQ(length(strings), 2u); - - AlignConfig<> alignConfig; - return globalAlignmentScore(strings[0], strings[1], scoringScheme, alignConfig); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_GLOBAL_ALIGNMENT_UNBANDED_H_ diff --git a/seqan/align/local_alignment_banded.h b/seqan/align/local_alignment_banded.h deleted file mode 100644 index abdbbcf..0000000 --- a/seqan/align/local_alignment_banded.h +++ /dev/null @@ -1,161 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Interface functions for banded local alignment. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_BANDED_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_BANDED_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function localAlignment() [banded, Align] -// ---------------------------------------------------------------------------- - -template -TScoreValue localAlignment(Align & align, - Score const & scoringScheme, - int lowerDiag, - int upperDiag) -{ - typedef Align TAlign; - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - SEQAN_ASSERT_EQ(length(rows(align)), 2u); - - String traceSegments; - TScoreValue score = _setUpAndRunAlignment(traceSegments, source(row(align, 0)), source(row(align, 1)), - scoringScheme, lowerDiag, upperDiag, SmithWaterman()); - _adaptTraceSegmentsTo(row(align, 0), row(align, 1), traceSegments); - return score; -} - -// ---------------------------------------------------------------------------- -// Function localAlignment() [banded, Gaps] -// ---------------------------------------------------------------------------- - -template -TScoreValue localAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme, - int lowerDiag, - int upperDiag) -{ - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - TScoreValue score = _setUpAndRunAlignment(traceSegments, source(gapsH), source(gapsV), scoringScheme, lowerDiag, - upperDiag, SmithWaterman()); - _adaptTraceSegmentsTo(gapsH, gapsV, traceSegments); - return score; -} - -// ---------------------------------------------------------------------------- -// Function localAlignment() [banded, Graph >] -// ---------------------------------------------------------------------------- - -template -TScoreValue localAlignment(Graph > & alignmentGraph, - Score const & scoringScheme, - int lowerDiag, - int upperDiag) -{ - typedef Graph > TGraph; - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - TScoreValue score = _setUpAndRunAlignment(traceSegments, value(stringSet(alignmentGraph), 0), - value(stringSet(alignmentGraph), 1), scoringScheme, lowerDiag, upperDiag, - SmithWaterman()); - _adaptTraceSegmentsTo(alignmentGraph, positionToId(stringSet(alignmentGraph), 0), - positionToId(stringSet(alignmentGraph), 1), traceSegments); - return score; -} - -// ---------------------------------------------------------------------------- -// Function localAlignment() [banded, String >] -// ---------------------------------------------------------------------------- - -// Full interface. - -template -TScoreValue localAlignment(String, TStringSpec> & fragmentString, - StringSet const & strings, - Score const & scoringScheme, - int lowerDiag, - int upperDiag) -{ - typedef String, TStringSpec> TFragments; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - - TScoreValue score = _setUpAndRunAlignment(traceSegments, value(strings, 0), value(strings, 1), scoringScheme, - lowerDiag, upperDiag, SmithWaterman()); - _adaptTraceSegmentsTo(fragmentString, positionToId(strings, 0), positionToId(strings, 1), traceSegments); - return score; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_BANDED_H_ diff --git a/seqan/align/local_alignment_banded_waterman_eggert_impl.h b/seqan/align/local_alignment_banded_waterman_eggert_impl.h deleted file mode 100644 index 763484b..0000000 --- a/seqan/align/local_alignment_banded_waterman_eggert_impl.h +++ /dev/null @@ -1,601 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// Author: Anne-Katrin Emde -// Author: Tobias Rausch -// Author: Birte Kehr -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_BANDED_WATERMAN_EGGERT_IMPL_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_BANDED_WATERMAN_EGGERT_IMPL_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// Legacy. -struct BandedWatermanEggert_; -typedef Tag BandedWatermanEggert; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _alignBandedSmithWaterman() -// ---------------------------------------------------------------------------- - -template -inline TScoreValue -_alignBandedSmithWaterman(LocalAlignmentFinder& finder, - TSequenceH const & seqH, - TSequenceV const & seqV, - TScore const& sc, - TScoreValue const cutoff, - TDiagonal const diagL, - TDiagonal const diagU) { - typedef typename Size::Type TSize; - typedef LocalAlignmentFinder TFinder; - - // Initialization - TSequenceH const& str1 = seqH; - TSequenceV const& str2 = seqV; - TSize len1 = length(str1); - TSize len2 = length(str2); - - TSize lo_row = (diagU <= 0) ? static_cast(-diagU) : 0; - TSize hi_row = len2;// + 1; - if (len1 - diagL < hi_row) hi_row = static_cast(len1 - diagL); - - TSize height = hi_row - lo_row + 1; - TSize diagonalWidth = (TSize) (diagU - diagL + 1); - - TSize actualCol, actualRow; - TScoreValue verti_val, hori_val; - - // Initialize iterators - typename TFinder::TMatrixIterator matIt = begin(finder.matrix); // Iterator in current row - goNext(matIt, 1); - typename TFinder::TMatrixIterator matIt2 = begin(finder.matrix); // Iterator in previous row (for diagonal and vertical value) - - for (TSize row = 1; row < height; ++row) { - actualRow = row + lo_row; - hori_val = 0; - - for (TSize col = 0; col < diagonalWidth; ++col, ++matIt) { - // handle begin and end triangle of band - if ((int)col + diagL + (int)actualRow < 0) {++matIt2; continue;} - actualCol = static_cast(col + diagL + actualRow); - if (actualCol > len1) {++matIt2; continue;} - - if (actualCol != 0) { - // Get the new maximum for diagonal - *matIt = *matIt2 + - score(const_cast(sc), sequenceEntryForScore(sc, str1, (int) actualCol - 1), - sequenceEntryForScore(sc, str2, (int) actualRow - 1)); - - ++matIt2; - - // Get the new maximum for vertical - if (col < diagonalWidth - 1) { - verti_val = *matIt2 + - scoreGapExtendVertical(sc, sequenceEntryForScore(sc, str1, (int) actualCol - 1), - sequenceEntryForScore(sc, str2, (int) actualRow - 1)); - if (verti_val > *matIt) { - *matIt = verti_val; - } - } - - // Get the new maximum for horizontal - if (col > 0) { - hori_val = hori_val + - scoreGapExtendHorizontal(sc, sequenceEntryForScore(sc, str1, (int) actualCol - 1), - sequenceEntryForScore(sc, str2, (int) actualRow - 1)); - if (hori_val > *matIt) { - *matIt = hori_val; - } - } - - // Check if new maximum is greater than 0 - if (0 > *matIt) { - *matIt = 0; - } - - // Record the new best score - if (*matIt >= cutoff) { - push(finder.pQ, ScoreAndID(*matIt, position(matIt))); - } - } else { - // First column (*matIt = 0) - ++matIt2; - } - hori_val = *matIt; - } - } - // // Debug code - // std::cerr << std::endl; - //for(TSize i= 0; i 0) std::cerr << " " << str2[i-1] << std::endl; - // else std::cerr << std::endl; - //} - // if(length(finder.pQ) > 0) std::cerr << "Max score: " << top(finder.pQ).value_ << std::endl; - - if(!empty(finder.pQ)) { - finder.bestEndPos = top(finder.pQ).id_; - return top(finder.pQ).value_; - } else { - return 0; - } -} - -// ---------------------------------------------------------------------------- -// Helper Function _alignBandedSmithWatermanDeclump() -// ---------------------------------------------------------------------------- - -template -inline void -_setForbiddenCell(String& forbidden, - TSize len1, - TSize len2, - TSize numRows) -{ - forbidden[(len1 - 1)*numRows + (len2 - 1)] = true; -} - - -template -inline void -_setForbiddenCell(Nothing&, - TSize, - TSize, - TSize) -{ -} - -// ---------------------------------------------------------------------------- -// Function _alignBandedSmithWatermanDeclump() -// ---------------------------------------------------------------------------- - -template -inline void -_alignBandedSmithWatermanDeclump(LocalAlignmentFinder& finder, - TSequenceH const & seqH, - TSequenceV const & seqV, - TScore const& sc, - TScoreValue const cutoff, - TDiagonal const diagL, - TDiagonal const diagU) -{ - typedef typename Size::Type TSize; - typedef LocalAlignmentFinder TFinder; - typedef unsigned char TTraceValue; - - // Traceback values - TTraceValue Diagonal = 0; TTraceValue Horizontal = 1; TTraceValue Vertical = 2; - - TSequenceH const& str1 = seqH; - TSequenceV const& str2 = seqV; - TSize len1 = length(str1); - - TSize diagonalWidth = (TSize) (diagU - diagL + 1); - TSize lo_row = (diagU <= 0) ? static_cast(-diagU) : 0; - TSize hi_row = length(seqV);// + 1; - if (len1 - diagL < hi_row) hi_row = static_cast(len1 - diagL); - TSize height = hi_row - lo_row + 1; - - TSize actualRow, actualCol; - //TSize row, col; - - // Initialize iterators - typename TFinder::TMatrixIterator matIt = iter(finder.matrix, finder.bestBeginPos); - typename TFinder::TMatrixIterator matIt2; - - // Initialize column boundaries - TSize minCol = diagonalWidth, newMinCol = diagonalWidth; - TSize maxCol = 0, newMaxCol = 0; - TSize row = coordinate(matIt, 1); - TSize col = coordinate(matIt, 0); - TSize traceCol = col; - - matIt -= col; - - // Initialize position in trace - TSize tracePos = length(finder.trace.sizes); - while (tracePos > 0 && finder.trace.tvs[tracePos-1] != Diagonal) --tracePos; - if (tracePos == 0) return; - TSize traceSize = finder.trace.sizes[tracePos-1]; - TTraceValue traceValue = finder.trace.tvs[tracePos-1]; - - // iterate over rows - while((row < height) && ((maxCol > minCol) || (tracePos > 0))) { - actualRow = row + lo_row; - - // make sure that all matrix entries of trace are re-calculated and set to forbidden - while (traceSize == 0 && tracePos > 1) { - // determine next trace direction - --tracePos; - traceValue = finder.trace.tvs[tracePos-1]; - if (traceValue == Horizontal) { - traceCol += finder.trace.sizes[tracePos-1]; - } else { - traceSize = finder.trace.sizes[tracePos-1]; - } - } - if (tracePos > 0) { - // follow the trace in the current row - if (traceValue == Diagonal) { - --traceSize; - _setForbiddenCell(finder.forbidden, row+1, traceCol+1, diagonalWidth); - minCol = _min(minCol, traceCol); - maxCol = _max(maxCol, traceCol+1); - } else if (traceValue == Vertical) { - if (traceCol > 0) --traceCol; - --traceSize; - } - - if (traceCol >= maxCol) { - maxCol = traceCol + 1; - } - } - - // iterate over columns that have to be re-calculated - if (maxCol > minCol) { - col = minCol; - matIt += col; - matIt2 = matIt - diagonalWidth; - while (col < maxCol) { - actualCol = static_cast(col + diagL + actualRow); - if (actualCol > len1) break; - - TScoreValue newVal = 0; - - // diagonal - if (!value(finder.forbidden, position(matIt))) { - newVal = _max(newVal, *matIt2 + score(sc, sequenceEntryForScore(sc, str1, (int)actualCol-1), - sequenceEntryForScore(sc, str2, (int)actualRow-1))); - } - ++matIt2; - - // horizontal - if (col > 0) { - newVal = _max(newVal, *(matIt-1) + - scoreGapExtendHorizontal(sc, sequenceEntryForScore(sc, str1, (int) actualCol-1), - sequenceEntryForScore(sc, str2, (int)actualRow-1))); - } - - // vertical - if (col+1 < maxCol) { - newVal = _max(newVal, *matIt2 + - scoreGapExtendVertical(sc, sequenceEntryForScore(sc, str1, (int)actualCol-1), - sequenceEntryForScore(sc, str2, (int)actualRow-1))); - } - - if (newVal != *matIt) { - // matrix entry changed - *matIt = newVal; - maxCol = _min(_max(maxCol, col+2), diagonalWidth); - newMaxCol = _max(newMaxCol, col+1); - newMinCol = ((col != 0) ? _min(newMinCol, col-1) : 0); - - // Record the new best score - if (newVal >= cutoff) { - push(finder.pQ, ScoreAndID(newVal, position(matIt))); - } - } else { - // matrix entry did not change - if (col == minCol) { - ++minCol; - } - } - ++col; - ++matIt; - } - matIt += diagonalWidth - col; - } else { - matIt += diagonalWidth; - } - - minCol = _max((TSize)0, newMinCol); - maxCol = _min(diagonalWidth, newMaxCol); - newMinCol = diagonalWidth; - newMaxCol = 0; - - ++row; - } - // // Debug code - // std::cerr << std::endl; - // for (TSize i = 0; i < height; ++i) { - // for(TSize j = 0; j < diagonalWidth; ++j) { - // std::cerr << value(finder.matrix, j, i) << ','; - // } - //if (i > 0) std::cerr << " " << str2[i-1] << " "; - //else std::cerr << " "; - // for (TSize j= 0; j 0) std::cerr << " " << str2[i-1] << std::endl; - //else std::cerr << std::endl; - // } -} - -// ---------------------------------------------------------------------------- -// Function _alignBandedSmithWatermanTrace() -// ---------------------------------------------------------------------------- - -template -inline Pair > -_alignBandedSmithWatermanTrace(LocalAlignmentFinder & finder, - TSequenceH const & seqH, - TSequenceV const & seqV, - TId id1, - TId id2, - TScore& sc, - TDiagonal diagL, - TDiagonal diagU) -{ - typedef LocalAlignmentFinder TFinder; - typedef typename Size::Type TSize; - typedef unsigned char TTraceValue; - - clear(finder.trace.sizes); - clear(finder.trace.tvs); - - // Traceback values - TTraceValue Diagonal = 0; TTraceValue Horizontal = 1; TTraceValue Vertical = 2; TTraceValue Stop = 3; - - // Initialization - TSequenceH const& str1 = seqH; - TSequenceV const& str2 = seqV; - TSize len1 = length(str1); - TSize len2 = length(str2); - - TSize lo_row = (diagU <= 0) ? static_cast(-diagU) : 0; - //TSize diagonalWidth = static_cast(diagU - diagL + 1); - - // Start the trace from the cell with the max value - typename TFinder::TMatrixIterator matIt = iter(finder.matrix, finder.bestEndPos); - typename TFinder::TMatrixIterator matIt2 = iter(finder.matrix, finder.bestEndPos); - goPrevious(matIt2, 1); - - TSize row = coordinate(matIt, 1); - TSize col = coordinate(matIt, 0); - TSize endRow = row + lo_row; - TSize endCol = static_cast(col + diagL + endRow); - - TSize actualRow = row + lo_row; - TSize actualCol = static_cast(col + diagL + actualRow); - if ((actualCol == 0) || (actualRow == 0)) - return Pair >(); - - if (actualCol < len1) _alignTracePrint(finder.trace, seqH, seqV, id1, actualCol, id2, actualRow, len1 - actualCol, Horizontal); - if (actualRow < len2) _alignTracePrint(finder.trace, seqH, seqV, id1, actualCol, id2, actualRow, len2 - actualRow, Vertical); - - TTraceValue traceValue = Stop; - TTraceValue nextTraceValue = Horizontal; - TSize segLen = 0; - - while (nextTraceValue != Stop) { - traceValue = nextTraceValue; - if (*matIt == 0) { - nextTraceValue = Stop; - } - else if (*matIt == *matIt2 + - score(const_cast(sc), sequenceEntryForScore(sc, str1, (int)actualCol-1), - sequenceEntryForScore(sc, str2, (int)actualRow-1))) - { - nextTraceValue = Diagonal; - --actualRow; --actualCol; - --row; - goPrevious(matIt, 1); - goPrevious(matIt2, 1); - } else if (*matIt == *(matIt2+1) + - scoreGapExtendVertical(sc, sequenceEntryForScore(sc, str1, (int)actualCol-1), - sequenceEntryForScore(sc, str2, (int)actualRow-1))) - { - nextTraceValue = Vertical; - --actualRow; - --row; ++col; - goPrevious(matIt, 1); goNext(matIt, 0); - goPrevious(matIt2, 1); goNext(matIt2, 0); - } else { - SEQAN_ASSERT_EQ(*matIt, *(matIt-1) + - scoreGapExtendHorizontal(sc, sequenceEntryForScore(sc, str1, (int) actualCol-1), - sequenceEntryForScore(sc, str2, (int) actualRow-1))); - nextTraceValue = Horizontal; - --actualCol; - --col; - goPrevious(matIt, 0); - goPrevious(matIt2, 0); - } - if (traceValue == nextTraceValue) { - ++segLen; - } else { - _alignTracePrint(finder.trace, seqH, seqV, id1, actualCol, id2, actualRow, segLen, traceValue); - segLen = 1; - } - } - - // Handle the remaining sequence - if (actualCol != 0) _alignTracePrint(finder.trace, seqH, seqV, (TId) id1, (TSize) 0, (TId) 0, (TSize) 0, (TSize) actualCol, Horizontal); - if (actualRow != 0) _alignTracePrint(finder.trace, seqH, seqV, (TId) 0, (TSize) 0, (TId) id2, (TSize) 0, (TSize) actualRow, Vertical); - - goNext(matIt, 1); // assumes that each trace ends with a diagonal - finder.bestBeginPos = position(matIt); - - return Pair >(Pair(actualCol, endCol), Pair(actualRow, endRow)); -} - -// ---------------------------------------------------------------------------- -// Function _initLocalAlignmentFinder() -// ---------------------------------------------------------------------------- - -template -void -_initLocalAlignmentFinder(TSequenceH const & seqH, - TSequenceV const & seqV, - LocalAlignmentFinder & finder, - BandedWatermanEggert const &, - TDiagonal const lowerDiag, - TDiagonal const upperDiag) { - typedef LocalAlignmentFinder TFinder; - typedef typename TFinder::TMatrix TMatrix; - typedef typename Size::Type TSize; - - TSize lo_row = (upperDiag <= 0) ? static_cast(-upperDiag) : 0; - TSize hi_row = length(seqV) + 1; - TSize len0 = length(seqH); - if (len0 - lowerDiag < hi_row) hi_row = static_cast(len0 - lowerDiag); - TSize height = hi_row - lo_row + 1; - SEQAN_ASSERT_GEQ(upperDiag, lowerDiag); - TSize diagonalWidth = (TSize) (upperDiag - lowerDiag + 1); - - setDimension(finder.matrix, 2); - setLength(finder.matrix, 0, diagonalWidth); - setLength(finder.matrix, 1, height); - resize(finder.matrix, 0); - - resize(finder.forbidden, height * diagonalWidth, false); - - finder.bestEndPos = minValue(); - finder.bestBeginPos = minValue(); -} - -// ---------------------------------------------------------------------------- -// Function _localAlignment() -// ---------------------------------------------------------------------------- - -template -inline TScoreValue -_localAlignment(LocalAlignmentFinder & finder, - Gaps & gapsH, - Gaps & gapsV, - Score const& sc, - TScoreValue cutoff, - TDiagonal diag1, - TDiagonal diag2, - BandedWatermanEggert const /*algorithmTag*/) -{ - clearGaps(gapsH); - clearClipping(gapsH); - clearGaps(gapsV); - clearClipping(gapsV); - - _initLocalAlignmentFinder(source(gapsH), source(gapsV), finder, BandedWatermanEggert(), diag1, diag2); - finder.needReinit = false; - - // Fill the matrix - TScoreValue maxScore = _alignBandedSmithWaterman(finder, source(gapsH), source(gapsV), sc, cutoff, diag1, diag2); - if (maxScore < cutoff) return 0; - - // Follow the matrix back from max entry and create a trace path - Pair > alignmentPositions = _alignBandedSmithWatermanTrace(finder, source(gapsH), source(gapsV), 0u, 0u, sc, diag1, diag2); - - // Fill the gaps following the trace path. - _pumpTraceToGaps(gapsH, gapsV, finder.trace); - - // The following (using rightOfGaps = false) only works if the gap open cost is negative. In this case, we can - // assume that there are no leading or trailing gaps in either sequence. - // - // We need this assumption because the we get source positions through alignmentPositions and conversion from - // souce to view coordinates gives us the end of a gap if we are at the beginning. - // - // TODO(holtgrew): This should be done in a more robust way. It would probably be better if alignmentPositions gave us the lengths of the local alignments! - setClippedEndPosition(gapsH, toViewPosition(gapsH, alignmentPositions.i1.i2, false)); - setClippedEndPosition(gapsV, toViewPosition(gapsV, alignmentPositions.i2.i2, false)); - setClippedBeginPosition(gapsH, toViewPosition(gapsH, alignmentPositions.i1.i1)); - setClippedBeginPosition(gapsV, toViewPosition(gapsV, alignmentPositions.i2.i1)); - - pop(finder.pQ); - - return maxScore; -} - -// ---------------------------------------------------------------------------- -// Function _localAlignmentNext() -// ---------------------------------------------------------------------------- - -template -inline TScoreValue -_localAlignmentNext(LocalAlignmentFinder & finder, - Gaps & gapsH, - Gaps & gapsV, - TScore const& sc, - TScoreValue cutoff, - TDiagonal diag1, - TDiagonal diag2, - BandedWatermanEggert const & /*algorithmTag*/) { - // Declump the matrix and find new maximum score - _alignBandedSmithWatermanDeclump(finder, source(gapsH), source(gapsV), sc, cutoff, diag1, diag2); - typename LocalAlignmentFinder::TMatrixPosition nextBestEnd; - nextBestEnd = _getNextBestEndPosition(finder, cutoff); - if(nextBestEnd==0) - return 0; - TScoreValue maxScore = getValue(finder.matrix, nextBestEnd); - if(maxScore == 0) return 0; - - // Follow the trace matrix and create a trace path - Pair > alignmentPositions = _alignBandedSmithWatermanTrace(finder, source(gapsH), source(gapsV), 0u, 0u, sc, diag1, diag2); - - // Fill the gaps following the trace path. - _pumpTraceToGaps(gapsH, gapsV, finder.trace); - - // The following (using rightOfGaps = false) only works if the gap open cost is negative. In this case, we can - // assume that there are no leading or trailing gaps in either sequence. - // - // We need this assumption because the we get source positions through alignmentPositions and conversion from - // souce to view coordinates gives us the end of a gap if we are at the beginning. - // - // TODO(holtgrew): This should be done in a more robust way. It would probably be better if alignmentPositions gave us the lengths of the local alignments! - setClippedEndPosition(gapsH, toViewPosition(gapsH, alignmentPositions.i1.i2, false)); - setClippedEndPosition(gapsV, toViewPosition(gapsV, alignmentPositions.i2.i2, false)); - setClippedBeginPosition(gapsH, toViewPosition(gapsH, alignmentPositions.i1.i1)); - setClippedBeginPosition(gapsV, toViewPosition(gapsV, alignmentPositions.i2.i1)); - - return maxScore; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_BANDED_WATERMAN_EGGERT_IMPL_H_ diff --git a/seqan/align/local_alignment_enumeration.h b/seqan/align/local_alignment_enumeration.h deleted file mode 100644 index d797606..0000000 --- a/seqan/align/local_alignment_enumeration.h +++ /dev/null @@ -1,342 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_ENUMERATION_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_ENUMERATION_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class LocalAlignmentEnumerator -// ---------------------------------------------------------------------------- - -template -class LocalAlignmentEnumerator; - -/*! - * @class LocalAlignmentEnumerator - * @headerfile - * - * @signature template - * class LocalAlignmentEnumerator; - * - * @tparam TScore The type of the @link Score @endlink to use for the local alignment. - * @tparam TSpec The tag to use for specializing the enumerator. - * - * See the documentation of the specializations for examples. - * - * @section References - * - *
    - *
  • Waterman MS, Eggert M: A new algorithm for best subsequence alignments with application to tRNA-rRNA - * comparisons. J Mol Biol 1987, 197(4):723-728.
  • - *
- */ - -/*! - * @class UnbandedLocalAlignmentEnumerator - * @extends LocalAlignmentEnumerator - * @headerfile - * @brief Unbanded enumeration of local alignments using the Waterman-Eggert algorithm. - * - * @signature template - * class LocalAlignmentEnumerator; - * - * @tparam TScore The @link Score @endlink type. - * - * @section Example - * - * Enumerate all alignments into a @link Align @endlink object. - * - * @code{.cpp} - * SimpleScore scoringScheme(2, -1, -1, -2); - * LocalAlignmentEnumerator enumerator(scoringScheme, 5); - * - * Dna5String seqH = "CGAGAGAGACCGAGA"; - * Dna5String seqV = "TTCTGAGATCCGTTTTT"; - * - * Align align; - * resize(rows(align), 2); - * assignSource(row(align), 0, seqH); - * assignSource(row(align), 1, seqV); - * - * int i = 0; - * while (nextLocalAlignment(align, enumerator)) - * { - * std::cout << i << "-th alignment:\n"; - * std::cout << align << "\n\n"; - * std::cout << "score == " << getScore(enumerator) << "\n"; - * } - * @endcode - */ - -/*! - * @fn UnbandedLocalAlignmentEnumerator::LocalAlignmentEnumerator - * @brief Constructor. - * - * @signature LocalAlignmentEnumerator::LocalAlignmentEnumerator(scheme[, cutoff]); - * - * @param scheme The @link Score @endlink object to use for the alignment score. - * @param cutoff Alignments with scores < cutoff will be discarded (int, default 0). - */ - -/*! - * @class BandedLocalAlignmentEnumerator - * @extends LocalAlignmentEnumerator - * @headerfile - * @brief Banded enumeration of local alignments using the Waterman-Eggert algorithm. - * - * @signature template - * class LocalAlignmentEnumerator; - * - * @tparam TScore The @link Score @endlink type. - * - * @section Example - * - * Enumerate all alignments in the band between -3 and 0 into an @link Align @endlink object. - * - * @code{.cpp} - * SimpleScore scoringScheme(2, -1, -1, -2); - * LocalAlignmentEnumerator enumerator(scoringScheme, -3, 0, 5); - * - * Dna5String seqH = "CGAGAGAGACCGAGA"; - * Dna5String seqV = "TTCTGAGATCCGTTTTT"; - * - * Align align; - * resize(rows(align), 2); - * assignSource(row(align), 0, seqH); - * assignSource(row(align), 1, seqV); - * - * int i = 0; - * while (nextLocalAlignment(align, enumerator)) - * { - * std::cout << i << "-th alignment:\n"; - * std::cout << align << "\n\n"; - * std::cout << "score == " << getScore(enumerator) << "\n"; - * } - * @endcode - */ - -/*! - * @fn BandedLocalAlignmentEnumerator::LocalAlignmentEnumerator - * @brief Constructor. - * - * @signature LocalAlignmentEnumerator::LocalAlignmentEnumerator(scheme, upperDiag, lowerDiag[, cutoff]); - * - * @param scheme The @link Score @endlink object to use for the alignment score. - * @param upperDiag An int with the upper diagonal. - * @param lowerDiag An int with the lower diagonal. - * @param cutoff Alignments with scores < cutoff will be discarded (int, default 0). - */ - -/** -.Class.LocalAlignmentEnumerator -..cat:Alignments -..summary:Enumerate local alignments using the Waterman-Eggert algorithm. -..description:This is an abstract base class for the alignment enumeration; the specializations provide the actual implementaiton of banded and unbanded local aligment search. -..signature:LocalAlignmentEnumerator -..param.TScore:The @Class.Score@ type to use. -...type:Class.Score -..param.TSpec:Specialization tag. -..example.text:See the specializations for usage examples. -..cite:Waterman MS, Eggert M: A new algorithm for best subsequence alignments with application to tRNA-rRNA comparisons. J Mol Biol 1987, 197(4):723-728. -..include:seqan/align.h - -.Spec.Unbanded LocalAlignmentEnumerator -..cat:Alignments -..general:Class.LocalAlignmentEnumerator -..summary:Unbanded enumeration of local alignments using the Waterman-Eggert algorithm. -..signature:LocalAlignmentEnumerator -..example.text:Enumerate all alignments into an @Class.Align@ object. -..example.code: -SimpleScore scoringScheme(2, -1, -1, -2); -LocalAlignmentEnumerator enumerator(scoringScheme, 5); - -Dna5String seqH = "CGAGAGAGACCGAGA"; -Dna5String seqV = "TTCTGAGATCCGTTTTT"; - -Align align; -resize(rows(align), 2); -assignSource(row(align), 0, seqH); -assignSource(row(align), 1, seqV); - -int i = 0; -while (nextLocalAlignment(align, enumerator)) -{ - std::cout << i << "-th alignment:\n"; - std::cout << align << "\n\n"; - std::cout << "score == " << getScore(enumerator) << "\n"; -} -..include:seqan/align.h - -.Memfunc.Unbanded LocalAlignmentEnumerator#LocalAlignmentEnumerator -..class:Spec.Unbanded LocalAlignmentEnumerator -..summary:Constructor -..signature:LocalAlignmentEnumerator(score, [cutoff]) -..param.score:The scoring scheme to use for the alignments. -...type:Class.Score -..param.cutoff:Alignments with scores < $cutoff$ will be discarded. -...default:0 -...type:nolink:$int$ - -.Spec.Banded LocalAlignmentEnumerator -..cat:Alignments -..general:Class.LocalAlignmentEnumerator -..signature:LocalAlignmentEnumerator -..summary:Banded enumeration of local alignments using the Waterman-Eggert algorithm. -..example.text:Enumerate all alignments in the band between $-3$ and $0$ into an @Class.Align@ object. -..example.code: -SimpleScore scoringScheme(2, -1, -1, -2); -LocalAlignmentEnumerator enumerator(scoringScheme, 5, -3, 0); - -Dna5String seqH = "CGAGAGAGACCGAGA"; -Dna5String seqV = "TTCTGAGATCCGTTTTT"; - -Align align; -resize(rows(align), 2); -assignSource(row(align), 0, seqH); -assignSource(row(align), 1, seqV); - -int i = 0; -while (nextLocalAlignment(align, enumerator)) -{ - std::cout << i << "-th alignment:\n"; - std::cout << align << "\n\n"; - std::cout << "score == " << getScore(enumerator) << "\n"; -} -..include:seqan/align.h - -.Memfunc.Banded LocalAlignmentEnumerator#LocalAlignmentEnumerator -..class:Spec.Banded LocalAlignmentEnumerator -..summary:Constructor -..signature:LocalAlignmentEnumerator(score, upperDiag, lowerDiag, [cutoff]) -..param.score:The scoring scheme to use for the alignments. -...type:Class.Score -..param.upperDiag:Upper diagonal of the band. -...type:nolink:$int$ -..param.lowerDiag:Lower diagonal of the band. -...type:nolink:$int$ -..param.cutoff:Alignments with scores < $cutoff$ will be discarded. -...type:nolink:$int$ -...default:0 -*/ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function getScore() -// ---------------------------------------------------------------------------- - -/*! - * @fn LocalAlignmentEnumerator#getScore - * @headerfile - * @brief Get current alignment score. - * - * @signature TScoreVal getScore(enumerator); - * - * @param enumerator The LocalAlignmentEnumerator to query. - * - * @return TScoreVal The current alignment score. - */ - -/** -.Function.LocalAlignmentEnumerator#getScore -..cat:Alignments -..summary:Compute next suboptimal local alignment. -..signature:getScore(enumerator) -..param.enumerator:The local alignment enumerator to use. -...type:Class.LocalAlignmentEnumerator -..returns: -The score of the previously computed alignment. -(Type: @Metafunction.Value@ of $enumerator$'s class.) -..include:seqan/align.h - */ - -// ---------------------------------------------------------------------------- -// Function nextLocalAlignment() -// ---------------------------------------------------------------------------- - -/*! - * @fn LocalAlignmentEnumerator#nextLocalAlignment - * @headerfile - * @brief Compute next suboptimal local alignment. - * - * @signature bool nextLocalAlignment(align, enumerator); - * @signature bool nextLocalAlignment(gapsH, gapsV, enumerator); - * - * @param align @link Align @endlink object to use for the alignment representation. - * @param gapsH @link Gaps @endlink object to use for the first/horizontal sequence in the alignment matrix. - * @param gapsV @link Gaps @endlink object to use for the second/vertical sequence in the alignment matrix. - * @param enumerator The LocalAlignmentEnumerator to advance. - * - * @return bool true if another suboptimal alignment above the given threshold was found and false - * otherwise. - */ - -/** -.Function.nextLocalAlignment -..cat:Alignments -..summary:Compute next suboptimal local alignment. -..signature:nextLocalAlignment(align, enumerator) -..signature:nextLocalAlignment(gapsH, gapsV, enumerator) -..param.align:The @Class.Align@ object to use for the alignment representation. -...type:Class.Align -..param.gapsH:The @Class.Gaps@ object to use for the horizontal sequence in the alignment matrix. -...type:Class.Gaps -..param.gapsV:The @Class.Gaps@ object to use for the vertical sequence in the alignment matrix. -...type:Class.Gaps -..param.enumerator:The @Class.LocalAlignmentEnumerator@ object to use. -...type:Class.LocalAlignmentEnumerator -..returns:$true$ if another suboptimal alignment above the given threshold was found, $false$ otherwise. -...type:nolink:$bool$ -..include:seqan/align.h -*/ - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_ENUMERATION_H_ diff --git a/seqan/align/local_alignment_enumeration_banded.h b/seqan/align/local_alignment_enumeration_banded.h deleted file mode 100644 index 2d50d72..0000000 --- a/seqan/align/local_alignment_enumeration_banded.h +++ /dev/null @@ -1,126 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_ENUMERATION_BANDED_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_ENUMERATION_BANDED_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Specialization Banded LocalAlignmentEnumerator -// ---------------------------------------------------------------------------- - -struct Banded_; -typedef Tag Banded; - -template -class LocalAlignmentEnumerator -{ -public: - typedef typename Value::Type TScoreValue_; - - TScore _score; - int _lowerDiag; - int _upperDiag; - TScoreValue_ _cutoff; - LocalAlignmentFinder _finder; - - LocalAlignmentEnumerator(TScore const & score, int lowerDiag, int upperDiag) : - _score(score), _lowerDiag(lowerDiag), _upperDiag(upperDiag), _cutoff(0) - {} - - LocalAlignmentEnumerator(TScore const & score, int lowerDiag, int upperDiag, int cutoff) : - _score(score), _lowerDiag(lowerDiag), _upperDiag(upperDiag), _cutoff(cutoff) - {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function getScore() -// ---------------------------------------------------------------------------- - -template -inline TScoreValue -getScore(LocalAlignmentEnumerator, Banded> const & enumerator) -{ - return getScore(enumerator._finder); -} - -// ---------------------------------------------------------------------------- -// Function nextLocalAlignment() -// ---------------------------------------------------------------------------- - -template -inline bool -nextLocalAlignment(Gaps & gapsH, - Gaps & gapsV, - LocalAlignmentEnumerator, Banded> & enumerator) -{ - if (enumerator._finder.needReinit) - return _localAlignment(enumerator._finder, gapsH, gapsV, enumerator._score, enumerator._cutoff, - enumerator._lowerDiag, enumerator._upperDiag, BandedWatermanEggert()); - else - return _localAlignmentNext(enumerator._finder, gapsH, gapsV, enumerator._score, - enumerator._cutoff, enumerator._lowerDiag, enumerator._upperDiag, - BandedWatermanEggert()); -} - -template -inline bool -nextLocalAlignment(Align & align, - LocalAlignmentEnumerator, Banded> & enumerator) -{ - SEQAN_ASSERT_EQ(length(rows(align)), 2u); - - return nextLocalAlignment(row(align, 0), row(align, 1), enumerator); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_ENUMERATION_BANDED_H_ diff --git a/seqan/align/local_alignment_enumeration_unbanded.h b/seqan/align/local_alignment_enumeration_unbanded.h deleted file mode 100644 index 35914ea..0000000 --- a/seqan/align/local_alignment_enumeration_unbanded.h +++ /dev/null @@ -1,122 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_ENUMERATION_UNBANDED_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_ENUMERATION_UNBANDED_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Specialization Unbanded LocalAlignmentEnumerator -// ---------------------------------------------------------------------------- - -struct Unbanded_; -typedef Tag Unbanded; - -template -class LocalAlignmentEnumerator -{ -public: - typedef typename Value::Type TScoreValue_; - - TScore _scoringScheme; - TScoreValue_ _cutoff; - LocalAlignmentFinder _finder; - - LocalAlignmentEnumerator(TScore const & score) : - _scoringScheme(score), _cutoff(0) - {} - - LocalAlignmentEnumerator(TScore const & score, int cutoff) : - _scoringScheme(score), _cutoff(cutoff) - {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function getScore() -// ---------------------------------------------------------------------------- - -template -inline TScoreValue -getScore(LocalAlignmentEnumerator, Unbanded> const & enumerator) -{ - // TODO(holtgrew): Const correctness! - return getScore(const_cast &>(enumerator._finder)); -} - -// ---------------------------------------------------------------------------- -// Function nextLocalAlignment() -// ---------------------------------------------------------------------------- - -template -inline bool -nextLocalAlignment(Gaps & gapsH, - Gaps & gapsV, - LocalAlignmentEnumerator, Unbanded> & enumerator) -{ - if (enumerator._finder.needReinit) - return _smithWaterman(gapsH, gapsV, enumerator._finder, enumerator._scoringScheme, enumerator._cutoff); - else - return _smithWatermanGetNext(gapsH, gapsV, enumerator._finder, enumerator._scoringScheme, enumerator._cutoff); -} - -template -inline bool -nextLocalAlignment(Align & align, - LocalAlignmentEnumerator, Unbanded> & enumerator) -{ - SEQAN_ASSERT_EQ(length(rows(align)), 2u); - - return nextLocalAlignment(row(align, 0), row(align, 1), enumerator); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_ENUMERATION_UNBANDED_H_ diff --git a/seqan/align/local_alignment_unbanded.h b/seqan/align/local_alignment_unbanded.h deleted file mode 100644 index f560b1c..0000000 --- a/seqan/align/local_alignment_unbanded.h +++ /dev/null @@ -1,330 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Interface functions for unbanded local alignment. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_UNBANDED_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_UNBANDED_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function localAlignment() -// ---------------------------------------------------------------------------- - -/*! - * @fn localAlignment - * @headerfile - * @brief Computes the best pairwise local alignment using the Smith-Waterman algorithm. - * - * @signature TScoreVal localAlignment(align, scoringScheme, [lowerDiag, upperDiag]); - * @signature TScoreVal localAlignment(gapsH, gapsV, scoringScheme, [lowerDiag, upperDiag]); - * @signature TScoreVal localAlignment(fragmentString, scoringScheme, [lowerDiag, upperDiag]); - * - * @param lowerDiag Optional lower diagonal (int). - * @param lowerDiag Optional upper diagonal (int). - * - * @param gapsH Horizontal gapped sequence in alignment matrix. Types: Gaps - * @param align An @link Align @endlink object that stores the alignment. The - * number of rows must be 2 and the sequences must have already - * been set. align[0] is the horizontal one in the - * alignment matrix alignment, align[1] is the vertical - * one. Types: Align - * @param fragmentString String of @link Fragment @endlink objects. The sequence - * with id 0 is the horizontal one, the sequence - * with id 1 is the vertical one. - * @param gapsV Vertical gapped sequence in alignment matrix. Types: Gaps - * @param scoringScheme The scoring scheme to use for the alignment. Note that - * the user is responsible for ensuring that the scoring - * scheme is compatible with algorithmTag. Types: - * Score - * - * @return TScoreVal The score value of the alignmetn. - * - * @section Remarks - * - * The Waterman-Eggert algorithm (local alignment with declumping) is available through the @link - * LocalAlignmentEnumerator @endlink class. - * - * When using @link Gaps @endlink and @link Align @endlink objects, only parts (i.e. one infix) of each sequence will be - * aligned. This will be presented to the user by setting the clipping begin and end position of the gaps (the rows in - * the case of @link Align @endlink objects). When using @link Fragment @endlink strings, these parts of the sequences - * will not appear in any fragment. - * - * There exist multiple overloads for this function with two configuration dimensions. - * - * First, you can select the type of the target storing the alignment. This can be either an @link Align @endlink - * object, two @link Gaps @endlink objects, or a string of @link Fragment @endlink objects. @link Align @endlink objects - * provide an interface to tabular alignments with the restriction of all rows having the same type. Using two @link - * Gaps @endlink objects has the advantage that you an align sequences with different types, for example @link DnaString - * @endlink and @link Dna5String @endlink. Using @link Fragment @endlink strings is useful for collecting many pairwise - * alignments, for example in the construction of @link AlignmentGraph Alignment Graphs @endlink for multiple- sequence - * alignments (MSA). - * - * Second, you can optionally give a band for the alignment using lowerDiag and upperDiag. The center - * diagonal has index 0, the ith diagonal below has index -i, the ith above has - * index i. - * - * The examples below show some common use cases. - * - * @section Examples - * - * Local alignment of two sequences using an @link Align @endlink object. - * - * @code{.cpp} - * Dna5String seqH = "CGATT"; - * Dna5String seqV = "CGAAATT"; - * - * Align align; - * resize(rows(align), 2); - * assignSource(row(align, 0), seqH); - * assignSource(row(align, 0), seqV); - * Score scoringScheme(2, -1, -2); - * - * int result = localAlignment(align, scoringScheme); - * @endcode - * - * Local banded alignment of two sequences using two @link Gaps @endlink objects. - * - * @code{.cpp} - * Dna5String seqH = "CGATT"; - * Gaps gapsH(seqH); - * DnaString seqV = "CGAAATT"; - * Gaps > gapsV(seqV); - * - * Score scoringScheme(5, -3, -1, -5); - * - * int result = localAlignment(gapsH, gapsV, scoringScheme, -2, 2); - * @endcode - * - * http://trac.seqan.de/wiki/Tutorial/PairwiseSequenceAlignment - * - * @section References - * - *
    - *
  • Smith TF, Waterman, MS: Identification of Common Molecular Subsequences. J Mol Biol 1981, 147(1):195-7.
  • - *
- * - * @see globalAlignment - * @see LocalAlignmentEnumerator - * @see PairwiseLocalAlignmentAlgorithms - */ - -/** -.Function.localAlignment -..summary:Computes the best pairwise local alignment using the Smith-Waterman algorithm. -..cat:Alignments -..signature:localAlignment(align, scoringScheme, [lowerDiag, upperDiag]) -..signature:localAlignment(gapsH, gapsV, scoringScheme, [lowerDiag, upperDiag]) -..signature:localAlignment(fragmentString, scoringScheme, [lowerDiag, upperDiag]) -..param.align: -An @Class.Align@ object that stores the alignment. -The number of rows must be 2 and the sequences must have already been set. -$align[0]$ is the horizontal one in the alignment matrix alignment, $align[1]$ is the vertical one. -...type:Class.Align -..param.gapsH:Horizontal gapped sequence in alignment matrix. -...type:Class.Gaps -..param.gapsV:Vertical gapped sequence in alignment matrix. -...type:Class.Gaps -..param.fragmentString: -String of @Class.Fragment@ objects. -The sequence with id $0$ is the horizontal one, the sequence with id $1$ is the vertical one. -..param.scoringScheme: -The scoring scheme to use for the alignment. -Note that the user is responsible for ensuring that the scoring scheme is compatible with $algorithmTag$. -...type:Class.Score -..param.lowerDiag:Optional lower diagonal. -...type:nolink:$int$ -..param.upperDiag:Optional upper diagonal. -...type:nolink:$int$ -..returns:An integer with the alignment score, as given by the @Metafunction.Value@ metafunction of the @Class.Score@ type. -..remarks:The Waterman-Eggert algorithm (local alignment with declumping) is available through the @Class.LocalAlignmentEnumerator@ class. -..remarks: -When using @Class.Gaps@ and @Class.Align@ objects, only parts (i.e. one infix) of each sequence will be aligned. -This will be presented to the user by setting the clipping begin and end position of the gaps (the rows in the case of @Class.Align@ objects). -When using @Class.Fragment@ strings, these parts of the sequences will not appear in any fragment. -..remarks: -There exist multiple overloads for this function with two configuration dimensions. -..remarks: -First, you can select the type of the target storing the alignment. -This can be either an @Class.Align@ object, two @Class.Gaps@ objects, or a string of @Class.Fragment@ objects. -@Class.Align@ objects provide an interface to tabular alignments with the restriction of all rows having the same type. -Using two @Class.Gaps@ objects has the advantage that you an align sequences with different types, for example @Shortcut.DnaString@ and @Shortcut.Dna5String@. -Using @Class.Fragment@ strings is useful for collecting many pairwise alignments, for example in the construction of @Spec.Alignment Graph|Alignment Graphs@ for multiple-sequence alignments (MSA). -..remarks: -Second, you can optionally give a band for the alignment using $lowerDiag$ and $upperDiag$. -The center diagonal has index $0$, the $i$th diagonal below has index $-i$, the $i$th above has index $i$. -..remarks: -The examples below show some common use cases. -..example.text:Local alignment of two sequences using an @Class.Align@ object. -..example.code: -Dna5String seqH = "CGATT"; -Dna5String seqV = "CGAAATT"; - -Align align; -resize(rows(align), 2); -assignSource(row(align, 0), seqH); -assignSource(row(align, 0), seqV); -Score scoringScheme(2, -1, -2); - -int result = localAlignment(align, scoringScheme); -..example.text:Local banded alignment of two sequences using two @Class.Gaps@ objects. -..example.code: -Dna5String seqH = "CGATT"; -Gaps gapsH(seqH); -DnaString seqV = "CGAAATT"; -Gaps > gapsV(seqV); - -Score scoringScheme(5, -3, -1, -5); - -int result = localAlignment(gapsH, gapsV, scoringScheme, -2, 2); -..see:Function.globalAlignment -..see:Class.LocalAlignmentEnumerator -..include:seqan/align.h -..wiki:Tutorial/PairwiseSequenceAlignment -..cite:Smith TF, Waterman, MS: Identification of Common Molecular Subsequences. J Mol Biol 1981, 147(1):195-7. -. -*/ - -// ---------------------------------------------------------------------------- -// Function localAlignment() [unbanded, Align] -// ---------------------------------------------------------------------------- - -template -TScoreValue localAlignment(Align & align, - Score const & scoringScheme) -{ - SEQAN_ASSERT_EQ(length(rows(align)), 2u); - typedef Align TAlign; - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - TScoreValue score = _setUpAndRunAlignment(traceSegments, source(row(align, 0)), source(row(align, 1)), - scoringScheme, SmithWaterman()); - _adaptTraceSegmentsTo(row(align, 0), row(align, 1), traceSegments); - return score; -} - -// ---------------------------------------------------------------------------- -// Function localAlignment() [unbanded, Gaps] -// ---------------------------------------------------------------------------- - -template -TScoreValue localAlignment(Gaps & gapsH, - Gaps & gapsV, - Score const & scoringScheme) -{ - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - TScoreValue score = _setUpAndRunAlignment(traceSegments, source(gapsH), source(gapsV), scoringScheme, - SmithWaterman()); - _adaptTraceSegmentsTo(gapsH, gapsV, traceSegments); - return score; -} - -// ---------------------------------------------------------------------------- -// Function localAlignment() [unbanded, Graph>] -// ---------------------------------------------------------------------------- - -// Full interface. - -template -TScoreValue localAlignment(Graph > & alignmentGraph, - Score const & scoringScheme) -{ - typedef Graph > TGraph; - typedef typename Size::Type TSize; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - TScoreValue score = _setUpAndRunAlignment(traceSegments, value(stringSet(alignmentGraph), 0), - value(stringSet(alignmentGraph), 1), scoringScheme, SmithWaterman()); - _adaptTraceSegmentsTo(alignmentGraph, positionToId(stringSet(alignmentGraph), 0), - positionToId(stringSet(alignmentGraph), 1), traceSegments); - return score; -} - -// ---------------------------------------------------------------------------- -// Function localAlignment() [unbanded, String >] -// ---------------------------------------------------------------------------- - -// Full interface. - -template -TScoreValue localAlignment(String, TStringSpec> & fragmentString, - StringSet const & strings, - Score const & scoringScheme) -{ - typedef String, TStringSpec> TFragments; - typedef typename Position::Type TPosition; - typedef TraceSegment_ TTraceSegment; - - String traceSegments; - TScoreValue score = _setUpAndRunAlignment(traceSegments, value(strings, 0), value(strings, 1), scoringScheme, - SmithWaterman()); - _adaptTraceSegmentsTo(fragmentString, positionToId(strings, 0), positionToId(strings, 1), traceSegments); - return score; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_UNBANDED_H_ diff --git a/seqan/align/local_alignment_waterman_eggert_impl.h b/seqan/align/local_alignment_waterman_eggert_impl.h deleted file mode 100644 index 5723c54..0000000 --- a/seqan/align/local_alignment_waterman_eggert_impl.h +++ /dev/null @@ -1,768 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// Author: Anne-Katrin Emde -// ========================================================================== -// Implementation of the Waterman-Eggert algorithm, sometimes also called -// Smith-Waterman algorithm with declumping. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_WATERMAN_EGGERT_IMPL_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_WATERMAN_EGGERT_IMPL_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Helper Class ScoreAndID -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Why is Pair<> not enough? -// TODO(holtgrew): Rename to ScoreAndID_ (with trailing underscore) - -// Simple class that stores a value with an ID. -template -class ScoreAndID -{ -public: - TValue value_; - TID id_; - - ScoreAndID() : value_(MinValue::VALUE), id_(MaxValue::VALUE) - {} - - ScoreAndID(TValue score, TID id_pos) - { - value_ = score; - id_ = id_pos; - } - - inline bool operator>(ScoreAndID const & other) const - { - return value_ > other.value_; - } - - inline bool operator<(ScoreAndID const & other) const - { - return value_ < other.value_; - } -}; - -// ---------------------------------------------------------------------------- -// Class LocalAlignmentFinder -// ---------------------------------------------------------------------------- - -/** -.Class.LocalAlignmentFinder: -..cat:Miscellaneous -..summary:Stores the information necessary for local alignment dynamic programming. -..signature:LocalAlignmentFinder -..param.TScoreValue:The value type that is used for scoring the alignments. -...remarks:Use @Metafunction.Value@ to get the value type for a given class. -..see:Function.localAlignment -.Memfunc.LocalAlignmentFinder#LocalAlignmentFinder -..class:Class.LocalAlignmentFinder -..summary:Constructor -..signature:LocalAlignmentFinder(align) -..param.align:An @Class.Align@ object that is already initialized with the sequences. -..include:seqan/align.h -*/ - -template -class LocalAlignmentFinder -{ -public: - typedef Matrix TMatrix; - typedef typename Position::Type TMatrixPosition; - typedef typename Size::Type TSize; - typedef ScoreAndID TPQEntry; - - typedef Iter TMatrixIterator; - typedef PriorityType TPriorityQ; - typedef String TBoolMatrix; - - //DP-matrix - TMatrix matrix; - //matrix that memorizes the cells from which not to go diagonal - TBoolMatrix forbidden; - //priority queue for quickly finding the maximum score in the DP-matrix - TPriorityQ pQ; - //position of maximum score (where traceback is started from) - TMatrixPosition bestEndPos; - //position where traceback ended and where declumping begins - TMatrixPosition bestBeginPos; - //traceback path that is set to forbidden while declumping - AlignTraceback trace; - - bool needReinit; //true: call "smithWaterman", false: call "smithWatermanGetNext" - - LocalAlignmentFinder() : needReinit(true) - {} - - // TODO(holtgrew): Remove and replace all occurrences with default constructor. - template - LocalAlignmentFinder(TAlign const &) - : needReinit(true) - {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _initLocalAlignmentFinder() -// ---------------------------------------------------------------------------- - -template -void -_initLocalAlignmentFinder(TSequenceH const & seqH, - TSequenceV const & seqV, - LocalAlignmentFinder & finder, - TTag) { - typedef LocalAlignmentFinder TFinder; - typedef typename TFinder::TMatrix TMatrix; - typedef typename Size::Type TSize; - - TSize len0 = length(seqH); - TSize len1 = length(seqV); - - setDimension(finder.matrix, 2); - setLength(finder.matrix, 0, len0 + 1); - setLength(finder.matrix, 1, len1 + 1); - resize(finder.matrix); - - resize(finder.forbidden, (len0 + 1) * (len1 + 1), false); - - finder.bestEndPos = maxValue(); - finder.bestBeginPos = maxValue(); -} - -// ---------------------------------------------------------------------------- -// Function clear() -// ---------------------------------------------------------------------------- - -template -void clear(LocalAlignmentFinder & sw_finder) -{ - sw_finder.needReinit = true; -} - -// ---------------------------------------------------------------------------- -// Function getScore() -// ---------------------------------------------------------------------------- - -template -TScoreValue getScore(LocalAlignmentFinder const & sw) -{ - typedef LocalAlignmentFinder TFinder; - if(sw.bestEndPos != maxValue()) - return getValue(const_cast(sw.matrix), sw.bestEndPos); - return 0; -} - -// ---------------------------------------------------------------------------- -// Function _smithWatermanGetMatrix() -// ---------------------------------------------------------------------------- - -template -TScoreValue -_smithWatermanGetMatrix(LocalAlignmentFinder & sw, - TStringH const & strH, - TStringV const & strV, - Score const & score_, - TScoreValue cutoff) -{ - // typedefs - typedef Matrix TMatrix; - typedef typename Position::Type TMatrixPosition; - typedef Iter TMatrixIterator; - - typedef typename Iterator::Type TStringIteratorH; - //typedef typename Value::Type TValueH; - typedef typename Iterator::Type TStringIteratorV; - typedef typename Value::Type TValueV; - - //------------------------------------------------------------------------- - //define some variables - - -// TSize str1_length = length(strH); -// TSize str2_length = length(strV); - TStringIteratorH x_begin = begin(strH) - 1; - TStringIteratorH x_end = end(strH) - 1; - TStringIteratorV y_begin = begin(strV) - 1; - TStringIteratorV y_end = end(strV) - 1; - - TStringIteratorH x = x_end; - TStringIteratorV y; - - TScoreValue score_match = scoreMatch(score_); - TScoreValue score_mismatch = scoreMismatch(score_); - TScoreValue score_gap = scoreGapExtend(score_); - - TScoreValue h = 0; - TScoreValue v = 0; - - TMatrixIterator col_ = end(sw.matrix) - 1; - TMatrixIterator finger1; - TMatrixIterator finger2; - - //------------------------------------------------------------------------- - // init - - finger1 = col_; - *finger1 = 0; - //std::cout <<" "; - for (x = x_end; x != x_begin; --x) - { - goPrevious(finger1, 0); - *finger1 = 0; - } - - //------------------------------------------------------------------------- - //fill matrix - for (y = y_end; y != y_begin; --y) - { - TValueV cy = *y; - - h = 0; - v = 0; - - finger2 = col_; //points to last column - goPrevious(col_, 1); //points to this column - finger1 = col_; - - *finger1 = v; - - for (x = x_end; x != x_begin; --x) - { - goPrevious(finger1, 0); - goPrevious(finger2, 0); - - if (*x == cy) - { - v = h + score_match; - h = *finger2; - } - else - { - TScoreValue s1 = h + score_mismatch; - h = *finger2; - TScoreValue s2 = score_gap + ((h > v) ? h : v); - v = (s1 > s2) ? s1 : s2; - if (v < 0) v = 0; - - } - *finger1 = v; - if (v >= cutoff) - { - push(sw.pQ,ScoreAndID(v,position(finger1))); - } - } - } - - // check if any scores >= cutoff were found - if(!empty(sw.pQ)) - { - ScoreAndID best = top(sw.pQ); - v = getValue(sw.matrix,best.id_); - sw.bestEndPos = best.id_; - } - else - v=0; - - return v; -} - -// ---------------------------------------------------------------------------- -// Function _smithWatermanDeclump() -// ---------------------------------------------------------------------------- - -// declumping -template -void -_smithWatermanDeclump(LocalAlignmentFinder & sw , - Gaps & gapsH, - Gaps & gapsV, - Score const & score_) -{ -//------------------------------------------------------------------------- -//typedefs - //typedef typename LocalAlignmentFinder::TMatrixPosition TMatrixPosition; - typedef typename LocalAlignmentFinder::TMatrix TMatrix; - typedef Iter TMatrixIterator; - - typedef Gaps TGapsH; - typedef typename Iterator::Type TGapsHIter; - typedef typename Iterator::Type TSequenceHIter; - //typedef typename Value::Type TValueH; - - typedef Gaps TGapsV; - typedef typename Iterator::Type TGapsVIter; - typedef typename Iterator::Type TSequenceVIter; - typedef typename Value::Type TValueV; - -//------------------------------------------------------------------------- -//variables - // TRow row0 = row(align_,0); - // TRow row1 = row(align_,1); - - // beginPosition == # leading gaps - // endPosition == length of clipped region without trailing gaps - // clippedEndPosition == source position of clipping end. - - // TAlignIterator ali_it0_stop = iter(row0,beginPosition(row0)); - // TAlignIterator ali_it1_stop = iter(row1,beginPosition(row1)); - TGapsHIter ali_it0_stop = begin(gapsH); - TGapsVIter ali_it1_stop = begin(gapsV); - - // SEQAN_ASSERT( endPosition(row0)- beginPosition(row0) == endPosition(row1)- beginPosition(row1) ); - - // TAlignIterator ali_it0 = iter(row0,endPosition(row0)); - // TAlignIterator ali_it1 = iter(row1,endPosition(row1)); - TGapsHIter ali_it0 = end(gapsH); - TGapsVIter ali_it1 = end(gapsV); - - // TStringIterator x_begin = begin(source(row0))-1; - // TStringIterator y_begin = begin(source(row1))-1; - // TStringIterator x_end = iter(source(row0),clippedEndPosition(row0))-1; - // TStringIterator y_end = iter(source(row1),clippedEndPosition(row1))-1; - TSequenceHIter x_begin = begin(source(gapsH))-1; - TSequenceVIter y_begin = begin(source(gapsV))-1; - TSequenceHIter x_end = iter(source(gapsH), endPosition(gapsH) - 1); - TSequenceVIter y_end = iter(source(gapsV), endPosition(gapsV) - 1); - - // TStringIterator x = x_end; - // TStringIterator y = y_end; - // TStringIterator x_stop = x_end; - TSequenceHIter x = x_end; - TSequenceVIter y = y_end; - TSequenceHIter x_stop = x_end; - - - TScoreValue score_match = scoreMatch(score_); - TScoreValue score_mismatch = scoreMismatch(score_); - TScoreValue score_gap = scoreGapExtend(score_); - TScoreValue h,v; - - TMatrixIterator finger0 = iter(sw.matrix,sw.bestBeginPos); - TMatrixIterator end_col = finger0; - TMatrixIterator finger1 = finger0; - TMatrixIterator forbidden = finger0; - - bool different = true; - bool forbidden_reached = true; - bool end_reached = false; - bool skip_row = false; - - -/* int str0_length = length(source(row(align_,0)))+1; - int str1_length = length(source(row(align_,1)))+1; - for(int i = 0; i v) ? h : v); - v = (s1 > s2) ? s1 : s2; - if (v < 0) v = 0; - - } - - // value is the same as in the original matrix - if(*finger0==v) - { - //x_stop is as far as we have to go at least - if(x -typename Iterator, Standard >::Type -_smithWatermanTrace(Gaps & gapsH, - Gaps & gapsV, - typename LocalAlignmentFinder::TBoolMatrix & fb_matrix, - Iter< Matrix, PositionIterator > source_, - Score const & scoring_) { - //typedefs - typedef Iter, PositionIterator > TMatrixIterator; - typedef typename Position >::Type TPosition; - -// typedef Segment TTargetSourceSegment; - typedef typename Iterator::Type TSourceIteratorH; - typedef typename Iterator::Type TSourceIteratorV; - - typedef Gaps TGapsH; - typedef Gaps TGapsV; - typedef typename Iterator::Type TTargetIteratorH; - typedef typename Iterator::Type TTargetIteratorV; - - //------------------------------------------------------------------------- - //variables - TPosition pos_0 = coordinate(source_, 0); - TPosition pos_1 = coordinate(source_, 1); - - TSourceH strH = source(gapsH); - TSourceV strV = source(gapsV); - - TTargetIteratorH target_0 = iter(gapsH, pos_0); - TTargetIteratorV target_1 = iter(gapsV, pos_1); - - TSourceIteratorH it_0 = iter(strH, pos_0, Standard()); - TSourceIteratorH it_0_end = end(strH); - - TSourceIteratorV it_1 = iter(strV, pos_1, Standard()); - TSourceIteratorV it_1_end = end(strV); - - TScoreValue score_mismatch = scoreMismatch(scoring_); - TScoreValue score_gap = scoreGapExtend(scoring_); - - //------------------------------------------------------------------------- - //follow the trace until 0 is reached - while ((*source_!=0) && (it_0 != it_0_end) && (it_1 != it_1_end)) - { - bool gv; - bool gh; - bool forbidden = fb_matrix[position(source_)]; - - if (*it_0 == *it_1 && !forbidden) - { - gv = gh = true; - } - else - { - TMatrixIterator it_ = source_; - - goNext(it_, 0); - TScoreValue v = *it_ + score_gap; - - TScoreValue d; - if(forbidden) - d = 0; - else{ - goNext(it_, 1); - d = *it_ + score_mismatch; - } - - it_ = source_; - goNext(it_, 1); - TScoreValue h = *it_ + score_gap; - - gv = (v >= h) | (d >= h); - gh = (h > v) | (d >= v); - } - - if (gv) - { - ++it_0; - goNext(source_, 0); - } - else - { - insertGap(target_0); - } - - if (gh) - { - ++it_1; - goNext(source_, 1); - } - else - { - insertGap(target_1); - } - ++target_0; - ++target_1; - } - - // We have removed all gaps and clippings from gapsH and gapsV in the calling functions, so the following works. - // Note that we have to set the end position first. - // TODO(holtgrew): Use setBegin/EndPosition(). - setClippedEndPosition(gapsH, toViewPosition(gapsH, position(it_0, strH))); - setClippedEndPosition(gapsV, toViewPosition(gapsV, position(it_1, strV))); - setClippedBeginPosition(gapsH, toViewPosition(gapsH, pos_0)); - setClippedBeginPosition(gapsV, toViewPosition(gapsV, pos_1)); - - return source_; -} - -// ---------------------------------------------------------------------------- -// Function _getNextBestEndPosition() -// ---------------------------------------------------------------------------- - -// Adjust the priority queue of scores until the true maximum is found. -template -typename LocalAlignmentFinder::TMatrixPosition -_getNextBestEndPosition(LocalAlignmentFinder & sw , - TScoreValue cutoff) -{ - // get maximal score from priority queue - TScoreValue topScore = 0; - if (!empty(sw.pQ)) - topScore = getValue(sw.matrix, top(sw.pQ).id_); - - // check if matrix entry of topScore did not change while declumping - if (!empty(sw.pQ)) { - while (top(sw.pQ).value_ != topScore) { - if (topScore >= cutoff) { - ((sw.pQ).heap[0]).value_ = topScore; - adjustTop(sw.pQ); - } else { - pop(sw.pQ); - } - if (!empty(sw.pQ)) topScore = getValue(sw.matrix, top(sw.pQ).id_); - else break; - } - } - - // priority queue with top scores is empty - if(empty(sw.pQ)) {//||top(sw.pQ).value_::TMatrixPosition ret_pos = top(sw.pQ).id_; - sw.bestEndPos = ret_pos; - pop(sw.pQ); - - return ret_pos; -} - -// ---------------------------------------------------------------------------- -// Function _smithWaterman() -// ---------------------------------------------------------------------------- - -// Wrapper that computes the matrix and does the backtracking for the best alignment -template -TScoreValue -_smithWaterman(Gaps & gapsH, - Gaps & gapsV, - LocalAlignmentFinder & sw_finder, - Score const & score_, - TScoreValue cutoff) -{ - // TODO(holtgrew): This sourceSegment() stuff is confusing... Do we *really* need this? - // Clear gaps and clipping from result Gaps structures. - clearGaps(gapsH); - clearGaps(gapsV); - clearClipping(gapsH); - clearClipping(gapsV); - - _initLocalAlignmentFinder(sourceSegment(gapsH), sourceSegment(gapsV), sw_finder, WatermanEggert()); - - TScoreValue ret = _smithWatermanGetMatrix(sw_finder, sourceSegment(gapsH), sourceSegment(gapsV), score_,cutoff); - - if(ret==0) - return ret; - sw_finder.needReinit = false; - - typedef Iter::TMatrix,PositionIterator > TMatrixIterator; - TMatrixIterator best_begin; - - // TODO(holtgrew): What does the following comment mean? - // TODO: sw_finder statt kram - best_begin = _smithWatermanTrace(gapsH, gapsV, sw_finder.forbidden,iter(sw_finder.matrix,(top(sw_finder.pQ)).id_), score_); - - sw_finder.bestBeginPos = position(best_begin); - - pop(sw_finder.pQ); - - return ret; -} - -// ---------------------------------------------------------------------------- -// Function _smithWatermanGetNext() -// ---------------------------------------------------------------------------- - -// Wrapper that declumps the matrix and traces back the next best alignment -template -TScoreValue -_smithWatermanGetNext(Gaps & gapsH, - Gaps & gapsV, - LocalAlignmentFinder & sw_finder , - Score const & score_, - TScoreValue cutoff) -{ - _smithWatermanDeclump(sw_finder, gapsH, gapsV, score_); - - clearGaps(gapsH); - clearGaps(gapsV); - clearClipping(gapsH); - clearClipping(gapsV); - - typename LocalAlignmentFinder::TMatrixPosition next_best_end; - next_best_end = _getNextBestEndPosition(sw_finder,cutoff); - if(next_best_end==0) - return 0; - typename LocalAlignmentFinder::TMatrixIterator next_best_begin; - next_best_begin= _smithWatermanTrace(gapsH, gapsV, sw_finder.forbidden,iter(sw_finder.matrix,next_best_end), score_); - sw_finder.bestBeginPos = position(next_best_begin); - - return getValue(sw_finder.matrix,next_best_end); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ALIGN_LOCAL_ALIGNMENT_WATERMAN_EGGERT_IMPL_H_ diff --git a/seqan/align/matrix_base.h b/seqan/align/matrix_base.h deleted file mode 100644 index f1438ea..0000000 --- a/seqan/align/matrix_base.h +++ /dev/null @@ -1,1141 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// Simple matrices; Used in many alignment algorithms. -// ========================================================================== - -#ifndef SEQAN_HEADER_MATRIX_BASE_H -#define SEQAN_HEADER_MATRIX_BASE_H - -namespace SEQAN_NAMESPACE_MAIN -{ - -////////////////////////////////////////////////////////////////////////////// - -struct NDimensional; - - -template -class Matrix; - -////////////////////////////////////////////////////////////////////////////// -template struct SizeArr_; - -template -struct SizeArr_ > -{ - typedef Matrix TMatrix_; - typedef typename Size::Type TSize_; - typedef String Type; -}; - -////////////////////////////////////////////////////////////////////////////// - -template -struct Host > -{ - typedef String Type; -}; - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -// TODO(holtgrew): Add more comprehensive documentation! - -/*! - * @class Matrix - * @headerfile - * @brief A simple n-dimensional matrix type. - * - * @signature template - * class Matrix; - * - * @tparam TValue Type of matrix entries. - * @tparam DIMENSION Dimension of the matrix. Use 0 for n-dimensional, values > 0 for a matrix with - * DIMENSION dimensions. - */ - -/** -.Class.Matrix: -..cat:Miscellaneous -..summary:A simple n-dimensional matrix type. -..signature:Matrix -..param.TValue:Type of matrix entries. -..param.unsigned DIMENSION:The specializing type (0: NDimensional matrix; 2: two dimensional matrix). -..remarks: The following operators and functions are supported: A*B, A*a, A+B,A-B,<<, transpose -..include:seqan/align.h -*/ - - -template -class Matrix -{ -//____________________________________________________________________________ - -public: - typedef typename Size::Type TSize; - typedef String TSizeArr; - typedef String THost; - - TSizeArr data_lengths; //Length of every dimension - TSizeArr data_factors; //used for positions of dimensions in host ("size of jumps" to get to next entry of specified dimension) - - Holder data_host; -//____________________________________________________________________________ - -public: - Matrix() - { - create(data_host); - } - Matrix(Matrix const & other_): - data_lengths(other_.data_lengths), - data_factors(other_.data_factors), - data_host(other_.data_host) - { - } - inline Matrix const & - operator = (Matrix const & other_) - { - data_lengths = other_.data_lengths; - data_factors = other_.data_factors; - data_host = other_.data_host; - - return *this; - } - ~Matrix() - { - } -//____________________________________________________________________________ - - -//____________________________________________________________________________ - - inline TValue & - operator () (TSize x1, TSize x2) - { - return value(*this, x1, x2); - } - inline TValue & - operator () (TSize x1, TSize x2, TSize x3) - { - return value(*this, x1, x2, x3); - } - inline TValue & - operator () (TSize x1, TSize x2, TSize x3, TSize x4) - { - return value(*this, x1, x2, x3, x4); - } - -//____________________________________________________________________________ -}; - - -template -class Matrix -{ -//____________________________________________________________________________ - -public: - typedef typename Size::Type TSize; - typedef String TSizeArr; - typedef String THost; - - TSizeArr data_lengths; - TSizeArr data_factors; - - Holder data_host; - - -//____________________________________________________________________________ - -public: - Matrix() - { - create(data_host); - - //setDimension to 2 - resize(data_lengths, 2, 0); - resize(data_factors, 2, 0); - data_factors[0] = 1; - } - Matrix(Matrix const & other_): - data_lengths(other_.data_lengths), - data_factors(other_.data_factors), - data_host(other_.data_host) - { - } - inline Matrix const & - operator = (Matrix const & other_) - { - data_lengths = other_.data_lengths; - data_factors = other_.data_factors; - data_host = other_.data_host; - - return *this; - } - - ~Matrix() - { - } -//____________________________________________________________________________ - - -//____________________________________________________________________________ - - inline TValue & - operator () (TSize x1, TSize x2) - { - return value(*this, x1, x2); - } - -//____________________________________________________________________________ -}; - -template -class Matrix -{ -//____________________________________________________________________________ - -public: - typedef typename Size::Type TSize; - typedef String TSizeArr; - typedef String THost; - - TSizeArr data_lengths; - TSizeArr data_factors; - - Holder data_host; - - -//____________________________________________________________________________ - -public: - Matrix() - { - create(data_host); - - //setDimension to 3 - resize(data_lengths, 3, 0); - resize(data_factors, 3); - data_factors[0] = 1; - } - Matrix(Matrix const & other_): - data_lengths(other_.data_lengths), - data_factors(other_.data_factors), - data_host(other_.data_host) - { - } - inline Matrix const & - operator = (Matrix const & other_) - { - data_lengths = other_.data_lengths; - data_factors = other_.data_factors; - data_host = other_.data_host; - - return *this; - } - - ~Matrix() - { - } -//____________________________________________________________________________ - - -//____________________________________________________________________________ - - inline TValue & - operator () (TSize x1, TSize x2, TSize x3) - { - return value(*this, x1, x2, x3); - } - -//____________________________________________________________________________ -}; - -template -inline typename SizeArr_ >::Type & -_dataLengths(Matrix & me) -{ - return me.data_lengths; -} - -template -inline typename SizeArr_ >::Type const & -_dataLengths(Matrix const & me) -{ - return me.data_lengths; -} - -template -inline typename SizeArr_ >::Type & -_dataFactors(Matrix & me) -{ - return me.data_factors; -} - -template -inline typename SizeArr_ >::Type const & -_dataFactors(Matrix const & me) -{ - return me.data_factors; -} - -//____________________________________________________________________________ - - -template -inline bool -dependent(Matrix & me) -{ - return dependent(me.data_host); -} - -//____________________________________________________________________________ - -template -inline void -setHost(Matrix & me, THost & host_) -{ - setValue(me.data_host, host_); -} - -//____________________________________________________________________________ - - -template -inline typename Host >::Type & -host(Matrix & me) -{ - return value(me.data_host); -} - -template -inline typename Host >::Type const & -host(Matrix const & me) -{ - return value(me.data_host); -} - -//____________________________________________________________________________ - -template -inline void -assignHost(Matrix & me, THost const & value_) -{ - assignValue(me.data_host, value_); -} - -//____________________________________________________________________________ - -template -inline void -moveHost(Matrix & me, THost const & value_) -{ - moveValue(me.data_host, value_); -} -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -template -struct Value< Matrix > -{ - typedef TValue Type; -}; - -////////////////////////////////////////////////////////////////////////////// - -template -struct Iterator< Matrix, TIteratorSpec > -{ - typedef Iter, PositionIterator> Type; -}; - -template -struct Iterator< Matrix const, TIteratorSpec > -{ - typedef Iter const, PositionIterator> Type; -}; - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -template -inline unsigned int -dimension(Matrix const & me) -{ - return length(_dataLengths(me)); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -setDimension(Matrix & me, - unsigned int dim_) -{ - - SEQAN_ASSERT_GT(dim_, 0u); -//std::cout<<"\npress enter1\n"; -//std::cin.get(); - resize(_dataLengths(me), dim_, 0); - - resize(_dataFactors(me), dim_); - _dataFactors(me)[0] = 1; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline typename Size >::Type -length(Matrix const & me, - unsigned int dim_) -{ - return me.data_lengths[dim_]; -} - -template -inline typename Size >::Type -length(Matrix const & me) -{ - return length(host(me)); -} - -template -inline bool empty(Matrix const & me) -{ - return empty(host(me)); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -setLength(Matrix & me, - unsigned int dim_, - TLength length_) -{ - SEQAN_ASSERT_GT(length_, static_cast(0)); - SEQAN_ASSERT_LT(dim_, dimension(me)); - - typedef typename SizeArr_ >::TSize_ TSize_; - - _dataLengths(me)[dim_] = static_cast(length_); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -resize(Matrix & me) -{ - typedef Matrix TMatrix; - typedef typename Size::Type TSize; - - unsigned int dimension_ = dimension(me); - - SEQAN_ASSERT_GT(dimension_, 0u); - - TSize factor_ = _dataFactors(me)[0] * length(me, 0); - for (unsigned int i = 1; (factor_ > 0) && (i < dimension_); ++i) - { - _dataFactors(me)[i] = factor_; - factor_ *= length(me, i); - } - - if (factor_ > 0) - { - resize(host(me), factor_); - } -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline void -resize(Matrix & me, TFillValue myValue) //resize the matrix and fill with value -{ - typedef Matrix TMatrix; - typedef typename Size::Type TSize; - - unsigned int dimension_ = dimension(me); - - SEQAN_ASSERT_GT(dimension_, 0u); - - TSize factor_ = _dataFactors(me)[0] * length(me, 0); - for (unsigned int i = 1; (factor_ > 0) && (i < dimension_); ++i) - { - _dataFactors(me)[i] = factor_; - factor_ *= length(me, i); - } - - if (factor_ > 0) - resize(host(me), factor_, myValue); -} - - -////////////////////////////////////////////////////////////////////////////// - -template -inline typename Position >::Type -nextPosition(Matrix & me, - TPosition position_, - unsigned int dimension_) -{ - return position_ + _dataFactors(me)[dimension_]; -} - -template -inline typename Position >::Type -nextPosition(Matrix const & me, - TPosition position_, - unsigned int dimension_) -{ - return position_ + _dataFactors(me)[dimension_]; -} - -template -inline typename Position >::Type -previousPosition(Matrix & me, - TPosition position_, - unsigned int dimension_) -{ - return position_ - _dataFactors(me)[dimension_]; -} - -template -inline typename Position >::Type -previousPosition(Matrix const & me, - TPosition position_, - unsigned int dimension_) -{ - return position_ - _dataFactors(me)[dimension_]; -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline typename Size< Matrix >::Type -coordinate(Matrix const & me, - TPosition position_, - unsigned int dimension_) -{ - SEQAN_ASSERT_LT(dimension_, dimension(me)); - - if (dimension_ < dimension(me) - 1) - { - return (position_ / _dataFactors(me)[dimension_]) % _dataFactors(me)[dimension_ + 1]; - } - else - { - return position_ / _dataFactors(me)[dimension_]; - } -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline typename Iterator, Tag const>::Type -begin(Matrix & me, - Tag const) -{ - return typename Iterator, Tag const >::Type(me, 0); -} -template -inline typename Iterator const, Tag const>::Type -begin(Matrix const & me, - Tag const) -{ - return typename Iterator const, Tag const >::Type(me, 0); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline typename Iterator, Tag const >::Type -end(Matrix & me, - Tag const) -{ - return typename Iterator, Tag const >::Type(me, length(host(me))); -} -template -inline typename Iterator const, Tag const >::Type -end(Matrix const & me, - Tag const) -{ - return typename Iterator, Tag const >::Type(me, length(host(me))); -} - -////////////////////////////////////////////////////////////////////////////// - -template -inline typename Reference >::Type -value(Matrix & me, - TPosition position_) -{ - return value(host(me), position_); -} - -template -inline typename Reference const>::Type -value(Matrix const & me, - TPosition position_) -{ - return value(host(me), position_); -} - -//____________________________________________________________________________ - -//two dimensional value access -template -inline typename Reference >::Type -value(Matrix & me, - TOrdinate1 i1, - TOrdinate2 i2) -{ - return value(host(me), i1 + i2 * _dataFactors(me)[1]); -} - -template -inline typename Reference const>::Type -value(Matrix const & me, - TOrdinate1 i1, - TOrdinate2 i2) -{ - return value(host(me), i1 + i2 * _dataFactors(me)[1]); -} - -//____________________________________________________________________________ - -//3 dimensional value access - -template -inline typename Reference >::Type -value(Matrix & me, - TOrdinate1 i1, - TOrdinate2 i2, - TOrdinate3 i3) -{ - return value(host(me), i1 + i2 * _dataFactors(me)[1] + i3 * _dataFactors(me)[2]); -} - -//____________________________________________________________________________ - -//4 dimensional value access - -template -inline typename Reference >::Type -value(Matrix & me, - TOrdinate1 i1, - TOrdinate2 i2, - TOrdinate3 i3, - TOrdinate4 i4) -{ - return value(host(me), i1 + i2 * _dataFactors(me)[1] + i3 * _dataFactors(me)[2] + i4 * _dataFactors(me)[3]); -} - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -// Iterator: goNext -////////////////////////////////////////////////////////////////////////////// - -template -inline void -goNext(Iter, PositionIterator> & me, - unsigned int dimension_) -{ - setPosition(me, nextPosition(container(me), position(me), dimension_)); -} - -template -inline void -goNext(Iter const, PositionIterator> & me, - unsigned int dimension_) -{ - setPosition(me, nextPosition(container(me), position(me), dimension_)); -} - -template -inline void -goNext(Iter, PositionIterator> & me) -{ - goNext(me, 0); -} - -template -inline void -goNext(Iter const, PositionIterator> & me) -{ - goNext(me, 0); -} - -////////////////////////////////////////////////////////////////////////////// -// Iterator: goPrevious -////////////////////////////////////////////////////////////////////////////// - -template -inline void -goPrevious(Iter< Matrix, PositionIterator > & me, - unsigned int dimension_) -{ - setPosition(me, previousPosition(container(me), position(me), dimension_)); -} - -template -inline void -goPrevious(Iter< Matrix const, PositionIterator > & me, - unsigned int dimension_) -{ - setPosition(me, previousPosition(container(me), position(me), dimension_)); -} - -template -inline void -goPrevious(Iter< Matrix, PositionIterator > & me) -{ - goPrevious(me, 0); -} - -template -inline void -goPrevious(Iter< Matrix const, PositionIterator > & me) -{ - goPrevious(me, 0); -} - -////////////////////////////////////////////////////////////////////////////// -// goTo -////////////////////////////////////////////////////////////////////////////// - -template -inline void -goTo(Iter, PositionIterator> & me, TPosition0 pos0, TPosition1 pos1) -{ - setPosition(me, pos0 + pos1 * _dataFactors(container(me))[1]); -} - - -template -inline void -goTo(Iter const, PositionIterator> & me, TPosition0 pos0, TPosition1 pos1) -{ - setPosition(me, pos0 + pos1 * _dataFactors(container(me))[1]); -} - - -template -inline void -goTo(Iter, PositionIterator> & me, TPosition0 pos0, TPosition1 pos1, TPosition2 pos2) -{ - setPosition(me, pos0 + pos1 * _dataFactors(container(me))[1] + pos2 * _dataFactors(container(me))[2]); -} - - -template -inline void -goTo(Iter const, PositionIterator> & me, TPosition0 pos0, TPosition1 pos1, TPosition2 pos2) -{ - setPosition(me, pos0 + pos1 * _dataFactors(container(me))[1] + pos2 * _dataFactors(container(me))[2]); -} - -////////////////////////////////////////////////////////////////////////////// -// Iterator: coordinate - -template -inline typename Size< Matrix >::Type -coordinate(Iter, PositionIterator > & me, - unsigned int dimension_) -{ - return coordinate(container(me), position(me), dimension_); -} - -template -inline typename Size< Matrix >::Type -coordinate(Iter const, PositionIterator > & me, - unsigned int dimension_) -{ - return coordinate(container(me), position(me), dimension_); -} - -/* -operator + -Computes the matricial sum between two matrices -..signature:Matrix +(matrix1,matrix2) -..param.matrix1:The first matrix. -...type:Class.Matrix -..param.matrix2:The second matrix. -...type:Class.Matrix -..returns:The sum of the two matrices (another nxm matrix). -..remarks:The number of rows and columns of matrix1 must be equal to the number of rows and columns of matrix2 (length of dimensions for NDimensional matrices) -*/ - -template -Matrix -operator + (Matrix const & matrix1,Matrix const & matrix2) -{ - //the two matrices must have same dimension - SEQAN_ASSERT(_dataLengths(matrix1) == _dataLengths(matrix2)); - - Matrix result; - //copy the first matrix - setDimension(result,length(_dataLengths(matrix1))); - _dataLengths(result) = _dataLengths(matrix1); - resize(result); - - //add the matrices - for(unsigned int i = 0;i< length(host(result));++i) - { - value(host(result), i)=value(host(matrix1), i)+value(host(matrix2), i); - } - //Return matrix sum - return result; -} - -template -Matrix -operator - (Matrix const & matrix1,Matrix const & matrix2) -{ - //the two matrices must have same dimension - SEQAN_ASSERT(_dataLengths(matrix1) == _dataLengths(matrix2)); - - Matrix result; - //resize the matrix - setDimension(result,length(_dataLengths(matrix1))); - _dataLengths(result) = _dataLengths(matrix1); - resize(result); - - //subtract the matrices - for(unsigned int i = 0;i< length(host(result));++i) - { - value(host(result), i)=value(host(matrix1), i)-value(host(matrix2), i); - } - //Return matrix difference - return result; -} - -template -Matrix -operator * (Matrix const & matrix1, Matrix const & matrix2) -{ - SEQAN_ASSERT_EQ(length(matrix1,1), length(matrix2,0)); - - unsigned int nrow1=length(matrix1,0); - unsigned int ncol2=length(matrix2,1); - Matrix result; - //resize the matrix - setLength(result, 0, nrow1); - setLength(result, 1, ncol2); - resize(result,(TValue) 0); - - //Matrix product - for(unsigned int row = 0; row < nrow1; row++) - { - for(unsigned int col = 0; col < ncol2; col++) - { - for(unsigned int colRes = 0; colRes < length(matrix1,1); colRes++) - { - value(result,row,col)+= value(host(matrix1), row + colRes * matrix1.data_factors[1])*value(host(matrix2), colRes + col * matrix2.data_factors[1]); - } - } - } - //return the matrix product - return result; -} - - -template -Matrix -operator * (TValue const & scalar, Matrix const & matrix) -{ - Matrix result; - result= matrix; - //scalar multiplication - for(unsigned int i = 0;i< length(host(result));++i) - { - value(host(result), i)*=scalar; - } - //return the matrix product - return result; -} - -template -Matrix -operator * (Matrix const & matrix, TValue const & scalar) -{ - Matrix result; - result= matrix; - //scalar multiplication - for(unsigned int i = 0;i< length(host(result));++i) - { - value(host(result), i)*=scalar; - } - //return the matrix product - return result; -} - - -template -bool -operator == (Matrix const & matrix1, Matrix const & matrix2) -{ - bool result; - result= (matrix1.data_lengths==matrix2.data_lengths)&&(matrix1.data_factors==matrix2.data_factors)&&(value(matrix1.data_host)==value(matrix2.data_host))&&(DIMENSION1==DIMENSION2); - return result; -} -/* -.Function.matricialSum: -..summary:Computes the matricial sum between two nxm matrixes -..signature:matricialSum(matrix1,matrix2) -..param.matrix1:The first matrix. -...type:Matrix& -..param.matrix2:The second matrix. -...type:Matrix& -..returns:The sum of the two matrices (another nxm matrix). -..remarks:The number of rows and columns of matrix1 must be equal to the number of rows and columns of matrix2. -..include:seqan/align.h -*/ -/* -template -Matrix -matricialSum(Matrix &matrix1,Matrix &matrix2) -{ - //the two matrices must have same dimension - if(length(matrix1,0) != length(matrix2,0)||length(matrix1,1) != length(matrix2,1)) - { - fprintf(stderr,"Error: The two matrices have different dimensions"); - } - - - unsigned int nrow=length(matrix1,0); - unsigned int ncol=length(matrix1,1); - - Matrix result; - //resize the matrix - setLength(result, 0, nrow); - setLength(result, 1, ncol); - resize(result); - - //add the matrices - for(unsigned int i = 0;i< nrow*ncol;++i) - { - value(host(result), i)=value(host(matrix1), i)+value(host(matrix2), i); - } - //Return matrix difference - return result; - -} -*/ -////////////////////////////////////////////////////////////////////////////// -// _matricialDifference -////////////////////////////////////////////////////////////////////////////// - -/* -.Function.matricialDifference: -..summary:Computes the matricial difference between two matrixes -..signature:matricialDifference(matrix1,matrix2) -..param.matrix1:The first matrix. -...type:Matrix& -..param.matrix2:The second matrix. -...type:Matrix& -..returns:The difference of the two matrices (another matrix). -..remarks:The number of rows and columns of matrix1 must be equal to the number of rows and columns of matrix2. -..include:seqan/align.h -*/ -/* -template -inline Matrix -matricialDifference(Matrix & matrix1, Matrix & matrix2) -{ - //the two matrices must have same dimension - if(length(matrix1,0) != length(matrix2,0)||length(matrix1,1) != length(matrix2,1)) - { - fprintf(stderr,"Error: The two matrices have different dimensions"); - } - - unsigned int nrow=length(matrix1,0); - unsigned int ncol=length(matrix1,1); - - Matrix result; - //resize the matrix - //setDimension(result, 2); - setLength(result, 0, nrow); - setLength(result, 1, ncol); - resize(result); - - //Substract the matrices - for(unsigned int i1 = 0;i1< nrow;++i1) - { - for(unsigned int i2 = 0;i2& -..param.matrix2:The second matrix (nxp). -...type:Matrix& -..returns:The products of the two matrices (another matrix, mxp). -..remarks:The number of columns of matrix1 (left matrix) must be equal to the number of rows of matrix2(right matrix). -..include:seqan/align.h -*/ -/* -template -inline Matrix -matricialProduct(Matrix &matrix1, - Matrix &matrix2) -{ - //SEQAN_ASSERT_LT(dimension_, dimension(me)); - if(length(matrix1,1) != length(matrix2,0)) - { - fprintf(stderr,"Error: Number of columns of matrix1 is unequal to number of rows of matrix2"); - } - - unsigned int nrow1=length(matrix1,0); - unsigned int ncol2=length(matrix2,1); - Matrix result; - //resize the matrix - setLength(result, 0, nrow1); - setLength(result, 1, ncol2); - resize(result,(TValue) 0); - - //Matrix product - for(unsigned int row = 0; row < nrow1; row++) - { - for(unsigned int col = 0; col < ncol2; col++) - { - for(unsigned int colRes = 0; colRes < length(matrix1,1); colRes++) - { - value(result,row,col)+=value(matrix1, row,colRes)*value(matrix2,colRes,col); - } - } - } - //return the matrix product - return result; -} -*/ -// TODO(holtgrew): Should work as the graph-transpose. -/** -.Function.Matrix#transpose -..summary:Transposes matrix -..class:Class.Matrix -..signature:Matrix transpose(matrix) -..param.matrix:The matrix (mxn) to transpose. -...type:Class.Matrix -...remarks: must be of type Matrix (two dimensional) -..returns:Transposed matrix -..remarks:Only works on two dimensional matrices -..include:seqan/align.h -*/ -template -Matrix -transpose(Matrix const & matrix) -{ - - unsigned int nrow=length(matrix,0); - unsigned int ncol=length(matrix,1); - - Matrix result; - //resize the matrix - setLength(result, 0, ncol); - setLength(result, 1, nrow); - resize(result); - - - for(unsigned int i1 = 0;i1< nrow;++i1) - { - for(unsigned int i2 = 0;i2 -::std::ostream& operator<<(::std::ostream &out, const Matrix &matrix) -{ - for(unsigned int i1 = 0;i1< matrix.data_lengths[0];++i1) - { - for(unsigned int i2 = 0;i2<(matrix.data_lengths[1]-1);++i2) - { - out< -// void read(FILE *file, Matrix & matrix) -// { -// //unsigned int column_size=3; -// unsigned int column_size=pow(4,5); -// //read the transition matrix -// setLength(matrix, 0, column_size); -// setLength(matrix, 1, column_size); -// resize(matrix,0.0); -// for(unsigned int row=0; row -// ========================================================================== -// Facade header for module arg_parse. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_H_ - -// =========================================================================== -// Prerequisites. -// =========================================================================== - -#include -#include -#include - -// =========================================================================== -// The ArgParse Headers. -// =========================================================================== - -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include - - -#endif // SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_H_ diff --git a/seqan/arg_parse/INFO b/seqan/arg_parse/INFO deleted file mode 100644 index 2d19c8a..0000000 --- a/seqan/arg_parse/INFO +++ /dev/null @@ -1,10 +0,0 @@ -Name: arg_parse -Author: Stephan Aiche -Maintainer: Stephan Aiche -License: BSD 3-clause -Copyright: 2006-2013, FU Berlin -Status: under development -Description: Command Line Parsing functionality. - The module arg_parse provides an argument/command line parser for SeqAn apps - including functionality to document tools and export the documentation/command - line information to different formats like man, html, or CTD. diff --git a/seqan/arg_parse/arg_parse_argument.h b/seqan/arg_parse/arg_parse_argument.h deleted file mode 100644 index 498d2b9..0000000 --- a/seqan/arg_parse/arg_parse_argument.h +++ /dev/null @@ -1,1402 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Stephan Aiche -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_ARGUMENT_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_ARGUMENT_H_ - -#include -#include - -#include -#include - -#include - -namespace seqan { - -// ========================================================================== -// Forwards -// ========================================================================== - -// Required for _checkStringRestrictions(). -inline std::string getFileExtension(ArgParseArgument const & me, unsigned pos); - -// ========================================================================== -// Tags, Classes, Enums -// ========================================================================== - -// ---------------------------------------------------------------------------- -// Class ArgParseArgument -// ---------------------------------------------------------------------------- - -/*! - * @class ArgParseArgument - * @extends AssignableConcept - * @headerfile - * @brief Information for a specific command line argument. - * - * @signature class ArgParseArgument - */ - -/*! - * @enum ArgParseArgument::ArgumentType - * @headerfile - * @brief Define the type of an @link ArgParseArgument @endlink. - * - * @signature enum ArgParseArgument::ArgumentType; - */ - -/*! - * @var ArgParseArgument::ArgumentType ArgParseArgument::STRING - * @brief Argument is a string. - * - * @var ArgParseArgument::ArgumentType ArgParseArgument::INTEGER - * @brief Argument is a signed 32 bit integer. - * - * @var ArgParseArgument::ArgumentType ArgParseArgument::INT64 - * @brief Argument is a signed 64 bit integer. - * - * @var ArgParseArgument::ArgumentType ArgParseArgument::DOUBLE - * @brief Argument is a floating point number stored as double. - * - * @var ArgParseArgument::ArgumentType ArgParseArgument::INPUTFILE - * @brief Argument is an input file. - * - * @var ArgParseArgument::ArgumentType ArgParseArgument::OUTPUTFILE - * @brief Argument is an output file. - */ - -/** -.Class.ArgParseArgument -..cat:Miscellaneous -..summary:Stores information for a specific command line argument. It can be either an argument of -a ArgParseArgument or directly an Argument on the command line. -..signature:ArgParseArgument -..include:seqan/arg_parse.h -..see:Class.ArgParseOption -..see:Class.ArgumentParser -*/ - -/*! - * @fn ArgParseArgument::ArgParseArgument - * @brief Constructor - * - * @signature ArgParseArgument::ArgParseArgument(argumentType[, argumentLabel[, isListArgument[, numberOfArgument]]]); - * - * @param argumentType Type of the argument (ArgParseArgument::ArgumentType). - * @param argumentLabel Label for the argument (char const *). - * @param isListArgument Whether or not this argument can be given multiple times (bool). - * @param numberOfArguments Number of times the argument must be given. E.g. set to 2 for the parser to always - * expect two values (int, default is 1). - */ - -/** -.Memfunc.ArgParseArgument#ArgParseArgument -..class:Class.ArgParseArgument -..summary:Constructor -..signature:ArgParseArgument (argumentType [, argumentLabel, isListArgument, numberOfArguments]) -..param.argumentType:A ArgParseArgument.ArgumentType value defining the type (e.g., String) of the -ArgParseArgument. -...tableheader:Flag|Description -...table:$ArgParseArgument::STRING$|Argument is a string -...table:$ArgParseArgument::INTEGER$|Argument is an integer -...table:$ArgParseArgument::INT64|Argument is a 64 bit integer -...table:$ArgParseArgument::DOUBLE$|A float -...table:$ArgParseArgument::INPUTFILE$|An input file -...table:$ArgParseArgument::OUTPUTFILE$|An output file - ..param.argumentLabel:Defines a user defined argument label for the help output. If this option is - not set, ArgParseArgument will automatically define a label based on the ArgumentType. -..param.isListArgument:Defines if the argument can be given multiple times. -...default:false. -..param.numberOfArguments: Defines if the argument consists of defined number of elements (e.g., if -you want to provide an interval you would set this option to 2, so the parser knows that he needs -to search for exactly 2 values). -...default:1. -*/ - -class ArgParseArgument -{ -public: - enum ArgumentType - { - // argument is - STRING, // .. a string - INTEGER, // .. an integer - INT64, // .. a 64 bit integer - DOUBLE, // .. a float - INPUTFILE, // .. an inputfile (implicitly also a string) - OUTPUTFILE, // .. an outputfile (implicitly also a string) - INPUTPREFIX, // .. an inputprefix (implicitly also a string) - OUTPUTPREFIX // .. an outoutprefix (implicitly also a string) - }; - - - // ---------------------------------------------------------------------------- - // Members to store type information - // ---------------------------------------------------------------------------- - ArgumentType _argumentType; - unsigned _numberOfValues; - std::string _argumentLabel; - bool _isListArgument; - - // ---------------------------------------------------------------------------- - // Members to store the values - // ---------------------------------------------------------------------------- - std::vector defaultValue; - std::vector value; - // Override for the file extension; only used for input/output file arguments. - std::vector _fileExtensions; - - // ---------------------------------------------------------------------------- - // Members for restrictions - // ---------------------------------------------------------------------------- - std::string minValue; - std::string maxValue; - std::vector validValues; - - // ---------------------------------------------------------------------------- - // Tags - // ---------------------------------------------------------------------------- - // Tags can be used to attach hints to the arguments (and options). Currently, - // this is used for tagging the "-file-ext" arguments as "file-ext-override" - // and "gkn-ignore" for ignoring in GKN. - std::vector tags; - - // ---------------------------------------------------------------------------- - // Members to help text - // ---------------------------------------------------------------------------- - std::string _helpText; // The help text shown on the command line - - // ---------------------------------------------------------------------------- - // Constructors - // ---------------------------------------------------------------------------- - - ArgParseArgument(ArgumentType argumentType, - std::string const & argumentLabel = "", - bool isListArgument = false, - unsigned numberOfValues = 1) : - _argumentType(argumentType), - _numberOfValues(numberOfValues), - _argumentLabel(argumentLabel), - _isListArgument(isListArgument), - minValue(""), - maxValue(""), - _helpText("") - {} -}; - -// ========================================================================== -// Metafunctions -// ========================================================================== - -// ========================================================================== -// Functions -// ========================================================================== - -// ---------------------------------------------------------------------------- -// Helper Function _typeToString() -// ---------------------------------------------------------------------------- - -inline std::string _typeToString(ArgParseArgument const & me) -{ - std::string typeName = ""; - - switch (me._argumentType) - { - case ArgParseArgument::DOUBLE: - typeName = "double"; - break; - - case ArgParseArgument::INTEGER: - typeName = "integer"; - break; - - case ArgParseArgument::INT64: - typeName = "int64"; - break; - - case ArgParseArgument::STRING: - typeName = "string"; - break; - - case ArgParseArgument::INPUTFILE: - typeName = "inputfile"; - break; - - case ArgParseArgument::OUTPUTFILE: - typeName = "outputfile"; - break; - - case ArgParseArgument::INPUTPREFIX: - typeName = "inputprefix"; - break; - - case ArgParseArgument::OUTPUTPREFIX: - typeName = "outputprefix"; - break; - - default: - typeName = "unknown"; - break; - } - - return typeName; -} - -// ---------------------------------------------------------------------------- -// Function isListArgument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#isListArgument - * @headerfile - * - * @brief Returns whether the argument can be given more than one time. - * - * @signature bool isListArgument(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return bool true if it can be given multiple times, false otherwise. - */ - -/** -.Function.isListArgument -..class:Class.ArgParseArgument -..summary:Returns whether the argument can be given multiple times. -..cat:Miscellaneous -..signature:isListArgument(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:$true$ if the argument argument can be given multiple times. -..see:Memfunc.ArgParseArgument#ArgParseArgument.param.isListArgument -..include:seqan/arg_parse.h -*/ - -inline bool isListArgument(ArgParseArgument const & me) -{ - return me._isListArgument; -} - -// ---------------------------------------------------------------------------- -// Function isStringArgument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#isStringArgument - * @headerfile - * - * @brief Returns whether the argument is a string. - * - * @signature bool ArgParseArgument#isStringArgument(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return bool true if it is a string, false otherwise. - */ - -/** -.Function.isStringArgument -..class:Class.ArgParseArgument -..summary:Returns whether the argument is a string. -..cat:Miscellaneous -..signature:isListArgument(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:$true$ if the argument argument is a string argument. -..see:Memfunc.ArgParseArgument#ArgParseArgument.param.argumentType -..include:seqan/arg_parse.h -*/ - -inline bool isStringArgument(ArgParseArgument const & me) -{ - return (me._argumentType == ArgParseArgument::STRING) || - (me._argumentType == ArgParseArgument::INPUTFILE) || - (me._argumentType == ArgParseArgument::OUTPUTFILE) || - (me._argumentType == ArgParseArgument::INPUTPREFIX) || - (me._argumentType == ArgParseArgument::OUTPUTPREFIX) ; -} - -// ---------------------------------------------------------------------------- -// Function isIntegerArgument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#isIntegerArgument - * @headerfile - * @brief Returns whether the argument is an integer. - * - * @signature bool isIntegerArgument(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return bool true if it is an integer, false otherwise. - */ - -/** -.Function.isIntegerArgument -..class:Class.ArgParseArgument -..summary:Returns whether the argument is an integer. -..cat:Miscellaneous -..signature:isIntegerArgument(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:$true$ if the argument argument is an integer argument. -..see:Memfunc.ArgParseArgument#ArgParseArgument.param.argumentType -..include:seqan/arg_parse.h -*/ - -inline bool isIntegerArgument(ArgParseArgument const & me) -{ - return me._argumentType == ArgParseArgument::INTEGER; -} - -// ---------------------------------------------------------------------------- -// Function isInt64Argument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#isInt64Argument - * @headerfile - * @brief Returns whether the argument is a 64 bit integer. - * - * @signature bool isInt64Argument(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return bool true if it is a 64 bit integer, false otherwise. - */ - -/** -.Function.isInt64Argument -..class:Class.ArgParseArgument -..summary:Returns whether the argument is a 64 bit integer. -..cat:Miscellaneous -..signature:isInt64Argument(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:$true$ if the argument argument is a 64 bit integer argument. -..see:Memfunc.ArgParseArgument#ArgParseArgument.param.argumentType -..include:seqan/arg_parse.h -*/ - -inline bool isInt64Argument(ArgParseArgument const & me) -{ - return me._argumentType == ArgParseArgument::INT64; -} - -// ---------------------------------------------------------------------------- -// Function isDoubleArgument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#isDoubleArgument - * @headerfile - * @brief Returns whether the argument is a double integer. - * - * @signature bool isDoubleArgument(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return bool true if it is a double argument, false otherwise. - */ - -/** -.Function.isDoubleArgument -..class:Class.ArgParseArgument -..summary:Returns whether the argument is a double. -..cat:Miscellaneous -..signature:isDoubleArgument(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:$true$ if the argument argument is a double argument. -..see:Memfunc.ArgParseArgument#ArgParseArgument.param.argumentType -..include:seqan/arg_parse.h -*/ - -inline bool isDoubleArgument(ArgParseArgument const & me) -{ - return me._argumentType == ArgParseArgument::DOUBLE; -} - -// ---------------------------------------------------------------------------- -// Function isInputFileArgument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#isInputFileArgument - * @headerfile - * @brief Returns whether the argument is a input file. - * - * @signature bool isInputFileArgument(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return bool true if it is a input file argument, false otherwise. - */ - -/** -.Function.isInputFileArgument -..class:Class.ArgParseArgument -..summary:Returns whether the argument is an input file. -..cat:Miscellaneous -..signature:isOutputFileArgument(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:$true$ if the argument argument is an input file argument. -..see:Memfunc.ArgParseArgument#ArgParseArgument.param.argumentType -..include:seqan/arg_parse.h -*/ - -inline bool isInputFileArgument(ArgParseArgument const & me) -{ - return me._argumentType == ArgParseArgument::INPUTFILE; -} - -// ---------------------------------------------------------------------------- -// Function isOutputFileArgument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#isOutputFileArgument - * @headerfile - * @brief Returns whether the argument is a output file. - * - * @signature bool isOutputFileArgument(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return bool true if it is a output file argument, false otherwise. - */ - -/** -.Function.isOutputFileArgument -..class:Class.ArgParseArgument -..summary:Returns whether the argument is an output file. -..cat:Miscellaneous -..signature:isOutputFileArgument(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -...type:Class.ArgParseOption -..returns:$true$ if the argument argument is an output file argument. -..see:Memfunc.ArgParseArgument#ArgParseArgument.param.argumentType -..include:seqan/arg_parse.h -*/ - -inline bool isOutputFileArgument(ArgParseArgument const & me) -{ - return me._argumentType == ArgParseArgument::OUTPUTFILE; -} - -// ---------------------------------------------------------------------------- -// Function isOutputPrefixArgument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#isOutputPrefixArgument - * @headerfile - * @brief Returns whether the argument is an output prefix. - * - * @signature bool isOutputPrefixArgument(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return bool true if it is an output prefix argument, false otherwise. - */ - -/** - .Function.isOutputPrefixArgument - ..class:Class.ArgParseArgument - ..summary:Returns whether the argument is an output file. - ..cat:Miscellaneous - ..signature:isOutputPrefixArgument(argument) - ..param.argument:The @Class.ArgParseArgument@ object. - ...type:Class.ArgParseArgument - ...type:Class.ArgParseOption - ..returns:$true$ if the argument argument is an output file argument. - ..see:Memfunc.ArgParseArgument#ArgParseArgument.param.argumentType - ..include:seqan/arg_parse.h - */ - -inline bool isOutputPrefixArgument(ArgParseArgument const & me) -{ - return me._argumentType == ArgParseArgument::OUTPUTPREFIX; -} - -// ---------------------------------------------------------------------------- -// Function isOutputFileArgument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#isInputPrefixArgument - * @headerfile - * @brief Returns whether the argument is an input prefix argument. - * - * @signature bool isInputPrefixArgument(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return bool true if it is an input prefix argument, false otherwise. - */ - -/** - .Function.isInputPrefixArgument - ..class:Class.ArgParseArgument - ..summary:Returns whether the argument is an output file. - ..cat:Miscellaneous - ..signature:isInputPrefixArgument(argument) - ..param.argument:The @Class.ArgParseArgument@ object. - ...type:Class.ArgParseArgument - ...type:Class.ArgParseOption - ..returns:$true$ if the argument argument is an input prefix argument. - ..see:Memfunc.ArgParseArgument#ArgParseArgument.param.argumentType - ..include:seqan/arg_parse.h - */ - -inline bool isInputPrefixArgument(ArgParseArgument const & me) -{ - return me._argumentType == ArgParseArgument::INPUTPREFIX; -} - -// ---------------------------------------------------------------------------- -// Function getArgumentLabel() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#getArgumentLabel - * @headerfile - * @brief Return argument label. - * - * @signature std::string getArgumentLabel(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return std::string The argument label as a STL string. - */ - -/** -.Function.getArgumentLabel -..class:Class.ArgParseArgument -..summary:Returns the label for the given @Class.ArgParseArgument@. Either the user defined label -is returned or a default label (based on the ArgumentType is used). -..cat:Miscellaneous -..signature:getArgumentLabel(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:A $ShortCut.std::string$ containing the label. -..include:seqan/arg_parse.h -*/ - -inline std::string const getArgumentLabel(ArgParseArgument const & me) -{ - if (me._argumentLabel != "") - { - return me._argumentLabel; - } - else - { - // infer from argument type - std::string baseLabel = ""; - if (isInputFileArgument(me) || isOutputFileArgument(me)) - baseLabel = "FILE"; - else if (isInputPrefixArgument(me) || isOutputPrefixArgument(me)) - baseLabel = "PREFIX"; - else if (isStringArgument(me)) - baseLabel = "STR"; - else if (isIntegerArgument(me) || isDoubleArgument(me)) - baseLabel = "NUM"; - - std::string finalLabel; - - if (me._numberOfValues != 1) - { - for (unsigned i = 0; i < me._numberOfValues; ++i) - { - if (i != 0) - append(finalLabel, " "); - append(finalLabel, baseLabel); - } - } - else if (isListArgument(me)) - finalLabel = baseLabel; // maybe we want to customize list labels - else - finalLabel = baseLabel; - - return finalLabel; - } -} - -// ---------------------------------------------------------------------------- -// Helper Function _intervalAssert() -// ---------------------------------------------------------------------------- - -// this methods ensures that the given arguments define a non emtpy value interval -// otherwise it will trigger a SEQAN_CHECK failure -template -inline void _intervalAssert(const std::string minValueAsString, const std::string maxValueAsString) -{ - if (minValueAsString != "" && maxValueAsString != "") - SEQAN_CHECK(_cast(minValueAsString) < _cast(maxValueAsString), - "The interval [%s:%s] is empty. Please specify a valid, non-empty interval.", - minValueAsString.c_str(), - maxValueAsString.c_str()); -} - -// ---------------------------------------------------------------------------- -// Function setMinValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#setMinValue - * @headerfile - * @brief Set smallest allowed value for the argument. - * - * @signature void setMinValue(arg, minValue); - * - * @param arg The ArgParseArgument to set the smallest value of. - * @param minValue The smallest value to set (std::string). - * - * @return std::string The argument label as a STL string. - */ - -/** -.Function.setMinValue -..class:Class.ArgParseArgument -..summary:Sets the minimum value of a @Class.ArgParseArgument@ object. -..cat:Miscellaneous -..signature:setMinValue(argument,minValue) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..param.minValue:A std::string containing a string representation of the minimum value -of the @Class.ArgParseArgument@. -..include:seqan/arg_parse.h -*/ - -inline void setMinValue(ArgParseArgument & me, const std::string minValue) -{ - if (isDoubleArgument(me)) - { - SEQAN_CHECK(_isCastable(minValue), "The maximal value for a double argument must be double."); - _intervalAssert(minValue, me.maxValue); - me.minValue = minValue; - } - else if (isIntegerArgument(me)) - { - SEQAN_CHECK(_isCastable(minValue), "The maximal value for an integer argument must be an integer"); - _intervalAssert(minValue, me.maxValue); - me.minValue = minValue; - } - else if (isInt64Argument(me)) - { - SEQAN_CHECK(_isCastable<__int64>(minValue), "The maximal value for a 64 integer argument must be a 64 bit integer"); - _intervalAssert<__int64>(minValue, me.maxValue); - me.minValue = minValue; - } - else - SEQAN_FAIL("min/max values are not applicable to non numeric arguments"); -} - -// ---------------------------------------------------------------------------- -// Function setMaxValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#setMaxValue - * @headerfile - * @brief Set smallest allowed value for the argument. - * - * @signature void setMaxValue(arg, maxValue); - * - * @param arg The ArgParseArgument to set the smallest value of. - * @param maxValue The largest value to set (std::string). - * - * @return std::string The argument label as a STL string. - */ - -/** -.Function.setMaxValue -..class:Class.ArgParseArgument -..summary:Sets the maximum value of a @Class.ArgParseArgument@ object. -..cat:Miscellaneous -..signature:setMaxValue(argument,maxValue) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..param.maxValue:A std::string containing a string representation of the maximum value -of the @Class.ArgParseArgument@. -..include:seqan/arg_parse.h -*/ - -inline void setMaxValue(ArgParseArgument & me, const std::string maxValue) -{ - if (isDoubleArgument(me)) - { - SEQAN_CHECK(_isCastable(maxValue), "The maximal value for a double argument must be double."); - _intervalAssert(me.minValue, maxValue); - me.maxValue = maxValue; - } - else if (isIntegerArgument(me)) - { - SEQAN_CHECK(_isCastable(maxValue), "The maximal value for an integer argument must be an integer"); - _intervalAssert(me.minValue, maxValue); - me.maxValue = maxValue; - } - else if (isInt64Argument(me)) - { - SEQAN_CHECK(_isCastable(maxValue), "The maximal value for a 64 bit integer argument must be an 64 bit integer"); - _intervalAssert(me.minValue, maxValue); - me.maxValue = maxValue; - } - else - SEQAN_FAIL("min/max values are not applicable to non numeric arguments"); -} - -// ---------------------------------------------------------------------------- -// Function setValidValues() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#setValidValues - * @headerfile - * @brief Set list of valid values. - * - * @signature void setValidValues(arg, values); - * - * @param arg The ArgParseArgument to set the valid values for. - * @param values Either a std::string containing all valid entries, separated by spaces or a - * std::vector<std::string> with the valid entries. - * - * If the argument is of type string then the list of valid values is the case-sensitive list of string values - * allowed for this argument. If it is an input or output file then the list of valid values is a list of - * case-insentive file extensions identifying the allowed types. - * - * @section Examples - * - * An example of setting allowed values for a string option. - * - * @code{.cpp} - * seqan::ArgParseArgument stringArg(seqan::ArgParseArgument::STRING); - * setValidValues(stringArg, "one two three"); // one of {"one", "two", "three"} - * - * std::vector values; - * values.push_back("four"); - * values.push_back("five"); - * setValidValues(stringArg, values); // one of {"four", "five"} - * @endcode - * - * An example for an input file option. Note that by changing INPUTFILE to OUTPUTFILE below, - * the example would be the same for output files. - * - * @code{.cpp} - * seqan::ArgParseArgument fileArg(seqan::ArgParseArgument::INPUTFILE); - * setValidValues(fileArg, "fq fastq"); // file must end in ".fq" or ".fastq" - * - * std::vector values; - * values.push_back("sam"); - * values.push_back("bam"); - * setValidValues(fileArg, values); // file must end in ".sam" or ".bam" - * @endcode - */ - -/** -.Function.setValidValues -..class:Class.ArgParseArgument -..summary:Sets the set of allowed values of a @Class.ArgParseArgument@ object. -..cat:Miscellaneous -..signature:setValidValues(argument,values) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..param.values:A std::vector containing all valid entries for the option or a std::string -with valid values separated by spaces. -..remarks:If the argument or option is an in- or output file. The valid strings will be interpreted as -file endings and the command line parser checks if the provided file has the required file ending. -..include:seqan/arg_parse.h -*/ - -inline void setValidValues(ArgParseArgument & me, std::vector const & values) -{ - if (isDoubleArgument(me) || isIntegerArgument(me)) - SEQAN_FAIL("ArgParseArgument does not support setting valid values for numeric arguments."); - - me.validValues = values; -} - -inline void setValidValues(ArgParseArgument & me, std::string const & valuesString) -{ - // convert array to String - std::vector values; - std::string current_argument; - - for (std::string::const_iterator ch = valuesString.begin(); ch != valuesString.end(); ++ch) - { - if (*ch == ' ') - { - appendValue(values, current_argument); - current_argument = ""; - } - else - { - append(current_argument, *ch); - } - } - if (current_argument != "") - appendValue(values, current_argument); - - setValidValues(me, values); -} - -// ---------------------------------------------------------------------------- -// Function setHelpText() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#setHelpText - * @headerfile - * @brief Set the help text for an ArgParseArgument. - * - * @signature void setHelpText(arg, text); - * - * @param arg The ArgParseArgument to set the help text for. - * @param text The text to display as the description of the argument (std::string). - */ - -/** -.Function.setHelpText -..class:Class.ArgParseArgument -..summary:Sets the help text for an ArgParseArgument. -..cat:Miscellaneous -..signature:setHelpText(argument,text) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..param.text:A std::string describing the argument. -..include:seqan/arg_parse.h -*/ - -inline void setHelpText(ArgParseArgument & me, std::string const & text) -{ - me._helpText = text; -} - -// ---------------------------------------------------------------------------- -// Helper Function _isInInterval() -// ---------------------------------------------------------------------------- - -// check if the given value is in the provided interval -template -inline bool _isInInterval(TString value, TString lowerIntervalBound, TString upperIntervalBound) -{ - bool isInInterval = true; - - if (lowerIntervalBound != "") - isInInterval &= (_cast(lowerIntervalBound) <= _cast(value)); - if (upperIntervalBound != "") - isInInterval &= (_cast(value) <= _cast(upperIntervalBound)); - - return isInInterval; -} - -// ---------------------------------------------------------------------------- -// Helper Function _checkNumericArgument() -// ---------------------------------------------------------------------------- - -// test if the values can be assigned to the option and is in the given boundaries -template -inline void _checkNumericArgument(ArgParseArgument const & me, std::string const & value) -{ - if (!_isCastable(value)) - { - std::stringstream what; - what << "the given value '" << value << "' cannot be casted to " << _typeToString(me); - SEQAN_THROW(ParseError(what.str())); - } - - if (!_isInInterval(value, me.minValue, me.maxValue)) - { - std::stringstream what; - what << "the given value '" << value << "' is not in the interval [" - << (me.minValue != "" ? me.minValue : "-inf") << ":" - << (me.maxValue != "" ? me.maxValue : "+inf") << "]"; - - SEQAN_THROW(ParseError(what.str())); - } -} - -// ---------------------------------------------------------------------------- -// Helper Function _compareExtension() -// ---------------------------------------------------------------------------- - -inline bool _compareExtension(std::string const & str, std::string const & ext) -{ - std::string str_ext = str.substr(str.size() - ext.size()); - for (size_t i = 0; i < str_ext.size() && i < ext.size(); ++i) - { - if (tolower(str_ext[i]) != tolower(ext[i])) - return false; - } - return true; -} - -// ---------------------------------------------------------------------------- -// Helper Function _checkStringRestrictions() -// ---------------------------------------------------------------------------- - -// The parameter i gives the index of the value in the argument. - -inline void _checkStringRestrictions(ArgParseArgument const & me, std::string value, - unsigned i) -{ - typedef std::vector::const_iterator TVectorIterator; - - // we only check valid values for files and string arguments, but not for prefix arguments - if (!empty(me.validValues) && !(isInputPrefixArgument(me) || isOutputPrefixArgument(me))) - { - bool isContained = false; - for (TVectorIterator validValue = me.validValues.begin(); - validValue != me.validValues.end(); - ++validValue) - { - // if it is an input or output file, we only check the file endings - if (isInputFileArgument(me) || isOutputFileArgument(me)) - { - if (length(*validValue) > length(getFileExtension(me, i))) - continue; - else - isContained |= _compareExtension(getFileExtension(me, i), *validValue); - } - else - { - isContained |= (*validValue == value); - } - if (isContained) - break; - } - if (!isContained) - { - std::stringstream what; - if (isInputFileArgument(me) || isOutputFileArgument(me)) - what << "the given path '" << value << "' does not have one of the valid file extensions ["; - else - what << "the given value '" << value << "' is not in the list of allowed values ["; - for (TVectorIterator validValue = me.validValues.begin(); - validValue != me.validValues.end(); - ++validValue) - { - if (validValue != me.validValues.begin()) - what << ", "; - what << ((isInputFileArgument(me) || isOutputFileArgument(me)) ? "*" : "") << *validValue; - } - what << "]"; - if (i < me._fileExtensions.size()) - what << "; the file extension was overridden to be '" << getFileExtension(me, i) << "'"; - SEQAN_THROW(ParseError(what.str())); - } - } -} - -// ---------------------------------------------------------------------------- -// Function _checkValue() -// ---------------------------------------------------------------------------- - -// Check value before or after assignment. -// -// The parameter i gives the index of the value to check for overriding the extension in case of file arguments. - -inline void _checkValue(ArgParseArgument const & me, std::string val, unsigned i = 0) -{ - // type checks - if (isIntegerArgument(me)) - _checkNumericArgument(me, val); - - if (isInt64Argument(me)) - _checkNumericArgument<__int64>(me, val); - - if (isDoubleArgument(me)) - _checkNumericArgument(me, val); - - // check valid values - if (isStringArgument(me)) - _checkStringRestrictions(me, val, i); -} - -inline void _checkValue(ArgParseArgument const & me) -{ - unsigned i = 0; - for (std::vector::const_iterator it = me.value.begin(); it != me.value.end(); ++it, ++i) - _checkValue(me, *it, i); -} - -// ---------------------------------------------------------------------------- -// Function _assignArgumentValue() -// ---------------------------------------------------------------------------- - -/** -.Internal.Function._assignArgumentValue -..class:Class.ArgParseArgument -..summary:Assigns the given value (if applicable) to the @Class.ArgParseArgument@ object. If -the @Class.ArgParseArgument@ is a list or can hold multiple values -(@Memfunc.ArgParseArgument#ArgParseArgument.param.numberOfArguments@) the value will be appended. -Otherwise the value will be overwritten. -..cat:internal -..signature:_assignArgumentValue(argument,value [, argNo]) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..param.value:A std::string containing the value that should be assigned. -..include:seqan/arg_parse.h -*/ - -inline void _assignArgumentValue(ArgParseArgument & me, std::string const & value) -{ - // assignment - if (isListArgument(me)) // just append - { - appendValue(me.value, value, Exact()); - } - else - { - // check if we already set all expected arguments - if (length(me.value) == me._numberOfValues) - clear(me.value); - appendValue(me.value, value, Exact()); - } -} - -// ---------------------------------------------------------------------------- -// Function getArgumentValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#getArgumentValue - * @headerfile - * @brief Return the value of the argument. - * - * @signature std::string getArgumentValue(arg[, argNo]); - * - * @param arg The ArgParseArgument to query. - * @param argNo In case that the ArgParseArgument allowed multiple values, give the index of the argument - * that you want to retrieve (unsigned, starts at 0). - * - * @return std::string Const-reference to the argument value. - */ - -/** -.Function.ArgParseArgument#getArgumentValue -..class:Class.ArgParseArgument -..summary:Returns the value of the @Class.ArgParseArgument@ object. If -the @Class.ArgParseArgument@ is a list or can hold multiple values -(@Memfunc.ArgParseArgument#ArgParseArgument.param.numberOfArguments@) you can specify which value -you want to get. If not set the first value will be returned. -..cat:Miscellaneous -..signature:getArgumentValue(argument [, argNo]) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..param.argNo:If the argument is a list, the $argNo$-th list element is returned. -..returns:The value set at position $position$. -..include:seqan/arg_parse.h -*/ - -inline std::string const & getArgumentValue(ArgParseArgument const & me, unsigned argNo) -{ - SEQAN_CHECK(argNo < me.value.size() || argNo < me.defaultValue.size(), - "ArgParseArgument: No value set for index %d", argNo); - - if (argNo < me.value.size()) - return me.value[argNo]; - else - return me.defaultValue[argNo]; -} - -inline std::string const & getArgumentValue(ArgParseArgument const & me) -{ - return getArgumentValue(me, 0); -} - -// ---------------------------------------------------------------------------- -// Function getArgumentValues() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#getArgumentValues - * @headerfile - * @brief Return all values of the argument. - * - * @signature std::vector getArgumentValue(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return std::vector Const-reference to the argument values. - */ - -/** -.Function.getArgumentValues -..class:Class.ArgParseArgument -..summary:Returns all values of the @Class.ArgParseArgument@ object as const std::vector. -..cat:Miscellaneous -..signature:getArgumentValues(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:$std::vector$ containing the values. If no value was set and no -default value exists an empty vector will be returned. -..include:seqan/arg_parse.h -*/ - -inline std::vector const & getArgumentValues(ArgParseArgument const & me) -{ - if (!me.value.empty()) - return me.value; - else - return me.defaultValue; -} - -// ---------------------------------------------------------------------------- -// Function hasArgumentValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#hasArgumentValue - * @headerfile - * @brief Return whether a value is available. - * - * @signature bool hasValue(arg[, pos]); - * - * @param arg The ArgParseArgument to query. - * @param pos The position of the argument in case of being a list (unsigned, 0-based, default is 0). - * - * @return bool true if pos is less than the size and the argument is non-empty. - */ - -/** -.Function.ArgParseArgument#hasValue -..class:Class.ArgParseArgument -..summary:Returns true if a value for the given position is available. -..cat:Miscellaneous -..signature:hasValue(argument [, position=0]) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..param.position:The position for which the availability should be tested. -..returns: $true$ if a value is available, $false$ if not. -..include:seqan/arg_parse.h -*/ -inline bool hasValue(ArgParseArgument const & arg, unsigned position) -{ - return arg.value.size() > position || arg.defaultValue.size() > position; -} - -inline bool hasValue(ArgParseArgument const & arg) -{ - return hasValue(arg, 0); -} - -// ---------------------------------------------------------------------------- -// Function isSet() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#isSet - * @headerfile - * @brief Returns true if a value was assigned to the argument. - * - * @signature bool isSet(arg): - * - * @param arg The ArgParseArgument to query. - * - * @return bool true if a value was assigned, false otherwise. - */ - -/** -.Function.ArgParseArgument#isSet -..class:Class.ArgParseArgument -..summary:Returns true if a value was assigned to the argument. -..cat:Miscellaneous -..signature:isSet(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:$true$ if a value was assigned to the argument, $false$ if not. -..include:seqan/arg_parse.h -*/ - -inline bool isSet(ArgParseArgument const & me) -{ - return !me.value.empty(); -} - -// ---------------------------------------------------------------------------- -// Function hasDefault() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#hasDefault - * @headerfile - * @brief Returns whether the argument has a default value. - * - * @signature bool hasDefault(arg); - * - * @param arg The argument to query. - * - * @return bool true if the argument has a default value and false if not. - */ - -/** -.Function.ArgParseArgument#hasDefault -..summary:Returns true if a default value was given for that argument. -..cat:Miscellaneous -..signature:hasDefault(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:$true$ if a default value was given for the argument, $false$ if not. -..include:seqan/arg_parse.h -*/ - -inline bool hasDefault(ArgParseArgument const & me) -{ - return !me.defaultValue.empty(); -} - -// ---------------------------------------------------------------------------- -// Function numberOfArguments -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#numberOfAllowedValues - * @headerfile - * @brief Returns the number of allowed values for this ArgParseArgument. - * - * @signature unsigned numberOfAllowedValues(arg); - * - * @param arg The ArgParseArgument to query. - * - * @return unsigned The number of allowed values. - */ - -/** -.Function.numberOfAllowedValues -..class:Class.ArgParseArgument -..summary:Returns the number of allowed values for this @Class.ArgParseArgument@. -..cat:Miscellaneous -..signature:numberOfAllowedValues(argument) -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..returns:The number of allowed values for this @Class.ArgParseArgument@. -..include:seqan/arg_parse.h -*/ - -inline unsigned numberOfAllowedValues(ArgParseArgument const & me) -{ - return me._numberOfValues; -} - -// ---------------------------------------------------------------------------- -// Function getFileExtension() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseArgument#getFileExtension - * @headerfile - * @brief Returns the file extension for the given file argument. - * - * Only valid when argument is an INPUTFILE or OUTPUTFILE. - * - * Halts the program if not an input or output file argument. - * - * Can be overridden with special hidden options. - * For arguments, you can pass --arg-<num>-file-ext for argument num. - * For parameters, you can pass --<param-name>-file-ext for the option named param-name. - * - * @signature std::string getFileExtension(arg[, pos]); - * - * @param arg The ArgParseArgument to query. - * @param pos The position of the value to retrieve if multiple values (unsigned). - * - * @return std::string The file extension, empty if no extension or not set. - */ - -/** -.Function.ArgParseArgument#getFileExtension -..class:Class.ArgParseArgument -..summary:Returns the file extension for the given file argument. -..description:Only valid when argument is an INPUTFILE or OUTPUTFILE. -..cat:Miscellaenous -..signature:std::string getFileExtension(argument[, pos]); -..param.argument:The @Class.ArgParseArgument@ object. -...type:Class.ArgParseArgument -..param.pos:The position of the value if multiple values are allowed. -...type:nolink:$unsigned$ -..returns:A $std::string$ with the extension of the file, if any. Empty if no extension. -..remarks:Halts the program if the argument is not an input or output file argument. -..remarks:Note that you can -..include:seqan/arg_parse.h -*/ - -inline std::string getFileExtension(ArgParseArgument const & me, unsigned pos = 0) -{ - if (me._argumentType != ArgParseArgument::INPUTFILE && - me._argumentType != ArgParseArgument::OUTPUTFILE) - SEQAN_FAIL("Cannot get file extension from non-file argument/option."); - - // Short-circuit to override file extension if set. - if (pos < me._fileExtensions.size()) - { - std::string result = me._fileExtensions[pos]; - if (!result.empty() && result[0] != '.') - result.insert(0, "."); - return result; - } - - // Get argument value and break if empty. - std::string value = getArgumentValue(me, pos); - if (value.empty()) - return ""; - - // If there is a list of valid values then we look for each of these in the path. - if (!me.validValues.empty()) - { - for (unsigned i = 0; i < length(me.validValues); ++i) - { - unsigned len = std::min(me.validValues[i].size(), value.size()); - std::string tmp = value.substr(value.size() - len); - std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower); - if (tmp == me.validValues[i]) - return me.validValues[i]; - } - return ""; - } - - // Fall back to finding position of last dot. Return suffix if found and empty string if not. - size_t dotPos = value.find_last_of('.'); - if (dotPos == std::string::npos) - return ""; - return value.substr(dotPos + 1); -} - -} // namespace seqan - -#endif // SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_ARGUMENT_H_ diff --git a/seqan/arg_parse/arg_parse_ctd_support.h b/seqan/arg_parse/arg_parse_ctd_support.h deleted file mode 100644 index 4c46d40..0000000 --- a/seqan/arg_parse/arg_parse_ctd_support.h +++ /dev/null @@ -1,568 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Bjoern Kahlert -// Author: Stephan Aiche -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_CTD_SUPPORT_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_CTD_SUPPORT_H_ - -#include - -#include -#include -#include - -#include - -namespace seqan { - -// ---------------------------------------------------------------------------- -// Function _toText() -// ---------------------------------------------------------------------------- -// Removes formatting (\fI, \fB, and \fP). -template -TSequence _toText(TSequence const & input) -{ - TSequence buffer = xmlEscape(input); - TSequence result; - String openTags; - - typedef typename Iterator::Type TIterator; - TIterator endIt = end(input, Standard()); - for (TIterator it = begin(input, Standard()); it != endIt; goNext(it)) - { - if (*it == '\\') - { - // Handle escape sequence, we interpret only "\-", "\fI", and "\fB". - goNext(it); - SEQAN_ASSERT_NOT(it == endIt); - if (*it == '-') - { - appendValue(result, *it); - } - else if (*it == 'f') - { - goNext(it); - SEQAN_ASSERT_NOT(it == endIt); - if (*it == 'I') - { - appendValue(openTags, "i"); - } - else if (*it == 'B') - { - appendValue(openTags, "b"); - } - else if (*it == 'P') - { - SEQAN_ASSERT_NOT(empty(openTags)); - eraseBack(openTags); - } - else - { - append(result, "\\f"); - appendValue(result, *it); - } - } - else - { - appendValue(result, '\\'); - appendValue(result, *it); - } - } - else - { - appendValue(result, *it); - } - } - - return result; -} - -// ---------------------------------------------------------------------------- -// Function _join() -// ---------------------------------------------------------------------------- - -/** - * joins all elements of the the passed StringSet into a single CharString - * the provided delimiter is used to separate the single entries in the - * resulting CharString - */ -template -inline std::string -_join(std::vector const & v, std::string const & delimiter) -{ - typedef typename std::vector::const_iterator TStringSetIterator; - - std::stringstream joined; - for (TStringSetIterator it = v.begin(); it != v.end(); ++it) - { - if (it != v.begin()) - joined << delimiter; - joined << *it; - } - return joined.str(); -} - -// ---------------------------------------------------------------------------- -// Function _getPrefixedOptionName() -// ---------------------------------------------------------------------------- - -inline std::string -_getPrefixedOptionName(ArgParseOption const & opt) -{ - std::string optName = ""; - if (!empty(opt.longName)) - optName = "--" + opt.longName; - else - optName = "-" + opt.shortName; - - return optName; -} - -// ---------------------------------------------------------------------------- -// Function _getOptionName() -// ---------------------------------------------------------------------------- - -inline std::string -_getOptionName(ArgParseOption const & opt) -{ - if (!empty(opt.longName)) - return opt.longName; - else - return opt.shortName; -} - -// ---------------------------------------------------------------------------- -// Function _getRestrictions() -// ---------------------------------------------------------------------------- -inline void -_getRestrictions(std::vector & restrictions, ArgParseArgument const & opt) -{ - // we only extract non-file restrictions - if (isOutputFileArgument(opt) || isInputFileArgument(opt) || isInputPrefixArgument(opt) || isOutputPrefixArgument(opt)) - return; - - if (length(opt.validValues) != 0) - { - for (std::vector::const_iterator valid = opt.validValues.begin(); - valid != opt.validValues.end(); - ++valid) - { - appendValue(restrictions, *valid); - } - } - else - { - std::string minMaxRestriction = ""; - if (opt.minValue != "") - { - append(minMaxRestriction, opt.minValue); - append(minMaxRestriction, ":"); - } - if (opt.maxValue != "") - { - if (minMaxRestriction == "") - append(minMaxRestriction, ":"); - append(minMaxRestriction, opt.maxValue); - } - - if (minMaxRestriction != "") - appendValue(restrictions, minMaxRestriction); - } -} - -// ---------------------------------------------------------------------------- -// Function _addValidValuesRestrictions() -// ---------------------------------------------------------------------------- - -inline void -_getSupportedFormats(std::vector & supported_formats, ArgParseArgument const & opt) -{ - // we check only file arguments - if (!(isOutputFileArgument(opt) || isInputFileArgument(opt) || isInputPrefixArgument(opt) || isOutputPrefixArgument(opt))) - return; - - if (length(opt.validValues) != 0) - { - std::string filetype; - for (std::vector::const_iterator valid = opt.validValues.begin(); - valid != opt.validValues.end(); - ++valid) - { - SEQAN_ASSERT_NOT(empty(*valid)); - - filetype = "*"; - - // ensure . as separator between * and file-extension - if (value(*valid, 0) != '.') - appendValue(filetype, '.'); - - append(filetype, *valid); - appendValue(supported_formats, filetype); - } - } -} - -// ---------------------------------------------------------------------------- -// Function _includeInCTD() -// ---------------------------------------------------------------------------- - -/* - * returns true if this option should be included in the ctd - */ -inline bool -_includeInCTD(ArgParseOption const & opt) -{ - return !(opt.longName == "help" || opt.longName == "version" || opt.longName == "write-ctd" || opt.longName == "export-help" || (opt.shortName == "" && opt.longName == "")); -} - -// ---------------------------------------------------------------------------- -// Function _indent() -// ---------------------------------------------------------------------------- - -inline std::string _indent(const int currentIndent) -{ - std::string indent = ""; - for (int i = 0; i < currentIndent; ++i) - indent += "\t"; - return indent; -} - -// ---------------------------------------------------------------------------- -// Function _writeCLIElement() -// ---------------------------------------------------------------------------- -inline void _writeCLIElement(std::ostream & ctdfile, int currentIndent, std::string const & optionIdentifier, std::string const & ref_name, bool isList) -{ - ctdfile << _indent(currentIndent) - << "\n"; - - ctdfile << _indent(currentIndent + 1) << "\n"; - - ctdfile << _indent(currentIndent) << "\n"; -} - -// ---------------------------------------------------------------------------- -// Function _getManual() -// ---------------------------------------------------------------------------- -inline std::string _getManual(ArgumentParser const & me) -{ - std::stringstream manual; - for (unsigned i = 0; i < me._description.size(); ++i) - { - manual << _toText(me._description[i]) << std::endl; - } - return manual.str(); -} - -// ---------------------------------------------------------------------------- -// Function writeCTD() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#writeCTD - * @headerfile \ - * @brief Export the app's interface description to a .ctd file. - * - * @signature bool writeCTD(parser[, stream]); - * - * @param parser The ArgumentParser to write the CTD file for. - * @param stream A std::ostream to write to. If omitted an output file with the name form the "write-ctd" - * parameter of the parser is used. - * - * @return bool true on success, false on failure. - */ - -/** -.Function.writeCTD -..summary:Exports the app's interface description to a .ctd file. -..cat:Miscellaneous -..signature:writeCTD(parser [, ctdfile]) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.ctdfile:The stream where the ctd file will be written to. If non is given the function writes it to the file given in the write-ctd parameter. -..param.parser:The @Class.ArgumentParser@ object. -..returns:$true$ if the ctd file could be created correctly, $false$ otherwise. -..include:seqan/arg_parse.h -*/ - -inline bool -writeCTD(ArgumentParser const & me, std::ostream & ctdfile) -{ - typedef ArgumentParser::TOptionMap::const_iterator TOptionMapIterator; - typedef ArgumentParser::TArgumentMapSize TArgumentMapSize; - - int currentIndent = 1; - - std::string toolname(toCString(xmlEscape(getAppName(me)))); - - // remove "_" in the tool name and make the following letter uppercase - std::string class_name; - bool upcase = true; - for (unsigned i = 0; i < toolname.size(); ++i) - { - if (toolname[i] == '_') - { - upcase = true; - continue; - } - class_name.push_back(toolname[i]); - if (upcase) - class_name[class_name.size() - 1] = toupper(toolname[i]); - upcase = false; - } - - ctdfile << "\n"; - ctdfile << "\n"; - ctdfile << _indent(currentIndent) << "" << toolname << "\n"; - ctdfile << _indent(currentIndent) << "" << xmlEscape(getShortDescription(me)) << "\n"; - ctdfile << _indent(currentIndent) << "" << xmlEscape(_getManual(me)) << "\n"; // TODO(aiche): as soon as we have a more sophisticated documentation embedded into the CmdParser, we should at this here - ctdfile << _indent(currentIndent++) << "\n"; - - // the unix way 1st the options - for (TOptionMapIterator optionMapIterator = me.optionMap.begin(); - optionMapIterator != me.optionMap.end(); - ++optionMapIterator) - { - ArgParseOption const & opt = *optionMapIterator; - std::string optionIdentifier = _getPrefixedOptionName(opt); - std::string refName = toolname + "." + _getOptionName(opt); - - if (_includeInCTD(opt)) - { - _writeCLIElement(ctdfile, currentIndent, optionIdentifier, refName, isListArgument(opt)); - } - } - - // add a warning to the CTD that arguments are hard to interpret by the users - if (me.argumentList.size() > 0u) - { - ctdfile << _indent(currentIndent) - << "\n"; - } - // then the arguments - for (TArgumentMapSize argIdx = 0; argIdx != me.argumentList.size(); ++argIdx) - { - // arguments do not have an option identifier - std::string optionIdentifier = ""; - std::stringstream refName; - refName << toolname << "." << "argument-" << argIdx; - _writeCLIElement(ctdfile, currentIndent, optionIdentifier, refName.str(), isListArgument(me.argumentList[argIdx])); - } - - ctdfile << _indent(--currentIndent) << "\n"; - ctdfile << _indent(currentIndent++) << "\n"; - ctdfile << _indent(currentIndent++) << "\n"; - - for (TOptionMapIterator optionMapIterator = me.optionMap.begin(); - optionMapIterator != me.optionMap.end(); - ++optionMapIterator) - { - ArgParseOption const & opt = *optionMapIterator; - - // exclude help, version, etc. - if (!_includeInCTD(opt)) - continue; - - // prefer short name for options - std::string optionName = _getOptionName(opt); - - std::string type; - - if (isIntegerArgument(opt) || isInt64Argument(opt)) - type = "int"; - else if (isDoubleArgument(opt)) - type = "double"; - else if (isInputFileArgument(opt)) - type = "input-file"; - else if (isOutputFileArgument(opt)) - type = "output-file"; - else if (isInputPrefixArgument(opt)) - type = "input-prefix"; - else if (isOutputPrefixArgument(opt)) - type = "output-prefix"; - else if (isStringArgument(opt) || isBooleanOption(opt)) - type = "string"; - - // set up restrictions - std::vector restrictions; - _getRestrictions(restrictions, opt); - - // set up supported formats - std::vector supported_formats; - _getSupportedFormats(supported_formats, opt); - - ctdfile << _indent(currentIndent) - << " 0) - ctdfile << ","; - ctdfile << opt.tags[i]; - } - ctdfile << "\" "; - } - - if (isListArgument(opt)) - { - ctdfile << ">\n"; - for (size_t i = 0; i < length(opt.defaultValue); ++i) - { - ctdfile << _indent(currentIndent + 1) << "\n"; - } - ctdfile << _indent(currentIndent) << "\n"; - } - else - { - ctdfile << "/>\n"; - } - } - - for (TArgumentMapSize argIdx = 0; argIdx != me.argumentList.size(); ++argIdx) - { - ArgParseArgument arg = me.argumentList[argIdx]; - - // prefer short name for options - std::stringstream argumentNameStream; - argumentNameStream << "argument-" << argIdx; - std::string optionName = argumentNameStream.str(); - - std::string type; - - if (isIntegerArgument(arg) || isInt64Argument(arg)) - type = "int"; - else if (isDoubleArgument(arg)) - type = "double"; - else if (isInputFileArgument(arg)) - type = "input-file"; - else if (isOutputFileArgument(arg)) - type = "output-file"; - else if (isInputPrefixArgument(arg)) - type = "input-prefix"; - else if (isOutputPrefixArgument(arg)) - type = "output-prefix"; - else if (isStringArgument(arg)) - type = "string"; - - // set up restrictions - std::vector restrictions; - _getRestrictions(restrictions, arg); - - // set up supported formats - std::vector supported_formats; - _getSupportedFormats(supported_formats, arg); - - ctdfile << _indent(currentIndent) - << " 0) - ctdfile << ","; - ctdfile << arg.tags[i]; - } - ctdfile << "\" "; - } - - ctdfile << "/>\n"; - } - - ctdfile << _indent(--currentIndent) << "\n"; - ctdfile << _indent(--currentIndent) << "\n"; - ctdfile << "" << std::endl; - - return true; -} - -inline bool -writeCTD(ArgumentParser const & me) -{ - // create file [appname].ctd in working directory - std::string ctdfilename; - getOptionValue(ctdfilename, me, "write-ctd"); - - std::ofstream ctdfile; - ctdfile.open(toCString(ctdfilename)); - - if (!ctdfile.is_open()) - { - std::cerr << getAppName(me) << ": Unable to create ctd file: " << ctdfilename << std::endl; - return false; - } - - writeCTD(me, ctdfile); - - ctdfile.close(); - return true; -} - -} // namespace seqan - -#endif // SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_CTD_SUPPORT_H_ diff --git a/seqan/arg_parse/arg_parse_doc.h b/seqan/arg_parse/arg_parse_doc.h deleted file mode 100644 index d49cb02..0000000 --- a/seqan/arg_parse/arg_parse_doc.h +++ /dev/null @@ -1,747 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Stephan Aiche -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_DOC_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_DOC_H_ - -#include -#include - -namespace seqan { - -// ============================================================================ -// Functions -// ============================================================================ - -// -------------------------------------------------------------------------- -// Function getAppName() -// -------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#getAppName -..class:Class.ArgumentParser -..summary:Get tool name of @Class.ArgumentParser@ object. -..cat:Miscellaneous -..signature:getAppName(parser) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..returns:Tool name of argument parser object. -...type:nolink:$std::string$ -..include:seqan/arg_parse.h -*/ - -inline CharString const & getAppName(ArgumentParser const & parser) -{ - return getName(parser._toolDoc); -} - -// ---------------------------------------------------------------------------- -// Helper Function _parseAppName() -// ---------------------------------------------------------------------------- - -inline void _parseAppName(ArgumentParser & parser, std::string const & candidate) -{ - //IOREV _notio_ irrelevant for io-revision - int i = length(candidate) - 1; - - for (; i >= 0; --i) - if (candidate[i] == '\\' || candidate[i] == '/') - break; - - setName(parser._toolDoc, candidate.substr(i + 1)); -} - -// ---------------------------------------------------------------------------- -// Helper Function _addLine() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#addLine: -..class:Class.ArgumentParser -..summary:Adds a line of text to the help output of the @Class.ArgumentParser@ in the block of -@Class.ArgParseOption@s. -..cat:Miscellaneous -..signature:addLine(parser, text) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.text:A line of text that will be added to the help output. -...type:Shortcut.CharString -..include:seqan/arg_parse.h -*/ - -template -inline void addLine(ArgumentParser & me, TString const & line) -{ - addOption(me, ArgParseOption("", "", line)); -} - -// ---------------------------------------------------------------------------- -// Function addSection() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#addSection: -..class:Class.ArgumentParser -..summary:Begins a new section of @Class.ArgParseOption@ the help output of -the @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:addSection(parser, text) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.text:A section header that will be added to the help output. -...type:Shortcut.CharString -..include:seqan/arg_parse.h -..example.code: -ArgumentParser parser; - -[...] // init parser - -addSection(parser, "In-/Output-Options"); -addOption("i", ... ); -addOption("o", ... ); - -addSection(parser, "Other Options"); -addOption("x", ... ); -*/ - -template -inline void addSection(ArgumentParser & me, TString const & line) -{ - addLine(me, ""); - addLine(me, line); -} - -// ---------------------------------------------------------------------------- -// Function addUsageLine() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#addUsageLine: -..class:Class.ArgumentParser -..summary:Adds a line of text to the usage output of the @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:addUsageLine(parser, text) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.text:A text line that will be added to the usage output. -..include:seqan/arg_parse.h -*/ - -inline void addUsageLine(ArgumentParser & me, std::string const & line) -{ - me._usageText.push_back(line); -} - -// ---------------------------------------------------------------------------- -// Helper Function _addUsage() -// ---------------------------------------------------------------------------- - -inline void _addUsage(ToolDoc & toolDoc, ArgumentParser const & me) -{ - for (unsigned i = 0; i < length(me._usageText); ++i) - { - std::string text = "\\fB"; - append(text, getAppName(me)); - append(text, "\\fP "); - append(text, me._usageText[i]); - addText(toolDoc, text, false); - } -} - -// ---------------------------------------------------------------------------- -// Function addDescription() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#addDescription -..class:Class.ArgumentParser -..summary:Appends a description paragraph to the @Class.ArgumentParser@ documentation. -..cat:Miscellaneous -..signature:addDescription(parser, text) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.text:The description paragraph. -..returns:$void$ -..include:seqan/arg_parse.h -*/ - -inline void addDescription(ArgumentParser & me, std::string const & description) -{ - me._description.push_back(description); -} - -// ---------------------------------------------------------------------------- -// Function setAppName() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#setAppName -..class:Class.ArgumentParser -..summary:Sets application name of @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:setAppName(parser, appName) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.appName:The name of the application. -..returns:$void$ -..include:seqan/arg_parse.h -*/ - -inline void setAppName(ArgumentParser & me, std::string const & name) -{ - setName(me._toolDoc, name); -} - -// ---------------------------------------------------------------------------- -// Function setShortDescription() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#setShortDescription -..class:Class.ArgumentParser -..summary:Sets short description of the @Class.ArgumentParser@ object. -..cat:Miscellaneous -..signature:setShortDescription(parser, text) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.text:The short description text. -..returns:$void$ -..include:seqan/arg_parse.h -*/ - -inline void setShortDescription(ArgumentParser & me, std::string const & description) -{ - setShortDescription(me._toolDoc, description); -} - -// ---------------------------------------------------------------------------- -// Function getShortDescription() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#getShortDescription -..class:Class.ArgumentParser -..summary:Gets short description of @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:getShortDescription(parser) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..returns:The short description of the @Class.ArgumentParser@ object. -..include:seqan/arg_parse.h -*/ - -inline CharString getShortDescription(ArgumentParser const & me) -{ - return getShortDescription(me._toolDoc); -} - -// ---------------------------------------------------------------------------- -// Function setVersion() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#setVersion -..class:Class.ArgumentParser -..summary:Sets version string of @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:setVersion(parser, versionString) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.versionString:The version string to set. -..returns:$void$ -..include:seqan/arg_parse.h -*/ - -inline void setVersion(ArgumentParser & me, std::string const & versionString) -{ - setVersion(me._toolDoc, versionString); - if (!hasOption(me, "version")) - addOption(me, ArgParseOption("", "version", "Display version information")); -} - -// -------------------------------------------------------------------------- -// Function getVersion() -// -------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#getVersion -..class:Class.ArgumentParser -..cat:Miscellaneous -..summary:Get version string from @Class.ArgumentParser@ object. -..signature:getVersion(parser) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..returns:Date string. -...type:Shortcut.CharString -..include:seqan/arg_parse.h -*/ - -inline CharString const & getVersion(ArgumentParser const & me) -{ - return getVersion(me._toolDoc); -} - -// -------------------------------------------------------------------------- -// Function setCategory() -// -------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#setCategory -..class:Class.ArgumentParser -..summary:Set tool category for @Class.ArgumentParser@ object. -..cat:Miscellaneous -..signature:setCategory(parser, category) -..param.parser:The @Class.ArgumentParser@ object to set the category. -...type:Class.ArgumentParser -..param.category:Category to set. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/arg_parse.h -*/ - -inline void setCategory(ArgumentParser & parser, CharString const & category) -{ - setCategory(parser._toolDoc, category); -} - -// -------------------------------------------------------------------------- -// Function getCategory() -// -------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#getCategory -..class:Class.ArgumentParser -..summary:Get tool category of @Class.ArgumentParser@ object. -..cat:Miscellaneous -..signature:getCategory(parser) -..param.parser:The @Class.ArgumentParser@ object to get the tool category of. -...type:Class.ArgumentParser -..returns:Tool category of the @Class.ArgumentParser@ object. -...type:Shortcut.CharString -..include:seqan/arg_parse.h -*/ - -inline CharString const & getCategory(ArgumentParser const & parser) -{ - return getCategory(parser._toolDoc); -} - -// ---------------------------------------------------------------------------- -// Function setDate() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#setDate -..class:Class.ArgumentParser -..summary:Sets date string of @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:setDate(parser, date) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.date:The date string. -..returns:$void$ -..include:seqan/arg_parse.h -*/ - -inline void setDate(ArgumentParser & me, std::string const & date) -{ - setDate(me._toolDoc, date); -} - -// ---------------------------------------------------------------------------- -// Function addTextSection() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#addTextSection -..class:Class.ArgumentParser -..summary:Adds a text section to the @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:addTextSection(parser, title) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.title:The section title. -..returns:$void$ -..remarks:This will result in an additional section heading to be printed. -..include:seqan/arg_parse.h -*/ - -inline void addTextSection(ArgumentParser & me, std::string const & title) -{ - addSection(me._toolDoc, title); -} - -// ---------------------------------------------------------------------------- -// Function addTextSubSection() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#addTextSubSection -..class:Class.ArgumentParser -..summary:Adds a text subsection to the @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:addTextSubSection(parser, title) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.title:The subsection title. -..returns:$void$ -..remarks:This will result in an additional subsection heading to be printed. -..include:seqan/arg_parse.h -*/ - -inline void addTextSubSection(ArgumentParser & me, std::string const & title) -{ - addSubSection(me._toolDoc, title); -} - -// ---------------------------------------------------------------------------- -// Function addText() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#addText -..class:Class.ArgumentParser -..summary:Appends a text paragraph to the @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:addText(parser, text) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.text:The content of the text. -..returns:$void$ -..include:seqan/arg_parse.h -*/ - -inline void addText(ArgumentParser & me, std::string const & text) -{ - addText(me._toolDoc, text); -} - -// ---------------------------------------------------------------------------- -// Function addListItem() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#addListItem -..class:Class.ArgumentParser -..summary:Appends a list item to the @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:addListItem(parser, item, description) -..description: -This method adds a list item to the parser's output. -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.item:The item text. -..param.description:The description text. -..returns:$void$ -..include:seqan/arg_parse.h -*/ - -inline void addListItem(ArgumentParser & me, std::string const & item, std::string const & description) -{ - addListItem(me._toolDoc, item, description); -} - -// ---------------------------------------------------------------------------- -// Function printShortHelp() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#printShortHelp -..class:Class.ArgumentParser -..summary:Prints a short help message for the parser to a stream -..cat:Miscellaneous -..signature:printShortHelp(parser[, stream]) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.stream:Target stream (e.g. $std::cerr$). -..include:seqan/arg_parse.h -*/ - -inline void printShortHelp(ArgumentParser const & me, std::ostream & stream) -{ - // TODO: maybe we can get this a bit prettier - ToolDoc shortDoc(me._toolDoc); - clearEntries(shortDoc); - - _addUsage(shortDoc, me); - - std::stringstream shortHelp; - shortHelp << "Try '" << getAppName(me) << " --help' for more information.\n"; - addText(shortDoc, shortHelp.str()); - - print(stream, shortDoc, "txt"); -} - -inline void printShortHelp(ArgumentParser const & me) -{ - printShortHelp(me, std::cerr); -} - -// ---------------------------------------------------------------------------- -// Function printVersion() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#printVersion -..class:Class.ArgumentParser -..summary:Prints the version information of the parser to a stream. -..cat:Miscellaneous -..signature:printVersion(parser[, stream]) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.stream:Target std::ostream (e.g. $std::cerr$). -...default: $std::cerr$ -..include:seqan/arg_parse.h -*/ - -inline void printVersion(ArgumentParser const & me, std::ostream & stream) -{ - stream << getAppName(me) << " version " << getVersion(me) << std::endl; -} - -inline void printVersion(ArgumentParser const & me) -{ - printVersion(me, std::cerr); -} - -// ---------------------------------------------------------------------------- -// Function _addNumericalRestriction() -// ---------------------------------------------------------------------------- - - -inline void _addNumericalRestriction(std::string & text, ArgParseOption const & opt) -{ - // expand min/max restrictions - if (!empty(opt.minValue) || !empty(opt.maxValue)) - { - append(text, " In range ["); - - if (!empty(opt.minValue)) - append(text, opt.minValue); - else - append(text, "-inf"); - - append(text, ".."); - - if (!empty(opt.maxValue)) - append(text, opt.maxValue); - else - append(text, "inf"); - - append(text, "]."); - } -} - -// ---------------------------------------------------------------------------- -// Function _expandList() -// ---------------------------------------------------------------------------- - -// expands the given vector as text in the form v1, v2, and v3, while respecting -// the size with respect to the used commas and "and"s -inline void _expandList(std::string & text, std::vector const & list) -{ - for (std::vector::size_type i = 0; i < list.size(); ++i) - { - if (i + 1 == list.size() && list.size() == 2u) - append(text, " and "); - else if (i + 1 == list.size() && list.size() > 2u) - append(text, ", and "); - else if (i != 0) - append(text, ", "); - - append(text, "\\fI"); - append(text, list[i]); - append(text, "\\fP"); - - } -} - -// ---------------------------------------------------------------------------- -// Function _addDefaultValues() -// ---------------------------------------------------------------------------- - -inline void _addDefaultValues(std::string & text, ArgParseOption const & opt) -{ - if (!empty(opt.defaultValue) && !isBooleanOption(opt)) - { - append(text, " Default: "); - _expandList(text, opt.defaultValue); - append(text, "."); - } -} - -// ---------------------------------------------------------------------------- -// Function _addValidValuesRestrictions() -// ---------------------------------------------------------------------------- - -inline void _addValidValuesRestrictions(std::string & text, ArgParseOption const & opt) -{ - if (!empty(opt.validValues) && !isBooleanOption(opt)) - { - if (isInputFileArgument(opt) || isOutputFileArgument(opt)) - { - append(text, " Valid filetype"); - - if (opt.validValues.size() > 1) - append(text, "s are: "); - else - append(text, " is: "); - } - else - { - append(text, " One of "); - } - - _expandList(text, opt.validValues); - append(text, "."); - } -} - -// ---------------------------------------------------------------------------- -// Function printHelp() -// ---------------------------------------------------------------------------- - -/** -.Function.ArgumentParser#printHelp -..class:Class.ArgumentParser -..summary:Prints the complete help message for the parser to a stream. -..cat:Miscellaneous -..signature:printHelp(parser[, stream][, format]) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.stream:Target std::ostream (e.g. $std::cerr$). -...default: $std::cerr$ -..param.format:Format to print, one of "html", "man", "txt". -..include:seqan/arg_parse.h -*/ - -inline void printHelp(ArgumentParser const & me, std::ostream & stream, CharString const & format) -{ - ToolDoc toolDoc(me._toolDoc); - clearEntries(toolDoc); // We will append me._toolDoc later. - - // Build synopsis section. - addSection(toolDoc, "Synopsis"); - _addUsage(toolDoc, me); - - // Add description to tool documentation. - addSection(toolDoc, "Description"); - for (unsigned i = 0; i < me._description.size(); ++i) - addText(toolDoc, me._description[i]); - - // Add options to description section. - for (unsigned i = 0; i < length(me.optionMap); ++i) - { - ArgParseOption const & opt = me.optionMap[i]; - if (empty(opt.shortName) && empty(opt.longName)) // this is not an option but a text line - { - if (empty(opt._helpText)) // TODO(holtgrew): Should go away in future. - continue; // Skip empty lines. - - // Is command line parser section, maps to ToolDoc subsection. - std::string title = opt._helpText; - append(title, ":"); - addSubSection(toolDoc, title); - } - else if (!isHidden(opt)) - { - // Build list item term. - std::string term; - if (!empty(opt.shortName)) - { - term = "\\fB-"; - append(term, opt.shortName); - append(term, "\\fP"); - } - if (!empty(opt.shortName) && !empty(opt.longName)) - append(term, ", "); - if (!empty(opt.longName)) - { - append(term, "\\fB--"); - append(term, opt.longName); - append(term, "\\fP"); - } - // Get arguments, autogenerate if necessary. - std::string arguments = getArgumentLabel(opt); - - // Write arguments to term line -> only exception, boolean flags - if (!empty(arguments)) - { - // Tokenize argument names. - std::istringstream iss(toCString(arguments)); - std::vector tokens; - std::copy(std::istream_iterator(iss), std::istream_iterator(), - std::back_inserter >(tokens)); - // Append them, formatted in italic. - for (unsigned i = 0; i < length(tokens); ++i) - { - append(term, " \\fI"); - append(term, tokens[i]); - append(term, "\\fP"); - } - } - - std::string helpText = opt._helpText; - - // expand min/max restrictions - _addNumericalRestriction(helpText, opt); - - // expand validValues restrictions - _addValidValuesRestrictions(helpText, opt); - - // expand defaultValue - _addDefaultValues(helpText, opt); - - // Add list item. - addListItem(toolDoc, term, helpText); - } - } - - append(toolDoc, me._toolDoc); - print(stream, toolDoc, format); -} - -inline void printHelp(ArgumentParser const & me, std::ostream & stream) -{ - printHelp(me, stream, "txt"); -} - -inline void printHelp(ArgumentParser const & me) -{ - printHelp(me, std::cerr, "txt"); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_DOC_H_ diff --git a/seqan/arg_parse/arg_parse_exceptions.h b/seqan/arg_parse/arg_parse_exceptions.h deleted file mode 100644 index a6cde3d..0000000 --- a/seqan/arg_parse/arg_parse_exceptions.h +++ /dev/null @@ -1,120 +0,0 @@ -// ========================================================================== -// arg_parse_exceptions.h -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Stephan Aiche -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_EXCEPTIONS_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_EXCEPTIONS_H_ - -namespace seqan { - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class ParseError -// ---------------------------------------------------------------------------- - -/* -.Internal.Class.ParseError -..cat:Miscellaneous -..summary:General ParseError. -*/ - -class ParseError : public RuntimeError -{ -public: - ParseError(std::string const & option) : - RuntimeError(option) - {} -}; - -// ---------------------------------------------------------------------------- -// Class InvalidOption -// ---------------------------------------------------------------------------- - -/* -.Internal.Class.InvalidOption -..cat:Miscellaneous -..summary:Thrown if an unknown option was set on the command line. -*/ - -class InvalidOption : public ParseError -{ -public: - InvalidOption(std::string const & option) : - ParseError("illegal option -- " + option) - {} -}; - -// ---------------------------------------------------------------------------- -// Class MissingArgument -// ---------------------------------------------------------------------------- - -/* -.Internal.Class.MissingArgument -..cat:Miscellaneous -..summary:Thrown if an option was set on the command line but without giving the -required arguments for this option. -*/ - -class MissingArgument : public ParseError -{ -public: - MissingArgument(std::string const & option) : - ParseError("option requires an argument -- " + option) - {} -}; - -// ---------------------------------------------------------------------------- -// Class NotEnoughArguments -// ---------------------------------------------------------------------------- - -/* -.Internal.Class.NotEnoughArguments -..cat:Miscellaneous -..summary:Thrown if an option was set on the command line but not enough arguments for -this option were provided. -*/ - -class NotEnoughArguments : public ParseError -{ -public: - NotEnoughArguments(std::string const & option) : - ParseError("option requires more arguments -- " + option) - {} -}; - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_EXCEPTIONS_H_ diff --git a/seqan/arg_parse/arg_parse_option.h b/seqan/arg_parse/arg_parse_option.h deleted file mode 100644 index 5329cb4..0000000 --- a/seqan/arg_parse/arg_parse_option.h +++ /dev/null @@ -1,587 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Stephan Aiche -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_OPTION_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_OPTION_H_ - -#include -#include -#include -#include - -namespace seqan { - -// ---------------------------------------------------------------------------- -// Class ArgParseOption -// ---------------------------------------------------------------------------- - -/*! - * @class ArgParseOption - * @extends ArgParseArgument - * @headerfile - * @brief Store information for a specific command line option. - * - * @signature class ArgParseOption : ArgParseArgument; - * - * You can use the shortcut @link ArgumentParser#addOption @endlink for adding options to @link ArgumentParser @endlink - * object. - */ - -/** -.Class.ArgParseOption -..base:Class.ArgParseArgument -..cat:Miscellaneous -..summary:Stores information for a specific command line option. -..signature:ArgParseOption -..remarks:A @Class.ArgParseOption@ object can be added to a @Class.ArgumentParser@ via @Function.ArgumentParser#addOption@. -..include:seqan/arg_parse.h -..see:Class.ArgParseArgument -..see:Class.ArgumentParser -*/ - -/*! - * @fn ArgParseOption::ArgParseOption - * @brief Constructor. - * - * @signature ArgParseOption::ArgParseOption(shortName, longName, helpText, argumentType[, argumentLabel[, isList[, numValues]]]); - * - * @param shortName The short name of the argument. - * @param longName The long name of the argument (std::string). - * @param helpText The text to display as help (std::string). - * @param argumentType The type of the argument (@link ArgParseArgument::ArgumentType @endlink). - * @param argumentLabel The label for the value to use in the help display, e.g. 'INT' in '--value INT' - * (std::string). - * @param isList Flag for whether this option can be given multiple times (bool, true for - * allowing multiple values). - * @param numValues Number of command line arguments that each option should bind (unsigned). - * - * @section Short and Long Option Names - * - * Short option names are passed to the program following one dash (e.g. '-i', '-e'). Long optiongs are passed - * following two dashes (e.g. '--num-threads', '--error-rate'). The leading one or two dashes are not passed to the - * constructor of ArgParseOption, however. - * - * @section Naming Conventions - * - *
    - *
  • Keep the short name short, ideally to one character.
  • - *
  • Only use lower-case characters in the long name, use dashes to separate words, only use alphanumeric characters - * and dashes, no underline characters
  • . - *
- */ - -/** -.Memfunc.ArgParseOption#ArgParseOption -..class:Class.ArgParseOption -..summary:Constructor -..signature:ArgParseOption(shortName, longName, helpText, argumentType[, argumentLabel[, isList]]) -..param.shortName:A std::string containing the short-name option identifier (e.g. $"h"$ for the $-h/--help$ option). -Although not suggested the short-name can contain more than 1 character. -...remarks:Note that the leading "-" is not passed. -..param.longName:A std::string containing the long-name option identifier (e.g. $"help"$ for the $-h/--help$ option). -...remarks:Note that the leading "--" is not passed. -..param.helpText:A std::string containing the help text associated with this option. -..param.argumentType:A $ArgParseArgument::ArgumentType$ for the option (e.g., an integer argument). -...type:Class.ArgParseArgument -..param.argumentLabel:The label to use for the argument in the help text, e.g. $"NUMBER"$ for an integer. Optional. -...default:$""$ -...type:nolink:$char const *$ -..param.isList:Whether or not the argument allows multiple values. -...default:$false$ -...type:nolink:$bool$ -*/ - -class ArgParseOption : - public ArgParseArgument -{ -public: - // ---------------------------------------------------------------------------- - // Members to specify the names of the ArgParseOption - // ---------------------------------------------------------------------------- - std::string shortName; // short option name - std::string longName; // long option name - - // ---------------------------------------------------------------------------- - // Members representing type, content and restrictions of the ArgParseOption - // ---------------------------------------------------------------------------- - bool _isFlag; // true if this a bool option, that has no - // argument we will internally represent it as a - // string option set to either "true" or "false" - bool _isRequired; // true if this ArgParseOption must be set - bool _isHidden; // true if this ArgParseOption should not be - // shown on the command line - - // ---------------------------------------------------------------------------- - // Constructors - // ---------------------------------------------------------------------------- - ArgParseOption(std::string const & _shortName, - std::string const & _longName, - std::string const & _help, - ArgumentType argumentType, - std::string const & argumentLabel = "", - bool isListArgument = false, - unsigned numberOfValues = 1) : - ArgParseArgument(argumentType, argumentLabel, isListArgument, numberOfValues), - shortName(_shortName), - longName(_longName), - _isFlag(false), - _isRequired(false), - _isHidden(false) - { - _helpText = _help; - } - - ArgParseOption(std::string const & _shortName, - std::string const & _longName, - std::string const & _help) : - ArgParseArgument(ArgParseArgument::STRING), - shortName(_shortName), - longName(_longName), - _isFlag(true), - _isRequired(false), - _isHidden(false) - { - defaultValue.push_back("false"); - setValidValues(*this, "true false"); - _helpText = _help; - } - -}; - -// ---------------------------------------------------------------------------- -// Function isStringArgument() -// ---------------------------------------------------------------------------- - -inline bool isStringArgument(ArgParseOption const & me) -{ - return isStringArgument(static_cast(me)) && !me._isFlag; -} - -// ---------------------------------------------------------------------------- -// Function isBooleanOption() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseOption#isBooleanOption - * @headerfile - * @brief Returns whether an option is a switch. - * - * @signature bool isBooleanOption(option); - * - * @param option The ArgParseOption object to query. - * - * @return bool true if option is a switch and false otherwise. - * - * Flags are given without arguments, e.g. the -l flag in the Unix ls command. - */ - -/** -.Function.ArgParseOption#isBooleanOption -..class:Class.ArgParseOption -..summary:Returns whether option is a switch. -..cat:Miscellaneous -..signature:isBooleanOption(option) -..param.option:The @Class.ArgParseOption@ object. -...type:Class.ArgParseOption -..returns:$true$ if the option is a switch. -..include:seqan/arg_parse.h -*/ - -inline bool isBooleanOption(ArgParseOption const & me) -{ - return me._isFlag; -} - -// ---------------------------------------------------------------------------- -// Function isHidden() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseOption#isHidden - * @headerfile - * @brief Return whether an option is hidden on the help screen. - * - * @signature bool isHidden(option); - * - * @param option The ArgParseOption object to query. - * - * @return bool true if it is hidden, false otherwise. - * - * By default, options are not hidden. - */ - -/** -.Function.ArgParseOption#isHidden -..class:Class.ArgParseOption -..summary:Returns whether option is hidden on the help screen. Default is false. -..cat:Miscellaneous -..signature:isHidden(option) -..param.option:The @Class.ArgParseOption@ object. -...type:Class.ArgParseOption -..returns:$true$ if the option is hidden on the help screen. -..include:seqan/arg_parse.h -*/ - -inline bool isHidden(ArgParseOption const & me) -{ - return me._isHidden; -} - -// ---------------------------------------------------------------------------- -// Function hideOption() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseOption#hideOption - * @headerfile - * @brief Hides the ArgParseOption from the help screen (or shows it again). - * - * @signature void hideOption(option[, hide]); - * - * @param option The ArgParseOption object to set the hidden flag of. - * @param hide bool that indicates whether to hide the flag (default: true) - */ - -/** -.Function.ArgParseOption#hideOption -..class:Class.ArgParseOption -..summary:Hides the ArgParseOption from the help screen. -..cat:Miscellaneous -..signature:hideOption(option [, hide]) -..param.option:The @Class.ArgParseOption@ object. -...type:Class.ArgParseOption -..param.hide:The new visibility of the option. Default is false. -...type:nolink:bool -..include:seqan/arg_parse.h -*/ - -inline void hideOption(ArgParseOption & me, bool hide = true) -{ - me._isHidden = hide; -} - -// ---------------------------------------------------------------------------- -// Function isRequired() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseOption#isRequired - * @headerfile - * @brief Returns whether the option is mandatory. - * - * @signature bool isRequired(option); - * - * @param option The ArgParseOption object to query. - * - * @return bool true if the option is mandatory and false if it not. - * - * By default, options are not mandatory. - */ - -/** -.Function.ArgParseOption#isRequired -..class:Class.ArgParseOption -..summary:Returns whether the option is mandatory. -..cat:Miscellaneous -..signature:isRequired(option) -..param.option:The @Class.ArgParseOption@ object. -...type:Class.ArgParseOption -..returns:$true$ if the option is mandatory. -..include:seqan/arg_parse.h -*/ - -inline bool isRequired(ArgParseOption const & me) -{ - return me._isRequired; -} - -// ---------------------------------------------------------------------------- -// Function setDefaultValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseOption#setDefaultValue - * @headerfile - * @brief Set the default value for the given option. - * - * @signature void setDefaultValue(option, v); - * - * @param option The ArgParseOption to set the default value for. - * @param v The value to set, (any type that can be streamed into an std::stringstream). - */ - -// TODO(holtgrew): Deprecate in favour of string-only variant? - -/** -.Function.ArgParseOption#setDefaultValue -..summary:Sets the default value for the given option. -..cat:Miscellaneous -..remarks:Note that this overwrites any previously given default values. -..signature:setDefaultValue(option, value) -..param.option:The @Class.ArgParseOption@ object. -...type:Class.ArgParseOption -..param.value:The new default value. -..include:seqan/arg_parse.h -*/ - -template -inline void setDefaultValue(ArgParseOption & me, const TValue & value) -{ - SEQAN_TRY - { - std::stringstream strm; - strm << value; - - // clear old values - me.defaultValue.clear(); - - // add defaultValue - me.defaultValue.push_back(strm.str()); - - // check if all constraints are satisfied - _checkValue(me, strm.str()); - } - SEQAN_CATCH(ParseError & ex) - { - SEQAN_FAIL("Default value does not satisfy the restrictions:\n %s", ex.what()); - } -} - -// ---------------------------------------------------------------------------- -// Function addDefaultValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseOption#addDefaultValue - * @headerfile - * @brief Adds/appends a new value to the list of default values. - * - * @signature void setDefaultValue(option, v); - * - * @param option The ArgParseOption to appen the default value for. - * @param v The value to append, (any type that can be streamed into an std::stringstream). - * - * @section Remarks - * - * This function does not check any length restrictions for this value. - */ - - -/** -.Function.ArgParseOption#addDefaultValue -..summary:Adds/appends a new value to the list of default values. -..cat:Miscellaneous -..remarks:Note that this method does not check any length restrictions for this value. -..signature:addDefaultValue(option, value) -..param.option:The @Class.ArgParseOption@ object. -...type:Class.ArgParseOption -..param.value:The new default value. -..include:seqan/arg_parse.h -*/ - -template -inline void addDefaultValue(ArgParseOption & me, const TValue & value) -{ - SEQAN_TRY - { - std::stringstream strm; - strm << value; - - // add defaultValue - me.defaultValue.push_back(strm.str()); - - // check if all constraints are satisfied - _checkValue(me, strm.str(), me.defaultValue.size() - 1); - } - SEQAN_CATCH(ParseError & ex) - { - SEQAN_FAIL("Default value does not satisfy the restrictions:\n %s", ex.what()); - } -} - -// ---------------------------------------------------------------------------- -// Function setRequired() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseOption#setRequired - * @headerfile - * @brief Sets whether or not the option is mandatory. - * - * @signature void setRequired(option, required); - * - * @param option The ArgParseOption to modify. - * @param required Flag whether the option is mandatory (bool). - * - * By default, options are not mandatory. - */ - -/** -.Function.ArgParseOption#setRequired -..class:Class.ArgParseOption -..summary:Sets whether or not the option is mandatory. -..cat:Miscellaneous -..signature:setRequired(option, required) -..param.option:The @Class.ArgParseOption@ object. -...type:Class.ArgParseOption -..param.required:The new required value of the option. -...type:nolink:bool -..include:seqan/arg_parse.h -*/ - -inline void setRequired(ArgParseOption & me, bool required) -{ - me._isRequired = required; -} - -// ---------------------------------------------------------------------------- -// Function getArgumentLabel() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseOption#getArgumentLabel - * @headerfile - * @brief Returns the argument label. - * - * @signature std::string getArgumentLabel(option); - * - * @param option The ArgParseOption object to query. - * - * @return std::string The argument label string. - */ - -inline std::string const getArgumentLabel(ArgParseOption const & me) -{ - if (isBooleanOption(me)) - return ""; - else - return getArgumentLabel(static_cast(me)); -} - -// ---------------------------------------------------------------------------- -// Function getOptionName() [ArgParseOption] -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseOption#getOptionName - * @headerfile - * @brief Returns the name of the ArgParseOption in a well-formatted way. - * - * @signature std::string getOptionName(option); - * - * @param option The ArgParseOption object to query. - * - * @return std::string The option name string. - */ - -/** - .Function.ArgParseOption#getOptionName - ..class:Class.ArgParseOption - ..summary:Returns the name of the @Class.ArgParseOption@ in a well formated way. - ..cat:Miscellaneous - ..signature:getOptionName(option) - ..param.option:The @Class.ArgParseOption@ object. - ...type:Class.ArgParseOption - ..include:seqan/arg_parse.h - ..returns:The name of the option as well formated string (e.g., -h, --help). - */ -inline std::string getOptionName(ArgParseOption const & me) -{ - std::stringstream stream; - - stream << (empty(me.shortName) ? "" : "-"); - stream << me.shortName; - stream << ((empty(me.shortName) || empty(me.longName) ? "" : ", ")); - if (!empty(me.longName)) - { - stream << "--"; - stream << me.longName; - } - return stream.str(); -} - -// ---------------------------------------------------------------------------- -// Function write() [ArgParseOption] -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgParseOption#write - * @headerfile - * @brief Writes the basic informationa bout the ArgParseOption to the provided stream. - * - * @signature void write(stream, option); - * - * @param stream The @link StreamConcept stream @endlink to write to. - * @param option The ArgParseOption object to write to stream. - */ - -/** -.Function.ArgParseOption#write -..class:Class.ArgParseOption -..summary:Writes the basic information about the @Class.ArgParseOption@ to the provided stream. -..cat:Miscellaneous -..signature:write(stream, option) -..param.stream:The target stream. -..param.option:The @Class.ArgParseOption@ object. -...type:Class.ArgParseOption -..include:seqan/arg_parse.h -*/ - -template -inline void write(TStream & target, ArgParseOption const & me) -{ - streamPut(target, '\t'); - streamPut(target, getOptionName(me)); - streamPut(target, '\t'); - streamPut(target, '\t'); - streamPut(target, me._helpText); -} - -// ---------------------------------------------------------------------------- -// operator<<() [ArgParseOption] -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): We need to work out a consistent scheme with operator<<(). - -template -inline TStream & operator<<(TStream & target, ArgParseOption const & source) -{ - - write(target, source); - return target; -} - -} // namespace seqan - -#endif // SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_OPTION_H_ diff --git a/seqan/arg_parse/arg_parse_parse.h b/seqan/arg_parse/arg_parse_parse.h deleted file mode 100644 index af4941c..0000000 --- a/seqan/arg_parse/arg_parse_parse.h +++ /dev/null @@ -1,376 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Stephan Aiche -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_PARSE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_PARSE_H_ - -#include -#include -#include - -namespace seqan { - -// ---------------------------------------------------------------------------- -// Function parse() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#parse - * @headerfile - * @brief Parse command line parameters. - * - * @signature TResult parse(parser, argc, argv[, outStream, errStream]]); - * - * @param parser The ArgumentParser to use for parsing and for storing parse results. - * @param argc The number of arguments (int). - * @param argv The arguments (const char * argv[]). - * @param outStream The std::ostream to use for output. - * @param errStream The std::ostream to use for error output. - * - * @return TResult The parse result, of type @link ArgumentParser::ParseResult @endlink. - * - * This function must be called before retrieving any options or arguments from the parser. - */ - -/** -.Function.ArgumentParser#parse -..summary:Parses the command line. -..class:Class.ArgumentParser -..cat:Miscellaneous -..signature:parse(parser, argc, argv[, outputStream, errorStream]) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.argc:Count of the objects on the command line. -..param.argv:Array of the different command line arguments ($const char *argv[]$). -..param.errorStream:A stream where error messages are sent to. -..remarks:Must be called before retrieving options or arguments. -..returns:$true$ if all required arguments are set and parseable and neither the help nor version argument is set. -..include:seqan/arg_parse.h -*/ - -// Helper class for parsing command line arguments. -// -// Putting things into its a class allows us to structure the parsing in a fine way. - -class ArgumentParserHelper_ -{ -public: - typedef ArgumentParser::TArgumentMapSize TArgumentPosition; - - // Reference to the ArgumentParser to parse for. - ArgumentParser & parser; - // The argc and argv from the main() method. - int argc; - const char ** argv; - - // The parser's state is stored in the following variables. - - // The special argument "--" is ignored as an option and only arguments can follow. The following flag holds the - // state that this token was seen. - bool seenDashDash; - // The index of the current positional argument. - TArgumentPosition currentArgument; - - ArgumentParserHelper_(ArgumentParser & parser, int argc, const char * argv[]) - : parser(parser), argc(argc), argv(argv), seenDashDash(false), currentArgument(0) - {} - - void reset() - { - seenDashDash = false; - currentArgument = 0; - } - - // Perform the argument parsing. - void parseArgs() - { - reset(); // reset state - - // Parse binary name from command line if it was not set. - if (empty(getAppName(parser))) - _parseAppName(parser, argv[0]); - - for (int argi = 1; argi < argc; ++argi) - { - if (seenDashDash || strlen(argv[argi]) == 0 || argv[argi][0] != '-') - // Handle as position argument if we have seen "--" or does not start with dash. - handleArgument(argv[argi]); - else if (strcmp(argv[argi], "--") == 0) - // If this is "--" then ignore the argument itself but set the seen flag for it. - seenDashDash = true; - else - // This is an option. - handleOption(argi, argv[argi]); - } - } - -private: - - // Handle the given string as an argument. - // - // Throw ParseError in case of too many arguments. - void handleArgument(char const * argStr) - { - // Check whether we have the largest number of allowed arguments already. - if (parser.argumentList.size() <= currentArgument) - SEQAN_THROW(ParseError("Too many arguments!")); - - ArgParseArgument & argument = getArgument(parser, currentArgument); - _assignArgumentValue(argument, argStr); - - if (!isListArgument(argument)) - ++currentArgument; - } - - // Handle the given string as an option. - // - // Throw InvalidOption if there is a formal error (== "-") or invalid option naparser. - // - // Throw MissingArgument in case of --key=value option but the option requires multiple values. - void handleOption(int & argi, std::string arg) - { - if (arg == "-") - SEQAN_THROW(InvalidOption("-")); - - if (arg[1] == '-') - handleLongOption(argi, arg); - else - handleShortOption(argi, arg); - } - - // Handle the given string as a long option. - void handleLongOption(int & argi, std::string const & arg) - { - // We will store the option name and the value in these variables. - std::string longOpt = arg; - std::string val; - - // Split option in case of --key=value format. - size_t t = arg.find('='); - if (t != std::string::npos) // is --key=value option - { - val = arg.substr(t + 1); - longOpt = arg.substr(0, t); - } - longOpt.erase(0, 2); - - // Guard against invalid option names. - if (!hasOption(parser, longOpt)) - SEQAN_THROW(InvalidOption(longOpt)); - - // Parse out the values for the option from the command line arguments. - ArgParseOption & opt = getOption(parser, longOpt); - if (t != std::string::npos) // was --key=value option - { - // We can only assign one value in this case. If the option expected more than one value then this is an - // error. - if (numberOfAllowedValues(opt) != 1) - SEQAN_THROW(MissingArgument(longOpt)); - // If everything is fine then we can assign the value to the option. - _assignArgumentValue(opt, val); - } - else if (isBooleanOption(opt)) - { - // Handling boolean options is simple. - _assignArgumentValue(opt, "true"); - } - else - { - // If we reach here, we have a --key value option and might require multiple values. - - // Guard against missing values. - if (argi + (int)numberOfAllowedValues(opt) >= argc) - SEQAN_THROW(MissingArgument(longOpt)); - // We have sufficient values, get them from argv and assign them to the option. - for (int t = 0; t < (int)numberOfAllowedValues(opt); ++t) - _assignArgumentValue(opt, argv[++argi]); - } - } - - // Handle the given string as a short option. - void handleShortOption(int & argi, std::string const & arg) - { - // Parse out the short option. This is made complicated because the user can concatenate multiple short options - // into one. NB: we do not check for and warn about possible ambiguities. - // - // We enumerate the possible option names starting from left to right, then sorted descendingly by length. - // Boolean options can be squished together in this way without further restrictions. If the option requires - // additional arguments then it has to be the last in the short options. - - for (unsigned s = 1; s < arg.size(); ++s) - { - unsigned e = arg.size(); - for (; s < e; --e) - { - if (hasOption(parser, arg.substr(s, e - s))) - { - ArgParseOption & opt = getOption(parser, arg.substr(s, e - s)); - s = --e; // advance in squished options; s > e if at end - - // Boolean options are easy to handle. - if (isBooleanOption(opt)) - { - _assignArgumentValue(opt, "true"); - continue; - } - - // Handle option with values. - if (e < arg.size() - 1) - { - std::stringstream what; - what << "invalid combination of arguments -- " << arg << std::endl; - SEQAN_THROW(ParseError(what.str())); - } - - // Handle the case of too few options. - if (argi + (int)numberOfAllowedValues(opt) >= argc) - SEQAN_THROW(MissingArgument(opt.shortName)); - - // Assign the required option value.s - for (int t = 0; t < (int)numberOfAllowedValues(opt); ++t) - _assignArgumentValue(opt, argv[++argi]); - } - } - - // No option was found. - if (s == e) - SEQAN_THROW(InvalidOption(arg.substr(s))); - } - } -}; - -// Parser driver function. -inline ArgumentParser::ParseResult parse(ArgumentParser & me, - int argc, - const char * argv[], - std::ostream & outputStream, - std::ostream & errorStream) -{ - SEQAN_TRY - { - // Perform the parsing without any valid value checking on the argument values. - ArgumentParserHelper_ parserHelper(me, argc, argv); - parserHelper.parseArgs(); - - // Copy the file extensions from the "--${NAME}-file-ext" options to "--${NAME}". - for (unsigned i = 0; i < me.optionMap.size(); ++i) - { - ArgParseOption & opt = me.optionMap[i]; - std::string longExtName = opt.longName + "-file-ext"; - std::string shortExtName = opt.shortName + "-file-ext"; - if (!opt.longName.empty() && hasOption(me, longExtName)) - opt._fileExtensions = getArgumentValues(getOption(me, longExtName)); - else if (!opt.shortName.empty() && hasOption(me, shortExtName)) - opt._fileExtensions = getArgumentValues(getOption(me, longExtName)); - } - // Copy the file extensions from the "--arg-${NUM}-file-ext" options to the argument. - for (unsigned i = 0; i < me.argumentList.size(); ++i) - { - ArgParseArgument & arg = me.argumentList[i]; - std::stringstream ss; - ss << "arg-" << (i + 1) << "-file-ext"; - if (hasOption(me, ss.str())) - arg._fileExtensions = getArgumentValues(getOption(me, ss.str())); - } - - // Check all arguments for their values. - for (unsigned i = 0; i < me.optionMap.size(); ++i) - _checkValue(me.optionMap[i]); - for (unsigned i = 0; i < me.argumentList.size(); ++i) - _checkValue(me.argumentList[i]); - } - SEQAN_CATCH(ParseError & ex) - { - errorStream << getAppName(me) << ": " << ex.what() << std::endl; - return ArgumentParser::PARSE_ERROR; - } - - // Handle the special options. - if (hasOption(me, "version") && isSet(me, "version")) - { - printVersion(me, outputStream); - return ArgumentParser::PARSE_VERSION; - } - else if (hasOption(me, "write-ctd") && isSet(me, "write-ctd")) - { - if (writeCTD(me)) - return ArgumentParser::PARSE_WRITE_CTD; - else - return ArgumentParser::PARSE_ERROR; - } - else if (isSet(me, "help")) - { - printHelp(me, outputStream); - return ArgumentParser::PARSE_HELP; - } - else if (isSet(me, "export-help")) - { - std::string format; - getOptionValue(format, me, "export-help"); - printHelp(me, outputStream, format); - return ArgumentParser::PARSE_EXPORT_HELP; - } - else if (argc == 1 && (me.argumentList.size() > 0 || !_allRequiredSet(me))) - { - // print short help and exit - printShortHelp(me, errorStream); - return ArgumentParser::PARSE_HELP; - } - - // In case that everything is fine, we can now return OK. - if (_allRequiredSet(me) && _allArgumentsSet(me)) - return ArgumentParser::PARSE_OK; - - // Otherwise, we check which options missed values. - if (!_allRequiredSet(me)) - for (unsigned o = 0; o < length(me.optionMap); ++o) - if (!isSet(me.optionMap[o]) && isRequired(me.optionMap[o])) - errorStream << getAppName(me) << ": Missing value for option: " << getOptionName(me.optionMap[o]) << std::endl; - // and arguments - if (!_allArgumentsSet(me)) - errorStream << getAppName(me) << ": Not enough arguments were provided." << std::endl; - errorStream << "Try '" << getAppName(me) << " --help' for more information.\n"; - return ArgumentParser::PARSE_ERROR; -} - -inline ArgumentParser::ParseResult parse(ArgumentParser & me, - int argc, - const char * argv[]) -{ - return parse(me, argc, argv, std::cout, std::cerr); -} - -} // namespace seqan - -#endif // SEQAN_CORE_INCLUDE_SEQAN_ARG_PARSE_ARG_PARSE_PARSE_H_ diff --git a/seqan/arg_parse/arg_parse_type_support.h b/seqan/arg_parse/arg_parse_type_support.h deleted file mode 100644 index 771bcdc..0000000 --- a/seqan/arg_parse/arg_parse_type_support.h +++ /dev/null @@ -1,190 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Stephan Aiche -// ========================================================================== - -// TODO(aiche): check if parts of the functionality could be merged with lexicalCast in stream module - -#ifndef SEQAN_CORE_INCLUDE_ARG_PARSE_ARG_PARSE_TYPE_SUPPRT_H_ -#define SEQAN_CORE_INCLUDE_ARG_PARSE_ARG_PARSE_TYPE_SUPPRT_H_ - -#include -#include - -#include - -namespace seqan { - -// ---------------------------------------------------------------------------- -// Function _tryCast() -// ---------------------------------------------------------------------------- -template -inline bool _tryCast(TTarget & dest, TString const source) -{ - std::istringstream stream(toCString(source)); - bool result = (!(stream >> dest).fail()) && (stream.rdbuf()->in_avail() == 0); - return result; -} - -// ---------------------------------------------------------------------------- -// Function _cast() -// ---------------------------------------------------------------------------- -template -inline TTarget _cast(TString const s) -{ - // We are sing additional braces here for "most vexing parse" resolution - // when enforcing default initialization also for built-in types. - TTarget dst((TTarget())); - std::istringstream stream(toCString(s)); - bool result = (!(stream >> dst).fail()) && (stream.rdbuf()->in_avail() == 0); - SEQAN_CHECK(result, "could not cast %s", toCString(s)); - return dst; -} - -// ---------------------------------------------------------------------------- -// Function _isCastable() -// ---------------------------------------------------------------------------- -template -inline bool _isCastable(TString const s) -{ - TTarget dst; - std::istringstream stream(toCString(s)); - return (!(stream >> dst).fail()) && (stream.rdbuf()->in_avail() == 0); -} - -// ---------------------------------------------------------------------------- -// Function _isDouble() -// ---------------------------------------------------------------------------- - -template -inline bool _isDouble(TString const s) -{ - return _isCastable(s); -} - -// ---------------------------------------------------------------------------- -// Function _isInt() -// ---------------------------------------------------------------------------- - -template -inline bool _isInt(TString const s) -{ - return _isCastable(s); -} - -// ---------------------------------------------------------------------------- -// Function _convertOptionValue() -// ---------------------------------------------------------------------------- - -class ArgParseOption; -inline bool isBooleanOption(ArgParseOption const & me); - -inline bool _convertArgumentValue(bool & dst, ArgParseOption const & opt, std::string const & src) -{ - if (!isBooleanOption(opt)) - return false; - - dst = !empty(src) && (src != "false"); - return true; -} - -// ---------------------------------------------------------------------------- -// Function _convertArgumentValue() -// ---------------------------------------------------------------------------- - -class ArgParseArgument; -inline bool isIntegerArgument(ArgParseArgument const & me); -inline bool isInt64Argument(ArgParseArgument const & me); -inline bool isDoubleArgument(ArgParseArgument const & me); -inline bool isStringArgument(ArgParseArgument const & me); - -inline bool _convertArgumentValue(int & dst, ArgParseArgument const & opt, std::string const & src) -{ - if (!isIntegerArgument(opt)) - return false; - - return _tryCast(dst, src); -} - -inline bool _convertArgumentValue(unsigned int & dst, ArgParseArgument const & opt, std::string const & src) -{ - if (!isIntegerArgument(opt)) - return false; - - return _tryCast(dst, src); -} - -inline bool _convertArgumentValue(__int64 & dst, ArgParseArgument const & opt, std::string const & src) -{ - if (!isIntegerArgument(opt) && !isInt64Argument(opt)) - return false; - - return _tryCast(dst, src); -} - -inline bool _convertArgumentValue(__uint64 & dst, ArgParseArgument const & opt, std::string const & src) -{ - if (!isIntegerArgument(opt) && !isInt64Argument(opt)) - return false; - - return _tryCast(dst, src); -} - -inline bool _convertArgumentValue(float & dst, ArgParseArgument const & opt, std::string const & src) -{ - if (!isDoubleArgument(opt)) - return false; - - return _tryCast(dst, src); -} - -inline bool _convertArgumentValue(double & dst, ArgParseArgument const & opt, std::string const & src) -{ - if (!isDoubleArgument(opt)) - return false; - - return _tryCast(dst, src); -} - -template -inline bool _convertArgumentValue(TObject & dst, ArgParseArgument const & opt, std::string const & src) -{ - if (!isStringArgument(opt)) - return false; - - assign(dst, src); - return true; -} - -} // namespace seqan - -#endif // SEQAN_CORE_INCLUDE_ARG_PARSE_ARG_PARSE_TYPE_SUPPRT_H_ diff --git a/seqan/arg_parse/argument_parser.h b/seqan/arg_parse/argument_parser.h deleted file mode 100644 index 674fc03..0000000 --- a/seqan/arg_parse/argument_parser.h +++ /dev/null @@ -1,1478 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_ARG_PARSE_ARGUMENT_PARSER_H_ -#define SEQAN_CORE_INCLUDE_ARG_PARSE_ARGUMENT_PARSER_H_ - -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - -namespace seqan { - -// ========================================================================== -// Forwards -// ========================================================================== - -// friend declaration to make addOption() and hideOption() available -// in ArgumentParser::init() -class ArgumentParser; -class ArgParseOption; -void addOption(ArgumentParser & me, ArgParseOption const & opt); -void hideOption(ArgumentParser & me, std::string const & name, bool hide); -void setValidValues(ArgumentParser & me, std::string const & name, std::string const & values); - -// Required in addOption() and addArgument(). -inline void hideOption(ArgumentParser & me, std::string const & name, bool hide = true); -inline ArgParseOption & getOption(ArgumentParser & me, std::string const & name); -inline void setValidValues(ArgumentParser & me, std::string const & name, std::vector const & values); -inline ArgParseArgument & getArgument(ArgumentParser & me, unsigned position); - -// ========================================================================== -// Tags, Classes, Enums -// ========================================================================== - -/*! - * @class ArgumentParser - * @headerfile - * @brief Parse the command line. - * - * @signature class ArgumentParser; - * - * Options are stored as @link ArgParseOption @endlink and @link ArgParseArgument @endlink objects. - * - * @section Remarks - * - * See the documentation of @link ToolDoc @endlink on how to format text. Wherever possible, formatting is added - * automatically for you. You have to use formatting in the following places: (1) usage lines, (2) option help texts, - * (3) description and additional text sections. - * - * @section Examples - * - * The following gives a simple example of how to use the ArgumentParser class. - * - * @include demos/arg_parse/argument_parser.cpp - * - * @code{.console} - * $ demo_arg_parse_argument_parser in.fa out.txt --id 0 - * Built target seqan_core - * Built target demo_arg_parse - * Verbose: off - * Identity: 0 - * Input-File: in.fa - * Output-File: out.txt - * @endcode - * - * @see ArgParseArgument - * @see ArgParseOption - * @see ToolDoc - */ - -/*! - * @fn ArgumentParser::ArgumentParser - * @brief Constructor - * - * @signature ArgumentParser::ArgumentParser([appName]); - * - * @param appName The name of the application (std::string), defaults to argv[0]. - */ - -/*! - * @enum ArgumentParser::ParseResult - * @brief Argument parsing result. - * - * @signature enum ArgumentParser::ParseResult; - * - * @var ArgumentParser::ParseResult ArgumentParser::PARSE_OK; - * @brief Parsing the program's arguments was successful and no builtin command was triggered. - * - * @var ArgumentParser::ParseResult ArgumentParser::PARSE_ERROR; - * @brief There were errors parsing the arguments. - * - * @var ArgumentParser::ParseResult ArgumentParser::PARSE_HELP; - * @brief Parsing was successful, built-in --help option was used. - * - * @var ArgumentParser::ParseResult ArgumentParser::PARSE_VERSION; - * @brief Parsing was successful, built-in --version option was used. - * - * @var ArgumentParser::ParseResult ArgumentParser::PARSE_WRITE_CTD; - * @brief Parsing was successful, built-in --write-ctd option was used. - * - * @var ArgumentParser::ParseResult ArgumentParser::PARSE_EXPORT_HELP; - * @brief Parsing was successful, built-in --export-help option was used. - */ - -/** -.Class.ArgumentParser -..cat:Miscellaneous -..summary:Stores multiple @Class.ArgParseOption@ objects and parses the command line arguments for these options. -..signature:ArgumentParser -..include:seqan/arg_parse.h -..remarks: -See the documentation of @Class.ToolDoc@ on how to format text. -Where possible, formatting is added automatically for you. -You have to use formatting in the following places: (1) usage lines, (2) option help texts, (3) description and additional text sections. -..example.text: -The following gives a simple example of how to use the @Class.ArgumentParser@. -..example.code: -ArgumentParser parser("alf"); -setShortDescription(parser, "Alignment free sequence comparison"); -setVersion(parser, "1.0"); -setDate(parser, "Jan 2010"); - -addUsageLine(parser, "[\\fIOPTIONS\\fP] \\fB-i\\fP \\fIIN\\fP \\fB-o\\fP \\fIOUT\\fP"); - -addDescription(parser, - "ALF can be used to calculate the pairwise similarity of sequences " - "using alignment-free methods. All methods which are implemented are " - "based on k-mer counts."); - -addOption(parser, ArgParseOption("i", "inputFile", "Name of the multi-FASTA input.", - ArgParseArgument(ArgParseArgument::INPUTFILE, "IN"))); -setRequired(parser, "i"); - -addOption(parser, ArgParseOption("o", "outputFile", "Name of the multi-FASTA input.", - ArgParseArgument(ArgParseArgument::OUTPUTFILE, "OUT"))); -setRequired(parser, "o"); - -addTextSection(parser, "See Also"); -addText(parser, "http://www.seqan.de/projects/alf"); -..see:Class.ToolDoc -..see:Class.ArgParseArgument -..see:Class.ArgParseOption - -.Memfunc.ArgumentParser#ArgumentParser -..class:Class.ArgumentParser -..summary:Constructor -..signature:ArgumentParser () -..signature:ArgumentParser (applicationName) -..param.applicationName:A std::string containing the name of the application. -..remarks:If the name of the application is not passed to the constructor it will be extracted from the command line. -*/ - -class ArgumentParser -{ -public: - - // ---------------------------------------------------------------------------- - // Enum ParseResult - // ---------------------------------------------------------------------------- - - // will be used as return value of parse(..) to indicate whether parsing worked - enum ParseResult - { - PARSE_OK, - PARSE_ERROR, - PARSE_HELP, - PARSE_VERSION, - PARSE_WRITE_CTD, - PARSE_EXPORT_HELP - }; - - // ---------------------------------------------------------------------------- - // Class Typedefs - // ---------------------------------------------------------------------------- - - typedef std::vector TOptionMap; - typedef std::vector TArgumentMap; - typedef Size::Type TOptionMapSize; - typedef Size::Type TArgumentMapSize; - - typedef std::map TStringMap; - typedef std::vector TValueMap; - - // ---------------------------------------------------------------------------- - // Mapping of option names to options - // ---------------------------------------------------------------------------- - - TStringMap shortNameMap; - TStringMap longNameMap; - TOptionMap optionMap; - TArgumentMap argumentList; - - // ---------------------------------------------------------------------------- - // Documentation Members - // ---------------------------------------------------------------------------- - - ToolDoc _toolDoc; // the tool doc for all user specified - // text - std::vector _description; // the description which we need to - // separate to put it on top of the rest - std::vector _usageText; // the usage lines as strings, to avoid - // interference with the rest of the doc - - // ---------------------------------------------------------------------------- - // Function init() - // ---------------------------------------------------------------------------- - - void init() - { - addOption(*this, ArgParseOption("h", "help", "Displays this help message.")); - - // hidden flags used for export of man pages and ctd formats - addOption(*this, ArgParseOption("", - "write-ctd", - "Exports the app's interface description to a .ctd file.", - ArgParseArgument::OUTPUTFILE)); - hideOption(*this, "write-ctd", true); - - addOption(*this, ArgParseOption("", - "export-help", - "Export help to a format. One of {'html', 'man', 'txt'}.", - ArgParseArgument::STRING, - "FORMAT")); - hideOption(*this, "export-help", true); - setValidValues(*this, "export-help", "html man txt"); - } - - // ---------------------------------------------------------------------------- - // Constructors - // ---------------------------------------------------------------------------- - - ArgumentParser() - { - init(); - } - - ArgumentParser(std::string const & _appName) - { - setName(_toolDoc, _appName); - init(); - } - -}; - -// ========================================================================== -// Metafunctions -// ========================================================================== - -// ========================================================================== -// Functions -// ========================================================================== - -// ---------------------------------------------------------------------------- -// Function hasOption() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#hasOption - * @headerfile - * @brief Query whether a certain option is registered in the parser. - * - * @signature bool hasOption(parser, name); - * - * @param parser The ArgumentParser to query. - * @param name The name to query for (std::string). - * - * @return bool true if there is such an option, false otherwise. - */ - -/** -.Function.ArgumentParser#hasOption -..class:Class.ArgumentParser -..summary:Returns whether a certain option is registered in the parser. -..cat:Miscellaneous -..signature:hasOption(parser, optionIdentifier) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionIdentifier:A @Shortcut.CharString@ that identifies the option. -..returns:$true$ if the option is registered. -..include:seqan/arg_parse.h -*/ - -inline bool hasOption(ArgumentParser const & me, std::string const & name) -{ - return hasKey(me.shortNameMap, name) || hasKey(me.longNameMap, name); -} - -// ---------------------------------------------------------------------------- -// Function addOption() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#addOption - * @headerfile - * @brief Adds an @link ArgParseOption @endlink to an ArgumentParser. - * - * @signature void addOption(parser, option); - * - * @param parser The ArgumentParser to add the option to. - * @param option The ArgParseOption to add to parser. - */ - -/** -.Function.ArgumentParser#addOption -..class:Class.ArgumentParser -..summary:Adds a @Class.ArgParseOption@ object to the @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:addOption(parser, option) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.option:The new @Class.ArgParseOption@ object that should be added. -...type:Class.ArgParseOption -..include:seqan/arg_parse.h -*/ - -inline void _copyValidValuesToFileExt(ArgumentParser & me, std::string const & name) -{ - // Copy valid values, remove leading dots. - ArgParseOption & option = getOption(me, name); - if (isInputFileArgument(option) || isOutputFileArgument(option)) - { - std::string longName = option.longName.empty() ? option.shortName : option.longName; - longName += "-file-ext"; - std::vector validValues = option.validValues; - for (unsigned i = 0; i < length(validValues); ++i) - if (!validValues[i].empty() && validValues[i][0] == '.') - validValues[i].erase(0, 1); - setValidValues(me, longName, validValues); - } -} - -inline void addOption(ArgumentParser & me, ArgParseOption const & opt) -{ - // check if an option with the same identifiers was already registered - SEQAN_CHECK(!hasOption(me, opt.shortName), "There already is an option with the name %s!", toCString(opt.shortName)); - SEQAN_CHECK(!hasOption(me, opt.longName), "There already is an option with the name %s!", toCString(opt.longName)); - - // finally append the option - appendValue(me.optionMap, opt); - - if (!empty(opt.shortName)) - me.shortNameMap.insert(std::make_pair(opt.shortName, length(me.optionMap) - 1)); - if (!empty(opt.longName)) - me.longNameMap.insert(std::make_pair(opt.longName, length(me.optionMap) - 1)); - - // handle the case of input and output option: add a string option --${name}-file-ext. - if (isInputFileArgument(opt) || isOutputFileArgument(opt)) - { - std::string longName = opt.longName.empty() ? opt.shortName : opt.longName; - longName += "-file-ext"; - std::string helpText = "Override file extension for --"; - helpText += opt.longName; - - // Add option, copy list argument, number of allowed values. - addOption(me, ArgParseOption("", longName, helpText, ArgParseOption::STRING, "EXT", - isListArgument(opt), numberOfAllowedValues(opt))); - getOption(me, longName.c_str()).tags.push_back("file-ext-override"); - getOption(me, longName.c_str()).tags.push_back("gkn-ignore"); - // Hide option. - hideOption(me, longName); - // Copy valid values, remove leading dots. - _copyValidValuesToFileExt(me, opt.longName); - } -} - -// ---------------------------------------------------------------------------- -// Function addArgument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#addArgument - * @headerfile - * @brief Adds an @link ArgParseArgument @endlink to an ArgumentParser. - * - * @signature void addArgument(parser, arg); - * - * @param parser The ArgumentParser to add the argument to. - * @param arg The ArgParseArgument to add to parser. - */ - -/** -.Function.ArgumentParser#addArgument -..class:Class.ArgumentParser -..summary:Adds a @Class.ArgParseArgument@ object to the @Class.ArgumentParser@. -..cat:Miscellaneous -..signature:addArgument(parser, argument) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.arg:The new @Class.ArgParseArgument@ object that should be added. -...type:Class.ArgParseArgument -..include:seqan/arg_parse.h -*/ - -inline void _copyValidValuesToFileExt(ArgumentParser & me, unsigned no) -{ - // Copy valid values, remove leading dots. - ArgParseArgument & arg = getArgument(me, no); - if (isInputFileArgument(arg) || isOutputFileArgument(arg)) - { - std::stringstream longNameSS; - longNameSS << "arg-" << (no + 1) << "-file-ext"; - std::string longName = longNameSS.str(); - std::vector validValues = arg.validValues; - for (unsigned i = 0; i < length(validValues); ++i) - if (!validValues[i].empty() && validValues[i][0] == '.') - validValues[i].erase(0, 1); - setValidValues(me, longName, validValues); - } -} - -inline void addArgument(ArgumentParser & me, ArgParseArgument const & arg) -{ - // check previous arguments - // .. lists can only be last argument - if (!me.argumentList.empty()) - { - SEQAN_CHECK(!isListArgument(me.argumentList[me.argumentList.size() - 1]), - "You cannot add an additional argument after a list argument."); - } - - // check current argument - // .. arguments should not have default values - SEQAN_CHECK(arg.defaultValue.empty(), "Arguments cannot have default values."); - SEQAN_CHECK(arg._numberOfValues == 1, "n-Tuple of arguments are not supported."); - - me.argumentList.push_back(arg); - - // handle the case of input and output option: add a string option --${name}-file-ext. - if (isInputFileArgument(arg) || isOutputFileArgument(arg)) - { - std::stringstream longNameSS; - longNameSS << "arg-" << me.argumentList.size() << "-file-ext"; - std::string longName = longNameSS.str(); - std::stringstream helpTextSS; - helpTextSS << "Override file extension for argument " << me.argumentList.size(); - std::string helpText = helpTextSS.str(); - - // Add option, copy list argument, number of allowed values. - addOption(me, ArgParseOption("", longName, helpText, ArgParseOption::STRING, "EXT", - isListArgument(arg), numberOfAllowedValues(arg))); - getOption(me, longName.c_str()).tags.push_back("file-ext-override"); - getOption(me, longName.c_str()).tags.push_back("gkn-ignore"); - // Hide option. - hideOption(me, longName); - // Copy valid values, remove leading dots. - _copyValidValuesToFileExt(me, me.argumentList.size() - 1); - } -} - -// ---------------------------------------------------------------------------- -// Function _getOptionIndex() -// ---------------------------------------------------------------------------- -// note that it is assumed that the option exists if this method is called - -inline ArgumentParser::TOptionMapSize _getOptionIndex(ArgumentParser const & me, - std::string const & name) -{ - ArgumentParser::TOptionMapSize option_index; - if (me.shortNameMap.find(name) != me.shortNameMap.end()) - { - option_index = me.shortNameMap.find(name)->second; - } - else - { - option_index = me.longNameMap.find(name)->second; - } - return option_index; -} - -// ---------------------------------------------------------------------------- -// Function getOption() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getOption - * @headerfile - * @brief Returns a reference to the specified option. - * - * @signature TOption getOption(parser, name); - * - * @param parser The parser to query. - * @param name The short or long name of the option (std::string). - * - * @return TOption Reference to the @link ArgParseOption @endlink with the given short or long name. - */ - -/** -.Function.ArgumentParser#getOption -..class:Class.ArgumentParser -..summary:Returns a reference to the specified option. -..cat:Miscellaneous -..signature:getOption(parser, optionName) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionName:The identifier of the command line option. -..returns: a reference to the specified @Class.ArgParseOption@ object. -..include:seqan/arg_parse.h -*/ - -inline ArgParseOption & getOption(ArgumentParser & me, std::string const & name) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - return me.optionMap[_getOptionIndex(me, name)]; -} - -inline ArgParseOption const & getOption(ArgumentParser const & me, std::string const & name) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - return me.optionMap[_getOptionIndex(me, name)]; -} - -// ---------------------------------------------------------------------------- -// Function setRequired() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#setRequired - * @headerfile - * @brief Sets whether or not the option with the givne name is mandatory. - * - * @signature void setRequired(parser, name[, required]). - * - * @param parser The ArgumentParser to set the flag of. - * @param name The short or long name of the option (std::string). - * @param required Whether or not the option is required (bool, default to true). - */ - -/** -.Function.ArgumentParser#setRequired -..class:Class.ArgumentParser -..summary:Sets whether or not the option defined by the parameter $name$ (which can be - either the short or the long name) is mandatory. -..remarks: Note that the empty string is, at least for string options, also a valid string. -Hence setting an option to required does not guarantee that the returned string is not empty. -..cat:Miscellaneous -..signature:setRequired(parser, optionName [, required]) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionName:The identifier of the command line option. -..param.required.remarks: The default value is true. -..include:seqan/arg_parse.h -*/ - -inline void setRequired(ArgumentParser & me, std::string const & name, bool required = true) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - setRequired(getOption(me, name), required); -} - -// ---------------------------------------------------------------------------- -// Function hideOption() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#hideOption - * @headerfile - * @brief Hides the ArgParseOption with the given name. - * - * @signature void hideOption(parser, name[, hide]). - * - * @param parser The ArgParseOption to the the hidden flag of. - * @param name The short or long name of the option to modify. - * @param hide Whether or not to hide the flag (bool, defaults to true). - */ - -/** -.Function.ArgumentParser#hideOption -..class:Class.ArgumentParser -..summary:Hides the ArgParseOption defined by the parameter $name$ (which can be - either the short or the long name) from the help screen. -..cat:Miscellaneous -..signature:hideOption(parser, optionName [, hide]) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionName:The identifier of the command line option. -..param.hide:The new visibility of the option. Default is false. -...type:nolink:bool -..include:seqan/arg_parse.h -*/ - -inline void hideOption(ArgumentParser & me, std::string const & name, bool hide) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - hideOption(getOption(me, name), hide); -} - -// ---------------------------------------------------------------------------- -// Function getArgument() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getArgument - * @headerfile - * @brief Returns a reference to the given positional argument. - * - * @signature TArgument getArgument(parser, pos); - * - * @param parser The ArgumentParser to query. - * @param pos The position of the argument to return (unsigned, starting at 0). - * - * @return TArgument Reference to the argument with the given position. - */ - -/** -.Function.ArgumentParser#getArgument -..class:Class.ArgumentParser -..summary:Returns a reference to the specified argument. -..cat:Miscellaneous -..signature:getArgument(parser, argumentPosition) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.argumentPosition:The index of the argument in the argument list. -..returns: a reference to the specified @Class.ArgParseArgument@ object. -..include:seqan/arg_parse.h -*/ - -inline ArgParseArgument & getArgument(ArgumentParser & me, unsigned position) -{ - SEQAN_CHECK(position < me.argumentList.size(), - "ArgumentParser: Only %d arguments available", me.argumentList.size()); - return me.argumentList[position]; -} - -inline ArgParseArgument const & getArgument(ArgumentParser const & me, unsigned position) -{ - SEQAN_CHECK(position < me.argumentList.size(), - "ArgumentParser: Only %d arguments available", me.argumentList.size()); - return me.argumentList[position]; -} - -// ---------------------------------------------------------------------------- -// Function isSet() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#isSet - * @headerfile - * @brief Query whether an option was set on the command line. - * - * @signature bool isSet(parser, name); - * - * @param parser The ArgumentParser to query. - * @param name The short or long name of the option (std::string). - * - * @return bool Whether or not the option was set on the command line or not. - */ - -/** -.Function.ArgumentParser#isSet -..class:Class.ArgumentParser -..summary:Returns whether an option was set on the parsed command line. -..cat:Miscellaneous -..signature:isSet(parser,optionIdentifier) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionIdentifier:A std::string that identifies the option (either short or long name). -..returns:$true$ if the option was set. -..include:seqan/arg_parse.h -*/ - -inline bool isSet(ArgumentParser const & me, std::string const & name) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - return isSet(getOption(me, name)); -} - -// ---------------------------------------------------------------------------- -// Function hasDefault() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#hasDefault - * @headerfile - * @brief Query whether an option has a default value. - * - * @signature bool hasDefault(parser, name); - * - * @param parser The ArgumentParser to query. - * @param name The short or long name of the option (std::string). - * - * @return bool Whether or not the option has a default value. - */ - -/** -.Function.ArgumentParser#hasDefault -..summary:Returns whether an option has a default value or not. -..cat:Miscellaneous -..signature:hasDefault(parser,optionIdentifier) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionIdentifier:A std::string that identifies the option (either short or long name). -..returns:$true$ if the option has a default value, $false$ otherwise. -..include:seqan/arg_parse.h -*/ - -inline bool hasDefault(ArgumentParser const & me, std::string const & name) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - return hasDefault(getOption(me, name)); -} - -// ---------------------------------------------------------------------------- -// Function _allRequiredSet() -// ---------------------------------------------------------------------------- - -inline bool _allRequiredSet(ArgumentParser const & me) -{ - for (unsigned o = 0; o < length(me.optionMap); ++o) - if (!isSet(me.optionMap[o]) && isRequired(me.optionMap[o])) - return false; - - return true; -} - -// ---------------------------------------------------------------------------- -// Function _allArgumentsSet() -// ---------------------------------------------------------------------------- - -inline bool _allArgumentsSet(ArgumentParser const & me) -{ - for (unsigned a = 0; a < me.argumentList.size(); ++a) - if (!isSet(me.argumentList[a])) - return false; - - return true; -} - -// ---------------------------------------------------------------------------- -// Function getOptionValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getOptionValue - * @headerfile - * @brief Retrieve the value of an option. - * - * @signature bool getOptionValue(dest, parser, name[, pos]); - * - * @param dest The variable to write the result to (the type is a template parameter and the value type of the option - * must be convertible in the type of dest for the retrieval to work, also see result value). - * @param parser The ArgumentParser to get the value from. - * @param name The short or long name of the option (std::string). - * @param pos Optional position for multi-value options (unsigned, defaults to 0). - * - * @return bool true if the requested option was given on the command line and could be coverted to the type of - * dest. - */ - -/** -.Function.ArgumentParser#getOptionValue -..class:Class.ArgumentParser -..summary:Retrieves the value of an option given either the short or long name. -..cat:Miscellaneous -..signature:getOptionValue(value, parser, optionIdentifier[, argNo]) -..param.value:The variable where the resulting value should be stored. -...remarks:The type of $value$ must be compatible the option type. -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionIdentifier:A std::string that is either the short or long name of the option. -..param.argNo:If the option is list, the $argNo$-th list element is returned. -..returns: $true$ if the requested option is set and has the requested type, $false$ otherwise. -..remarks:The value passed to the method (value) was only updated if the method returns $true$. -..include:seqan/arg_parse.h -*/ - -template -inline bool getOptionValue(TValue & val, - ArgumentParser const & me, - std::string const & name, - unsigned argNo) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - - if (isSet(me, name) || hasDefault(me, name)) - return _convertArgumentValue(val, - getOption(me, name), - getArgumentValue(getOption(me, name), argNo)); - else - return false; -} - -template -inline bool getOptionValue(TValue & val, - ArgumentParser const & me, - std::string const & name) -{ - return getOptionValue(val, me, name, 0); -} - -// ---------------------------------------------------------------------------- -// Function getOptionFileExtension() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getOptionFileExtension - * @headerfile - * @brief Retrieve the file extension of a file option. - * - * @signature std::string getOptionFileExtension(parser, name[, pos]); - * - * Can be overridden by --${name}-file-ext. - * - * @param parser The ArgumentParser to get the value from. - * @param name The short or long name of the option (std::string). - * @param pos Optional position for multi-value options (unsigned, defaults to 0). - * - * @return std::string The extension of the option. Empty if not set or no extension. - */ - -/** -.Function.ArgumentParser#getOptionFileExtension -..class:Class.ArgumentParser -..summary:Returns the extension of a file option. -..cat:Miscellaneous -..signature:std::string getOptionFileExtension(parser, name[, argNo]); -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParsre -..param.name:The name of the option. -..param.argNo:An optional index for multi-value options. -...type:nolink:$unsigned$ -..returns:A $std::string$ with the extension. Empty if no extension or empty value. -*/ - -inline std::string getOptionFileExtension(ArgumentParser const & me, - std::string const & name, - unsigned argNo = 0) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - - return getFileExtension(getOption(me, name), argNo); -} - -// ---------------------------------------------------------------------------- -// Function getOptionValueCount() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getOptionValueCount - * @headerfile - * @brief Query number of values stored for the specified option. - * - * @signature unsigned getOptionValueCount(parser, name); - * - * @param parser The ArgumentParser to query. - * @param name The short or long name of the option (string). - */ - -/** -.Function.ArgumentParser#getOptionValueCount -..class:Class.ArgumentParser -..summary:Returns the number of values stored in the specified option. -..cat:Miscellaneous -..signature:getOptionValueCount(parser, optionIdentifier) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionIdentifier:A std::string that is either the short or long name of the option. -..returns: The number of values stored for this option. -..include:seqan/arg_parse.h -*/ - -inline unsigned getOptionValueCount(ArgumentParser const & me, std::string const & name) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - return getArgumentValues(getOption(me, name)).size(); -} - -// ---------------------------------------------------------------------------- -// Function getArgumentValueCount() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getArgumentValueCount - * @headerfile - * @brief Query number of values stored for the specified argument. - * - * @signature unsigned getArgumentValueCount(parser, pos); - * - * @param parser The ArgumentParser to query. - * @param name The position of the argument (unsigned, 0-based). - */ - -/** -.Function.ArgumentParser#getArgumentValueCount -..class:Class.ArgumentParser -..summary:Returns the number of values stored in the specified option. -..cat:Miscellaneous -..signature:getArgumentValueCount(parser, argumentPosition) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.argumentPosition:The index of the argument in the argument list. -..returns: The number of values stored for the specified argument. -..include:seqan/arg_parse.h -*/ - -inline unsigned getArgumentValueCount(ArgumentParser const & me, unsigned argumentPosition) -{ - SEQAN_CHECK(me.argumentList.size() > argumentPosition, - "Argument Parser has only %d arguments.", - me.argumentList.size()); - return getArgumentValues(getArgument(me, argumentPosition)).size(); -} - -// ---------------------------------------------------------------------------- -// Function getArgumentValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getArgumentValue - * @headerfile - * @brief Retrieves the value of an argument given by its position. - * - * @signature bool getArgumentValue(dest, parser, pos[, no]); - * - * @param dest The variable to write the result to (the type is a template parameter and the value type of the - * argument must be convertible in the type of dest for the retrieval to work, also see result - * value). - * @param parser The ArgumentParser to get the value from. - * @param pos The position of the argument to get the value of. - * @param no Optional position for multi-value arguments (unsigned, defaults to 0). - * - * @return bool true if the retrieval was successful, false otherwise. - */ - -/** -.Function.ArgumentParser#getArgumentValue -..class:Class.ArgumentParser -..summary:Retrieves the value of an argument given by its position. -..cat:Miscellaneous -..signature:getArgumentValue(value, parser, argumentPosition[, argNo]) -..param.value:The variable where the resulting value should be stored. -...remarks:The type of $value$ must be compatible the option type. -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.argumentPosition:The index of the argument in the argument list. -..param.argNo:If the argument is a list, the $argNo$-th list element is returned. -..returns: $true$ if the requested argument is set and has the requested type, $false$ otherwise. -..include:seqan/arg_parse.h -*/ - -template -inline bool getArgumentValue(TValue & value, - ArgumentParser const & me, - unsigned argumentPosition, - unsigned argNo) -{ - SEQAN_CHECK(me.argumentList.size() > argumentPosition, - "Argument Parser has only %d arguments.", - me.argumentList.size()); - return _convertArgumentValue(value, getArgument(me, argumentPosition), getArgumentValue(getArgument(me, argumentPosition), argNo)); -} - -template -inline bool getArgumentValue(TValue & value, - ArgumentParser const & me, - unsigned argumentPosition) -{ - return getArgumentValue(value, me, argumentPosition, 0); -} - -// ---------------------------------------------------------------------------- -// Function getArgumentFileExtension() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getArgumentFileExtension - * @headerfile - * @brief Retrieve the file extension of a file argument. - * - * @signature std::string argumentFileExtension(parser, pos[, argNo]); - * - * Can be overridden by --arg-${pos}-file-ext. - * - * @param parser The ArgumentParser to get the value from. - * @param pos The position of the argument to query (unsigned). - * @param argNo Optional position for multi-value options (unsigned, defaults to 0). - * - * @return std::string The extension of the argument if any. - */ - -/** -.Function.ArgumentParser#getArgumentFileExtension -..class:Class.ArgumentParser -..summary:Returns the extension of a file argument. -..cat:Miscellaneous -..signature:std::string argumentFileExtension(parser, argPos[, argNo]); -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParsre -..param.argPos:The position of the argument. -...type:nolink:$unsigned$ -..param.argNo:An optional index for multi-value arguments. -...type:nolink:$unsigned$ -..returns:A $std::string$ with the extension. Empty if no extension or empty value. -*/ - -inline std::string getArgumentFileExtension(ArgumentParser const & me, - unsigned argumentPosition, - unsigned argNo = 0) -{ - SEQAN_CHECK(me.argumentList.size() > argumentPosition, - "Argument Parser has only %d arguments.", - me.argumentList.size()); - - - return getFileExtension(getArgument(me, argumentPosition), argNo); -} - -// ---------------------------------------------------------------------------- -// Function getOptionValues() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getOptionValues - * @headerfile - * @brief Returns all values of an option given on the command line. - * - * @signature TVector getOptionValues(parser, name); - * - * @param parser The ArgumentParser to query. - * @param name The short or long name of the option to get (std::string). - * - * @return TVector The resulting values (std::vector<std::string>). - */ - -/** -.Function.ArgumentParser#getOptionValues -..class:Class.ArgumentParser -..summary:Returns all values of an option given on the command line. -..cat:Miscellaneous -..signature:getOptionValues(parser, optionIdentifier) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionIdentifier:A std::string that is either the short or long name of the option. -..returns: A $String$ of option values. -..include:seqan/arg_parse.h -*/ - -inline std::vector const & getOptionValues(ArgumentParser const & me, - std::string const & name) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - return getArgumentValues(getOption(me, name)); -} - -// ---------------------------------------------------------------------------- -// Function getArgumentValues() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getArgumentValues - * @headerfile - * @brief Returns all values of an argument given on the command line. - * - * @signature TVector getArgumentValues(parser, pos); - * - * @param parser The ArgumentParser to query. - * @param pos The position of the argument (unsigned, 0-based). - * - * @return TVector The resulting values (std::vector<std::string>). - */ - -/** -.Function.ArgumentParser#getArgumentValues -..class:Class.ArgumentParser -..summary:Returns all values of an option given on the command line. -..cat:Miscellaneous -..signature:getArgumentValues(parser, argumentPosition) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.argumentPosition:The index of the argument in the argument list. -..returns: A $String$ of argument values. -..include:seqan/arg_parse.h -*/ - -inline std::vector const & getArgumentValues(ArgumentParser const & me, - unsigned argumentPosition) -{ - SEQAN_CHECK(me.argumentList.size() > argumentPosition, - "Argument Parser has only %d arguments.", - me.argumentList.size()); - return getArgumentValues(getArgument(me, argumentPosition)); -} - -// ---------------------------------------------------------------------------- -// Function setDefaultValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#setDefaultValue - * @headerfile - * @brief Set the default value of an option of an ArgumentParser. - * - * @signature void setDefaultValue(parser, name, v); - * - * @param parser The ArgumentParser to set the default value to. - * @param name The short or long name of the argument (std::string). - * @param v The value to set (template parameter, must be streamable into a std::stringstream). - */ - -/** -.Function.ArgumentParser#setDefaultValue -..class:Class.ArgumentParser -..summary:Set default value of an option of an ArgumentParser. -..signature:setDefaultValue(parser, optionName, value) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionName:The identifier of the command line option. -..param.value:The new default value. -..include:seqan/arg_parse.h -*/ - -template -inline void setDefaultValue(ArgumentParser & me, - std::string const & name, - const TValue & value) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - setDefaultValue(getOption(me, name), value); -} - -// ---------------------------------------------------------------------------- -// Function addDefaultValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#addDefaultValue - * @headerfile - * @brief Add/append a value to the default values for an option in an ArgumentParser. - * - * @signature void addDefaultValue(parser, name, v); - * - * @param parser The ArgumentParser to append the default value to. - * @param name The short or long name of the argument (std::string). - * @param v The value to append (template parameter, must be streamable into a std::stringstream). - */ - -/** -.Function.ArgumentParser#addDefaultValue -..class:Class.ArgumentParser -..summary:Add to the default values of an option of an ArgumentParser. -..signature:addDefaultValue(parser, optionName, value) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionName:The identifier of the command line option. -..param.value:The new default value. -..include:seqan/arg_parse.h -*/ - -template -inline void addDefaultValue(ArgumentParser & me, - std::string const & name, - const TValue & value) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - addDefaultValue(getOption(me, name), value); -} - -// ---------------------------------------------------------------------------- -// Function setMinValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#setMinValue - * @headerfile - * @brief Set smallest allowed value for an option or argument of an ArgumentParser. - * - * @signature void setMinValue(parser, name, v); - * @signature void setMinValue(parser, pos, v); - * - * @param parser The ArgumentParser to set the minimal value for. - * @param name The name of the option to set the minimal value for (std::string). - * @param pos The position of the argument to set the minimal value for (unsigned, 0-based). - * @param v The minimal value to set (std::string). - * - * @section Remarks - * - * The option/argument must have an integer or double type. - */ - -/** -.Function.ArgumentParser#setMinValue -..class:Class.ArgumentParser -..summary:Set smallest allowed value for an option or argument of an ArgumentParser. -..signature:setMinValue(parser,optionName,minValue) -..signature:setMinValue(parser,argumentPosition,minValue) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionName:The identifier of the command line option. -..param.argumentPosition:The index of the argument in the argument list. -..param.minValue:A std::string containing a string representation of the minimum value of the @Class.ArgParseOption@. -..include:seqan/arg_parse.h -*/ - -inline void setMinValue(ArgumentParser & me, - std::string const & name, - std::string const & _minValue) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - setMinValue(getOption(me, name), _minValue); -} - -inline void setMinValue(ArgumentParser & me, - unsigned argumentPosition, - std::string const & _minValue) -{ - SEQAN_CHECK(me.argumentList.size() > argumentPosition, - "Argument Parser has only %d arguments.", - me.argumentList.size()); - setMinValue(getArgument(me, argumentPosition), _minValue); -} - -// ---------------------------------------------------------------------------- -// Function setMaxValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#setMaxValue - * @headerfile - * @brief Set largest allowed value for an option or argument of an ArgumentParser. - * - * @signature void setMaxValue(parser, name, v); - * @signature void setMaxValue(parser, pos, v); - * - * @param parser The ArgumentParser to set the maximal value for. - * @param name The name of the option to set the maximal value for (std::string). - * @param pos The position of the argument to set the maximal value for (unsigned, 0-based). - * @param v The maximal value to set (std::string). - * - * @section Remarks - * - * The option/argument must have an integer or double type. - */ - -/** -.Function.ArgumentParser#setMaxValue -..class:Class.ArgumentParser -..summary:Set largest allowed value for an option or argument of an ArgumentParser. -..signature:setMaxValue(parser,optionName,maxValue) -..signature:setMaxValue(parser,argumentPosition,minValue) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionName:The identifier of the command line option. -..param.argumentPosition:The index of the argument in the argument list. -..param.maxValue:A std::string containing a string representation of the maximum value of the @Class.ArgParseOption@. -..include:seqan/arg_parse.h -*/ - -inline void setMaxValue(ArgumentParser & me, - std::string const & name, - std::string const & _maxValue) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - setMaxValue(getOption(me, name), _maxValue); -} - -inline void setMaxValue(ArgumentParser & me, - unsigned argumentPosition, - std::string const & _minValue) -{ - SEQAN_CHECK(me.argumentList.size() > argumentPosition, - "Argument Parser has only %d arguments.", - me.argumentList.size()); - setMaxValue(getArgument(me, argumentPosition), _minValue); -} - -// ---------------------------------------------------------------------------- -// Function setValidValues() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#setValidValues - * @headerfile - * @brief Set valid values for an argumetn or option of an ArgumentParser. - * - * @signature void setValidValues(parser, name, values); - * @signature void setValidValues(parser, pos, values); - * - * @param parser The ArgumentParser to set the default values to. - * @param name The name of the option (std::string). - * @param pos The position of the argument (unsigned, 0-based). - * @param values The values to set. Either a std::string with the values as space-separated list - * or a std::vector<std::string> with the values. - */ - -/** -.Function.ArgumentParser#setValidValues -..class:Class.ArgumentParser -..summary:Set valid values for an argument or option of an ArgumentParser. -..signature:setValidValues(parser,optionName,values) -..signature:setValidValues(parser,argumentPosition,values) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionName:The identifier of the command line option. -..param.argumentPosition:The index of the argument in the argument list. -..param.values:A $std::string$ containing all valid entries for the option. -Alternatively you can pass a string containing all values separated by spaces. -..include:seqan/arg_parse.h -*/ - -inline void setValidValues(ArgumentParser & me, - std::string const & name, - std::vector const & values) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - setValidValues(getOption(me, name), values); - _copyValidValuesToFileExt(me, name); -} - -inline void setValidValues(ArgumentParser & me, - std::string const & name, - std::string const & values) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - setValidValues(getOption(me, name), values); - _copyValidValuesToFileExt(me, name); -} - -inline void setValidValues(ArgumentParser & me, - unsigned argumentPosition, - std::vector const & values) -{ - SEQAN_CHECK(me.argumentList.size() > argumentPosition, - "Argument Parser has only %d arguments.", - me.argumentList.size()); - setValidValues(getArgument(me, argumentPosition), values); - _copyValidValuesToFileExt(me, argumentPosition); -} - -inline void setValidValues(ArgumentParser & me, - unsigned argumentPosition, - std::string const & values) -{ - SEQAN_CHECK(me.argumentList.size() > argumentPosition, - "Argument Parser has only %d arguments.", - me.argumentList.size()); - setValidValues(getArgument(me, argumentPosition), values); - _copyValidValuesToFileExt(me, argumentPosition); -} - -// ---------------------------------------------------------------------------- -// Function setHelpText() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#setHelpText - * @headerfile - * @brief Set the help text of an option or argument. - * - * @signature void setHelpText(parser, name, text); - * @signature void setHelpText(parser, pos, text); - * - * @param parser The ArgumentParser object. - * @param name The name of the option to set the help text for (std::string). - * @param pos The position of the argument to set the help text for. - * @param text The string to use for the help text (std::string). - */ - -/** -.Function.ArgumentParser#setHelpText -..class:Class.ArgumentParser -..summary:Set help text of argument parser. -..signature:setHelpText(parser,optionName,text) -..signature:setHelpText(parser,argumentPosition,text) -..param.parser:The @Class.ArgumentParser@ object. -...type:Class.ArgumentParser -..param.optionName:The identifier of the command line option. -..param.argumentPosition:The index of the argument in the argument list. -..param.text:A $std::string$ describing the option or argument. -..include:seqan/arg_parse.h -*/ - -inline void setHelpText(ArgumentParser & me, - std::string const & name, - std::string const & text) -{ - SEQAN_CHECK(hasOption(me, name), "Unknown option: %s", toCString(name)); - setHelpText(getOption(me, name), text); -} - -inline void setHelpText(ArgumentParser & me, - unsigned argumentPosition, - std::string const & text) -{ - SEQAN_CHECK(me.argumentList.size() > argumentPosition, - "Argument Parser has only %d arguments.", - me.argumentList.size()); - setHelpText(getArgument(me, argumentPosition), text); -} - -// ---------------------------------------------------------------------------- -// Function getFileFormatExtensions() -// ---------------------------------------------------------------------------- - -/*! - * @fn ArgumentParser#getFileFormatExtensions - * @headerfile - * @brief Returns file format extension given a format tag. - * - * @signature TVector getFormatExtension(tag); - * @signature TVector getFormatExtension(tagList); - * @signature TVector getFormatExtension(tagSelector); - * - * @param tag A single file foramt, e.g. Fastq(). - * @param tagList A list of file format (@link TagList @endlink). - * @param tagSelector A file format selector (@link TagSelector @endlink). - * - * @return TVector A std::vector<std::string> with the allowed file format extensions. - */ - -/** -.Function.ArgumentParser#getFileFormatExtensions -..class:Class.ArgumentParser -..summary:Returns file format extensions given a format tag. -..signature:getFileFormatExtensions(formatTag) -..signature:getFileFormatExtensions(formatTagList) -..signature:getFileFormatExtensions(formatTagSelector) -..param.format:A single file format, e.g. @Tag.File Format.tag.Fastq@ or @Tag.Sam@. -...type:Tag.Tag -..param.formatTagList:A list of file formats. -...type:Tag.TagList -..param.formatTagSelector:A file format selector. -...type:Class.TagSelector -..returns:A $std::vector$ of all extensions supported by a single format or all formats of a list or selector. -..include:seqan/arg_parse.h -*/ - -template -inline std::vector -getFileFormatExtensions(T const formatTag) -{ - std::vector extensions; - _getFileFormatExtensions(extensions, formatTag); - return extensions; -} - - -} // namespace seqan - -#endif // SEQAN_CORE_INCLUDE_ARG_PARSE_ARGUMENT_PARSER_H_ diff --git a/seqan/arg_parse/tool_doc.h b/seqan/arg_parse/tool_doc.h deleted file mode 100644 index 13447a8..0000000 --- a/seqan/arg_parse/tool_doc.h +++ /dev/null @@ -1,1675 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_ARG_PARSE_TOOL_DOC_H_ -#define SEQAN_CORE_INCLUDE_ARG_PARSE_TOOL_DOC_H_ - -#include - -#include -#include - -namespace seqan { - -// ========================================================================== -// Forwards -// ========================================================================== - -class ToolDoc; -inline void clearEntries(ToolDoc & doc); -inline void append(ToolDoc & a, ToolDoc const & b); - -// ========================================================================== -// Tags, Classes, Enums -// ========================================================================== - -// -------------------------------------------------------------------------- -// Class ToolDocEntry_ -// -------------------------------------------------------------------------- - -// Base class for entries in the ToolDoc class. - -class ToolDocEntry_ -{ -public: - enum EntryType - { - SUBSECTION, SECTION, LINE, LIST_ITEM - }; - - virtual ~ToolDocEntry_() {} - - virtual EntryType getType() const = 0; -}; - -// -------------------------------------------------------------------------- -// Class ToolDocSection_ -// -------------------------------------------------------------------------- - -// A section in the ToolDoc class. - -class ToolDocSection_ : - public ToolDocEntry_ -{ -public: - CharString _title; - - ToolDocSection_(ToolDocSection_ const & sec) : - ToolDocEntry_(sec), _title(sec._title) - {} - - ToolDocSection_(CharString const & title) : - _title(title) - {} - - virtual EntryType getType() const - { - return SECTION; - } - -}; - -// -------------------------------------------------------------------------- -// Class ToolDocSubSection_ -// -------------------------------------------------------------------------- - -// A subsection. - -class ToolDocSubSection_ : - public ToolDocSection_ -{ -public: - ToolDocSubSection_(ToolDocSubSection_ const & sec) : - ToolDocSection_(sec) - {} - - ToolDocSubSection_(CharString const & title) : - ToolDocSection_(title) - {} - - virtual EntryType getType() const - { - return SUBSECTION; - } - -}; - -// -------------------------------------------------------------------------- -// Class ToolDocLine__ -// -------------------------------------------------------------------------- - -// A Line/Paragraph in ToolDoc documents. - -class ToolDocLine_ : - public ToolDocEntry_ -{ -public: - CharString _text; - // Evaluates to true if it is a paragraph and separated by .sp, false if it is a line, separated by .br. - bool _isPar; - - ToolDocLine_(ToolDocLine_ const & line) : - ToolDocEntry_(line), _text(line._text), _isPar(line._isPar) - {} - - ToolDocLine_(CharString const & text, bool isParagraph) : - _text(text), _isPar(isParagraph) - {} - - virtual EntryType getType() const - { - return LINE; - } - - bool isParagraph() const - { - return _isPar; - } - -}; - -// -------------------------------------------------------------------------- -// Class ToolDocListItem_ -// -------------------------------------------------------------------------- - -// A list item in ToolDoc documents. - -class ToolDocListItem_ : - public ToolDocEntry_ -{ -public: - CharString _term; - CharString _description; - - ToolDocListItem_(ToolDocListItem_ const & item) : - ToolDocEntry_(item), _term(item._term), _description(item._description) - {} - - ToolDocListItem_(CharString const & term, CharString const & description) : - _term(term), _description(description) - {} - - virtual EntryType getType() const - { - return LIST_ITEM; - } - -}; - -// -------------------------------------------------------------------------- -// Class ToolDocPrinter_ -// -------------------------------------------------------------------------- - -// Abstrace base class for ToolDoc printers. - -class ToolDocPrinter_ -{ -public: - virtual void print(std::ostream & stream, ToolDoc const & doc) = 0; -}; - -// -------------------------------------------------------------------------- -// Class ManToolDocPrinter_ -// -------------------------------------------------------------------------- - -// Print ToolDoc instance in man format. - -class ManToolDocPrinter_ : - public ToolDocPrinter_ -{ -public: - virtual void print(std::ostream & stream, ToolDoc const & doc); -}; - -// -------------------------------------------------------------------------- -// Class HtmlToolDocPrinter_ -// -------------------------------------------------------------------------- - -// Print ToolDoc instance in HTML format. - -class HtmlToolDocPrinter_ : - public ToolDocPrinter_ -{ -public: - void _maybeCloseList(std::ostream & stream, bool & isListOpen) - { - if (!isListOpen) - return; - - stream << "\n"; - isListOpen = false; - } - - void _maybeCloseParagraph(std::ostream & stream, bool & isParOpen) - { - if (!isParOpen) - return; - - stream << "

\n"; - isParOpen = false; - } - - // Converts formatting with \fI, \fB, and \fP to HTML. - template - TSequence _toHtml(TSequence const & input) const - { - TSequence buffer = xmlEscape(input); - TSequence result; - String openTags; - - typedef typename Iterator::Type TIterator; - TIterator endIt = end(input, Standard()); - for (TIterator it = begin(input, Standard()); it != endIt; goNext(it)) - { - if (*it == '\\') - { - // Handle escape sequence, we interpret only "\-", "\fI", and "\fB". - goNext(it); - SEQAN_ASSERT_NOT(it == endIt); - if (*it == '-') - { - appendValue(result, *it); - } - else if (*it == 'f') - { - goNext(it); - SEQAN_ASSERT_NOT(it == endIt); - if (*it == 'I') - { - appendValue(openTags, "em"); - append(result, ""); - } - else if (*it == 'B') - { - appendValue(openTags, "strong"); - append(result, ""); - } - else if (*it == 'P') - { - SEQAN_ASSERT_NOT(empty(openTags)); - append(result, ""); - eraseBack(openTags); - } - else - { - append(result, "\\f"); - appendValue(result, *it); - } - } - else - { - appendValue(result, '\\'); - appendValue(result, *it); - } - } - else - { - appendValue(result, *it); - } - } - - return result; - } - - virtual void print(std::ostream & stream, ToolDoc const & doc); -}; - -// -------------------------------------------------------------------------- -// Class TextToolDocPrinter_ -// -------------------------------------------------------------------------- - -// Print ToolDoc objects in Text format, suitable for console output. - -class TextToolDocPrinter_ : - public ToolDocPrinter_ -{ -public: - // Stores the relevant parameters of the documentation on the screen. - struct Layout_ - { - unsigned screenWidth; - unsigned defaultScreenWidth; - unsigned maximalScreenWidth; - unsigned minimalScreenWidth; - unsigned leftPadding; - unsigned centerPadding; - unsigned rightPadding; - unsigned leftColumnWidth; - unsigned rightColumnWidth; - unsigned rightColumnTab; - - Layout_() : - screenWidth(0), defaultScreenWidth(80), maximalScreenWidth(120), minimalScreenWidth(40), - leftPadding(4), centerPadding(2), rightPadding(2), leftColumnWidth(4), rightColumnWidth(0) - { - // Guess terminal screen width and set into layout. - unsigned cols = 0, rows = 0; - bool success = getTerminalSize(cols, rows); - screenWidth = (success && cols > 0) ? cols : defaultScreenWidth; - screenWidth = std::max(screenWidth, minimalScreenWidth); - screenWidth = std::min(screenWidth, maximalScreenWidth); - screenWidth -= rightPadding; - - rightColumnWidth = screenWidth - leftPadding - leftColumnWidth - centerPadding - rightPadding; - rightColumnTab = leftPadding + leftColumnWidth + centerPadding; - - // std::cerr << "screen width\t" << screenWidth << std::endl; - } - - }; - - Layout_ _layout; - - virtual void print(std::ostream & stream, ToolDoc const & doc); - - void _printSection(std::ostream & stream, ToolDocSection_ const & section) - { - std::ostream_iterator out(stream); - stream << '\n' << _toText("\\fB"); - std::transform(begin(section._title), end(section._title), out, toupper); - stream << _toText("\\fP") << '\n'; - } - - void _printSubSection(std::ostream & stream, ToolDocSection_ const & section) - { - std::ostream_iterator out(stream); - stream << '\n' << _toText("\\fB"); - std::fill_n(out, _layout.leftPadding / 2, ' '); - stream << section._title << _toText("\\fP") << '\n'; - } - - void _printLine(std::ostream & stream, ToolDocLine_ const & line) - { - std::ostream_iterator out(stream); - std::fill_n(out, _layout.leftPadding, ' '); - - _printText(stream, line._text, _layout.leftPadding); - } - - CharString _toText(CharString const & str) const - { - CharString result; - - typedef Iterator::Type TIterator; - for (TIterator it = begin(str, Rooted()); !atEnd(it); goNext(it)) - { - if (*it == '\\') - { - // Handle escape sequence, we interpret only "\-", "\fI", and "\fB". - goNext(it); - SEQAN_ASSERT_NOT(atEnd(it)); - if (*it == '-') - { - appendValue(result, *it); - } - else if (*it == 'f') - { - goNext(it); - SEQAN_ASSERT_NOT(atEnd(it)); - if (*it == 'I') - { - if (isTerminal()) - append(result, "\033[4m"); - } - else if (*it == 'B') - { - if (isTerminal()) - append(result, "\033[1m"); - } - else if (*it == 'P') - { - if (isTerminal()) - append(result, "\033[0m"); - } - else - { - append(result, "\\f"); - appendValue(result, *it); - } - } - else - { - appendValue(result, '\\'); - appendValue(result, *it); - } - } - else - { - appendValue(result, *it); - } - } - - return result; - } - - void _printListItem(std::ostream & stream, ToolDocListItem_ const & listItem) - { - std::ostream_iterator out(stream); - - // Print term. - std::fill_n(out, _layout.leftPadding, ' '); - stream << _toText(listItem._term); - unsigned pos = _layout.leftPadding + length(listItem._term); - if (pos + _layout.centerPadding > _layout.rightColumnTab) - { - stream << '\n'; - pos = 0; - } - std::fill_n(out, _layout.rightColumnTab - pos, ' '); - - _printText(stream, listItem._description, _layout.rightColumnTab); - } - - // Returns width of text if printed, i.e. "\-" has length 1, "\fI", "\fB", "\fP" have length 0. - unsigned _textWidth(CharString const & text) - { - unsigned result = 0; - - for (unsigned i = 0; i < length(text); ++i) - { - if (text[i] != '\\') - { - result += 1; - continue; - } - - if (i + 1 == length(text)) - { - result += 1; // Will print "\\". - continue; - } - - if (text[i + 1] == '\\' || text[i + 1] == '-') - { - i += 1; - result += 1; - continue; // Will print '\\' or '-'. - } - - if (i + 2 == length(text)) - { - i += 1; - result += 2; // Will print two chars. - continue; - } - - if (text[i + 1] == 'f') - { - if (text[i + 2] == 'B' || text[i + 2] == 'I' || text[i + 2] == 'P') - i += 2; // Skip f and {B, I, P}. - else - result += 1; - } - } - - return result; - } - - // Print text, must be at tab already. - void _printText(std::ostream & stream, CharString const & text, unsigned tab) - { - unsigned pos = tab; - std::ostream_iterator out(stream); - - // Tokenize the text. - std::istringstream iss(toCString(text)); - std::vector tokens; - std::copy(std::istream_iterator(iss), std::istream_iterator(), - std::back_inserter >(tokens)); - - // Print the text. - SEQAN_ASSERT_LEQ(pos, tab); - std::fill_n(out, tab - pos, ' '); // go to tab - - pos = tab; - typedef std::vector::const_iterator TConstIter; - for (TConstIter it = tokens.begin(); it != tokens.end(); ++it) - { - if (it == tokens.begin()) - { - stream << _toText(*it); - pos += _textWidth(*it); - if (pos > _layout.screenWidth) - { - stream << '\n'; - std::fill_n(out, tab, ' '); - pos = tab; - } - } - else - { - if (pos + 1 + _textWidth(*it) > _layout.screenWidth) - { - // Would go over screen with next, print current word on next line. - stream << '\n'; - fill_n(out, tab, ' '); - stream << _toText(*it); - pos = tab + _textWidth(*it); - } - else - { - stream << ' '; - stream << _toText(*it); - pos += _textWidth(*it) + 1; - } - } - } - if (!empty(tokens)) - stream << '\n'; - } - -}; - -// -------------------------------------------------------------------------- -// Class ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @class ToolDoc - * @headerfile - * @brief Container for string documentation on a command line tool. - * - * @signature class ToolDoc; - * - * @section Remarks - * - * This class is generally not used directly by the user but through @link ArgumentParser @endlink. It allows to store - * and represent all information related to a command line tool that would normally go into a man page. It can be - * printed to STL streams in different formats, currently plain text, HTML and man pages are supported. - * - * You can also use basic formatting in text. This formatting is tailored to the usage on the command line. Use - * \fB to start bold font, \fI to start italic font and \fP to use the previous font (of - * course, use correct escaping of the backslash in C strings, so use "\\fB", "\\fI", and - * "\\fP" in your code. - * - * @section Examples - * - * The following shows a brief example of how to use @link ToolDoc @endlink. - * - * @code{.cpp} - * ToolDoc doc; - * setName(doc, "RazerS"); - * setShortDescription(doc, "Read mapping with controllable sensitivity."); - * setDate(doc, "04 March 2012"); - * setVersion(doc, "1.0"); - * setCategory(doc, "Read Mapping"); - * setManTitle(doc, "SeqAn Apps Reference Manual"); - * - * addSection(doc, "Synopsis"); - * addText(doc, "\\fBrazers\\fP [\\fIOPTIONS\\fP] \\fIREFERENCE\\fP \\fIREADS\\fP", false); - * addText(doc, - * "\\fBrazers\\fP [\\fIOPTIONS\\fP] \\fIREFERENCE\\fP \\fILEFT_READS\\fP " - * "\\fIRIGHT_READS\\fP", false); - * - * addSection(doc, "Description"); - * addText(doc, - * "RazerS is a read mapper with controllable, sensitivity. This " - * "means that you can find all read matches in the reference sequence " - * "and optionally, you can trade lower sensitivity for better " - * "performance."); - * addText(doc, - * "What's special about RazerS is that you can control the sensitivity."); - * - * addSection(doc, "Options"); - * addSubSection(doc, "Main Options"); - * addListItem(doc, "\\fB-id\\fP, \\fB--indels\\fP", - * "Enable mapping with indels enabled."); - * addListItem(doc, "\\fB-i\\fP, \\fB--identity\\fP \\fIIDENTITY\\fP", - * "Set minimal identity of matches to find."); - * - * print(std::cout, doc, "text"); - * @endcode - * - * @see ToolDoc#addText - * @see ToolDoc#addListItem - * @see ArgumentParser - */ - -/*! - * @fn ToolDoc::ToolDoc - * @brief Constructor - * - * @signature ToolDoc::ToolDoc() - */ - -/** -.Class.ToolDoc -..cat:Miscellaneous -..summary:Container for string documentation on a command line tool. -..signature:ToolDoc -..remarks: -This class is generally not used directly by the user but through @Class.ArgumentParser@. -It allows to store and represent all information related to a command line tool that would normally go into a man page. -It can be printed to STL streams in different formats, currently plain text, HTML and man pages are supported. -..remarks: -You can also use basic formatting in text. This formatting is tailored to the usage on the command line. -Use $\fB$ to start bold font, $\fI$ to start italic font and $\fP$ to use the previous font (of course, use correct escaping of the backslash in C strings, so use $"\\fB"$, $"\\fI"$, and $"\\fP"$ in your code. -..example.text:The following shows a brief example of how to use @Class.ToolDoc@. -..example.code: -ToolDoc doc; -setName(doc, "RazerS"); -setShortDescription(doc, "Read mapping with controllable sensitivity."); -setDate(doc, "04 March 2012"); -setVersion(doc, "1.0"); -setCategory(doc, "Read Mapping"); -setManTitle(doc, "SeqAn Apps Reference Manual"); - -addSection(doc, "Synopsis"); -addText(doc, "\\fBrazers\\fP [\\fIOPTIONS\\fP] \\fIREFERENCE\\fP \\fIREADS\\fP", false); -addText(doc, - "\\fBrazers\\fP [\\fIOPTIONS\\fP] \\fIREFERENCE\\fP \\fILEFT_READS\\fP " - "\\fIRIGHT_READS\\fP", false); - -addSection(doc, "Description"); -addText(doc, - "RazerS is a read mapper with controllable, sensitivity. This " - "means that you can find all read matches in the reference sequence " - "and optionally, you can trade lower sensitivity for better " - "performance."); -addText(doc, - "What's special about RazerS is that you can control the sensitivity."); - -addSection(doc, "Options"); -addSubSection(doc, "Main Options"); -addListItem(doc, "\\fB-id\\fP, \\fB--indels\\fP", - "Enable mapping with indels enabled."); -addListItem(doc, "\\fB-i\\fP, \\fB--identity\\fP \\fIIDENTITY\\fP", - "Set minimal identity of matches to find."); - -print(std::cout, doc, "text"); -..include:seqan/arg_parse/tool_doc.h - -.Memfunc.ToolDoc#ToolDoc -..summary:constructor -..class:Class.ToolDoc -..signature:ToolDoc() -*/ - -class ToolDoc -{ -public: - CharString _name; - CharString _shortDescription; - CharString _date; - CharString _version; - CharString _manTitle; - CharString _category; - unsigned _manSection; - - String _entries; - - enum Format {FORMAT_HTML, FORMAT_MAN, FORMAT_TXT}; - - ToolDoc() : - _manSection(1) {} - - ToolDoc(ToolDoc const & toolDoc) : - _name(toolDoc._name), _shortDescription(toolDoc._shortDescription), - _date(toolDoc._date), _version(toolDoc._version), _manTitle(toolDoc._manTitle), - _category(toolDoc._category), _manSection(1) - { - append(*this, toolDoc); - } - - ~ToolDoc() - { - clearEntries(*this); - } - - void print(std::ostream & stream, Format format) const - { - switch (format) - { - case FORMAT_HTML: - { - HtmlToolDocPrinter_ p; - p.print(stream, *this); - } - break; - - case FORMAT_MAN: - { - ManToolDocPrinter_ p; - p.print(stream, *this); - } - break; - - case FORMAT_TXT: - { - TextToolDocPrinter_ p; - p.print(stream, *this); - } - break; - } - } - - void print(std::ostream & stream, CharString const & format) const - { - if (format == "html") - print(stream, FORMAT_HTML); - else if (format == "man") - print(stream, FORMAT_MAN); - else - print(stream, FORMAT_TXT); - } - -}; - -// ========================================================================== -// Metafunctions -// ========================================================================== - -// ========================================================================== -// Functions -// ========================================================================== - -// -------------------------------------------------------------------------- -// Function append() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#append - * @headerfile - * @brief Append two @link ToolDoc @endlink objects. - * - * @signature void append(a, b); - * - * @param a This object is updated - * @param b This object is appended to b. - */ - -/** -.Function.ToolDoc#append -..summary:Append two @Class.ToolDoc@ objects. -..cat:Miscellaneous -..signature:append(a, b) -..class:Class.ToolDoc -..param.a:This object is updated. -...type:Class.ToolDoc -..param.b:This object is appended to $b$. -...type:Class.ToolDoc -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void append(ToolDoc & a, ToolDoc const & b) -{ - for (unsigned i = 0; i < length(b._entries); ++i) - { - // TODO(holtgrew): This is quite ugly and can be made better with shared_ptr<> in C++11. - switch (b._entries[i]->getType()) - { - case ToolDocEntry_::SUBSECTION: - appendValue(a._entries, new ToolDocSubSection_(*static_cast(b._entries[i]))); - break; - - case ToolDocEntry_::SECTION: - appendValue(a._entries, new ToolDocSection_(*static_cast(b._entries[i]))); - break; - - case ToolDocEntry_::LINE: - appendValue(a._entries, new ToolDocLine_(*static_cast(b._entries[i]))); - break; - - case ToolDocEntry_::LIST_ITEM: - appendValue(a._entries, new ToolDocListItem_(*static_cast(b._entries[i]))); - break; - } - } -} - -// -------------------------------------------------------------------------- -// Function setName() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#setName - * @headerfile - * @brief Set the tool name. - * - * @signature void setName(toolDoc, name); - * - * @param toolDoc The ToolDoc object to the set the name for. - * @param name The name of the tool (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#setName -..summary:Set tool name for @Class.ToolDoc@ object. -..cat:Miscellaneous -..signature:setName(doc, name) -..class:Class.ToolDoc -..param.doc:Tool documentation object to set the name of. -...type:Class.ToolDoc -..param.name:Name to set. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void setName(ToolDoc & doc, CharString const & name) -{ - doc._name = name; -} - -// -------------------------------------------------------------------------- -// Function getName() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#getName - * @headerfile - * @brief Get the tool name. - * - * @signature CharString getName(toolDoc); - * - * @param toolDoc The ToolDoc object to the get the name for. - * - * @return CharString Resulting name (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#getName -..summary:Get tool name of @Class.ToolDoc@ object. -..cat:Miscellaneous -..signature:getName(doc) -..class:Class.ToolDoc -..param.doc:Tool documentation object to get the tool name of. -...type:Class.ToolDoc -..returns:Tool name of documentation object. -...type:Shortcut.CharString -..include:seqan/arg_parse/tool_doc.h -*/ - -inline CharString const & getName(ToolDoc const & doc) -{ - return doc._name; -} - -// -------------------------------------------------------------------------- -// Function setCategory() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#setCategory - * @headerfile - * @brief Set the tool name. - * - * @signature void setName(toolDoc, name); - * - * @param toolDoc The ToolDoc object to the set the name for. - * @param name The name of the tool (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#setCategory -..summary:Set tool category for @Class.ToolDoc@ object. -..cat:Miscellaneous -..signature:setCategory(doc, category) -..class:Class.ToolDoc -..param.doc:Tool documentation object to set the name of. -...type:Class.ToolDoc -..param.category:Category to set. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void setCategory(ToolDoc & doc, CharString const & category) -{ - doc._category = category; -} - -// -------------------------------------------------------------------------- -// Function getCategory() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#getCategory - * @headerfile - * @brief Get the tool category. - * - * @signature CharString getCategory(toolDoc); - * - * @param toolDoc The ToolDoc object to the get the category for. - * - * @return CharString Resulting category (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#getCategory -..summary:Get tool category of @Class.ToolDoc@ object. -..cat:Miscellaneous -..signature:getCategory(doc) -..class:Class.ToolDoc -..param.doc:Tool documentation object to get the tool category of. -...type:Class.ToolDoc -..returns:Tool category of documentation object. -...type:Shortcut.CharString -..include:seqan/arg_parse/tool_doc.h -*/ - -inline CharString const & getCategory(ToolDoc const & doc) -{ - return doc._category; -} - -// -------------------------------------------------------------------------- -// Function setShortDescription() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#setShortDescription - * @headerfile - * @brief Set the tool short description. - * - * @signature void setShortDescription(toolDoc, text); - * - * @param toolDoc The ToolDoc object to the set the short description for. - * @param text The short description of the tool (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#setShortDescription -..summary:Set short description for @Class.ToolDoc@ object. -..cat:Miscellaneous -..signature:setShortDescriptioin(doc, description) -..class:Class.ToolDoc -..param.doc:Tool documentation object to set the short description of. -...type:Class.ToolDoc -..param.description:Short description to set. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void setShortDescription(ToolDoc & doc, CharString const & shortDescription) -{ - doc._shortDescription = shortDescription; -} - -// -------------------------------------------------------------------------- -// Function getShortDescription() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#getShortDescription - * @headerfile - * @brief Get the tool short description. - * - * @signature CharString getShortDescription(toolDoc); - * - * @param toolDoc The ToolDoc object to the get the short description for. - * - * @return CharString Resulting short description (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#getShortDescription -..summary:Get short description of @Class.ToolDoc@ object. -..cat:Miscellaneous -..signature:setName(doc) -..class:Class.ToolDoc -..param.doc:Tool documentation object to set the short description of. -...type:Class.ToolDoc -..returns:Tool description of documentation object. -...type:Shortcut.CharString -..include:seqan/arg_parse/tool_doc.h -*/ - -inline CharString const & getShortDescription(ToolDoc const & doc) -{ - return doc._shortDescription; -} - -// -------------------------------------------------------------------------- -// Function setDate() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#setDate - * @headerfile - * @brief Set the date string. - * - * @signature void setName(toolDoc, str); - * - * @param toolDoc The ToolDoc object to the set the date string for. - * @param str The date string of the tool (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#setDate -..cat:Miscellaneous -..summary:Set date string for @Class.ToolDoc@ object. -..signature:setDate(doc, date) -..class:Class.ToolDoc -..param.doc:Tool documentation object to set the date string to. -...type:Class.ToolDoc -..param.date:Date string to set. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void setDate(ToolDoc & doc, CharString const & date) -{ - doc._date = date; -} - -// -------------------------------------------------------------------------- -// Function getDate() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#getDate - * @headerfile - * @brief Get the date. - * - * @signature CharString getDate(toolDoc); - * - * @param toolDoc The ToolDoc object to the get the date from. - * - * @return CharString Resulting date string (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#getDate -..cat:Miscellaneous -..summary:Get date string from @Class.ToolDoc@ object. -..signature:getDate(doc) -..class:Class.ToolDoc -..param.doc:Tool documentation object to get the date string of. -...type:Class.ToolDoc -..returns:Date string. -...type:Shortcut.CharString -..include:seqan/arg_parse/tool_doc.h -*/ - -inline CharString const & getDate(ToolDoc const & doc) -{ - return doc._date; -} - -// -------------------------------------------------------------------------- -// Function setVersion() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#setVersion - * @headerfile - * @brief Set the tool version string. - * - * @signature void setName(toolDoc, str); - * - * @param toolDoc The ToolDoc object to the set the version string for. - * @param str The version string of the tool (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#setVersion -..cat:Miscellaneous -..summary:Set version string for @Class.ToolDoc@ object. -..signature:setVersion(doc, version) -..class:Class.ToolDoc -..param.doc:Tool documentation object to set the version string to. -...type:Class.ToolDoc -..param.version:Version string to set. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void setVersion(ToolDoc & doc, CharString const & version) -{ - doc._version = version; -} - -// -------------------------------------------------------------------------- -// Function getVersion() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#getVersion - * @headerfile - * @brief Get the tool version string. - * - * @signature CharString getVersion(toolDoc); - * - * @param toolDoc The ToolDoc object to the get the version string. - * - * @return CharString Resulting version string (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#getVersion -..cat:Miscellaneous -..summary:Get version string from @Class.ToolDoc@ object. -..class:Class.ToolDoc -..signature:CharString getVersion(doc) -..param.doc:Tool documentation object to get the version string of. -...type:Class.ToolDoc -..returns:Date string. -...type:Shortcut.CharString -..include:seqan/arg_parse/tool_doc.h -*/ - -inline CharString const & getVersion(ToolDoc const & doc) -{ - return doc._version; -} - -// -------------------------------------------------------------------------- -// Function setManTitle() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#setManTitle - * @headerfile - * @brief Set the man title. - * - * @signature void setTitle(toolDoc, title); - * - * @param toolDoc The ToolDoc object to the set the title for. - * @param title The title of the tool (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#setManTitle -..cat:Miscellaneous -..summary:Set version string for @Class.ToolDoc@ object. -..signature:setManTitle(doc, title) -..class:Class.ToolDoc -..param.doc:Tool documentation object to set the man title to. -...type:Class.ToolDoc -..param.title:Title string to set. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void setManTitle(ToolDoc & doc, CharString const & title) -{ - doc._manTitle = title; -} - -// -------------------------------------------------------------------------- -// Function getManTitle() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#getManTitle - * @headerfile - * @brief Get the tool man page title of. - * - * @signature CharString getManTitle(toolDoc); - * - * @param toolDoc The ToolDoc object to the get the man page title. - * - * @return CharString Resulting man page title (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#getManTitle -..cat:Miscellaneous -..summary:Get man title from @Class.ToolDoc@ object. -..signature:getManTitle(doc) -..class:Class.ToolDoc -..param.doc:Tool documentation object to get the man title of. -...type:Class.ToolDoc -..returns:Man title. -...type:Shortcut.CharString -..include:seqan/arg_parse/tool_doc.h -*/ - -inline CharString const & getManTitle(ToolDoc & doc) -{ - return doc._manTitle; -} - -// -------------------------------------------------------------------------- -// Function addSection() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#addSection - * @headerfile - * @brief Add a section with the given title. - * - * @signature void addSection(toolDoc, title); - * - * @param toolDoc The ToolDoc object to add a section for. - * @param title The section title (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#addSection -..cat:Miscellaneous -..summary:Add section to @Class.ToolDoc@ object. -..signature:addSection(doc, title) -..class:Class.ToolDoc -..param.doc:Tool documentation object to add section to. -...type:Class.ToolDoc -..param.title:Section title. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void addSection(ToolDoc & doc, CharString const & title) -{ - appendValue(doc._entries, new ToolDocSection_(title)); -} - -// -------------------------------------------------------------------------- -// Function addSubSection() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#addSubSection - * @headerfile - * @brief Add a subsection with the given title. - * - * @signature void addSubSection(toolDoc, title); - * - * @param toolDoc The ToolDoc object to add a subsection for. - * @param title The subsection title (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#addSubSection -..cat:Miscellaneous -..summary:Add subsection to @Class.ToolDoc@ object. -..signature:addSubSection(doc, title) -..class:Class.ToolDoc -..param.doc:Tool documentation object to add subsection to. -...type:Class.ToolDoc -..param.title:Subsection title. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void addSubSection(ToolDoc & doc, CharString const & title) -{ - appendValue(doc._entries, new ToolDocSubSection_(title)); -} - -// -------------------------------------------------------------------------- -// Function addText() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#addText - * @headerfile - * @brief Add a text line/paragraph to ToolDoc. - * - * @signature void addText(toolDoc, text[, isParagraph]); - * - * @param toolDoc The ToolDoc to add the text to. - * @param text The text to add (@link CharString @endlink). - * @param isParagraph Whether to insert as paragraph or just a line (only one line break if not a paragraph). - */ - -/** -.Function.ToolDoc#addText -..cat:Miscellaneous -..summary:Add text line/paragraph to @Class.ToolDoc@. -..signature:addText(doc, text, [isParagraph]) -..class:Class.ToolDoc -..param.doc:Tool documentation object to text to. -...type:Class.ToolDoc -..param.text:Text to add. -...type:Shortcut.CharString -..param.isParagraph:Whether to insert as paragraph or just a line (only line break in the last case). -...type:nolink:$bool$ -..returns:$void$ -..remarks:See @Class.ToolDoc@ for information on formatting of text. -..see:Class.ToolDoc -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void addText(ToolDoc & doc, CharString const & text, bool isParagraph) -{ - appendValue(doc._entries, new ToolDocLine_(text, isParagraph)); -} - -inline void addText(ToolDoc & doc, CharString const & text) -{ - addText(doc, text, true); -} - -// -------------------------------------------------------------------------- -// Function addListItem() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#addListItem - * @headerfile - * @brief Add a list item to a ToolDoc. - * - * @signature void addListItem(toolDoc, key, value); - * - * @param toolDoc The ToolDoc object to add the list item to. - * @param key The key for the list (@link CharString @endlink). - * @param value The value for the list (@link CharString @endlink). - */ - -/** -.Function.ToolDoc#addListItem -..cat:Miscellaneous -..summary:Add list item to @Class.ToolDoc@ object. -..signature:addListItem(doc, key, value) -..class:Class.ToolDoc -..param.doc:Tool documentation object to add subsection to. -...type:Class.ToolDoc -..param.key:List item key. -...type:Shortcut.CharString -..param.key:List item value. -...type:Shortcut.CharString -..returns:$void$ -..remarks:You can add formatting to both $key$ and $value$. See @Class.ToolDoc@ for information on formatting of text. -..see:Class.ToolDoc -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void addListItem(ToolDoc & doc, CharString const & key, CharString const & value) -{ - appendValue(doc._entries, new ToolDocListItem_(key, value)); -} - -// -------------------------------------------------------------------------- -// Function print() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#print - * @headerfile - * @brief Print ToolDoc object in a given format. - * - * @signature void print(stream, toolDoc, format); - * - * @param stream The std::ostream to write to. - * @param toolDoc The ToolDoc to print. - * @param format The format, one of {"html", "man", "txt"}. - */ - -/** -.Function.ToolDoc#print -..cat:Miscellaneous -..summary:Print @Class.ToolDoc@ object in a given format. -..signature:print(stream, doc, format) -..class:Class.ToolDoc -..param.stream:List item key. -...type:nolink:$std::ostream$ -..param.doc:Tool documentation object to print. -...type:Class.ToolDoc -..param.format:Format to print in. One of "html", "man", "txt". -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void print(std::ostream & stream, ToolDoc const & doc, CharString const & format) -{ - doc.print(stream, format); -} - -// -------------------------------------------------------------------------- -// Function clearEntries() ToolDoc -// -------------------------------------------------------------------------- - -/*! - * @fn ToolDoc#clearEntries - * @headerfile - * @brief Clear entries from ToolDoc. - * - * @signature void clearEntries(toolDoc); - * - * @param toolDoc The ToolDoc object to clear entries from. - */ - -/** -.Function.ToolDoc#clearEntries -..cat:Miscellaneous -..summary:Clear entries from @Class.ToolDoc@ object. -..signature:clearEntries(doc) -..class:Class.ToolDoc -..param.doc:Tool documentation object to clear. -...type:Class.ToolDoc -..returns:$void$ -..include:seqan/arg_parse/tool_doc.h -*/ - -inline void clearEntries(ToolDoc & doc) -{ - typedef Iterator, Rooted>::Type TIter; - for (TIter it = begin(doc._entries, Rooted()); !atEnd(it); goNext(it)) - delete *it; - clear(doc._entries); -} - -// -------------------------------------------------------------------------- -// Function HtmlDocPrinter_::print() -// -------------------------------------------------------------------------- - -inline -void HtmlToolDocPrinter_::print(std::ostream & stream, ToolDoc const & doc) -{ - // Print HTML boilerplate header. - stream << "\n" - << "\n" - << "\n" - << "\n" - << "" << xmlEscape(doc._name) << " — " << xmlEscape(doc._shortDescription) << "\n" - << "\n" - << "\n"; - - stream << "

" << _toHtml(doc._name) << "

\n" - << "
" << _toHtml(doc._shortDescription) << "
\n"; - - typedef Iterator const, Rooted>::Type TIter; - bool isDl = false; - bool isP = false; - for (TIter it = begin(doc._entries, Rooted()); !atEnd(it); goNext(it)) - { - SEQAN_ASSERT_NOT_MSG(isDl && isP, "Current
and

are mutually exclusive."); - ToolDocEntry_ * entry = *it; - - switch (entry->getType()) - { - case ToolDocEntry_::SECTION: - { - _maybeCloseList(stream, isDl); - _maybeCloseParagraph(stream, isP); - ToolDocSection_ const * sec = static_cast(entry); - stream << "

" << _toHtml(sec->_title) << "

\n"; - } - break; - - case ToolDocEntry_::SUBSECTION: - { - _maybeCloseList(stream, isDl); - _maybeCloseParagraph(stream, isP); - ToolDocSection_ const * sec = static_cast(entry); - stream << "

" << _toHtml(sec->_title) << "

\n"; - } - break; - - case ToolDocEntry_::LINE: - { - ToolDocLine_ const * line = static_cast(entry); - _maybeCloseList(stream, isDl); - if (!isP) - { - stream << "

\n"; - isP = true; - } - stream << _toHtml(line->_text) << "\n"; - if (line->isParagraph()) - _maybeCloseParagraph(stream, isP); - else - stream << "
\n"; - } - break; - - case ToolDocEntry_::LIST_ITEM: - { - _maybeCloseParagraph(stream, isP); - ToolDocListItem_ const * item = static_cast(entry); - if (!isDl) - { - stream << "

\n"; - isDl = true; - } - stream << "
" << _toHtml(item->_term) << "
\n" - << "
" << _toHtml(item->_description) << "
\n"; - } - break; - } - } - _maybeCloseList(stream, isDl); - - // Print version and date. - stream << "

Version

\n" - << "

Last update: " << _toHtml(doc._date) << ", " << doc._name - << " version: " << doc._version << "

\n"; - - // Print HTML boilerplate footer. - stream << ""; -} - -// -------------------------------------------------------------------------- -// Function TextDocPrinter_::print() -// -------------------------------------------------------------------------- - -inline -void TextToolDocPrinter_::print(std::ostream & stream, ToolDoc const & doc) -{ - std::ostream_iterator out(stream); - - stream << doc._name; - if (!empty(doc._shortDescription)) - stream << " - " << doc._shortDescription; - stream << "\n"; - unsigned len = _textWidth(doc._name) + (empty(doc._shortDescription) ? 0 : 3) + _textWidth(doc._shortDescription); - std::fill_n(out, len, '='); - stream << '\n'; - - typedef Iterator const, Rooted>::Type TIter; - bool prevWasParagraph = false; // Stores whether to add a line break. - for (TIter it = begin(doc._entries, Rooted()); !atEnd(it); goNext(it)) - { - ToolDocEntry_ * entry = *it; - - switch (entry->getType()) - { - case ToolDocEntry_::SECTION: - { - ToolDocSection_ const * sec = static_cast(entry); - _printSection(stream, *sec); - prevWasParagraph = false; - } - break; - - case ToolDocEntry_::SUBSECTION: - { - ToolDocSection_ const * sec = static_cast(entry); - _printSubSection(stream, *sec); - prevWasParagraph = false; - } - break; - - case ToolDocEntry_::LINE: - { - if (prevWasParagraph) - stream << '\n'; - ToolDocLine_ const * line = static_cast(entry); - _printLine(stream, *line); - prevWasParagraph = line->isParagraph(); - } - break; - - case ToolDocEntry_::LIST_ITEM: - { - if (prevWasParagraph) - stream << '\n'; - ToolDocListItem_ const * item = static_cast(entry); - _printListItem(stream, *item); - prevWasParagraph = false; - } - break; - } - } - - // Print version and date. - stream << "\n" << _toText("\\fB") << "VERSION" << _toText("\\fP") << "\n"; - std::fill_n(out, _layout.leftPadding, ' '); - stream << doc._name << " version: " << doc._version << "\n"; - std::fill_n(out, _layout.leftPadding, ' '); - stream << "Last update " << doc._date << "\n"; -} - -inline -void ManToolDocPrinter_::print(std::ostream & stream, ToolDoc const & doc) -{ - std::ostream_iterator out(stream); - - // Print .TH line. - stream << ".TH "; - std::transform(begin(doc._name), end(doc._name), out, toupper); - stream << " " << doc._manSection << " \"" << doc._date << "\" \""; - std::transform(begin(doc._name), end(doc._name), out, tolower); - stream << " " << doc._version << "\" \"" << doc._manTitle << "\"\n"; - - // Print NAME section. - stream << ".SH NAME\n" - << doc._name << " \\- " << doc._shortDescription << std::endl; - - // Print text. - typedef Iterator const, Rooted>::Type TIter; - bool isFirstInSection = true; - for (TIter it = begin(doc._entries, Rooted()); !atEnd(it); goNext(it)) - { - ToolDocEntry_ * entry = *it; - switch (entry->getType()) - { - case ToolDocEntry_::SUBSECTION: - { - ToolDocSubSection_ const * sec = static_cast(entry); - stream << ".SS " << sec->_title << "\n"; - isFirstInSection = true; - } - break; - - case ToolDocEntry_::SECTION: - { - ToolDocSection_ const * sec = static_cast(entry); - stream << ".SH "; - std::transform(begin(sec->_title), end(sec->_title), out, toupper); - stream << "\n"; - isFirstInSection = true; - } - break; - - case ToolDocEntry_::LINE: - { - ToolDocLine_ const * line = static_cast(entry); - if (!isFirstInSection && line->isParagraph()) - stream << ".sp\n"; - else if (!isFirstInSection && !line->isParagraph()) - stream << ".br\n"; - stream << line->_text << "\n"; - isFirstInSection = false; - } - break; - - case ToolDocEntry_::LIST_ITEM: - { - ToolDocListItem_ const * item = static_cast(entry); - stream << ".TP\n" - << item->_term << "\n" - << item->_description << "\n"; - isFirstInSection = false; - } - break; - } - } -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_MISC_TOOL_DOC_H_ diff --git a/seqan/arg_parse/xml_support.h b/seqan/arg_parse/xml_support.h deleted file mode 100644 index 14db0ce..0000000 --- a/seqan/arg_parse/xml_support.h +++ /dev/null @@ -1,104 +0,0 @@ -// ========================================================================== -// xml_support.h -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Stephan Aiche -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_ARG_PARSE_XML_SUPPORT_H_ -#define CORE_INCLUDE_SEQAN_ARG_PARSE_XML_SUPPORT_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function _xmlEscape() -// ---------------------------------------------------------------------------- - -/* - * make sure that the text we put into the XML does not break the XML - * candidates are - * " -> " - * ' -> ' - * & -> & - * < -> < - * > -> > - */ -/** -.Function.xmlEscape: -..summary:Replaces invalid XML characters in the given sequence with their valid XML equivalent. -..cat:Miscellaneous -..signature:xmlEscape(sequence) -..param.sequence:The sequence to escape. -..returns:An escaped version of the given string. -..include:seqan/arg_parse/xml_support.h -*/ -template -TSequence xmlEscape(TSequence const & original) -{ - typedef typename Iterator::Type TSequenceIterator; - TSequence escaped; - TSequenceIterator endIter = end(original, Standard()); - for (TSequenceIterator ch = begin(original, Standard()); ch != endIter; goNext(ch)) - { - if (value(ch) == '"') - append(escaped, """); - else if (value(ch) == '\'') - append(escaped, "'"); - else if (value(ch) == '&') - append(escaped, "&"); - else if (value(ch) == '<') - append(escaped, "<"); - else if (value(ch) == '>') - append(escaped, ">"); - else - append(escaped, *ch); - } - return escaped; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_ARG_PARSE_XML_SUPPORT_H_ diff --git a/seqan/bam_io.h b/seqan/bam_io.h deleted file mode 100644 index 66ee7d1..0000000 --- a/seqan/bam_io.h +++ /dev/null @@ -1,109 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade header for module bam_io. -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_H_ - -// =========================================================================== -// Prerequisites. -// =========================================================================== - -#include -#include -#include -#include -#include -#include - -// =========================================================================== -// Data Structures & Conversion. -// =========================================================================== - -#include -#include -#include -#include -#include -#include - -// =========================================================================== -// Actual I/O Code. -// =========================================================================== - -#include -#include - -// BAM I/O is only available when ZLIB is available (and thus the BGz Stream). -#if SEQAN_HAS_ZLIB -#include -#include -#endif // #if SEQAN_HAS_ZLIB - -// =========================================================================== -// BAM Index Related. -// =========================================================================== - -// BAM indices are only available when ZLIB is available. -#if SEQAN_HAS_ZLIB -#include -#include -#endif // #if SEQAN_HAS_ZLIB - -// =========================================================================== -// Utility Routines. -// =========================================================================== - -#include - -// =========================================================================== -// Easy BAM / SAM I/O. -// =========================================================================== - -#include -#if SEQAN_HAS_ZLIB -#include -#endif // #if SEQAN_HAS_ZLIB -#include - -#include -#if SEQAN_HAS_ZLIB -#include -#endif // #if SEQAN_HAS_ZLIB -#include - -#include - -#endif // CORE_INCLUDE_SEQAN_BAM_IO_H_ diff --git a/seqan/bam_io/INFO b/seqan/bam_io/INFO deleted file mode 100644 index 16e6f47..0000000 --- a/seqan/bam_io/INFO +++ /dev/null @@ -1,12 +0,0 @@ -Name: seqan-bam_io -Author: Manuel Holtgrewe -Maintainer: Manuel Holtgrewe -License: BSD 3-clause -Copyright: 2006-2013, FU Berlin -Status: beta -Description: BAM and SAM record I/O code. - This module contains code for streaming through SAM and BAM files. - . - It provides data structures for representing alignments, code to work with - tags and the necessary routines for reading data from and writing data to - streams. diff --git a/seqan/bam_io/bam_alignment_record.h b/seqan/bam_io/bam_alignment_record.h deleted file mode 100644 index fd64316..0000000 --- a/seqan/bam_io/bam_alignment_record.h +++ /dev/null @@ -1,923 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// The class BamAlignmentRecord, flag checking methods, flag constants. -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_RECORD_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_RECORD_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -class BamAlignmentRecord; -inline void clear(BamAlignmentRecord & record); - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @enum BamFlags - * @headerfile - * @brief Shortcuts to the bitmask flags for BAM/SAM files. - * - * @signature enum BamFlags; - * - * @var BamFlags BAM_FLAG_MULTIPLE = 0x0001; - * @brief Template has multiple fragments in sequencing. - * - * @var BamFlags BAM_FLAG_ALL_PROPER = 0x0002; - * @brief All fragments in the template are properly mapped. - * - * @var BamFlags BAM_FLAG_UNMAPPED = 0x0004; - * @brief This fragment is unmapped. - * - * @var BamFlags BAM_FLAG_NEXT_UNMAPPED = 0x0008; - * @brief Next fragment in template is unmapped. - * - * @var BamFlags BAM_FLAG_RC = 0x0010; - * @brief Fragment is reverse-complemented. - * - * @var BamFlags BAM_FLAG_NEXT_RC = 0x0020; - * @brief Next fragment in template is reverse-complemented. - * - * @var BamFlags BAM_FLAG_FIRST = 0x0040; - * @brief This fragment is the first one in its template. - * - * @var BamFlags BAM_FLAG_LAST = 0x0080; - * @brief This fragment is the last one in its template (second in case of paired sequencing). - * - * @var BamFlags BAM_FLAG_SECONDARY = 0x0100; - * @brief Secondary alignment. - * - * @var BamFlags BAM_FLAG_QC_NO_PASS = 0x0200; - * @brief Does not pass quality controls. - * - * @var BamFlags BAM_FLAG_DUPLICATE = 0x0400; - * @brief PCR or optical duplicate. - * - * @var BamFlags BAM_FLAG_SUPPLEMENTARY = 0x0800; - * @brief Supplementary alignment. - */ - -/** -.Enum.BamFlags -..cat:BAM I/O -..signature:BamFlags -..summary:Shortcuts to the bitmask flags for BAM/SAM files. -..value.BAM_FLAG_MULTIPLE:$0x0001$ Template has multiple fragments in sequencing. -..value.BAM_FLAG_ALL_PROPER:$0x0002$ All fragments have been aligned properly. -..value.BAM_FLAG_UNMAPPED:$0x0004$ This fragment could not be mapped. -..value.BAM_FLAG_NEXT_UNMAPPED:$0x0008$ Next fragment is unmapped. -..value.BAM_FLAG_RC:$0x0010$ This fragment is reverse-complemented. -..value.BAM_FLAG_NEXT_RC:$0x0020$ Next fragment is reverse-complemented. -..value.BAM_FLAG_FIRST:$0x0040$ This fragment is the first one in its template. -..value.BAM_FLAG_LAST:$0x0080$ This fragment is the last one in its template. -..value.BAM_FLAG_SECONDARY:$0x0100$ This is a secondary alignment. -..value.BAM_FLAG_QC_NO_PASS:$0x0200$ Does not pass quality controls. -..value.BAM_FLAG_DUPLICATE:$0x0400$ PCR or optical duplicate. -..remarks:Also see the SAM standard on these flags for more explanation. -..include:seqan/bam_io.h -*/ - -enum BamFlags -{ - BAM_FLAG_MULTIPLE = 0x0001, - BAM_FLAG_ALL_PROPER = 0x0002, - BAM_FLAG_UNMAPPED = 0x0004, - BAM_FLAG_NEXT_UNMAPPED = 0x0008, - BAM_FLAG_RC = 0x0010, - BAM_FLAG_NEXT_RC = 0x0020, - BAM_FLAG_FIRST = 0x0040, - BAM_FLAG_LAST = 0x0080, - BAM_FLAG_SECONDARY = 0x0100, - BAM_FLAG_QC_NO_PASS = 0x0200, - BAM_FLAG_DUPLICATE = 0x0400, - BAM_FLAG_SUPPLEMENTARY = 0x0800 -}; - -/*! - * @class BamAlignmentRecord - * @headerfile - * @brief Represent a record from a BAM or SAM file. - * - * @signature class BamAlignmentRecord; - * - * @section Remarks - * - * While also used to represent SAM records, the type is called BamAlignmentRecord since the data directly - * reflects a BAM records (0-based positions, identify references by id, and tags are stored in BAM format. - */ - -/*! - * @fn BamAlignmentRecord::BamAlignmentRecord - * @brief Default constructor. - * - * @signature BamAlignmentRecord::BamAlignmentRecord(); - */ - -/*! - * @var __uint32 BamAlignmentRecord::INVALID_POS - * @brief Static member with invalid sentinel/position value (-1). - * - * @var __uint32 BamAlignmentRecord::INVALID_REFID - * @brief Static member with invalid sentinel/position value (-1). - * - * @var __uint32 BamAlignmentRecord::INVALID_LEN - * @brief Static member with invalid/sentinel reference ids (0 as in BAM/SAM). - * - * @var CharString BamAlignmentRecord::qName - * @brief The query/read name. - * - * Note that the reads of a template all of the same query name and are differentiated by their position - * and the BAM_FLAG_FIRST/BAM_FLAG_LAST flag values. - * - * @var __uint16 BamAlignmentRecord::flag - * @brief The flag of this mapping. - * - * See @link BamFlags @endlink for flag constants and also see the hasFlag*() functions. - * - * @var __int32 BamAlignmentRecord::rID - * @brief ID of reference for this fragment mapping (0-based, INVALID_REFID for '*' in SAM). - * - * @var __int32 BamAlignmentRecord::beginPos - * @brief Begin position of the alignment (0-based, INVALID_POS for '0' in SAM). - * - * @var __uint8 BamAlignmentRecord::mapQ; - * @brief Mapping quality (255 for '*'). - * - * @var __uint16 BamAlignmentRecord::bin; - * @brief The bin of the alignment, automatically computed when writing BAM. - * - * @var TCigarString BamAlignmentRecord::cigar; - * @brief The CIGAR string for the BAM alignment (of type String >). - * - * @var __int32 BamAlignmentRecord::rNextId; - * @brief The ID of the reference where the next fragment in this template aligns. - * - * INVALID_REFID for '*'. - * - * @var __int32 BamAlignmentRecord::pNext; - * @brief Position on the reference where the next fragment in this template aligns. - * - * INVALID_POS for '*'. - * - * @var __int32 BamAlignmentRecord::tLen; - * @brief The inferred template size. - * - * INVALID_LEN for '*'. - * - * @var CharString BamAlignmentRecord::seq; - * @brief The fragment sequence. - * - * @var CharString BamAlignmentRecord::qual; - * @brief The PHRED quality values of the sequence (as in SAM), empty for '*'. - * - * @var CharString BamAlignmentRecord::tags; - * @brief Raw BAM tag string, use @link BamTagsDict @endlink for comfortable access. - */ - -/** -.Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Represent a record from a BAM/SAM file. -..remarks:While also used to represent SAM records, called $BamAlignmentRecord$ since the data directly reflects a BAM record (0-based positions, identify references by ids, not names, tags stored in BAM format.) -..include:seqan/bam_io.h -..see:Enum.BamFlags - -.Memfunc.BamAlignmentRecord#BamAlignmentRecord -..class:Class.BamAlignmentRecord -..summary:Constructor. -..signature:BamAlignmentRecord() -..remarks:Only the default constructor is provided. - -.Memvar.BamAlignmentRecord#INVALID_POS -..class:Class.BamAlignmentRecord -..summary:Static member with invalid/sentinel position value (-1). -..type:nolink:$__uint32$ - -.Memvar.BamAlignmentRecord#INVALID_REFID -..class:Class.BamAlignmentRecord -..summary:Static member with invalid/sentinel reference id (-1). -..type:nolink:$__int32$ - -.Memvar.BamAlignmentRecord#INVALID_LEN -..class:Class.BamAlignmentRecord -..summary:Static member with invalid/sentinel position value (0 as in BAM/SAM). -..type:nolink:$__int32$ - -.Memvar.BamAlignmentRecord#qName -..class:Class.BamAlignmentRecord -..summary:The read/query name. -..type:Shortcut.CharString - -.Memvar.BamAlignmentRecord#flag -..class:Class.BamAlignmentRecord -..summary:The flag of this mapping, see @Enum.BamFlags@ for flag constants and the $hasFlag*$ functions. -..type:nolink:$__uint16$ - -.Memvar.BamAlignmentRecord#rID -..class:Class.BamAlignmentRecord -..summary:ID of reference for this fragment mapping (0-based, $INVALID_REFID$ for '*' in SAM). -..type:nolink:$__int32$ - -.Memvar.BamAlignmentRecord#beginPos -..class:Class.BamAlignmentRecord -..summary:The position of this fragment mapping (0-based, $INVALID_POS$ for '*' in SAM). -..type:nolink:$__int32$ - -.Memvar.BamAlignmentRecord#mapQ -..class:Class.BamAlignmentRecord -..summary:The mapping quality (255 for '*'). -..type:nolink:$__uint8$ - -.Memvar.BamAlignmentRecord#bin -..class:Class.BamAlignmentRecord -..summary:The bin of the alignment, automatically computed when writing BAM. -..type:nolink:$__uint16$ - -.Memvar.BamAlignmentRecord#cigar -..class:Class.BamAlignmentRecord -..summary:The CIGAR string as string of @Class.CigarElement@ objects (empty for '*'). -..type:nolink:$String >$ - -.Memvar.BamAlignmentRecord#rNextId -..class:Class.BamAlignmentRecord -..summary:ID of reference for next fragment mapping (0-based, $INVALID_REFID$ for '*') -..type:nolink:$__int32$ - -.Memvar.BamAlignmentRecord#pNext -..class:Class.BamAlignmentRecord -..summary:Position of next fragment mapping (0-based, $INVALID_POS$ for '*') -..type:nolink:$__uint32$ - -.Memvar.BamAlignmentRecord#tLen -..class:Class.BamAlignmentRecord -..summary:The inferred template size ($INVALID_LEN$ for '*') -..type:nolink:$__int32$ - -.Memvar.BamAlignmentRecord#seq -..class:Class.BamAlignmentRecord -..summary:The sequence string (empty for '*'). -..type:Shortcut.CharString - -.Memvar.BamAlignmentRecord#qual -..class:Class.BamAlignmentRecord -..summary:String with Phred scores (as in SAM file, empty for '*'). -..type:Shortcut.CharString - -.Memvar.BamAlignmentRecord#tags -..class:Class.BamAlignmentRecord -..summary:Raw BAM tag string, use @Class.BamTagsDict@ for comfortable access. -..type:Shortcut.CharString -*/ - -class BamAlignmentRecord -{ -public: - static __int32 const INVALID_POS = -1; - static __int32 const INVALID_REFID = -1; // TODO(holtgrew): Rename to ...REF_ID. - static __int32 const INVALID_LEN = 0; - static __uint32 const INVALID_QID = 4294967295u; // TODO(holtgrew): Undocumented as of yet. - - __uint32 _qID; // TODO(holtgrew): Undocumented as of yet. - CharString qName; - __uint16 flag; - __int32 rID; - __int32 beginPos; - __uint8 mapQ; - __uint16 bin; - String > cigar; - __int32 rNextId; - __int32 pNext; - __int32 tLen; - CharString seq; - CharString qual; - CharString tags; // raw tags in BAM format - - BamAlignmentRecord() : _qID(MaxValue::VALUE) { clear(*this); } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function clear() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#clear - * @brief Clear BamAlignmentRecord. - * - * @signature void clear(record); - * - * @param record The BamAlignmentRecord to clear. - * - * Clears all strings and resets it to default initialization state. - */ - -///.Function.clear.param.object.type:Class.BamAlignmentRecord -///.Function.clear.class:Class.BamAlignmentRecord - -inline void -clear(BamAlignmentRecord & record) -{ - clear(record.qName); - record._qID = MaxValue<__uint32>::VALUE; - record.rID = BamAlignmentRecord::INVALID_REFID; - record.beginPos = BamAlignmentRecord::INVALID_POS; - record.mapQ = 255; - record.bin = 0; - clear(record.cigar); - record.rNextId = BamAlignmentRecord::INVALID_REFID; - record.pNext = BamAlignmentRecord::INVALID_POS; - record.tLen = BamAlignmentRecord::INVALID_LEN; - clear(record.seq); - clear(record.qual); - clear(record.tags); -} - -// ---------------------------------------------------------------------------- -// Function hasFlagMultiple() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagMultiple - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "multiple" flag set. - * - * @signature bool hasFlagMultiple(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagMultiple -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "multiple" flag set. -..signature:hasFlagMultiple(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagAllProper -..see:Function.hasFlagUnmapped -..see:Function.hasFlagNextUnmapped -..see:Function.hasFlagRC -..see:Function.hasFlagNextRC -..see:Function.hasFlagFirst -..see:Function.hasFlagLast -..see:Function.hasFlagSecondary -..see:Function.hasFlagQCNoPass -..see:Function.hasFlagDuplicate -*/ - -inline bool -hasFlagMultiple(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_MULTIPLE) == BAM_FLAG_MULTIPLE; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagAllProper() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagAllProper - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "all properly aligned" flag set. - * - * @signature bool hasFlagAllProper(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagAllProper -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "all properly aligned" flag set. -..signature:hasFlagAllProper(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagMultiple -..see:Function.hasFlagUnmapped -..see:Function.hasFlagNextUnmapped -..see:Function.hasFlagRC -..see:Function.hasFlagNextRC -..see:Function.hasFlagFirst -..see:Function.hasFlagLast -..see:Function.hasFlagSecondary -..see:Function.hasFlagQCNoPass -..see:Function.hasFlagDuplicate -*/ - -inline bool -hasFlagAllProper(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_ALL_PROPER) == BAM_FLAG_ALL_PROPER; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagUnmapped() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagUnmapped - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "unmapped" flag set. - * - * @signature bool hasFlagUnmapped(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagUnmapped -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "fragment unmapped" flag set. -..signature:hasFlagUnmapped(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagMultiple -..see:Function.hasFlagAllProper -..see:Function.hasFlagNextUnmapped -..see:Function.hasFlagRC -..see:Function.hasFlagNextRC -..see:Function.hasFlagFirst -..see:Function.hasFlagLast -..see:Function.hasFlagSecondary -..see:Function.hasFlagQCNoPass -..see:Function.hasFlagDuplicate -*/ - -inline bool -hasFlagUnmapped(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_UNMAPPED) == BAM_FLAG_UNMAPPED; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagNextUnmapped() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagNextUnmapped - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "next unmapped" flag set. - * - * @signature bool hasFlagNextUnmapped(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagNextUnmapped -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "next fragment unmapped" flag set. -..signature:hasFlagNextUnmapped(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagMultiple -..see:Function.hasFlagAllProper -..see:Function.hasFlagUnmapped -..see:Function.hasFlagRC -..see:Function.hasFlagNextRC -..see:Function.hasFlagFirst -..see:Function.hasFlagLast -..see:Function.hasFlagSecondary -..see:Function.hasFlagQCNoPass -..see:Function.hasFlagDuplicate -*/ - -inline bool -hasFlagNextUnmapped(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_NEXT_UNMAPPED) == BAM_FLAG_NEXT_UNMAPPED; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagRC() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagRC - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "reverse-complemented" flag set. - * - * @signature bool hasFlagRC(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagRC -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "reverse-complemented" flag set. -..signature:hasFlagRC(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagMultiple -..see:Function.hasFlagAllProper -..see:Function.hasFlagUnmapped -..see:Function.hasFlagNextUnmapped -..see:Function.hasFlagNextRC -..see:Function.hasFlagFirst -..see:Function.hasFlagLast -..see:Function.hasFlagSecondary -..see:Function.hasFlagQCNoPass -..see:Function.hasFlagDuplicate -*/ -inline bool -hasFlagRC(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_RC) == BAM_FLAG_RC; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagNextRC() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagNextRC - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "next reverse-complemented" flag set. - * - * @signature bool hasFlagNextRC(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagNextRC -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "next fragment reverse-complemented" flag set. -..signature:hasFlagNextRC(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagMultiple -..see:Function.hasFlagAllProper -..see:Function.hasFlagUnmapped -..see:Function.hasFlagNextUnmapped -..see:Function.hasFlagRC -..see:Function.hasFlagFirst -..see:Function.hasFlagLast -..see:Function.hasFlagSecondary -..see:Function.hasFlagQCNoPass -..see:Function.hasFlagDuplicate -*/ - -inline bool -hasFlagNextRC(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_NEXT_RC) == BAM_FLAG_NEXT_RC; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagFirst() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagFirst - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "first in template" flag set. - * - * @signature bool hasFlagFirst(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagFirst -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "first fragment of template" flag set. -..signature:hasFlagFirst(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagMultiple -..see:Function.hasFlagAllProper -..see:Function.hasFlagUnmapped -..see:Function.hasFlagNextUnmapped -..see:Function.hasFlagRC -..see:Function.hasFlagNextRC -..see:Function.hasFlagLast -..see:Function.hasFlagSecondary -..see:Function.hasFlagQCNoPass -..see:Function.hasFlagDuplicate -*/ - -inline bool -hasFlagFirst(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_FIRST) == BAM_FLAG_FIRST; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagLast() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagLast - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "last in template" flag set. - * - * @signature bool hasFlagLast(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagLast -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "last fragment of template" flag set. -..signature:hasFlagLast(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagMultiple -..see:Function.hasFlagAllProper -..see:Function.hasFlagUnmapped -..see:Function.hasFlagNextUnmapped -..see:Function.hasFlagRC -..see:Function.hasFlagNextRC -..see:Function.hasFlagFirst -..see:Function.hasFlagSecondary -..see:Function.hasFlagQCNoPass -..see:Function.hasFlagDuplicate -*/ - -inline bool -hasFlagLast(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_LAST) == BAM_FLAG_LAST; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagSecondary() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagSecondary - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "secondary" flag set. - * - * @signature bool hasFlagSecondary(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagSecondary -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "secondary alignment" flag set. -..signature:hasFlagSecondary(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagMultiple -..see:Function.hasFlagAllProper -..see:Function.hasFlagUnmapped -..see:Function.hasFlagNextUnmapped -..see:Function.hasFlagRC -..see:Function.hasFlagNextRC -..see:Function.hasFlagFirst -..see:Function.hasFlagLast -..see:Function.hasFlagQCNoPass -..see:Function.hasFlagDuplicate -*/ - -inline bool -hasFlagSecondary(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_SECONDARY) == BAM_FLAG_SECONDARY; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagQCNoPass() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagQCNoPass - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "did not pass QC" flag set. - * - * @signature bool hasFlagQCNoPass(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagQCNoPass -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "does not pass quality controls" flag set. -..signature:hasFlagQCNoPass(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagMultiple -..see:Function.hasFlagAllProper -..see:Function.hasFlagUnmapped -..see:Function.hasFlagNextUnmapped -..see:Function.hasFlagRC -..see:Function.hasFlagNextRC -..see:Function.hasFlagFirst -..see:Function.hasFlagLast -..see:Function.hasFlagSecondary -..see:Function.hasFlagDuplicate -*/ - -inline bool -hasFlagQCNoPass(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_QC_NO_PASS) == BAM_FLAG_QC_NO_PASS; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagDuplicate() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagDuplicate - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "duplicate" flag set. - * - * @signature bool hasFlagDuplicate(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -/** -.Function.hasFlagDuplicate -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Return true if a @Class.BamAlignmentRecord@ has the "PCR or optical duplicate" flag set. -..signature:hasFlagDuplicate(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$bool$, indicating the flag's status. -..include:seqan/bam_io.h -..see:Function.hasFlagMultiple -..see:Function.hasFlagAllProper -..see:Function.hasFlagUnmapped -..see:Function.hasFlagNextUnmapped -..see:Function.hasFlagRC -..see:Function.hasFlagNextRC -..see:Function.hasFlagFirst -..see:Function.hasFlagLast -..see:Function.hasFlagSecondary -..see:Function.hasFlagQCNoPass -*/ - -inline bool -hasFlagDuplicate(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_DUPLICATE) == BAM_FLAG_DUPLICATE; -} - -// ---------------------------------------------------------------------------- -// Function hasFlagSupplementary() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#hasFlagSupplementary - * @headerfile - * @brief Return true if a @link BamAlignmentRecord @endlink has the "supplementary" flag set. - * - * @signature bool hasFlagSupplementary(record); - * - * @param record The BamAlignmentRecord to query. - * - * @return bool true if the flag is set, false otherwise. - */ - -inline bool -hasFlagSupplementary(BamAlignmentRecord const & record) -{ - return (record.flag & BAM_FLAG_SUPPLEMENTARY) == BAM_FLAG_SUPPLEMENTARY; -} - -// ---------------------------------------------------------------------------- -// Function getAlignmentLengthInRef() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#getAlignmentLengthInRef - * @headerfile - * @brief Return the alignment length in the record's projection in the reference. - * - * @signature unsigned getAlignmentLengthInRef(record); - * - * @param record The BamAlignmentRecord to compute length for. - * - * @return unsigned The alignment length. - */ - -/** -.Function.getAlignmentLengthInRef -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Returns length of @Class.BamAlignmentRecord@'s projection in reference. -..signature:getAlignmentLengthInRef(record) -..param.record:The record to query. -...type:Class.BamAlignmentRecord -..returns:$unsigned$, the alignment length in the reference. -..include:seqan/bam_io.h -*/ - -inline unsigned -getAlignmentLengthInRef(BamAlignmentRecord const & record) -{ - unsigned l = 0; - _getLengthInRef(record.cigar, l); - return l; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_RECORD_H_ diff --git a/seqan/bam_io/bam_alignment_record_util.h b/seqan/bam_io/bam_alignment_record_util.h deleted file mode 100644 index bb9dd44..0000000 --- a/seqan/bam_io/bam_alignment_record_util.h +++ /dev/null @@ -1,236 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_ALIGNMENT_RECORD_UTIL_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_ALIGNMENT_RECORD_UTIL_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function getClippedPos() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Test me! -// TODO(holtgrew): Document me! - -// Extract positions of soft clipping. - -inline bool -getClippedPos(unsigned & posBegin, unsigned & posEnd, BamAlignmentRecord const & record) -{ - posBegin = 0; - posEnd = length(record.seq); - - for (unsigned j = 0; j < length(record.cigar); ++j) - { - if (record.cigar[j].operation == 'S') - posBegin += record.cigar[j].count; - else - break; - } - for (unsigned j = 0; j < length(record.cigar); ++j) - { - if (record.cigar[length(record.cigar) - j - 1].operation == 'S') - posEnd -= record.cigar[length(record.cigar) - j - 1].count; - else - break; - } - SEQAN_ASSERT_LEQ(posBegin, posEnd); - SEQAN_ASSERT_LEQ(posBegin, length(record.seq)); - SEQAN_ASSERT_LEQ(posEnd, length(record.seq)); - - return (posBegin != 0) || (posEnd != length(record.seq)); -} - -// ---------------------------------------------------------------------------- -// Function clippedSeqInfix() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Test me! -// TODO(holtgrew): Document me! - -// Returns clipped infix of seq member. - -inline Infix::Type -clippedSeqInfix(BamAlignmentRecord & record) -{ - unsigned begPos = 0, endPos = 0; - getClippedPos(begPos, endPos, record); - return infix(record.seq, begPos, endPos); -} - -inline Infix::Type -clippedSeqInfix(BamAlignmentRecord const & record) -{ - unsigned begPos = 0, endPos = 0; - getClippedPos(begPos, endPos, record); - return infix(record.seq, begPos, endPos); -} - -// ---------------------------------------------------------------------------- -// Function clippedQualInfix() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Test me! -// TODO(holtgrew): Document me! - -// Returns clipped infix of qual member. - -inline Infix::Type -clippedQualInfix(BamAlignmentRecord & record) -{ - unsigned begPos = 0, endPos = 0; - getClippedPos(begPos, endPos, record); - return infix(record.qual, begPos, endPos); -} - -inline Infix::Type -clippedQualInfix(BamAlignmentRecord const & record) -{ - unsigned begPos = 0, endPos = 0; - getClippedPos(begPos, endPos, record); - return infix(record.qual, begPos, endPos); -} - -// ---------------------------------------------------------------------------- -// Function countPaddings() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): This actually belongs to wherever CigarElement is defined. - -inline unsigned countPaddings(String > const & cigarString) -{ - unsigned result = 0; - for (unsigned i = 0; i < length(cigarString); ++i) - if (cigarString[i].operation == 'P') - result += cigarString[i].count; - return result; -} - -// ---------------------------------------------------------------------------- -// Function bamRecordToAlignment() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamAlignmentRecord#bamRecordToAlignment - * @headerfile - * @brief Construct an @link Align @endlink object from a BamAlignmentRecord object. - * - * @signature void bamRecordToAlignment(align, reference, record); - * - * @param align The @link Align @endlink object to create the alignment object in. - * @param reference The string with the reference that record lies on. - * @param record The @link BamAlignmentRecord @endlink to construct alignment from. - * - * The function will resize align to have two rows. The part of the reference that the read from - * record aligns to will be copied to the first row and the sequence from record will be copied to the second - * row (and reverse-complemented if appropriate). Then, the gaps from the CIGAR string in record will be - * copied to align. - * - * @section Example - * - * Here is an example: - * - * @code{.cpp} - * StringSet references; - * BamAlignment record; - * // Read references and record. - * Align align; - * if (record.rID != BamAlignmentRecord::INVALID_REFID) - * bamRecordToAlignment(align, references[record.refId], record); - * @endcode - */ - -// TODO(holtgrew): Convert into full example. - -/** -.Function.bamRecordToAlignment -..class:Class.BamAlignmentRecord -..cat:BAM I/O -..summary:Convert @Class.BamAlignmentRecord@ to an @Class.Align@ object. -..signature:bamRecordToAlignment(align, reference, record) -..param.align:The alignment to create. -...type:Class.Align -..param.reference:String of Dna, Dna5, ... characters. -...type:Class.String -..param.record:The alignment record to convert. -...type:Class.BamAlignmentRecord -..returns:$void$ -..include:seqan/bam_io.h -..example.code: -StringSet references; -BamAlignment record; -// Read references and record. -Align align; -if (record.rID != BamAlignmentRecord::INVALID_REFID) - bamRecordToAlignment(align, references[record.refId], record); - */ - -template -void -bamRecordToAlignment(Align & result, TReference & reference, BamAlignmentRecord & record) -{ - // TODO(holtgrew): Clipping better than copying infix? But is it generic? - resize(rows(result), 2); - - unsigned len = record.beginPos + getAlignmentLengthInRef(record) - countPaddings(record.cigar); - - setSource(row(result, 0), reference); - setClippedEndPosition(row(result, 0), record.beginPos + len); - setClippedBeginPosition(row(result, 0), record.beginPos); - cigarToGapAnchorContig(record.cigar, row(result, 0)); - - assignSource(row(result, 1), record.seq); - cigarToGapAnchorRead(record.cigar, row(result, 1)); -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_ALIGNMENT_RECORD_UTIL_H_ diff --git a/seqan/bam_io/bam_header_record.h b/seqan/bam_io/bam_header_record.h deleted file mode 100644 index 466fdf3..0000000 --- a/seqan/bam_io/bam_header_record.h +++ /dev/null @@ -1,648 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// BamHeaderRecord class, supporting types and functions for accessing tags -// in headers. -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_HEADER_RECORD_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_HEADER_RECORD_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @enum BamHeaderRecordType - * @headerfile - * @brief Enumeration for the header record type. - * - * @signature enum BamHeaderRecordType; - * - * @var BamHeaderRecordType BAM_HEADER_FIRST = 0; - * @brief Is the first header (HD). - * - * @var BamHeaderRecordType BAM_HEADER_REFERENCE = 1; - * @brief Is a reference (SQ) header. - * - * @var BamHeaderRecordType BAM_HEADER_READ_GROUP = 2; - * @brief Is a read group (RG) header. - * - * @var BamHeaderRecordType BAM_HEADER_PROGRAM = 3; - * @brief Is a program (PG) header. - * - * @var BamHeaderRecordType BAM_HEADER_COMMENT = 4; - * @brief Is a comment (CO) header. - */ - -/** -.Enum.BamHeaderRecordType -..cat:BAM I/O -..summary:Enumeration for the header record type. -..signature:BamHeaderRecordType -..value.BAM_HEADER_FIRST:@Class.BamHeaderRecord@ is of type $@HD$ -..value.BAM_HEADER_REFERENCE:@Class.BamHeaderRecord@ is of type $@SQ$ -..value.BAM_HEADER_READ_GROUP:@Class.BamHeaderRecord@ is of type $@RG$ -..value.BAM_HEADER_PROGRAM:@Class.BamHeaderRecord@ is of type $@PG$ -..value.BAM_HEADER_COMMENT:@Class.BamHeaderRecord@ is of type $@CO$ -..include:seqan/bam_io.h -*/ - -enum BamHeaderRecordType -{ - BAM_HEADER_FIRST = 0, - BAM_HEADER_REFERENCE = 1, - BAM_HEADER_READ_GROUP = 2, - BAM_HEADER_PROGRAM = 3, - BAM_HEADER_COMMENT = 4 -}; - -/*! - * @enum BamSortOrder - * @headerfile - * @brief Enumeration for the header record type. - * - * @signature enum BamSortOrder; - * - * @var BamSortOrder BAM_SORT_UNKNOWN = 0; - * @brief BAM file sort order is unknown. - * - * @var BamSortOrder BAM_SORT_UNSORTED = 1; - * @brief BAM file is unsorted. - * - * @var BamSortOrder BAM_SORT_QUERYNAME = 2; - * @brief BAM file is sorted by query name; - * - * @var BamSortOrder BAM_SORT_COORDINATE = 3; - * @brief BAM file is sorted by coordinate. - */ - -/** -.Enum.BamSortOrder -..cat:BAM I/O -..summary:Enumeration for the header record type. -..signature:BamSortOrder -..value.BAM_SORT_UNKNOWN:BAM file sort order is unknown. -..value.BAM_SORT_UNSORTED:BAM file is unsorted. -..value.BAM_SORT_QUERYNAME:BAM file is sorted by query name. -..value.BAM_SORT_COORDINATE:BAM file is sorted by coordinates. -..include:seqan/bam_io.h -*/ - -enum BamSortOrder -{ - BAM_SORT_UNKNOWN = 0, - BAM_SORT_UNSORTED = 1, - BAM_SORT_QUERYNAME = 2, - BAM_SORT_COORDINATE = 3 -}; - -/*! - * @class BamHeaderRecord - * @headerfile - * @brief Represents a header entry in a SAM file or the header section of the BAM header. - * - * @signature class BamHeaderRecord; - * - * @section Remarks - * - * Comment records are stored with one tag where the key is empty and the value is the comment. - */ - -/*! - * @fn BamHeaderRecord::BamHeaderRecord - * @brief Constructor. - * @signature BamHeaderRecord::BamRecord(); - * - * @section Remarks - * - * Only the default constructor is provided. - */ - -/*! - * @typedef BamHeaderRecord::TTagName - * @brief Type of the tag keys. - * @signature BamHeaderRecord::TTagName; - * - * @typedef BamHeaderRecord::TTagValue - * @brief Type of the tag values. - * @signature BamHeaderRecord::TTagValue; - * - * @typedef BamHeaderRecord::TTag - * @brief Type of the tag keys. - * @signature BamHeaderRecord::TTag; - * - * @typedef BamHeaderRecord::TTags - * @brief Type of the string of @link Pair Pairs @endlink. - * @signature BamHeaderRecord::TTags; - * - * @var BamHeaderRecordType BamHeaderRecord::type - * @brief Type of the record. - * - * @var TRecordString BamHeaderRecord::tags - * @brief The header record's tags, of type @link BamHeaderRecord::TTags @endlink. - */ - -/** -.Class.BamHeaderRecord -..cat:BAM I/O -..summary:Represents a header entry in a SAM file or the header section of the BAM header. -..signature:BamHeaderRecord -..remarks:Comment records are stored with one tag where the key is empty and the value is the comment. -..include:seqan/bam_io.h - -.Memfunc.BamHeaderRecord#BamHeaderRecord -..class:Class.BamHeaderRecord -..signature:BamHeaderRecord() -..summary:Constructor. -..remarks:Only the default constructor is provided. - -.Typedef.BamHeaderRecord#TTagName -..class:Class.BamHeaderRecord -..summary:Type of the tag keys. - -.Typedef.BamHeaderRecord#TTagValue -..class:Class.BamHeaderRecord -..summary:Type of the tag values. - -.Typedef.BamHeaderRecord#TTag -..class:Class.BamHeaderRecord -..summary:@Class.Pair@ to use for storing tags. - -.Typedef.BamHeaderRecord#TTags -..class:Class.BamHeaderRecord -..summary:Type of the string of tag @Class.Pair|Pairs@. - -.Memvar.BamHeaderRecord#type -..summary:Type of the record. -..class:Class.BamHeaderRecord -..type:Enum.BamHeaderRecordType - -.Memvar.BamHeaderRecord#tags -..summary:The header record's tags. -..class:Class.BamHeaderRecord -..type:Typedef.BamHeaderRecord#TTags -*/ - -class BamHeaderRecord -{ -public: - typedef CharString TTagName; - typedef CharString TTagValue; - typedef Pair TTag; - typedef String TTags; - - BamHeaderRecordType type; - String > tags; - - BamHeaderRecord() {} -}; - -// ---------------------------------------------------------------------------- -// Function std::swap() -// ---------------------------------------------------------------------------- - -inline void -swap(BamHeaderRecord &a, BamHeaderRecord &b) -{ - std::swap(a.type, b.type); - swap(a.tags, b.tags); -} - -/*! - * @class BamHeader - * @headerfile - * @brief Stores the information of the BAM header. - * - * @signature class BamHeader; - * - * @fn BamHeader::BamHeader - * @brief Constructor. - * - * @signature BamHeader::BamHeader(); - * - * Only the the default constructor is provided. - * - * @var TSequenceInfos BamHeader::sequenceInfos - * @brief String of (seqId, length) with reference name / length information. - * - * TSequenceInfos is a String of @link Pair @endlink objects with entries @link CharString @endlink and - * __int32. - * - * @var TBamHeaderRecords BamHeader::records - * @brief String of @link BamHeaderRecord BamHeaderRecords @endlink. - */ - -/** -.Class.BamHeader -..cat:BAM I/O -..summary:Stores the information of the BAM header. -..signature:BamHeader -..see:Class.BamHeaderRecord -..include:seqan/bam_io.h - -.Memfunc.BamHeader#BamHeader -..class:Class.BamHeader -..signature:BamHeader() -..summary:Constructor. -..remarks:Only the default constructor is provided. - -.Memvar.BamHeader#sequenceInfos -..class:Class.BamHeader -..summary:String of $(seqid, length)$ with reference name / length information. -..type:nolink:$String >$ - -.Memvar.BamHeader#records -..class:Class.BamHeader -..summary:String of @Class.BamHeaderRecord|BamHeaderRecords@. -..type:nolink:$String$ -*/ - -class BamHeader -{ -public: - typedef Pair TSequenceInfo; - - String > sequenceInfos; - String records; -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function clear() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamHeaderRecord::clear - * @brief Clear BamHeaderRecord object. - * - * @signature void(record); - * - * @param record The record to clear. - */ - -///.Function.clear.param.object.type:Class.BamHeaderRecord - -inline void -clear(BamHeaderRecord & record) -{ - clear(record.tags); -} - -// ---------------------------------------------------------------------------- -// Function findTagKey() -// ---------------------------------------------------------------------------- - -/** -.Function.BamHeaderRecord#findTagKey -..cat:BAM I/O -..summary:Find a tag's key of a @Class.BamHeaderRecord@. -..signature:findTagKey(idx, key, record) -..param.idx:The index of the found key is stored here. -...type:nolink:$unsigned$ -..param.key:The name of the tag key whose position is to be stored in $idx$. -...type:Shortcut.CharString -..param.record:The record to query. -...type:Class.BamHeaderRecord -..returns:$bool$, indicating whether the key could be found. -..include:seqan/bam_io.h -..example.code: -unsigned myIdx = 0; -bool keyFound = findTagKey(myIdx, "SN", record); -*/ - -template -inline bool -findTagKey(unsigned & idx, TKeyName const & key, BamHeaderRecord const & record) -{ - typedef BamHeaderRecord::TTags const TTags; - typedef Iterator::Type TIterator; - - idx = 0; - TIterator itEnd = end(record.tags, Standard()); - for (TIterator it = begin(record.tags, Standard()); it != itEnd; goNext(it), ++idx) - if (it->i1 == key) - return true; - - return false; -} - -// ---------------------------------------------------------------------------- -// Function getTagValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamHeaderRecord::getTagValue - * @brief Return tag value from a @link BamHeaderRecord @endlink. - * - * @signature bool getTagValue(tagValue, idx, record); - * @signature bool getTagValue(tagValue, key, record); - * - * @param tagValue The @link CharString @endlink to write the tag value to. - * @param idx An integer with the index of the tag in the header record. - * @param key A two-letter sequence with the key of the tag in the header record. - * - * @return bool true in case the value could be retrieved, false otherwise. - * - * @section Example - * - * @code{.cpp} - * CharString tagValue; - * bool keyFound = getTagValue(tagValue, "SN", record); - * @endcode - */ - -/** -.Function.BamHeaderRecord#getTagValue -..cat:BAM I/O -..summary:Return tag value from a @Class.BamHeaderRecord@ or @Class.BamTagsDict@. -..signature:getTagValue(tagValue, idx, record) -..signature:getTagValue(tagValue, key, record) -..param.tagValue:The tag's value is stored here. -...type:Shortcut.CharString -..param.idx:The index of the tag whose value is to be retrieved. -...type:nolink:$unsigned$ -..param.key:The name of tag whose value is to be retrieved. -...type:Shortcut.CharString -..param.record:The record to query. -...type:Class.BamHeaderRecord -..returns:$bool$, indicating whether the value could be retrieved, always $true$ if $idx$ is given. -..include:seqan/bam_io.h -..example.code: -CharString tagValue; -bool keyFound = getTagValue(tagValue, "SN", record); -..see:Function.BamHeaderRecord#findTagKey -*/ - -template -SEQAN_FUNC_ENABLE_IF( - IsInteger, - bool) -inline getTagValue(CharString & value, TId idx, BamHeaderRecord const & record) -{ - if ((unsigned)idx >= length(record.tags)) - return false; - value = record.tags[idx].i2; - return true; -} - -template -SEQAN_FUNC_ENABLE_IF( - IsSequence, - bool) -inline getTagValue(CharString & value, TKeyName const & key, BamHeaderRecord const & record) -{ - unsigned idx = 0; - if (!findTagKey(idx, key, record)) - return false; - return getTagValue(value, idx, record); -} - -/*! - * @fn BamHeaderRecord::setTagValue - * @brief Sets the value of a tag in a BamHeaderRecord. - * - * @signature void setTagValue(idx, value, record); - * @signature void setTagValue(key, value, record); - * - * @param idx The index of the tag in the header record to set the value for. - * @param key The name of the tag (two-letter sequence) to set. - * @param record The header record to set the value for. - */ - -// TODO(holtgrew): Parameter order! - -/** -.Function.BamHeaderRecord#setTagValue -..cat:BAM I/O -..summary:Set tag value of a @Class.BamHeaderRecord@. -..signature:setTagValue(idx, tagValue, record) -..signature:setTagValue(key, tagValue, record) -..param.idx:The index of the tag whose value should be set. -...type:nolink:$unsigned$ -..param.key:The name of tag whose value should be set. -...type:Shortcut.CharString -..param.tagValue:The new tag value. -...type:Shortcut.CharString -..param.record:The record to query. -...type:Class.BamHeaderRecord -..include:seqan/bam_io.h -..example.code: -setTagValue("SN", "chr1", record); -..see:Function.BamHeaderRecord#findTagKey -*/ - -template -SEQAN_FUNC_ENABLE_IF( - IsInteger, - void) -inline setTagValue(TId idx, CharString const & value, BamHeaderRecord & record) -{ - if (idx >= length(record.tags)) - return; - record.tags[idx].i2 = value; -} - -template -SEQAN_FUNC_ENABLE_IF( - IsSequence, - void) -inline setTagValue(TKeyName const & key, CharString const & value, BamHeaderRecord & record) -{ - unsigned idx = 0; - if (!findTagKey(idx, key, record)) - { - idx = length(record.tags); - resize(record.tags, idx + 1); - record.tags[idx].i1 = key; - } - setTagValue(idx, value, record); -} - -// ---------------------------------------------------------------------------- -// Function getSortOrder() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Document me! Test me! - - -inline bool -searchRecord(unsigned & recordIdx, - BamHeader const & header, - BamHeaderRecordType recordType, - unsigned startIdx) -{ - for (recordIdx = startIdx; recordIdx < length(header.records); ++recordIdx) - { - if (header.records[recordIdx].type == recordType) - return true; - } - return false; -} - -inline bool -searchRecord(unsigned & recordIdx, - BamHeader const & header, - BamHeaderRecordType recordType) -{ - return searchRecord(recordIdx, header, recordType, 0); -} - - -struct BamHeaderRecordTypeLess -{ - bool operator() (BamHeaderRecord const &a, BamHeaderRecord const &b) const - { - return a.type < b.type; - } -}; - -struct BamHeaderRecordEqual -{ - bool operator() (BamHeaderRecord const &a, BamHeaderRecord const &b) const - { - return a.type == b.type && a.tags == b.tags; - } -}; - - -inline void -removeDuplicates(BamHeader & header) -{ - BamHeaderRecordTypeLess less; - BamHeaderRecordEqual pred; - - std::stable_sort(begin(header.records, Standard()), end(header.records, Standard()), less); - - for (size_t uniqueBegin = 0, uniqueEnd = 1; uniqueEnd < length(header.records);) - { - if (less(header.records[uniqueBegin], header.records[uniqueEnd])) - uniqueBegin = uniqueEnd; - - size_t j; - for (j = uniqueBegin; j < uniqueEnd; ++j) - { - if (pred(header.records[j], header.records[uniqueEnd])) - { - erase(header.records, uniqueEnd); - break; - } - } - - if (j == uniqueEnd) - ++uniqueEnd; - } -} - -inline BamSortOrder -getSortOrder(BamHeader const & header) -{ - CharString soString; - for (unsigned recIdx = 0; searchRecord(recIdx, header, BAM_HEADER_FIRST, recIdx); ++recIdx) - { - if (getTagValue(soString, "SO", header.records[recIdx])) - { - if (soString == "unsorted") - return BAM_SORT_UNSORTED; - else if (soString == "") - return BAM_SORT_QUERYNAME; - else if (soString == "") - return BAM_SORT_COORDINATE; - else - return BAM_SORT_UNKNOWN; - } - } - return BAM_SORT_UNKNOWN; -} - -inline void -setSortOrder(BamHeader & header, BamSortOrder sortOrder) -{ - for (unsigned recIdx = 0; searchRecord(recIdx, header, BAM_HEADER_FIRST, recIdx); ++recIdx) - { - unsigned idx = 0; - if (findTagKey(idx, "SO", header.records[recIdx])) - { - CharString soString; - switch (sortOrder) - { - case BAM_SORT_UNSORTED: - soString = "unsorted"; - break; - - case BAM_SORT_QUERYNAME: - soString = "queryname"; - break; - - case BAM_SORT_COORDINATE: - soString = "coordinate"; - break; - - default: - soString = "unknown"; - } - setTagValue(idx, soString, header.records[recIdx]); - } - } -} - -// ---------------------------------------------------------------------------- -// Function clear() -// ---------------------------------------------------------------------------- - -///.Function.clear.param.object.type:Class.BamHeader - -inline void -clear(BamHeader & header) -{ - clear(header.sequenceInfos); - clear(header.records); -} - - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_HEADER_RECORD_H_ diff --git a/seqan/bam_io/bam_index_bai.h b/seqan/bam_io/bam_index_bai.h deleted file mode 100644 index da9a27f..0000000 --- a/seqan/bam_io/bam_index_bai.h +++ /dev/null @@ -1,818 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -// The index building algorithm is based on the samtools implementation which -// is under the MIT License: - -/* The MIT License - - Copyright (c) 2008-2009 Genome Research Ltd. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_INDEX_BAI_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_INDEX_BAI_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Tag Bai -// ---------------------------------------------------------------------------- - -struct Bai_; -typedef Tag Bai; - -// ---------------------------------------------------------------------------- -// Helper Class BaiBamIndexBinData_ -// ---------------------------------------------------------------------------- - -// Store the information of a bin. - -struct BaiBamIndexBinData_ -{ - String > chunkBegEnds; -}; - -// ---------------------------------------------------------------------------- -// Spec BAI BamIndex -// ---------------------------------------------------------------------------- - -/*! - * @class BaiBamIndex - * @extends BamIndex - * @brief Access to BAI (samtools-style) - * - * @signature template <> - * class BamIndex; - */ - -/*! - * @fn BaiBamIndex::BamIndex - * @brief Constructor. - * - * @signature BamIndex::BamIndex(); - * - * @section Remarks - * - * Only the default constructor is provided. - */ - -/** -.Spec.BAI BamIndex -..cat:BAM I/O -..general:Class.BamIndex -..summary:Access to BAI (samtools-style) Indices. -..signature:BamIndex -..include:seqan/bam_io.h - -.Memfunc.BAI BamIndex#BamIndex -..class:Spec.BAI BamIndex -..signature:BamIndex() -..summary:Constructor. -..remarks:Only the default constructor is provided. -*/ - -template <> -class BamIndex -{ -public: - typedef std::map<__uint32, BaiBamIndexBinData_> TBinIndex_; - typedef String<__uint64> TLinearIndex_; - - __uint64 _unalignedCount; - - // 1<<14 is the size of the minimum bin. - static const __int32 BAM_LIDX_SHIFT = 14; - - String _binIndices; - String _linearIndices; - - BamIndex() : _unalignedCount(maxValue<__uint64>()) - {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function jumpToRegion() -// ---------------------------------------------------------------------------- - -/** -.Function.BamIndex#jumpToRegion -..class:Class.BamIndex -..cat:BAM I/O -..signature:jumpToRegion(bgzfStream, hasAlignments, bamIOContext, refId, pos, posEnd, bamIndex) -..summary:Seek in BAM BGZF stream using an index. -..remark:Note that because of the structure of BAI indices, you cannot simply jump to a position and you have to jump to region. -..param.bgzfStream:The BGZF Stream to seek in. -...type:Spec.BGZF Stream -..param.refId:Reference ID to seek to. -...type:nolink:$__int32$ -..param.hasAlignments:Set to $true$ iff there are alignments at this position. -...type:nolink:$bool$ -..param.bamIOContext:Context to use for loading alignments. -...type:Class.BamIOContext -..param.pos:Zero-based begin position in the reference. -...type:nolink:$__int32$ -..param.pos:Zero-based (exclusive, C-style) end position in the reference. -...type:nolink:$__int32$ -..param.bamIndex:The index to use. -...type:Class.BamIndex -..returns:$bool$ indicating success. -..remarks:This function may fail if the refId/pos is invalid. -..include:seqan/bam_io.h -*/ - -static inline void -_baiReg2bins(String<__uint16> & list, __uint32 beg, __uint32 end) -{ - unsigned k; - if (beg >= end) return; - if (end >= 1u<<29) end = 1u<<29; - --end; - appendValue(list, 0); - for (k = 1 + (beg>>26); k <= 1 + (end>>26); ++k) appendValue(list, k); - for (k = 9 + (beg>>23); k <= 9 + (end>>23); ++k) appendValue(list, k); - for (k = 73 + (beg>>20); k <= 73 + (end>>20); ++k) appendValue(list, k); - for (k = 585 + (beg>>17); k <= 585 + (end>>17); ++k) appendValue(list, k); - for (k = 4681 + (beg>>14); k <= 4681 + (end>>14); ++k) appendValue(list, k); -} - -// TODO(holtgrew): Switch order of hasAlignments and stream, stream is state. - -template -inline bool -jumpToRegion(Stream & stream, - bool & hasAlignments, - BamIOContext /*const*/ & bamIOContext, - __int32 refId, - __int32 pos, - __int32 posEnd, - BamIndex const & index) -{ - hasAlignments = false; - if (refId < 0) - return false; // Cannot seek to invalid reference. - if (static_cast(refId) >= length(index._binIndices)) - return false; // Cannot seek to invalid reference. - - // ------------------------------------------------------------------------ - // Compute offset in BGZF file. - // ------------------------------------------------------------------------ - __uint64 offset = MaxValue<__uint64>::VALUE; - - // Retrieve the candidate bin identifiers for [pos, posEnd). - String<__uint16> candidateBins; - _baiReg2bins(candidateBins, pos, posEnd); - - // Retrieve the smallest required offset from the linear index. - unsigned windowIdx = pos >> 14; // Linear index consists of 16kb windows. - __uint64 linearMinOffset = 0; - if (windowIdx >= length(index._linearIndices[refId])) - { - // TODO(holtgrew): Can we simply always take case 1? - - // This is the case were we want to jump in a non-existing window. - // - // If there are no linear indices for this reference then we use the linear min offset of the next - // reference that has an linear index. - if (empty(index._linearIndices[refId])) - { - for (unsigned i = refId; i < length(index._linearIndices); ++i) - { - if (!empty(index._linearIndices[i])) - { - linearMinOffset = front(index._linearIndices[i]); - if (linearMinOffset != 0u) - break; - for (unsigned j = 1; j < length(index._linearIndices[i]); ++j) - { - if (index._linearIndices[i][j] > linearMinOffset) - { - linearMinOffset = index._linearIndices[i][j]; - break; - } - } - if (linearMinOffset != 0u) - break; - } - } - } - else - { - linearMinOffset = back(index._linearIndices[refId]); - } - } - else - { - linearMinOffset = index._linearIndices[refId][windowIdx]; - } - - // Combine candidate bins and smallest required offset from linear index into candidate offset. - typedef std::set<__uint64> TOffsetCandidates; - TOffsetCandidates offsetCandidates; - typedef typename Iterator, Rooted>::Type TCandidateIter; - for (TCandidateIter it = begin(candidateBins, Rooted()); !atEnd(it); goNext(it)) - { - typedef typename std::map<__uint32, BaiBamIndexBinData_>::const_iterator TMapIter; - TMapIter mIt = index._binIndices[refId].find(*it); - if (mIt == index._binIndices[refId].end()) - continue; // Candidate is not in index! - - typedef typename Iterator > const, Rooted>::Type TBegEndIter; - for (TBegEndIter it2 = begin(mIt->second.chunkBegEnds, Rooted()); !atEnd(it2); goNext(it2)) - if (it2->i2 >= linearMinOffset) - offsetCandidates.insert(it2->i1); - } - - // Search through candidate offsets, find smallest with a fitting alignment. - // - // Note that it is not necessarily the first. - // - // TODO(holtgrew): Can this be optimized similar to how bamtools does it? - typedef typename TOffsetCandidates::const_iterator TOffsetCandidateIter; - BamAlignmentRecord record; - for (TOffsetCandidateIter candIt = offsetCandidates.begin(); candIt != offsetCandidates.end(); ++candIt) - { - if (streamSeek(stream, *candIt, SEEK_SET) != 0) - return false; // Error while seeking. - if (readRecord(record, bamIOContext, stream, Bam()) != 0) - return false; // Error while reading. - - // std::cerr << "record.beginPos == " << record.beginPos << "\n"; - // __int32 endPos = record.beginPos + getAlignmentLengthInRef(record); - if (record.rID != refId) - continue; // Wrong contig. - if (record.beginPos >= posEnd) - continue; // Cannot overlap with [pos, posEnd). - - // Found an alignment. - hasAlignments = true; - offset = *candIt; - // std::cerr << "offset == " << offset << "\n"; - break; - } - - if (offset != MaxValue<__uint64>::VALUE) - { - if (streamSeek(stream, offset, SEEK_SET) != 0) - return false; // Error while seeking. - } - // Finding no overlapping alignment is not an error, hasAlignments is false. - return true; -} - -// ---------------------------------------------------------------------------- -// Function jumpToOrphans() -// ---------------------------------------------------------------------------- - -/** -.Function.BamIndex#jumpToOrphans -..class:Class.BamIndex -..cat:BAM I/O -..signature:jumpToOrphans(bgzfStream, bamIOContext, bamIndex) -..summary:Seek to orphans block in BAM BGZF stream using an index. -..param.bgzfStream:The BGZF Stream to seek in. -...type:Spec.BGZF Stream -..param.bamIOContext:Context to use for loading alignments. -...type:Class.BamIOContext -..param.bamIndex:The index to use. -...type:Class.BamIndex -..returns:$bool$ indicating success. -..include:seqan/bam_io.h -*/ - -// TODO(holtgrew): Parameter order, see jumpToRegion()! - -template -bool jumpToOrphans(Stream & stream, - bool & hasAlignments, - BamIOContext /*const*/ & bamIOContext, - BamIndex const & index) -{ - hasAlignments = false; - - // Search linear indices for the largest entry of all references. - __uint64 aliOffset = MaxValue<__uint64>::VALUE; - for (int i = length(index._linearIndices) - 1; i >= 0; --i) - if (!empty(index._linearIndices[i])) - { - aliOffset = back(index._linearIndices[i]); - break; - } - if (aliOffset == MaxValue<__uint64>::VALUE) - return false; // No offset found. - - // Get index of the first orphan alignment by seeking from linear index bucket. - BamAlignmentRecord record; - __uint64 offset = MaxValue<__uint64>::VALUE; - __uint64 result = 0; - int res = streamSeek(stream, aliOffset, SEEK_SET); - if (res != 0) - return false; // Error while seeking. - while (!atEnd(stream)) - { - result = streamTell(stream); - res = readRecord(record, bamIOContext, stream, Bam()); - if (res != 0) - return false; // Error while reading. - if (record.rID == -1) - { - // Found alignment. - hasAlignments = true; - offset = result; - break; - } - } - - // Jump back to the first alignment. - if (offset != MaxValue<__uint64>::VALUE) - { - int res = streamSeek(stream, offset, SEEK_SET); - if (res != 0) - return false; // Error while seeking. - } - - // Finding no orphan alignment is not an error, hasAilgnments is false then. - return true; -} - -// ---------------------------------------------------------------------------- -// Function getUnalignedCount() -// ---------------------------------------------------------------------------- - -/** -.Function.BamIndex#getUnalignedCount -..class:Class.BamIndex -..cat:BAM I/O -..signature:getUnalignedCount(index) -..summary:Query index for number of unaligned reads. -..param.index:Index to query. -...type:Class.BamIndex -..returns:$__uint64$ with number of unaligned reads. -..include:seqan/bam_io.h -*/ - -inline __uint64 -getUnalignedCount(BamIndex const & index) -{ - return index._unalignedCount; -} - -// ---------------------------------------------------------------------------- -// Function read() -// ---------------------------------------------------------------------------- - -/** -.Function.BamIndex#read -..class:Class.BamIndex -..cat:BAM I/O -..signature:read(index, filename) -..summary:Load a BAM index from a given file name. -..param.index:Target data structure. -...type:Class.BamIndex -..param.filename:Path to file to load. -...type:nolink:$char const *$ -..returns:$int$ status code, $0$ indicating success. -..include:seqan/bam_io.h - */ - -inline int -read(BamIndex & index, char const * filename) -{ - std::fstream fin(filename, std::ios::binary | std::ios::in); - if (!fin.good()) - return 1; // Could not open file. - - // Read magic number. - CharString buffer; - resize(buffer, 4); - fin.read(&buffer[0], 4); - if (!fin.good()) - return 1; - if (buffer != "BAI\1") - return 1; // Magic number is wrong. - - __int32 nRef = 0; - fin.read(reinterpret_cast(&nRef), 4); - if (!fin.good()) - return 1; - - resize(index._linearIndices, nRef); - resize(index._binIndices, nRef); - - for (int i = 0; i < nRef; ++i) // For each reference. - { - // Read bin index. - __int32 nBin = 0; - fin.read(reinterpret_cast(&nBin), 4); - if (!fin.good()) - return 1; - index._binIndices[i].clear(); - BaiBamIndexBinData_ data; - for (int j = 0; j < nBin; ++j) // For each bin. - { - clear(data.chunkBegEnds); - - __uint32 bin = 0; - fin.read(reinterpret_cast(&bin), 4); - if (!fin.good()) - return 1; - - __int32 nChunk = 0; - fin.read(reinterpret_cast(&nChunk), 4); - if (!fin.good()) - return 1; - reserve(data.chunkBegEnds, nChunk); - for (int k = 0; k < nChunk; ++k) // For each chunk; - { - __uint64 chunkBeg = 0; - __uint64 chunkEnd = 0; - fin.read(reinterpret_cast(&chunkBeg), 8); - fin.read(reinterpret_cast(&chunkEnd), 8); - if (!fin.good()) - return 1; - appendValue(data.chunkBegEnds, Pair<__uint64>(chunkBeg, chunkEnd)); - } - - // Copy bin data into index. - index._binIndices[i][bin] = data; - } - - // Read linear index. - __int32 nIntv = 0; - fin.read(reinterpret_cast(&nIntv), 4); - if (!fin.good()) - return 1; - clear(index._linearIndices[i]); - reserve(index._linearIndices[i], nIntv); - for (int j = 0; j < nIntv; ++j) - { - __uint64 ioffset = 0; - fin.read(reinterpret_cast(&ioffset), 8); - if (!fin.good()) - return 1; - appendValue(index._linearIndices[i], ioffset); - } - } - - if (!fin.good()) - return 1; - - // Read (optional) number of alignments without coordinate. - __uint64 nNoCoord = 0; - fin.read(reinterpret_cast(&nNoCoord), 8); - if (!fin.good()) - { - fin.clear(); - nNoCoord = 0; - } - index._unalignedCount = nNoCoord; - - return 0; -} - -// TODO(holtgrew): This is only here because of the read() function with TSequence in old file.h. - -inline int -read(BamIndex & index, char * filename) -{ - return read(index, static_cast(filename)); -} - -// ---------------------------------------------------------------------------- -// Function buildIndex() -// ---------------------------------------------------------------------------- - -/*DISABLED -.Function.BamIndex#buildIndex -..class:Class.BamIndex -..cat:BAM I/O -..signature:buildIndex(index, filename) -..summary:Build index for BAM file with given filename. -..remarks:This will create an index file named $filename + ".bai"$. -..param.index:Target data structure. -...type:Class.BamIndex -..param.filename:Path to BAM file to load. -...type:nolink:$char const *$ -..returns:$bool$ indicating success. -..include:seqan/bam_io.h - */ - -inline int _writeIndex(BamIndex const & index, char const * filename) -{ - std::cerr << "WRITE INDEX TO " << filename << std::endl; - // Open output stream. - std::ofstream out(filename, std::ios::binary | std::ios::out); - - SEQAN_ASSERT_EQ(length(index._binIndices), length(index._linearIndices)); - - // Write header. - out.write("BAI\1", 4); - __int32 numRefSeqs = length(index._binIndices); - out.write(reinterpret_cast(&numRefSeqs), 4); - - // Write out indices. - typedef BamIndex const TBamIndex; - typedef TBamIndex::TBinIndex_ const TBinIndex; - typedef TBinIndex::const_iterator TBinIndexIter; - typedef TBamIndex::TLinearIndex_ TLinearIndex; - for (int i = 0; i < numRefSeqs; ++i) - { - TBinIndex const & binIndex = index._binIndices[i]; - TLinearIndex const & linearIndex = index._linearIndices[i]; - - // Write out binning index. - __int32 numBins = binIndex.size(); - out.write(reinterpret_cast(&numBins), 4); - for (TBinIndexIter itB = binIndex.begin(), itBEnd = binIndex.end(); itB != itBEnd; ++itB) - { - // Write out bin id. - out.write(reinterpret_cast(&itB->first), 4); - // Write out number of chunks. - __uint32 numChunks = length(itB->second.chunkBegEnds); - out.write(reinterpret_cast(&numChunks), 4); - // Write out all chunks. - typedef Iterator > const, Rooted>::Type TChunkIter; - for (TChunkIter itC = begin(itB->second.chunkBegEnds); !atEnd(itC); goNext(itC)) - { - out.write(reinterpret_cast(&itC->i1), 8); - out.write(reinterpret_cast(&itC->i2), 8); - } - } - - // Write out linear index. - __int32 numIntervals = length(index._linearIndices); - out.write(reinterpret_cast(&numIntervals), 4); - typedef Iterator const, Rooted>::Type TLinearIndexIter; - for (TLinearIndexIter it = begin(linearIndex, Rooted()); !atEnd(it); goNext(it)) - out.write(reinterpret_cast(&*it), 8); - } - - // Write the number of unaligned reads if set. - std::cerr << "UNALIGNED\t" << index._unalignedCount << std::endl; - if (index._unalignedCount != maxValue<__uint64>()) - out.write(reinterpret_cast(&index._unalignedCount), 8); - - return !out.good(); // 1 on error, 0 on success. -} - -inline void _baiAddAlignmentChunkToBin(BamIndex & index, - __uint32 currBin, - __uint32 currOffset, - __uint64 prevOffset) -{ - // If this is not the first reference sequence then add previous reference data. - Pair<__uint64> newChunk(currOffset, prevOffset); - - // If no interest exists yet for this bin, create one and store alignment chunk. - BamIndex::TBinIndex_::iterator binIter = back(index._binIndices).find(currBin); - if (binIter == back(index._binIndices).end()) - { - BaiBamIndexBinData_ binData; - appendValue(binData.chunkBegEnds, newChunk); - back(index._binIndices).insert(std::make_pair(currBin, binData)); - } - else - { - // Otherwise, just append alignment chunk. - appendValue(binIter->second.chunkBegEnds, newChunk); - } -} - -inline bool -buildIndex(BamIndex & index, char const * filename) -{ - SEQAN_FAIL("This does not work ye!"); - - index._unalignedCount = 0; - clear(index._binIndices); - clear(index._linearIndices); - - // Open BAM file for reading. - Stream bamStream; - if (!open(bamStream, filename, "r")) - return false; // Could not open BAM file. - - // Initialize BamIOContext. - typedef StringSet TNameStore; - typedef NameStoreCache TNameStoreCache; - - TNameStore refNameStore; - TNameStoreCache refNameStoreCache(refNameStore); - BamIOContext bamIOContext(refNameStore, refNameStoreCache); - - // Read BAM header. - BamHeader header; - int res = readRecord(header, bamIOContext, bamStream, Bam()); - if (res != 0) - return false; // Could not read BAM header. - __uint32 numRefSeqs = length(header.sequenceInfos); - - // Scan over BAM file and create index. - BamAlignmentRecord record; - __uint32 currBin = maxValue<__uint32>(); - __uint32 prevBin = maxValue<__uint32>(); - __int32 currRefId = BamAlignmentRecord::INVALID_REFID; - __int32 prevRefId = BamAlignmentRecord::INVALID_REFID; - __uint64 currOffset = streamTell(bamStream); - __uint64 prevOffset = currOffset; - __int32 prevPos = minValue<__int32>(); - - while (!atEnd(bamStream)) - { - // Load next record. - res = readRecord(record, bamIOContext, bamStream, Bam()); - if (res != 0) - return false; - - // Check ordering. - if (prevRefId == record.rID && prevPos > record.beginPos) - return false; - - // The reference sequence changed, close bins for previous reference. - if (prevRefId != record.rID) - { - if (prevRefId != BamAlignmentRecord::INVALID_REFID) - { - _baiAddAlignmentChunkToBin(index, currBin, currOffset, prevOffset); - - // Add an index for all empty references between prevRefId (excluded) and record.rID (included). - for (int i = prevRefId + 1; i < record.rID; ++i) - { - BamIndex::TBinIndex_ binIndex; - appendValue(index._binIndices, binIndex); - BamIndex::TLinearIndex_ linearIndex; - appendValue(index._linearIndices, linearIndex); - } - - // Update bin book keeping. - currOffset = prevOffset; - currBin = record.bin; - prevBin = record.bin; - currRefId = record.rID; - } - else - { - // Otherwise, this is the first pass. Create an index for all empty references up to and including - // current refId. - for (int i = 0; i < record.rID; ++i) - { - BamIndex::TBinIndex_ binIndex; - appendValue(index._binIndices, binIndex); - BamIndex::TLinearIndex_ linearIndex; - appendValue(index._linearIndices, linearIndex); - } - } - - // Update reference book keeping. - prevRefId = record.rID; - prevBin = minValue<__int32>(); - } - - // If the alignment's reference id is valid and its bin is not a leaf. - if (record.rID >= 0 && record.bin < 4681) - { - __int32 beginOffset = record.beginPos >> BamIndex::BAM_LIDX_SHIFT; - __int32 endPos = getAlignmentLengthInRef(record); - __int32 endOffset = (endPos - 1) >> BamIndex::BAM_LIDX_SHIFT; - - // Resize linear index if necessary. - unsigned oldSize = length(index._linearIndices); - unsigned newSize = endOffset + 1; - if (oldSize < newSize) - resize(back(index._linearIndices), newSize, 0); - - // Store offset. - for (int i = beginOffset + 1; i <= endOffset; ++i) - if (back(index._linearIndices)[i] == 0u) - back(index._linearIndices)[i] = prevOffset; - } - - // Handle the case if we changed to a new BAI bin. - if (record.bin != prevBin) - { - // If not first bin of reference, save previous bin data. - if (currBin != maxValue<__uint32>()) - _baiAddAlignmentChunkToBin(index, currBin, currOffset, prevOffset); - - // Update markers. - currOffset = prevOffset; - currBin = record.bin; - prevBin = record.bin; - currRefId = record.rID; - - // If the reference id is invalid then break out. - if (currRefId < 0) - break; - } - - // Make sure that the current file pointer is beyond prevOffset. - if (streamTell(bamStream) <= static_cast<__int64>(prevOffset)) - return false; // Calculating offsets failed. - - // Update prevOffset and prevPos. - prevOffset = streamTell(bamStream); - prevPos = record.beginPos; - } - - // Count remaining unaligned records. - while (!streamEof(bamStream)) - { - SEQAN_ASSERT_GT(index._unalignedCount, 0u); - - res = readRecord(record, bamIOContext, bamStream, Bam()); - if (res != 0 || record.rID >= 0) - return false; // Could not read record. - - index._unalignedCount += 1; - } - - // After loading all alignments, if any data was read, perform checks. - if (currRefId >= 0) - { - // Store last alignment chunk to its bin and then write last reference entry with data. - _baiAddAlignmentChunkToBin(index, currBin, currOffset, prevOffset); - - // Finally, write any empty references remaining at end of file. - SEQAN_ASSERT_GEQ(numRefSeqs, length(index._binIndices)); - BamIndex::TBinIndex_ binIndex; - resize(index._binIndices, numRefSeqs, binIndex); // TODO(holtgrew): binIndex is unnecessary if resize used T() as default value as vector.resize() does. - } - - // Merge small bins if possible. - SEQAN_FAIL("TODO: Merge bins!"); - - // Write out index. - CharString baiFilename(filename); - append(baiFilename, ".bai"); - res = _writeIndex(index, toCString(baiFilename)); - - return (res == 0); -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_INDEX_BAI_H_ diff --git a/seqan/bam_io/bam_index_base.h b/seqan/bam_io/bam_index_base.h deleted file mode 100644 index 35e3ad4..0000000 --- a/seqan/bam_io/bam_index_base.h +++ /dev/null @@ -1,130 +0,0 @@ -// ========================================================================== -// bam_index_base.h -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_INDEX_BASE_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_INDEX_BASE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @class BamIndex - * @headerfile - * - * @brief Access to BAM indices. - * - * @signature template - * class BamIndex; - * - * @section Remarks - * - * This is an abstract class, don't use it itself but its specializations. - */ - -/** -.Class.BamIndex -..cat:BAM I/O -..summary:Access to BAM Indices. -..signature:BamIndex -..param.TSpec:Tag to specialize index. -..remarks:This is an abstract class, don't use it itself but its specializations. -..include:seqan/bam_io.h -*/ - -template -class BamIndex; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function BamIndex#jumpToRegion -// ---------------------------------------------------------------------------- - -/*! - * @fn BamIndex#jumpToRegion - * @brief Seek in BAM BGZF stream using an index. - * - * You provide a region [pos, posEnd) on the reference refID that you want to jump to and the function - * jumps to the first alignment in this region, if any. - * - * @signature bool jumpToRegion(stream, hasAlignments, bamIOContext, refID, pos, posEnd, index); - * - * @param[in,out] stream The @link BgzfStream @endlink to jump with. - * @param[out] hasAlignments A bool that is set true if the region [pos, posEnd) has any - * alignments. - * @param[in,out] bamIOContext The @link BamIOContext @endlink to use for jumping. - * @param[in] refID The reference id to jump to (__int32). - * @param[in] pos The begin of the region to jump to. - * @param[in] posEnd The end of the region to jump to. - * @param[in] index The @link BamIndex @endlink to use for the jumping. - * - * @return bool true if seeking was successful, false if not. - * - * @section Remarks - * - * This function fails if refID/pos are invalid. - */ - -// ---------------------------------------------------------------------------- -// Function jumpToOrphans -// ---------------------------------------------------------------------------- - -/*! - * @fn BamIndex#jumpToOrphans - * @brief Seek to orphans block in BAM BGZF stream using an index. - * - * @signature bool jumpToOrphans(stream, hasAlignments, bamIOContext, index); - * - * @param[in,out] stream The @link BgzfStream @endlink object to jump with. - * @param[out] hasAlignments A bool that is set to true if there are any orphans. - * @param[in,out] bamIOContext The @link BamIOContext @endlink to use for the state. - * @param[in] index The index to use for jumping. - */ - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_INDEX_BASE_H_ diff --git a/seqan/bam_io/bam_io_context.h b/seqan/bam_io/bam_io_context.h deleted file mode 100644 index a5a07c5..0000000 --- a/seqan/bam_io/bam_io_context.h +++ /dev/null @@ -1,272 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Class BamIOContext, accessor functions. -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_IO_CONTEXT_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_IO_CONTEXT_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @class BamIOContext - * @headerfile - * @brief The I/O context to use for BAM I/O. - * - * @signature template > - * class BamIOContext; - * - * @tparam TNameStore The name store class. - * @tparam TNameStoreCache The name store cache class. Defaults to @link NameStoreCache @endlink <TNameStore>l;. - * - * @section Examples - * - * Creating a @link BamIOContext @endlink for a raw @link StringSet @endlink of @link CharString @endlink. - * - * @code{.cpp} - * StringSet nameStore; - * NameStoreCache > nameStoreCache(nameStore); - * BamIOContext > bamIOContext(nameStore, nameStoreCache); - * // ... - * @endcode - * - * Using a @link BamIOContext @endlink with a @link FragmentStore @endlink. - * - * @code{.cpp} - * typedef FragmentStore<>::TContigNameStore TNameStore; - * typedef NameStoreCache TNameStoreCache; - * FragmentStore<> store; - * // Optionally, do something with store. - * typedef BamIOContext TBamIOContext; - * TBamIOContext bamIOContext(store.contigNameStore, store.contigNameStoreCache); - * // ... - * @endcode - */ - -/*! - * @fn BamIOContext::BamIOContext - * @headerfile - * @brief Constructor. - * - * @signature BamIOContext::BamIOContext(); - * - * @section Remarks - * - * Only the default constructor is provided. - */ - -/*! - * @typedef BamIOContext::TNameStore - * - * @brief The name store class. - - * @signature typedef (...) BamIOContext::TNameStore; - */ - -/*! - * @typedef BamIOContext::TNameStoreCache - * @brief The name store cache class. - * - * @signature typedef (...) BamIOContext::TNameStoreCache; - */ - -/** -.Class.BamIOContext -..cat:BAM I/O -..signature:BamIOContext -..summary:The I/O context to use for BAM I/O. -..param.TNameStore:The name store class. -..param.TNameStoreCache:The name store cache class. -...default:@Class.NameStoreCache@ -..include:bam_io.h -..example.text:Creating a @Class.BamIOContext@ for a raw @Class.StringSet@ of @Shortcut.CharString@. -..example.code: -StringSet nameStore; -NameStoreCache > nameStoreCache(nameStore); -BamIOContext > bamIOContext(nameStore, nameStoreCache); -// ... -..example.text:Using a @Class.BamIOContext@ with a @Class.FragmentStore@. -..example.code: -typedef FragmentStore<>::TContigNameStore TNameStore; -typedef NameStoreCache TNameStoreCache; -FragmentStore<> store; -// Optionally, do something with store. -typedef BamIOContext TBamIOContext; -TBamIOContext bamIOContext(store.contigNameStore, store.contigNameStoreCache); -// ... - -.Memfunc.BamIOContext#BamIOContext -..class:Class.BamIOContext -..signature:BamIOContext() -..summary:Constructor. -..remarks:Only the default constructor is provided. - -.Typedef.BamIOContext#TNameStore -..class:Class.BamIOContext -..summary:The name store class. - -.Typedef.BamIOContext#TNameStoreCache -..class:Class.BamIOContext -..summary:The name store cache class. -*/ - -template > -class BamIOContext -{ -public: - typedef TNameStore_ TNameStore; - typedef TNameStoreCache_ TNameStoreCache; - - TNameStore * _nameStore; - TNameStoreCache * _nameStoreCache; - CharString buffer; - String translateFile2GlobalRefId; - - BamIOContext() : _nameStore(0), _nameStoreCache(0) - {} - - BamIOContext(TNameStore & nameStore, TNameStoreCache & nameStoreCache) : - _nameStore(&nameStore), _nameStoreCache(&nameStoreCache) - {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function nameStore() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamIOContext#nameStoreCache - * @brief Return reference to name store cache from @link BamIOContext @endlink. - * - * @signature TNameStoreRef nameStoreCache(context); - * - * @param context The @link BamIOContext @endlink to query. - * - * @return TNameStoreRef A reference to the TNameStore of the context. - */ - -/** -.Function.BamIOContext#nameStore -..class:Class.BamIOContext -..cat:BAM I/O -..summary:Return reference to name store from @Class.BamIOContext@. -..signature:nameStore(context) -..param.context:The @Class.BamIOContext@ to query. -...type:Class.BamIOContext -..see:Typedef.BamIOContext#TNameStore -..include:seqan/bam_io.h -*/ - -// TODO(holtgrew): Rename to referenceNameStore -template -TNameStore & -nameStore(BamIOContext & context) -{ - SEQAN_ASSERT(context._nameStore != 0); - return *context._nameStore; -} - -template -TNameStore const & -nameStore(BamIOContext const & context) -{ - SEQAN_ASSERT(context._nameStore != 0); - return *context._nameStore; -} - -// ---------------------------------------------------------------------------- -// Function nameStoreCache() -// ---------------------------------------------------------------------------- - -/* - * @fn BamIOContext#nameStore - * @headerfile - * @brief Return reference to name store from @link BamIOContext @endlink. - * - * @signature TNameStoreCacheRef nameStore(context); - * - * @param context The @link BamIOContext @endlink to query. - * - * @return TNameStoreCacheRef A reference to the TNameStoreCache of the context. - */ - -/** -.Function.BamIOContext#nameStoreCache -..class:Class.BamIOContext -..cat:BAM I/O -..summary:Return reference to name store cache from @Class.BamIOContext@. -..signature:nameStoreCache(context) -..param.context:The @Class.BamIOContext@ to query. -...type:Class.BamIOContext -..see:Typedef.BamIOContext#TNameStoreCache -..include:seqan/bam_io.h -..see:Function.BamIOContext#nameStore -*/ - -// TODO(holtgrew): Rename to referenceNameStoreCache -template -TNameStoreCache & -nameStoreCache(BamIOContext & context) -{ - SEQAN_ASSERT(context._nameStoreCache != 0); - return *context._nameStoreCache; -} - -template -TNameStoreCache const & -nameStoreCache(BamIOContext const & context) -{ - SEQAN_ASSERT(context._nameStoreCache != 0); - return *context._nameStoreCache; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_IO_CONTEXT_H_ diff --git a/seqan/bam_io/bam_reader.h b/seqan/bam_io/bam_reader.h deleted file mode 100644 index 17e4a64..0000000 --- a/seqan/bam_io/bam_reader.h +++ /dev/null @@ -1,206 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_READER_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_READER_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// Implementation of reading BAM files. - -class BamReader_ : - public XamReader_ -{ -public: - // The BGZF Stream to read from. - Stream _stream; - // Flag indicating whether there was an error or not. - bool _isGood; - // Size of the underlying file in bytes as it is on the disk. - __int64 _fileSize; - - BamReader_() : - XamReader_(), _isGood(true), _fileSize(0) - {} - - BamReader_(CharString const & filename); - - // XamReader_ interface. - - virtual int open(CharString const & filename); - virtual bool isGood(); - virtual bool atEnd(); - virtual int readHeader(BamHeader & header, BamIOContext > & context); - virtual int readRecord(BamAlignmentRecord & record, BamIOContext > & context); - virtual int close(); - - virtual __int64 fileSize() const; - virtual __int64 positionInFile() const; - - bool jumpToRegion(bool & hasAlignment, __int32 refId, __int32 pos, __int32 endPos, BamIndex const & index, BamIOContext > & context); - bool jumpToOrphans(BamIndex const & index, BamIOContext > & context); -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::BamReader_() -// ---------------------------------------------------------------------------- - -inline BamReader_::BamReader_(CharString const & filename) : - XamReader_(filename), _isGood(true) -{ - this->open(_filename); -} - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::open() -// ---------------------------------------------------------------------------- - -inline int BamReader_::open(CharString const & filename) -{ - if (!seqan::open(this->_stream, toCString(filename), "r")) - { - _isGood = false; - return 1; - } - - // Get file size from BGZF stream. - this->_fileSize = this->_stream._fileSize; - - return 0; -} - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::isGood() -// ---------------------------------------------------------------------------- - -inline bool BamReader_::isGood() -{ - return this->_isGood; -} - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::atEnd() -// ---------------------------------------------------------------------------- - -inline bool BamReader_::atEnd() -{ - return seqan::atEnd(this->_stream); -} - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::readHeader() -// ---------------------------------------------------------------------------- - -inline int BamReader_::readHeader(BamHeader & header, BamIOContext > & context) -{ - return seqan::readRecord(header, context, this->_stream, Bam()); -} - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::readRecord() -// ---------------------------------------------------------------------------- - -inline int BamReader_::readRecord(BamAlignmentRecord & record, BamIOContext > & context) -{ - return seqan::readRecord(record, context, this->_stream, Bam()); -} - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::close() -// ---------------------------------------------------------------------------- - -inline int BamReader_::close() -{ - seqan::close(this->_stream); - return 0; -} - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::fileSize() -// ---------------------------------------------------------------------------- - -inline __int64 BamReader_::fileSize() const -{ - return this->_fileSize; -} - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::positionInFile() -// ---------------------------------------------------------------------------- - -inline __int64 BamReader_::positionInFile() const -{ - return this->_stream._blockPosition; -} - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::jumpToRegion() -// ---------------------------------------------------------------------------- - -inline bool BamReader_::jumpToRegion(bool & hasAlignments, __int32 refId, __int32 pos, __int32 posEnd, - BamIndex const & index, BamIOContext > & context) -{ - return seqan::jumpToRegion(this->_stream, hasAlignments, context, refId, pos, posEnd, index); -} - -// ---------------------------------------------------------------------------- -// Member Function BamReader_::jumpToOrphans() -// ---------------------------------------------------------------------------- - -inline bool BamReader_::jumpToOrphans(BamIndex const & index, BamIOContext > & context) -{ - bool hasAlignments = false; - (void) hasAlignments; - return seqan::jumpToOrphans(this->_stream, hasAlignments, context, index); -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_READER_H_ diff --git a/seqan/bam_io/bam_sam_conversion.h b/seqan/bam_io/bam_sam_conversion.h deleted file mode 100644 index 289abab..0000000 --- a/seqan/bam_io/bam_sam_conversion.h +++ /dev/null @@ -1,682 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Code to convert between SAM and BAM format tags (textual <-> binary). -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_SAM_CONVERSION_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_SAM_CONVERSION_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function assignTagsSamToBam() -// ---------------------------------------------------------------------------- - -template -void _assignTagsSamToBamOneTag(TTarget & target, TRecordReader & reader, CharString & buffer) -{ - SEQAN_ASSERT_NOT(atEnd(reader)); - int res = readNChars(target, reader, 2); // Read tag name. - (void)res; // If run without assertions. - SEQAN_ASSERT_EQ(res, 0); - SEQAN_ASSERT_NOT(atEnd(reader)); - - clear(buffer); - res = readNChars(buffer, reader, 3); // Read '::'. - SEQAN_ASSERT_EQ(res, 0); - SEQAN_ASSERT_EQ(buffer[0], ':'); - SEQAN_ASSERT_EQ(buffer[2], ':'); - char t = buffer[1]; - appendValue(target, t); - - SEQAN_ASSERT_NOT(atEnd(reader)); - - switch (t) - { - case 'A': - clear(buffer); - res = readNChars(target, reader, 1); - SEQAN_ASSERT_EQ(res, 0); - break; - case 'i': - { - clear(buffer); - res = readUntilTabOrLineBreak(buffer, reader); - SEQAN_ASSERT(res == 0 || res == EOF_BEFORE_SUCCESS); - __int32 x = 0; - bool b = lexicalCast2<__int32>(x, buffer); - (void)b; - SEQAN_ASSERT(b); - char const * ptr = reinterpret_cast(&x); - for (int i = 0; i < 4; ++i, ++ptr) - appendValue(target, *ptr); - } - break; - case 'f': - { - clear(buffer); - res = readUntilTabOrLineBreak(buffer, reader); - SEQAN_ASSERT(res == 0 || res == EOF_BEFORE_SUCCESS); - float x = 0; - bool b = lexicalCast2(x, buffer); - (void)b; - SEQAN_ASSERT(b); - char const * ptr = reinterpret_cast(&x); - for (int i = 0; i < 4; ++i, ++ptr) - appendValue(target, *ptr); - } - break; - case 'H': - case 'Z': - { - // TODO(holtgrew): Could test on even length in case of 'H'. - res = readUntilTabOrLineBreak(target, reader); - SEQAN_ASSERT(res == 0 || res == EOF_BEFORE_SUCCESS); - appendValue(target, '\0'); - } - break; - case 'B': - { - CharString buffer2; // TODO(holtgrew): Also give from outside. - - // Read type. - clear(buffer); - res = readNChars(buffer, reader, 1); - SEQAN_ASSERT_EQ(res, 0); - char t2 = back(buffer); - appendValue(target, t2); - - // Read array contents. - clear(buffer); - res = readUntilTabOrLineBreak(buffer, reader); - SEQAN_ASSERT(res == 0 || res == EOF_BEFORE_SUCCESS); - typename Iterator::Type it, it2; - // Search first non-comma position. - it = begin(buffer, Rooted()); - for (;!atEnd(it) && *it == ','; ++it) - continue; - // Count number of entries. - __int32 nEntries = !atEnd(it); // At least one if array not empty. - for (it2 = it; !atEnd(it2); ++it2) - nEntries += (*it2 == ','); - // Write out array length to result. - char const * ptr = reinterpret_cast(&nEntries); - for (int i = 0; i < 4; ++i, ++ptr) - appendValue(target, *ptr); - - // Now, write out the arrays, depending on the entry type. - // TODO(holtgrew): Whee, this could be a bit more compact... - switch (t2) - { - case 'c': - for (int i = 0; i < nEntries; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - clear(buffer2); - for (; !atEnd(it) && *it != ',' && *it != '\t'; goNext(it)) - appendValue(buffer2, *it); - __int16 x = 0; // short to avoid textual interpretation in lexicalCast<> below. - bool b = lexicalCast2<__int16>(x, buffer2); - (void)b; - SEQAN_ASSERT(b); - appendValue(target, static_cast<__int8>(x)); - if (!atEnd(it) && *it == ',') - goNext(it); // Skip ','. - else - break; // End of field or end of string. - } - break; - case 'C': - for (int i = 0; i < nEntries; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - clear(buffer2); - for (; !atEnd(it) && *it != ',' && *it != '\t'; goNext(it)) - appendValue(buffer2, *it); - __uint16 x = 0; // short to avoid textual interpretation in lexicalCast<> below. - bool b = lexicalCast2<__uint16>(x, buffer2); - (void)b; - SEQAN_ASSERT(b); - appendValue(target, static_cast<__int8>(x)); - if (!atEnd(it) && *it == ',') - goNext(it); // Skip ','. - else - break; // End of field or end of string. - } - break; - case 's': - for (int i = 0; i < nEntries; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - clear(buffer2); - for (; !atEnd(it) && *it != ',' && *it != '\t'; goNext(it)) - appendValue(buffer2, *it); - __int16 x = 0; - bool b = lexicalCast2<__int16>(x, buffer2); - (void)b; - SEQAN_ASSERT(b); - char const * ptr = reinterpret_cast(&x); // write out byte-wise - for (int i = 0; i < 2; ++i, ++ptr) - appendValue(target, *ptr); - if (!atEnd(it) && *it == ',') - goNext(it); // Skip ','. - else - break; // End of field or end of string. - } - break; - case 'S': - for (int i = 0; i < nEntries; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - clear(buffer2); - for (; !atEnd(it) && *it != ',' && *it != '\t'; goNext(it)) - appendValue(buffer2, *it); - __uint16 x = 0; - bool b = lexicalCast2<__uint16>(x, buffer2); - (void)b; - SEQAN_ASSERT(b); - char const * ptr = reinterpret_cast(&x); // write out byte-wise - for (int i = 0; i < 2; ++i, ++ptr) - appendValue(target, *ptr); - if (!atEnd(it) && *it == ',') - goNext(it); // Skip ','. - else - break; // End of field or end of string. - } - break; - case 'i': - for (int i = 0; i < nEntries; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - clear(buffer2); - for (; !atEnd(it) && *it != ',' && *it != '\t'; goNext(it)) - appendValue(buffer2, *it); - __int32 x = 0; - bool b = lexicalCast2<__int32>(x, buffer2); - (void)b; - SEQAN_ASSERT(b); - char const * ptr = reinterpret_cast(&x); // write out byte-wise - for (int i = 0; i < 4; ++i, ++ptr) - appendValue(target, *ptr); - if (!atEnd(it) && *it == ',') - goNext(it); // Skip ','. - else - break; // End of field or end of string. - } - break; - case 'I': - for (int i = 0; i < nEntries; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - clear(buffer2); - for (; !atEnd(it) && *it != ',' && *it != '\t'; goNext(it)) - appendValue(buffer2, *it); - __uint32 x = 0; - bool b = lexicalCast2<__uint32>(x, buffer2); - (void)b; - SEQAN_ASSERT(b); - char const * ptr = reinterpret_cast(&x); // write out byte-wise - for (int i = 0; i < 4; ++i, ++ptr) - appendValue(target, *ptr); - if (!atEnd(it) && *it == ',') - goNext(it); // Skip ','. - else - break; // End of field or end of string. - } - break; - case 'f': - for (int i = 0; i < nEntries; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - clear(buffer2); - for (; !atEnd(it) && *it != ',' && *it != '\t'; goNext(it)) - appendValue(buffer2, *it); - float x = 0; - bool b = lexicalCast2(x, buffer2); - (void)b; - SEQAN_ASSERT(b); - char const * ptr = reinterpret_cast(&x); // write out byte-wise - for (int i = 0; i < 4; ++i, ++ptr) - appendValue(target, *ptr); - if (!atEnd(it) && *it == ',') - goNext(it); // Skip ','. - else - break; // End of field or end of string. - } - break; - default: - SEQAN_FAIL("Invalid array type: %c!", t2); - } - } - break; - default: - SEQAN_ASSERT_FAIL("Invalid tag type: %c!", t); - } -} - -/*! - * @fn assignTagsSamToBam - * @headerfile - * @brief Assign tags in SAM format to tags in BAM format. - * - * @signature void assignTagsBamToSam(bamTags, samTags); - * - * @param bamTags[out] A sequence of char (e.g. @link CharString @endlink) for the target BAM tags. - * @param samTags[in] A sequence of char (e.g. @link CharString @endlink) for the source SAM tags. - * - * @see assignTagsBamToSam - */ - -/** -.Function.assignTagsSamToBam -..cat:BAM I/O -..summary:Assign tags in SAM format to tags in BAM format. -..signature:assignTagsSamToBam(bamTags, samTags) -..param.bamTags:Destination BAM tags. -...type:Shortcut.CharString -..param.samTags:Source SAM tags. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/bam_io.h -*/ - -template -void assignTagsSamToBam(TTarget & target, TSource & source) -{ - // Handle case of empty source sequence. - if (empty(source)) - clear(target); - - typedef typename Iterator::Type TSourceIter; - TSourceIter it = begin(source, Standard()); - TSourceIter itEnd = end(source, Standard()); - - typedef Stream > TStream; - typedef RecordReader > TRecordReader; - - TStream stream(it, itEnd); - TRecordReader reader(stream); - - CharString buffer; - - while (!atEnd(reader)) - { - if (value(reader) == '\t') - goNext(reader); - SEQAN_ASSERT_NOT(atEnd(reader)); - - _assignTagsSamToBamOneTag(target, reader, buffer); - } -} - -// ---------------------------------------------------------------------------- -// Function assignTagsBamToSam() -// ---------------------------------------------------------------------------- - -template -void _assignTagsBamToSamOneTag(TTarget & target, TSourceIter & it) -{ - // Copy tag name. - SEQAN_ASSERT_NOT(atEnd(it)); - appendValue(target, *it++); - SEQAN_ASSERT_NOT(atEnd(it)); - appendValue(target, *it++); - unsigned char t = *it; - - // Add ':'. - appendValue(target, ':'); - - // Add type. - SEQAN_ASSERT_NOT(atEnd(it)); - if (*it == 'c' || *it == 'C' || *it == 's' || *it == 'S' || *it == 'i' || *it == 'I') - appendValue(target, 'i'); - else - appendValue(target, *it); - ++it; - - // Add ':'. - appendValue(target, ':'); - - // Convert the payload, depending on the field's type. - - switch (t) - { - case 'A': - appendValue(target, *it++); - break; - case 'c': - { - SEQAN_ASSERT_NOT(atEnd(it)); - __int8 x = *it++; - char buffer[4]; - snprintf(buffer, 4, "%d", x); - append(target, buffer); - } - break; - case 'C': - { - SEQAN_ASSERT_NOT(atEnd(it)); - char buffer[4]; - __uint8 x = *it++; - snprintf(buffer, 4, "%u", x); - append(target, buffer); - } - break; - case 's': - { - __int16 x = 0; - char * ptr = reinterpret_cast(&x); - for (int i = 0; i < 2; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - char buffer[32]; - snprintf(buffer, 32, "%d", x); - append(target, buffer); - } - break; - case 'S': - { - __uint16 x = 0; - char * ptr = reinterpret_cast(&x); - for (int i = 0; i < 2; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - char buffer[32]; - snprintf(buffer, 32, "%u", x); - append(target, buffer); - } - break; - case 'i': - { - int x = 0; - char * ptr = reinterpret_cast(&x); - for (int i = 0; i < 4; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - char buffer[32]; - snprintf(buffer, 32, "%d", x); - append(target, buffer); - } - break; - case 'I': - { - unsigned x = 0; - char * ptr = reinterpret_cast(&x); - for (int i = 0; i < 4; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - char buffer[32]; - snprintf(buffer, 32, "%u", x); - append(target, buffer); - } - break; - case 'f': - { - float x = 0; - char * ptr = reinterpret_cast(&x); - for (int i = 0; i < 4; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - char buffer[32]; - snprintf(buffer, 32, "%g", x); - append(target, buffer); - } - break; - case 'Z': - { - while (*it != '\0') - { - SEQAN_ASSERT_NOT(atEnd(it)); - appendValue(target, *it++); - } - SEQAN_ASSERT_NOT(atEnd(it)); - it++; - } - break; - case 'H': - { - while (*it != '\0') - { - SEQAN_ASSERT_NOT(atEnd(it)); - appendValue(target, *it++); - } - SEQAN_ASSERT_NOT(atEnd(it)); - it++; - } - break; - case 'B': - { - // Read type. - char t2 = *it++; - appendValue(target, t2); - // Read array length. - __int32 x = 0; - char * ptr = reinterpret_cast(&x); - for (int i = 0; i < 4; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - // Depending on t2, read array. - // TODO(holtgrew): Whee, this could be a bit more compact... - switch (t2) - { - case 'c': - for (__int32 i = 0; i < x; ++i) - { - appendValue(target, ','); - __int8 y = *it++; - char buffer[32]; - snprintf(buffer, 32, "%d", y); - append(target, buffer); - } - break; - case 'C': - for (__int32 i = 0; i < x; ++i) - { - appendValue(target, ','); - __uint8 y = *it++; - char buffer[32]; - snprintf(buffer, 32, "%u", y); - append(target, buffer); - } - break; - case 's': - for (__int32 i = 0; i < x; ++i) - { - appendValue(target, ','); - __int16 y = 0; - char * ptr = reinterpret_cast(&y); - for (int i = 0; i < 2; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - char buffer[32]; - snprintf(buffer, 32, "%d", y); - append(target, buffer); - } - break; - case 'S': - for (__int32 i = 0; i < x; ++i) - { - appendValue(target, ','); - __uint16 y = 0; - char * ptr = reinterpret_cast(&y); - for (int i = 0; i < 2; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - char buffer[32]; - snprintf(buffer, 32, "%d", y); - append(target, buffer); - } - break; - case 'i': - for (__int32 i = 0; i < x; ++i) - { - appendValue(target, ','); - int y = 0; - char * ptr = reinterpret_cast(&y); - for (int i = 0; i < 4; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - char buffer[32]; - snprintf(buffer, 32, "%d", y); - append(target, buffer); - } - break; - case 'I': - for (__int32 i = 0; i < x; ++i) - { - appendValue(target, ','); - unsigned y = 0; - char * ptr = reinterpret_cast(&y); - for (int i = 0; i < 4; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - char buffer[32]; - snprintf(buffer, 32, "%u", y); - append(target, buffer); - } - break; - case 'f': - for (__int32 i = 0; i < x; ++i) - { - appendValue(target, ','); - float y = 0; - char * ptr = reinterpret_cast(&y); - for (int i = 0; i < 4; ++i) - { - SEQAN_ASSERT_NOT(atEnd(it)); - *ptr++ = *it++; - } - char buffer[32]; - snprintf(buffer, 32, "%g", y); - append(target, buffer); - } - break; - default: - SEQAN_FAIL("Invalid array type: %c!", t2); - } - } - break; - default: - SEQAN_ASSERT_FAIL("Invalid tag type: %c!", t); - } -} - -/*! - * @fn assignTagsBamToSam - * @headerfile - * @brief Assign tags in BAM format to tags in SAM format. - * - * @signature void assignTagsBamToSam(samTags, bamTags); - * - * @param samTags[out] A sequence of char (e.g. @link CharString @endlink) for the target SAM tags. - * @param bamTags[in] A sequence of char (e.g. @link CharString @endlink) for the source BAM tags. - * - * @see assignTagsSamToBam - */ - -/** -.Function.assignTagsBamToSam -..cat:BAM I/O -..summary:Assign tags in BAM format to tags in SAM format. -..signature:assignTagsSamToBam(bamTags, samTags) -..param.samTags:Destination SAM tags. -...type:Shortcut.CharString -..param.bamTags:Source BAM tags. -...type:Shortcut.CharString -..returns:$void$ -..include:seqan/bam_io.h -..see:Function.assignTagsSamToBam -*/ - -template -void assignTagsBamToSam(TTarget & target, TSource const & source) -{ - // Handle case of empty source sequence. - if (empty(source)) - clear(target); - - clear(target); - - typedef typename Iterator::Type TSourceIter; - TSourceIter it = begin(source, Rooted()); - - bool first = true; - while (!atEnd(it)) - { - if (!first) - appendValue(target, '\t'); - first = false; - _assignTagsBamToSamOneTag(target, it); - } -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_SAM_CONVERSION_H_ diff --git a/seqan/bam_io/bam_stream.h b/seqan/bam_io/bam_stream.h deleted file mode 100644 index a73fb68..0000000 --- a/seqan/bam_io/bam_stream.h +++ /dev/null @@ -1,851 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Simple-to-use I/O for SAM and BAM files. -// -// The actual implementation is done using the class hierarchies rooted in -// XamReader and XamWriter. We use virtual functions and native C++ -// inheritance here because the implementations requires some kind of dynamic -// lookup, and using the built-in inheritance model is probably fast. Also, -// this API is on a very high level/layer and thus some loss in performance is -// OK. -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_STREAM_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_STREAM_H_ - -#include -#include - -#include - -// TODO(holtgrew): Replace std::fstream by MMap String? -// TODO(holtgrew): Implement BAI support? - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @class BamStream - * @headerfile - * @brief Class that provides an easy to use interface for reading and writing SAM and BAM files. - * - * @signature class BamStream; - * - * @section Example - * - * Read and write SAM or BAM files. - * - * @include demos/bam_io/bam_stream.cpp - * - * The output is as follows: - * - * @include demos/bam_io/bam_stream.cpp.stdout - */ - -/*! - * @fn BamStream::BamStream - * @brief Constructor - * - * @signature BamStream::BamStream([fileName[, mode[, format]]]); - * - * @param[in] fileName The path to the SAM or BAM file to load, char const *. - * @param[in] mode The open mode, of type @link BamStream::OperationMode @endlink, defaults to READ. - * @param[in] format The format, of type @link BamStream::Format @endlink, defaults to AUTO. - */ - -/*! - * @var THeader BamStream::header - * @brief The @link BamHeader @endlink of the @link BamStream @endlink object. - * - * SAM and BAM files have a header. When writing SAM or BAM files, you have to fill this member before writing @link - * BamAlignmentRecord @endlinks. Upon writing the first record, the header will be written out. - * - * When reading BAM files, the header will be read upon opening the file. When reading SAM files, any header will be - * read upon opening the file. - * - * Note that there is a special case when reading SAM records: If there is no header, or records refer to reference - * sequences that are previously unknown when reading SAM then a new entry is added to @link BamHeader::sequenceInfos - * @endlink. - */ - -/*! - * @var TBamIOContext BamStream::bamIOContext - * - * @brief The @link BamIOContext @endlink object to use for reading and writing @link BamAlignmentRecord @endlinks. - * - * When reading, the bamIOContext will be updated automatically. When reading SAM, new reference sequences can - * be introduced "on the fly" when a new sequence appears. When writing, the bamIOContext is automatically - * filled/reset when the first record is written. - */ - -/** -.Class.BamStream -..cat:BAM I/O -..summary:Class that provides an easy to use interface for reading and writing SAM and BAM files. -..signature:BamStream -..example:Read and write SAM or BAM files. -..example.file:demos/bam_io/bam_stream.cpp -..example.text:The output is as follows: -..example.output: -@HD VN:1.3 SO:coordinate -@SQ SN:ref LN:45 -@SQ SN:ref2 LN:40 -r001 163 ref 7 30 8M4I4M1D3M = 37 39 TTAGATAAAGAGGATACTG * XX:B:S,12561,2,20,112 -r002 0 ref 9 30 1S2I6M1P1I1P1I4M2I * 0 0 AAAAGATAAGGGATAAA * -r003 0 ref 9 30 5H6M * 0 0 AGCTAA * -r004 0 ref 16 30 6M14N1I5M * 0 0 ATAGCTCTCAGC * -r003 16 ref 29 30 6H5M * 0 0 TAGGC * -r001 83 ref 37 30 9M = 7 -39 CAGCGCCAT * -..include:seqan/bam_io.h - -.Memfunc.BamStream#BamStream: -..class:Class.BamStream -..description:See documentation of @Class.BamStream@ for more information. -..summary:Constructor -..signature:BamStream() -..signature:BamStream(fileName[, mode[, format]]) -..param.fileName:Path to the file to open. -...type:nolink:$char const *$ -..param.mode:The mode to use for opening the file (read/write). Optional -...default:@Enum.BamStream\colon\colonOperationMode.value.READ@ -...type:Enum.BamStream\colon\colonOperationMode -..param.format:Use this to enforce opening the file in the given format. Autodetected from file name or content if not specified. Optional. -...type:Enum.BamStream\colon\colonFormat -...default:@Enum.BamStream\colon\colonFormat.value.AUTO@ - -.Memvar.BamStream#header: -..class:Class.BamStream -..type:Class.BamHeader -..summary:The @Class.BamHeader@ of the @Class.BamStream@ object. -..description: -SAM and BAM files have a header. -When writing SAM or BAM files, you have to fill this member before writing @Class.BamAlignmentRecord@s. -Upon writing the first record, the header will be written out. -..description: -When reading BAM files, the header will be read upon opening the file. -When reading SAM files, any header will be read upon opening the file. -..description: -Note that there is a special case when reading SAM records: -If there is no header, or records refer to reference sequences that are previously unknown when reading SAM then a new entry is added to @Memvar.BamHeader#sequenceInfos@.\ - -.Memvar.BamStream#bamIOContext: -..class:Class.BamStream -..summary:The @Class.BamIOContext@ object to use for reading and writing @Class.BamAlignmentRecord@s. -..description: -When reading, the $bamIOContext$ will be updated automatically. -When reading SAM, new reference sequences can be introduced "on the fly" when a new sequence appears. -When writing, the $bamIOContext$ is automatically filled/reset when the first record is written. - -.Enum.BamStream\colon\colonOperationMode: -..cat:BAM I/O -..summary:Select the operation mode of a @Class.BamStream@. -..value.READ:Open stream for reading. -..value.WRITE:Open stream for writing. -..include:seqan/bam_io.h - -.Enum.BamStream\colon\colonFormat: -..cat:BAM I/O -..summary:Select the format to use for reading/writing. -..value.AUTO:Auto-detect format from file content on reading and from the file name on writing. If Auto-detection fails, SAM is used. -..value.SAM:Force reading/writing of SAM. -..value.BAM:Force reading/writing of BAM. -..include:seqan/bam_io.h -*/ - -/*! - * @enum BamStream::OperationMode - * @brief Selects teh operation mode of a @link BamStream @endlink. - * @see BamStream - * - * @signature enum BamStream::OperationMode; - * - * @var BamStream::OperationMode BamStream::READ; - * @brief Enum value for reading. - * - * @var BamStream::OperationMode BamStream::WRITE; - * @brief Enum value for writing. - */ - -/*! - * @enum BamStream::Format - * @brief Select the format to use for reading/writing. - * - * @signature enum BamStream::Format; - * - * @var BamStream::Format BamStream::AUTO; - * @brief Auto-detect the format from file content on reading and from the file name on writing. If auto-detection - * fails, SAM is used. - * - * @var BamStream::Format BamStream::SAM; - * @brief Force reading/writing of SAM. - * - * @var BamStream::Format BamStream::BAM; - * @brief Force reading/writing of BAM. - */ - -class BamStream -{ -public: - - // Enum for selecting read/write mode. - enum OperationMode - { - READ, - WRITE - }; - - // Enum for selecting format. AUTO is only used as the default, after opening, only SAM and BAM are used. - enum Format - { - AUTO, - SAM, - BAM - }; - - // Name of the BAM file. - CharString _filename; - // The open mode. - OperationMode _mode; - // The format. - Format _format; - // Whether or not the header was written out. - bool _headerWritten; - - // Indicates whether stream is at end when reading. - bool _atEnd; - // Indicates whether there was an error when reading or writing. - bool _isGood; - - // The BAM Header record. - BamHeader header; - // The BAM I/O Context and its elements. - StringSet _nameStore; - NameStoreCache > _nameStoreCache; - BamIOContext > bamIOContext; - - // The actual implementation of writing SAM or BAM. - std::SEQAN_AUTO_PTR_NAME _writer; - // The actual implementation of reading SAM or BAM. - std::SEQAN_AUTO_PTR_NAME _reader; - - // Constructors. - - BamStream() : - _mode(READ), _format(AUTO), _headerWritten(false), _atEnd(false), _isGood(true), - _nameStoreCache(_nameStore), bamIOContext(_nameStore, _nameStoreCache) - {} - - BamStream(char const * filename, OperationMode mode = READ, Format format = AUTO); - - // Write header if necessary. - inline int _writeHeader() - { - if (this->_headerWritten) - return 0; - - // Rewrite name store and cache. - clear(_nameStore); - for (unsigned i = 0; i < length(header.sequenceInfos); ++i) - appendValue(_nameStore, header.sequenceInfos[i].i1); - refresh(_nameStoreCache); - - // Write out header. - this->_headerWritten = true; - return this->_writer->writeHeader(header, bamIOContext); - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Member Function BamStream::BamStream() -// ---------------------------------------------------------------------------- - -// Forward declaration is here since it refers to enum member type. -inline int open(BamStream & bamIO, - char const * filename, - BamStream::OperationMode mode, - BamStream::Format format); - -inline BamStream::BamStream(char const * filename, OperationMode mode, Format format) : - _filename(filename), _mode(mode), _format(format), _headerWritten(false), _atEnd(false), _isGood(true), - _nameStoreCache(_nameStore), bamIOContext(_nameStore, _nameStoreCache) -{ - open(*this, filename, _mode, _format); -} - -// ---------------------------------------------------------------------------- -// Function open() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#open - * @brief Open a @link BamStream @endlink object for reading/writing. - * - * @signature int open(bamIO, fileName[, mode[, format]]); - * - * @param[in,out] bamIO The @link BamStream @endlink object to open. Types: BamStream - * @param[in] fileName The path to the file to open, char const *. - * @param[in] mode The mode to open the file in, optional, of type @link BamStream::OperationMode @endlink, - * defaults to BamStream::READ. - * @param[in] format The format to use, inferred from file contents (reading) or file name (writing) by default. - * the path to the file to open, of type @link BamStream::Format @endlink, defaults to - * AUTO. - * - * @return int A status code, 0 on success, a value != 0 on errors. - */ - -/** -.Function.BamStream#open -..class:Class.BamStream -..summary:Open a @Class.BamStream@ object for reading/writing. -..signature:open(bamIO, fileName[, mode[, format]]) -..param.bamIO:The @Class.BamStream@ object to open. -...type:Class.BamStream -..param.fileName:The path to the file to open. -...type:Shortcut.CharString -..param.mode:The mode to open the file in. Optional. -...default:$BamStream::READ$ -...type:nolink:$BamStream::OperationMode$. -..param.format:The format to use, inferred from file contents (reading) or file name (writing) by default. -...default:$BamStream::AUTO$ -...type:nolink:$BamStream::Format$. -..param.format:The path to the file to open. -...type:Shortcut.CharString -..returns:An $int$ status code: $0$ on success, $1$ on errors. -..include:seqan/bam_io.h -*/ - -inline int open(BamStream & bamIO, - char const * fileName, - BamStream::OperationMode mode = BamStream::READ, - BamStream::Format format = BamStream::AUTO) -{ - bamIO._filename = fileName; - bamIO._isGood = true; - - // Guess format if necessary. - if (format == BamStream::AUTO) - { - if (mode == BamStream::READ) - { - format = BamStream::SAM; // SAM is default. - - // Look whether the file is in BAM format. - std::fstream inStream(toCString(fileName), std::ios_base::binary | std::ios_base::in); - if (!inStream.good()) - { - bamIO._isGood = false; - return 1; // Error opening the file. - } - char buffer[3]; - inStream.read(&buffer[0], 3); - if (buffer[0] == '\x1F' && buffer[1] == '\x8B' && buffer[2] == '\x08') - format = BamStream::BAM; - } - else // mode == WRITE - { - format = BamStream::SAM; // SAM is default. - if (endsWith(fileName, ".bam")) - format = BamStream::BAM; - } - } - -#if !SEQAN_HAS_ZLIB - // Guard against opening BAM files without zlib. - if (format == BamStream::BAM) - { - std::cerr << "ERROR: Trying to open BAM file and ZLIB is not available!\n"; - bamIO._isGood = false; - return 1; - } -#endif // #if !SEQAN_HAS_ZLIB - - if (mode == BamStream::READ) - { - if (format == BamStream::SAM) - bamIO._reader.reset(new SamReader_()); -#if SEQAN_HAS_ZLIB - // The branch above is always taken if zlib is not available, there already is a check above. - else - bamIO._reader.reset(new BamReader_()); -#endif // #if !SEQAN_HAS_ZLIB - if (bamIO._reader->open(fileName) != 0) - { - bamIO._isGood = false; - return 1; - } - } - else // (format == BamStream::WRITE) - { - if (format == BamStream::SAM) - bamIO._writer.reset(new SamWriter_()); -#if SEQAN_HAS_ZLIB - // The branch above is always taken if zlib is not available, there already is a check above. - else - bamIO._writer.reset(new BamWriter_()); -#endif // #if !SEQAN_HAS_ZLIB - if (bamIO._writer->open(fileName) != 0) - { - bamIO._isGood = false; - return 1; - } - } - - bamIO._mode = mode; - bamIO._format = format; - - // Read header. - if (bamIO._isGood && bamIO._mode == BamStream::READ) - { - clear(bamIO.header); - if (bamIO._reader->readHeader(bamIO.header, bamIO.bamIOContext) != 0) - { - bamIO._isGood = false; - return 1; - } - } - - return 0; -} - -// ---------------------------------------------------------------------------- -// Function reset() -// ---------------------------------------------------------------------------- - -/* - * @fn BamStream#reset - * @brief Reset @link BamStream @endlink object to status after construction. - * - * @signature void reset(stream); - * - * @param stream The @link BamStream @endlink object to reset. - * - * @return int A status code, 0 on success, != 0 on error. - */ - -/** -.Function.BamStream#reset -..class:Class.BamStream -..summary:Reset @Class.BamStream@ object to status after construction. -..signature:reset(bamIO) -..param.bamIO:The @Class.BamStream@ object to reset. -...type:Class.BamStream -..returns:$int$, a status code ($0$ for success, non-$0$ for error). -..include:seqan/bam_io.h -*/ - -inline int reset(BamStream & bamIO) -{ - return open(bamIO, toCString(bamIO._filename), bamIO._mode, bamIO._format); -} - -// ---------------------------------------------------------------------------- -// Function flush() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#flush - * @brief Flush output when writing. - * - * @signature int flush(stream); - * - * @param stream The @link BamStream @endlink object to flush. - * - * @return int A status code, 0 on success, != 0 on errors. - * - * @section Remarks - * - * This will write out the header if no record has been written out yet. - */ - -/** -.Function.BamStream#flush -..class:Class.BamStream -..summary:Flush output when writing. -..description:This will write out the header if no record has been written out yet. -..signature:flush(bamIO) -..param.bamIO:The @Class.BamStream@ object to flush. -...type:Class.BamStream -..returns:$int$ with an error code. -..include:seqan/bam_io.h -*/ - -inline int flush(BamStream & bamIO) -{ - if (bamIO._mode == BamStream::WRITE) - { - bamIO._writeHeader(); - return bamIO._writer->flush(); - } - return 0; -} - -// ---------------------------------------------------------------------------- -// Function close() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#close - * @brief Close BamStream object's underlying file. - * - * @signature int close(stream); - * - * @param stream[in,out] The @link BamStream @endlink object to close. - * - * @return int A status code, 0 on success, != 0 on error. - */ - -/** -.Function.BamStream#close -..class:Class.BamStream -..summary:Close BamStream object's underlying file. -..signature:close(bamIO) -..param.bamIO:The @Class.BamStream@ object to close -...type:Class.BamStream -..returns:$int$ with an error code. -..include:seqan/bam_io.h -*/ - -inline int close(BamStream & bamIO) -{ - if (bamIO._mode == BamStream::WRITE) - { - bamIO._writeHeader(); - return bamIO._writer->close(); - } - else - { - return bamIO._reader->close(); - } -} - -// ---------------------------------------------------------------------------- -// Function atEnd() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#atEnd - * @brief Check whether a @link BamStream @endlink object is at end when reading. - * - * @signature bool atEnd(stream); - * - * @param[in] stream The @link BamStream @endlink object to query. - * - * @return bool true in case of the stream being at the end, false otherwise. - * - * @section Remarks - * - * The stream will only be guaranteed at the end after trying to read after the last character. - */ - -/** -.Function.BamStream#atEnd -..class:Class.BamStream -..summary:Check whether a @Class.BamStream@ object is at end when reading. -..signature:atEnd(bamIO) -..param.bamIO:The @Class.BamStream@ object to query. -...type:Class.BamStream -..returns:$bool$, indicating whether the object is at the end of the file. -..include:seqan/bam_io.h -*/ - -inline bool atEnd(BamStream const & bamIO) -{ - SEQAN_ASSERT_EQ_MSG(bamIO._mode, BamStream::READ, "You can only call atEnd() when opened the file for reading."); - return bamIO._reader->atEnd(); -} - -inline bool atEnd(BamStream & bamIO) -{ - SEQAN_ASSERT_EQ_MSG(bamIO._mode, BamStream::READ, "You can only call atEnd() when opened the file for reading."); - return bamIO._reader->atEnd(); -} - -// ---------------------------------------------------------------------------- -// Function isGood() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#isGood - * @brief Check whether the @link BamStream @endlink object has is in the failure state. - * - * @signature bool isGood(stream); - * - * @param stream The @link BamStream @endlink object to query. - * - * @return bool true if the stream is not in an error state and false otherwise. - */ - -/** -.Function.BamStream#isGood -..class:Class.BamStream -..summary:Check whether the @Class.BamStream@ object has is in the failure state. -..signature:isGood(bamIO) -..param.bamIO:The @Class.BamStream@ object to query. -...type:Class.BamStream -..returns:$bool$, indicating whether there was no error or not. -..include:seqan/bam_io.h -*/ - -inline bool isGood(BamStream const & bamIO) -{ - return bamIO._isGood; -} - -// ---------------------------------------------------------------------------- -// Function readRecord() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#readRecord - * @brief Read one @link BamAlignmentRecord @endlink from a @link BamStream @endlink. - * - * @signature int readRecord(record, stream); - * - * @param[out] record The @link BamAlignmentRecord @endlink to read the next alignment record into. Of type - * @link BamAlignmentRecord @endlink. - * @param[in,out] stream The @link BamStream @endlink object to read from. - * - * @return int A status code, 0 on success. - */ - -/** -.Function.BamStream#readRecord -..class:Class.BamStream -..summary:Read one @Class.BamAlignmentRecord@ from a @Class.BamStream@. -..signature:readRecord(record, bamIO) -..param.record:The @Class.BamAlignmentRecord@ to read the next alignment record into. -...class:Class.BamAlignmentRecord -..param.bamIO:The @Class.BamStream@ object to read from. -...type:Class.BamStream -..returns:An $int$ status code: $0$ on success, non-$0$ on failure. -..include:seqan/bam_io.h -*/ - -inline int readRecord(BamAlignmentRecord & record, BamStream & bamIO) -{ - int res = bamIO._reader->readRecord(record, bamIO.bamIOContext); - bamIO._isGood = bamIO._isGood && (res == 0); - return res; -} - -// ---------------------------------------------------------------------------- -// Function writeRecord() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#writeRecord - * @brief Write one @link BamAlignmentRecord @endlink to a @link BamStream @endlink. - * - * @signature int writeRecord(stream, record); - * - * @param[in,out] bamIO The @link BamStream @endlink object to write to. - * @param[in] record The @link BamAlignmentRecord @endlink to write out. - * - * @return int A status code, 0 on success. - */ - -/** -.Function.BamStream#writeRecord -..class:Class.BamStream -..summary:Write one @Class.BamAlignmentRecord@ to a @Class.BamStream@. -..signature:writeRecord(bamIO, record) -..param.record:The @Class.BamAlignmentRecord@ to write out. -...class:Class.BamAlignmentRecord -..param.bamIO:The @Class.BamStream@ object to write to. -...type:Class.BamStream -..returns:An $int$ status code: $0$ on success, non-$0$ on failure. -..include:seqan/bam_io.h -*/ - -inline int writeRecord(BamStream & bamIO, BamAlignmentRecord const & record) -{ - bamIO._writeHeader(); // Does nothing if head already written out. - - int res = bamIO._writer->writeRecord(record, bamIO.bamIOContext); - bamIO._isGood = bamIO._isGood && (res == 0); - return res; -} - -// ---------------------------------------------------------------------------- -// Function fileSize() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#fileSize - * @brief Returns the size of the file in bytes as stored on the disk. - * - * @signature __int64 fileSize(stream); - * - * @param[in] stream The @link BamStream @endlink to query. - * - * @return __int64 The size of the file on the disk. - * - * @section Remarks - * - * This only works when reading. - */ - -// Returns size of file in bytes as stored on the disk. - -inline __int64 fileSize(BamStream const & bamIO) -{ - if (bamIO._mode == BamStream::WRITE) - return 0; - return bamIO._reader->fileSize(); -} - -// ---------------------------------------------------------------------------- -// Function positionInFile() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#positionInFile - * @brief Approximate byte position in file, to be used for progress display, not for seeking. - * - * @signature __int64 positionInFile(stream); - * - * @param[in] stream The @link BamStream @endlink to query for its position in the file. - * - * @return __int64 The position in the file. - * - * @section Remarks - * - * This function returns the "approximate" position in the file and only works when the file is opened in BAM format. - * It is meant for progress display in connection with @link BamStream#fileSize @endlink and not for jumping within the - * file. The position is approximate in the sense that it points between the block boundaries of the BGZ file. - */ - -// TODO(holtgrew): Review this functionality, extend, fix. - -// Returns "approximate" byte position in file. To be used for progress display, not for seeking. For this, we have to -// implement streamTell() and streamSeek() for BamStream. This works for BAM only at the moment. - -inline __int64 positionInFile(BamStream const & bamIO) -{ - if (bamIO._mode == BamStream::WRITE) - return 0; - return bamIO._reader->positionInFile(); -} - -// ---------------------------------------------------------------------------- -// Function jumpToRegion() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#jumpToRegion - * @brief Seek in BamStream using an index. - * - * You provide a region [pos, posEnd) on the reference refID that you want to jump to and the function - * jumps to the first alignment in this region, if any. - * - * @signature bool jumpToRegion(stream, hasAlignments, bamIOContext, refID, pos, posEnd, index); - * - * @param[in,out] stream The @link BamStream @endlink to jump with. - * @param[out] hasAlignments A bool that is set true if the region [pos, posEnd) has any - * alignments. - * @param[in] refID The reference id to jump to (__int32). - * @param[in] pos The begin of the region to jump to. - * @param[in] posEnd The end of the region to jump to. - * @param[in] index The @link BamIndex @endlink to use for the jumping. - * - * @return bool true if seeking was successful, false if not. - * - * @section Remarks - * - * This function fails if refID/pos are invalid. - * - * @see BamIndex#jumpToRegion - */ - -#if SEQAN_HAS_ZLIB -inline bool jumpToRegion(BamStream & bamIO, bool & hasAlignments, __int32 refId, __int32 pos, __int32 posEnd, BamIndex const & index) -{ - if (bamIO._format != BamStream::BAM) - return false; // Can only jump in BAM files. - if (bamIO._mode != BamStream::READ) - return false; // Can only jump when reading. - - BamReader_ * s = static_cast(bamIO._reader.get()); - return s->jumpToRegion(hasAlignments, refId, pos, posEnd, index, bamIO.bamIOContext); -} -#endif // #if SEQAN_HAS_ZLIB - -// ---------------------------------------------------------------------------- -// Function jumpToOrphans() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamStream#jumpToOrphans - * @brief Seek to orphans block in BamStream using an index. - * - * @signature bool jumpToOrphans(stream, hasAlignments, index); - * - * @param[in,out] stream The @link BgzfStream @endlink object to jump with. - * @param[out] hasAlignments A bool that is set to true if there are any orphans. - * @param[in] index The index to use for jumping. - * - * @see BamIndex#jumpToOrphans - */ - -#if SEQAN_HAS_ZLIB -inline bool jumpToOrphans(BamStream & bamIO, BamIndex const & index) -{ - if (bamIO._format != BamStream::BAM) - return false; // Can only jump in BAM files. - if (bamIO._mode != BamStream::READ) - return false; // Can only jump when reading. - - BamReader_ * s = static_cast(bamIO._reader.get()); - return s->jumpToOrphans(index, bamIO.bamIOContext); -} -#endif // #if SEQAN_HAS_ZLIB - -} // namespace seqan; - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_STREAM_H_ diff --git a/seqan/bam_io/bam_tags_dict.h b/seqan/bam_io/bam_tags_dict.h deleted file mode 100644 index 32f0c51..0000000 --- a/seqan/bam_io/bam_tags_dict.h +++ /dev/null @@ -1,1058 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Code for read/write access to BAM tag dicts. -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_TAGS_DICT_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_TAGS_DICT_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @class BamTagsDict - * @headerfile - * @brief Indexes start positions of BAM tags in a @link CharString @endlink and provides a dict-like API. - * - * @signature class BamTagsDict; - * - * @section Example - * - * @code{.cpp} - * CharString samStr = "AA:Z:value1\tAB:Z:value2\tAC:i:30"; - * CharString bamStr; - * assignSamToBam(bamStr, samStr); - * BamTagsDict tags(bamStr); - * std::cerr << length(tags) << std::endl; // #=> "3" - * for (unsigned i = 0; i < length(tags); ++i) - * { - * std::cerr << getTagKey(tags, i) << " -> " << getTagValue(tags, i) << std::endl; - * if (getTagValue(tags, i)[0] == 'i') // is 32 bit integer - * { - * __int32 x = 0; - * bool res = extractTagValue(x, tags, i); - * SEQAN_ASSERT_MSG(res, "Not a valid integer at pos %u!", i); - * std::cerr << " " << x << std::endl; - * } - * } - * @endcode - * - * Output is: - * - * @code{.cpp} - * "AA -> Zvalue1" - * "AB -> Zvalue2" - * "AC -> i" - * -> " 30" - * @endcode - * - * @see getBamTypeSize - * @see getBamTypeChar - */ - -/*! - * @fn BamTagsDict::BamTagsDict - * @brief Constructor - * - * @signature BamTagsDict::BamTagsDict(); - */ - -/** -.Class.BamTagsDict -..cat:BAM I/O -..cat:Fragment Store -..signature:BamTagsDict -..summary:Indexes start positions of BAM tags in a @Shortcut.CharString@ and provides a dict-like API. -..example.code: -CharString samStr = "AA:Z:value1\tAB:Z:value2\tAC:i:30"; -CharString bamStr; -assignSamToBam(bamStr, samStr); -BamTagsDict tags(bamStr); -std::cerr << length(tags) << std::endl; // #=> "3" -for (unsigned i = 0; i < length(tags); ++i) -{ - std::cerr << getTagKey(tags, i) << " -> " << getTagValue(tags, i) << std::endl; - if (getTagValue(tags, i)[0] == 'i') // is 32 bit integer - { - __int32 x = 0; - bool res = extractTagValue(x, tags, i); - SEQAN_ASSERT_MSG(res, "Not a valid integer at pos %u!", i); - std::cerr << " " << x << std::endl; - } -} -// #=> "AA -> Zvalue1" -// #=> "AB -> Zvalue2" -// #-> "AC -> i" -# #-> " 30" -..include:seqan/bam_io.h - -.Memfunc.BamTagsDict#BamTagsDict -..class:Class.BamTagsDict -..signature:BamTagsDict() -..summary:Constructor. -..remarks:Only the default constructor is provided. -*/ - -class BamTagsDict -{ -public: - Holder _host; - String _positions; - - BamTagsDict() {} - - explicit - BamTagsDict(CharString & tags) : _host(tags) {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction Host -// ---------------------------------------------------------------------------- - -template <> -struct Host -{ - typedef CharString Type; -}; - -template <> -struct Host -{ - typedef CharString const Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function host() -// ---------------------------------------------------------------------------- - -inline Host::Type & -host(BamTagsDict & bamTags) -{ - return value(bamTags._host); -} - -inline Host::Type & -host(BamTagsDict const & bamTags) -{ - return value(bamTags._host); -} - -// ---------------------------------------------------------------------------- -// Function hasIndex() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamTagsDict#hasIndex - * @brief Returns whether the BamTagsDict has an index. - * - * @signature bool hasIndex(dict); - * - * @param dict The @link BamTagsDict @endlink to query. - * - * @return bool true if dict has an index and false otherwise. - */ - -/** -.Function.BamTagsDict#hasIndex -..class:Class.BamTagsDict -..cat:Fragment Store -..summary:Return $true$ if @Class.BamTagsDict@ has an index. -..signature:hasIndex(bamTags) -..param.bamTags:SAM Tags to query -...type:Class.BamTagsDict -..returns:$bool$ -..include: -*/ - -// TODO(holtgrew): Remove non-const variante. - -inline bool -hasIndex(BamTagsDict const & bamTags) -{ - return length(bamTags._positions) != 0u; -} - -inline bool -hasIndex(BamTagsDict & bamTags) -{ - return hasIndex(const_cast(bamTags)); -} - -// ---------------------------------------------------------------------------- -// Function getBamTypeSize() -// ---------------------------------------------------------------------------- - -/*! - * @fn getBamTypeSize - * @brief Return size of the type identified by a type char. - * - * @signature int getBamTypeSize(c); - * - * @param c A char that identifies a type. - * - * @return int The size of the type in bytes, -1 vor variable-sized types, -2 for invalid paramters. - * - * @see BamTagsDict - * @see getBamTypeChar - */ - -// Return sizeof() of the type identified with the given char. Returns -2 if not -// valid, -1 if of variable length. - -/** -.Function.getBamTypeSize -..class:Class.BamTagsDict -..cat:BAM I/O -..signature:getBamTypeSize(c) -..summary:Return size of the type identified by $c$. -..param.c:The BAM type identifier -..returns:$int$ with the $sizeof()$ of the type, -1 for variable sized types, -2 for invalid parameters. -..include:seqan/bam_io.h -*/ - -inline int -getBamTypeSize(char c) -{ - switch (c) - { - case 'A': - return 1; - case 'f': - return 4; - case 'Z': - case 'H': - case 'B': - return -1; - case 'c': - case 'C': - return 1; - case 's': - case 'S': - return 2; - case 'i': - case 'I': - return 4; - } - return -2; -} - -// ---------------------------------------------------------------------------- -// Function buildIndex() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamTagsDict#buildIndex - * @brief Build index for a BamTagsDict object. - * - * @signature void buildIndex(bamTags); - * - * @param[in,out] bamTags The BamTagsDict object to build the index for. - */ - -/** -.Function.BamTagsDict#buildIndex -..class:Class.BamTagsDict -..cat:Fragment Store -..summary:Build index for a @Class.BamTagsDict@ object. -..signature:buildIndex(bamTags) -..param.bamTags:SAM Tags to build index for. -...type:Class.BamTagsDict -..returns:$void$ -..include: -*/ - -inline void -buildIndex(BamTagsDict & bamTags) -{ - typedef Host::Type TCharString; - typedef Iterator::Type TCharStringIter; - - clear(bamTags._positions); - if (empty(value(bamTags._host))) - return; // Done. - - appendValue(bamTags._positions, 0); - for (TCharStringIter it = begin(host(bamTags)); !atEnd(it);) - { - it += 2; - char c = *it; - if (c == 'H' || c == 'Z') - { - while (!atEnd(it) && *it != '\0') - ++it; - ++it; - } - else if (c == 'B') - { - ++it; - c = *it; - ++it; - __uint32 len = 0; - memcpy(&len, &*it, 4); - it += 4; - it += len * getBamTypeSize(c); - } - else - { - ++it; - it += getBamTypeSize(c); - } - - appendValue(bamTags._positions, position(it)); - } - // if (!empty(value(bamTags._host))) - // appendValue(bamTags._positions, length(host(bamTags)) + 1); // +1 since there is not tab at the end -} - -// ---------------------------------------------------------------------------- -// Function setHost() -// ---------------------------------------------------------------------------- - -inline Holder & -_dataHost(BamTagsDict & bamTags) -{ - return bamTags._host; -} - -inline void -setHost(BamTagsDict & me, CharString & host_) -{ - SEQAN_CHECKPOINT; - setValue(_dataHost(me), host_); - clear(me._positions); -} - -inline void -setHost(BamTagsDict & me, CharString const & host_) -{ - SEQAN_CHECKPOINT; - setValue(_dataHost(me), host_); - clear(me._positions); -} - -// ---------------------------------------------------------------------------- -// Function length() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamTagsDict#length - * @brief Returns the number of entries in a BamTagsDict. - * - * @signature unsigned length(tagsDict); - * - * @param tagsDict The BamTagsDict object to query for its length. - * - * @return unsigned The number of entries in the BamTagsDict. - */ - -///.Function.length.param.object.type:Class.BamTagsDict - -inline unsigned -length(BamTagsDict const & tags) -{ - if (empty(value(tags._host))) - return 0; - if (!hasIndex(tags)) - buildIndex(const_cast(tags)); - return length(tags._positions) - 1; -} - -// ---------------------------------------------------------------------------- -// Function getTagType() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamTagsDict#getTagType - * @brief Returns the tag type char for an entry of a BamTagsDict. - * - * @signature char getTagType(tags, idx); - * - * @param[in] tags The BamTagsDict to query. - * @param[in] idx The position for which to retrieve the type. - */ - -/** -.Function.BamTagsDict#getTagType -..class:Class.BamTagsDict -..cat:BAM I/O -..signature:getTagType(tagsDict, idx) -..summary:Get key of a tag by index. -..param.tagsDict:The @Class.BamTagsDict@ to retrieve data from. -..param.idx:Index of the tag whose key to retrieve. -..returns:$char$, the SAM/BAM identifier of the type. -..include:seqan/bam_io.h -*/ - -template -inline char -getTagType(BamTagsDict & tags, TPos idx) -{ - if (!hasIndex(tags)) - buildIndex(tags); - return host(tags)[tags._positions[idx] + 2]; -} - -// ---------------------------------------------------------------------------- -// Function getTagKey() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamTagsDict#getTagKey - * @brief Return key of a tag by index. - * - * @signature TKey getTagKey(tagsDict, idx); - * - * @param[in] tagsDict The BamTagsDict to query. - * @param[in] idx The index of the dict entry. - * - * @return TKey An infix of a @link CharString @endlink. Will be a two-character char sequence. - */ - -/** -.Function.BamTagsDict#getTagKey -..class:Class.BamTagsDict -..cat:BAM I/O -..signature:getTagKey(tagsDict, idx) -..summary:Return key of a tag by index. -..param.tagsDict:The @Class.BamTagsDict@ to retrieve data from. -...type:Class.BamTagsDict -..param.idx:Index of the tag whose key to retrieve. -..returns:Infix of the underlying string. -..remarks:See @Class.BamTagsDict@ for an example. -..include:seqan/bam_io.h -*/ - -template -inline Infix::Type>::Type -getTagKey(BamTagsDict & tags, TPos idx) -{ - if (!hasIndex(tags)) - buildIndex(tags); - return infix(host(tags), tags._positions[idx], tags._positions[idx] + 2); -} - -template -inline Infix::Type>::Type -getTagKey(BamTagsDict const & tags, TPos idx) -{ - return getTagKey(const_cast(tags), idx); -} - -// ---------------------------------------------------------------------------- -// Function findTagKey() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamTagsDict#findTagKey - * @brief Find a tag by its key for a @link BamTagsDict @endlink object. - * - * @signature bool findTagKey(idx, tagsDict, name); - * - * @param[out] idx The index of the tag is stored here (unsigned). - * @param[in] tagsDict The BamTagsDict to query. - * @param[in] name The key to query for: @link CharString @endlink. - * - * @return bool true if the key could be found and false otherwise. - */ - -/** -.Function.BamTagsDict#findTagKey -..summary:Find a tag by its key for a @Class.BamTagsDict@ object. -..class:Class.BamTagsDict -..signature:findTagKey(idx, tagsDict, name) -..param.idx:Index of the tag with the given key. -...type:nolink:$unsigned$ -..param.tagsDict:The @Class.BamTagsDict@ to retrieve data from. -..param.name:Name of the key to find. -...type:Shortcut.CharString -..returns:$bool$, indicating whether such a key could be found. -..include:seqan/bam_io.h -*/ - -inline bool -findTagKey(unsigned & idx, BamTagsDict & tags, CharString const & name) -{ - for (idx = 0; idx < length(tags); ++idx) - if (getTagKey(tags, idx) == name) - return true; - return false; -} - -inline bool -findTagKey(unsigned & idx, BamTagsDict const & tags, CharString const & name) -{ - return findTagKey(idx, const_cast(tags), name); -} - -// ---------------------------------------------------------------------------- -// Function getTagValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamTagsDict#getTagValue - * @brief The value of a tag by its key. - * - * @signature CharString getTagValue(tagsDict, idx); - * - * @param[in] tagsDict The tags dict to query. - * @param[in] idx The index of the entry to query for its value. - * - * @return CharString the raw tags data. - * - * @section Remarks - * - * Note that you will get <type char> + payload in the case of @link BamTagsDict @endlink. - * - * See documentation of @link BamTagsDict @endlink for an example. - */ - - -/** -.Function.BamTagsDict#getTagValue -..class:Class.BamTagsDict -..cat:BAM I/O -..summary:Return the value of a tag by its index in the @Class.BamTagsDict@. -..signature:getTagValue(tagsDict, idx) -..param.tagsDict:The @Class.BamTagsDict@ to retrieve data from. -...type:Class.BamTagsDict -..param.idx:Index of the tag whose value to retrieve. -..returns:@Shortcut.CharString@ with the raw tags data. -..remarks:Note that you will get $ + payload$ in case of @Class.BamTagsDict@. -..remarks:See @Class.BamTagsDict@ for an example. -..include:seqan/bam_io.h -*/ - -template -inline CharString -getTagValue(BamTagsDict & tags, TIdx idx) -{ - if (!hasIndex(tags)) - buildIndex(tags); - - // TODO(holtgrew): Can't we use positions to speed this up? - - typedef typename Position::Type TPos; - TPos beginPos = tags._positions[idx] + 2; - TPos endPos = beginPos + 1; - - char theType = getTagType(tags, idx); - if (theType == 'Z' || theType == 'H') - { - typedef typename Iterator::Type TIterator; - TIterator it = begin(host(tags), Rooted()) + beginPos + 1; - for (; !atEnd(it) && *it != '\0'; goNext(it)) - endPos += 1; - endPos += 1; - } - else if (theType == 'B') - { - __uint32 len = 0; - memcpy(&len, &host(tags)[tags._positions[idx]] + 4, 4); - char c = host(tags)[tags._positions[idx] + 3]; - int typeSize = getBamTypeSize(c); - SEQAN_ASSERT_GT(typeSize, 0); - endPos += 5 + len * typeSize; - } - else - { - endPos += getBamTypeSize(theType); - } - - return infix(host(tags), beginPos, endPos); -} - -template -inline CharString //Infix::Type>::Type -getTagValue(BamTagsDict const & tags, TPos idx) -{ - return getValue(const_cast(tags), idx); -} - -// ---------------------------------------------------------------------------- -// Function extractTagValue() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamTagsDict#extractTagValuej - * @brief Extract and cast "atomic" value from tags string with index idx. - * - * @signature bool extractTagValue(dest, tags, idx) - * - * @param[out] dest The variable to write the value to.The value is first copied in a variable of the type indicated in - * the BAM file. Then it is cast into the type of dest. - * - * @param[in] tags The BamTagsDict object to query. - * @param[in] idx The integer index in the dict to use. - * - * @return bool true if the value could be extracted. - * - * @section Remarks - * - * The function only works for atomic types such as int, not for char* or arrays. - * - * See @link BamTagsDict @endlink for an example. - */ - -/** -.Function.BamTagsDict#extractTagValue -..class:Class.BamTagsDict -..cat:BAM I/O -..signature:extractTagValue(dest, tags, idx) -..summary:Extract and cast "atomic" value from tags string with index $idx$. -..param.dest:The variable to write the value to. -...remarks:The value is first copied in a variable of the type indicated in the BAM file. Then it is cast into the type of $dest$. -..param.tags:@Class.BamTagsDict@ object. -...type:Class.BamTagsDict -..params.idx:Index of the tag in the tag list. -..returns:$bool$, indicating the success. -..remarks:The function only works for atomic types such as $int$, not for $char*$ or arrays. -..remarks:See @Class.BamTagsDict@ for an example. -..see:Function.BamTagsDict#getTagValue -..include:seqan/bam_io.h -*/ - -template -inline bool -extractTagValue(TDest & dest, BamTagsDict & tags, TIdx idx) -{ - if (!hasIndex(tags)) - buildIndex(tags); - - char typeC = host(tags)[tags._positions[idx] + 2]; - if (typeC == 'A') - { - char x = 0; - char * ptr = reinterpret_cast(&x); - memcpy(ptr, &host(tags)[tags._positions[idx] + 3], 1); - dest = static_cast(x); - } - else if (typeC == 'c') - { - __int8 x = 0; - char * ptr = reinterpret_cast(&x); - memcpy(ptr, &host(tags)[tags._positions[idx] + 3], 1); - dest = static_cast(x); - } - else if (typeC == 'C') - { - __uint8 x = 0; - char * ptr = reinterpret_cast(&x); - memcpy(ptr, &host(tags)[tags._positions[idx] + 3], 1); - dest = static_cast(x); - } - else if (typeC == 's') - { - __int16 x = 0; - char * ptr = reinterpret_cast(&x); - memcpy(ptr, &host(tags)[tags._positions[idx] + 3], 2); - dest = static_cast(x); - } - else if (typeC == 'S') - { - __uint16 x = 0; - char * ptr = reinterpret_cast(&x); - memcpy(ptr, &host(tags)[tags._positions[idx] + 3], 2); - dest = static_cast(x); - } - else if (typeC == 'i') - { - __int32 x = 0; - char * ptr = reinterpret_cast(&x); - memcpy(ptr, &host(tags)[tags._positions[idx] + 3], 4); - dest = static_cast(x); - } - else if (typeC == 'I') - { - __uint32 x = 0; - char * ptr = reinterpret_cast(&x); - memcpy(ptr, &host(tags)[tags._positions[idx] + 3], 4); - dest = static_cast(x); - } - else if (typeC == 'f') - { - float x = 0; - char * ptr = reinterpret_cast(&x); - memcpy(ptr, &host(tags)[tags._positions[idx] + 3], 4); - dest = static_cast(x); - } - else // variable sized type or invald - { - return false; - } - return true; -} - - -// ---------------------------------------------------------------------------- -// Function getBamTypeChar() -// ---------------------------------------------------------------------------- - -/*! - * @fn getBamTypeChar - * @brief Return char identifying the type of the argument type. - * - * @signature char getBamTypeChar(); - * - * @tparam T The type to query for its type char. - * - * @section Remarks - * - * Note that this function is defined for the __int16, __uint16 etc. but not for the types - * short, int etc. An exception are 8-bit characters/char, where it is defined for __int8, - * __uint8, and char unless char is equal to one of the other two types. This is important - * when used in @link BamTagsDict#setTagValue @endlink etc. since BAM gives type chars for printable characters, signed - * 8-bit numbers and unsigned 8-bit numbers. - * - * If __int8 and __uint8 are not identical to char, we can make this decision from the type, - * otherwise we cannot and we will give the integer types a higher precedence. - * - * In your programs, this should not make any difference, only the written SAM/BAM will differ. - * - * @see BamTagsDict - * @see getBamTypeSize - */ - -/** -.Function.getBamTypeChar -..class:Class.BamTagsDict -..cat:BAM I/O -..summary:Return char identifying the type of the atomic argument. -..signature:getBamTypeChar() -..param.T:The type to get the BAM char for. -..returns:$char$ describing the BAM type. One of $ACcSsIifZ$. -..remarks:Note that this function is defined for the $__int16$, $__uint16$ etc. but not for the types $short$, $int$ etc. An exception are 8-bit characters/char, where it is defined for $__int8$, $__uint8$, and $char$ unless $char$ is equal to one of the other two types. This is important when used in @Function.BamTagsDict#setTagValue@ etc. since BAM gives type chars for printable characters, signed 8-bit numbers and unsigned 8-bit numbers. -..remarks:If $__int8$ and $__uint8$ are not identical to $char$, we can make this decision from the type, otherwise we cannot and we will give the integer types a higher precedence. -..remarks:In your programs, this should not make any difference, only the written SAM/BAM will differ. -..include:seqan/bam_io.h -*/ - -template -inline char getBamTypeChar() -{ - if (IsSameType::Type::VALUE) - return 'C'; - if (IsSameType::Type::VALUE) - return 'c'; - if (IsSameType::Type::VALUE) - return 'A'; - if (IsSameType::Type::VALUE) - return 's'; - if (IsSameType::Type::VALUE) - return 'S'; - if (IsSameType::Type::VALUE) - return 'i'; - if (IsSameType::Type::VALUE) - return 'I'; - if (IsSameType::Type::VALUE) - return 'f'; - if (IsSameType::Type::VALUE || IsSameType::Type::VALUE) - return 'Z'; - else - return '\0'; -} - -// ---------------------------------------------------------------------------- -// Function setTagValue() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Test me! - -/*! - * @fn BamTagsDict#setTagValue - * - * @headerfile seqan/bam_io.h - * - * @brief Set the value of a tag through a @link BamTagsDict @endlink. - * - * @signature bool setTagValue(tags, key, val[, typeC]); - * - * @param[in,out] tags The BamTagsDict to modify. - * @param[in] key The key of the tag.Must be a string of length 2. Types: CharString - * @param[in] val The value to set the the tag to. - - * @param[in] typeC BAM type char to use.For portability (so the generated files are the same on all platforms), use - * a signed/unsigned qualified type for val or give typeC. Also see the remarks - * for @link getBamTypeChar @endlink. Types: getBamTypeChar@. - - * - * @return bool true on success, false on failure. This function can fail if the key is not a valid tag id (e.g. does - * not have length 2) or if the type of val is not an atomic value or a string (anything but - * char *, char const *, a character, integer or float type is invalid). - * - * @section Remarks - * - * Note that setTagValue does not cast the type, so typeC only influences the type character written - * out but val is written out in binary without modification. - * - * @section Examples - * - * An example setting some atomic tag values. - * - * @code{.cpp} - * CharString rawTagsText; - * BamTagsDict tags(rawTagsText); - * setTagValue(tags, "XA", 9); // int - * setTagValue(tags, "XB", 9u); // unsigned int - * setTagValue(tags, "XC", 'X'); // char - * @endcode - * - * If char is equal to __int8 or __uint8 then the last line produces an entry with type 'c' - * or 'C'. To make sure that the type char 'A' (for "printable character") is written to the file, give it explicitely: - * - * @code{.cpp} - * setTagValue(tags, "XC", 'X', 'A'); // Overrwrite XC, enforce type 'printable character'. - * @endcode - * - * Note that on most systems ints have a width of 32 bytes, but the C++ standard leaves this open. For all - * types but characters, you should not give an explicit type char but use one of the types with explicit width and - * signed/unsigned qualifier such as __int32, __uint32 etc. - * - * @code{.cpp} - * // The following is not recommended since the type of x is not "unsigned 32 bit int." - * __int32 x = -1; - * setTagValue(tags, "XB", x, 'I'); - * // Instead, explicitely use an unsigned type if you need one. Note that your compiler - * // might warn you about assigning -1 to an unsigned variable so you know that you are - * // probably doing something unintended. - * __uint32 y = -1; - * setTagValue(tags, "XB", y); - * - * // Do not do this! - * setTagValue(tags, "XA", 9, 'f'); // BOGUS since 9 is not a floating point number. - * @endcode - * - * @see getBamTypeChar - */ - -/** -.Function.BamTagsDict#setTagValue -..class:Class.BamTagsDict -..cat:BAM I/O -..summary:Set the value of a tag through a @Class.BamTagsDict@. -..signature:setTagValue(tags, key, val[, typeC]) -..param.tags:The dict to modify. -...type:Class.BamTagsDict -..param.key:The key of the tag. -...type:Shortcut.CharString -...remarks:Must be a string of length 2. -..param.val:The value to set the the tag to. -..param.typeC:BAM type char to use. -...type:nolink:By default, the type is inflected using @Function.getBamTypeChar@. -...remarks:For portability (so the generated files are the same on all platforms), use a signed/unsigned qualified type for $val$ or give $typeC$. Also see the remarks for @Function.getBamTypeChar@. -..returns:$bool$ indicating the success. This function can fail if the key is not a valid tag id (e.g. does not have length 2) or if the type of $val$ is not an atomic value or a string (anything but $char *$, $char const *$, a character, integer or float type is invalid). -..see:Function.getBamTypeChar -..remarks:Note that $setTagValue$ does not cast the type, so $typeC$ only influences the type character written out but $val$ is written out in binary without modification. -..include:seqan/bam_io.h -..example.text:An example setting some atomic tag values. -..example.code: -CharString rawTagsText; -BamTagsDict tags(rawTagsText); -setTagValue(tags, "XA", 9); // int -setTagValue(tags, "XB", 9u); // unsigned int -setTagValue(tags, "XC", 'X'); // char -..example.text:If $char$ is equal to $__int8$ or $__uint8$ then the last line produces an entry with type 'c' or 'C'. To make sure that the type char 'A' (for "printable character") is written to the file, give it explicitely: -..example.code: -setTagValue(tags, "XC", 'X', 'A'); // Overrwrite XC, enforce type 'printable character'. -..example.text:Note that on most systems $int$s have a width of 32 bytes, but the C++ standard leaves this open. For all types but characters, you should not give an explicit type char but use one of the types with explicit width and signed/unsigned qualifier such as $__int32$, $__uint32$ etc. -..example.code: -// The following is not recommended since the type of $x$ is not "unsigned 32 bit int." -__int32 x = -1; -setTagValue(tags, "XB", x, 'I'); -// Instead, explicitely use an unsigned type if you need one. Note that your compiler -// might warn you about assigning -1 to an unsigned variable so you know that you are -// probably doing something unintended. -__uint32 y = -1; -setTagValue(tags, "XB", y); - -// Do not do this! -setTagValue(tags, "XA", 9, 'f'); // BOGUS since 9 is not a floating point number. -*/ - -// Convert "atomic" value to BAM tag. Return whether val was atomic. -template -bool _toBamTagValue(CharString & result, T const & val, char const typeC) -{ - appendValue(result, typeC); - - if (typeC == 'A' || typeC == 'c' || typeC == 'C') - { - resize(result, length(result) + 1); - char * dst = reinterpret_cast(&result[0]) + length(result) - 1; - char const * src = reinterpret_cast(&val); - memcpy(dst, src, 1); - } - else if (typeC == 's' || typeC == 'S') - { - resize(result, length(result) + 2); - char * dst = reinterpret_cast(&result[0]) + length(result) - 2; - char const * src = reinterpret_cast(&val); - memcpy(dst, src, 2); - } - else if (typeC == 'i' || typeC == 'I' || typeC == 'f') - { - resize(result, length(result) + 4); - char * dst = reinterpret_cast(&result[0]) + length(result) - 4; - char const * src = reinterpret_cast(&val); - memcpy(dst, src, 4); - } - else if (typeC == 'Z') - { - unsigned oldSize = length(result); - unsigned valLen = length(val) + 1; - resize(result, length(result) + valLen); - char * dst = reinterpret_cast(&result[0] + oldSize); - char const * src = reinterpret_cast(val); - memcpy(dst, src, valLen); - *(dst + valLen - 1) = '\0'; - } - else // non-string and variable sized type or invald - { - return false; - } - return true; -} - -// Sets an atomic value in a BamTagsDict. -// Returns true successful, can fail if val not atomic or key is not a valid tag id (2 chars). - -template -inline bool -setTagValue(BamTagsDict & tags, CharString const & key, T const & val, char const typeC) -{ - if (!hasIndex(tags)) - buildIndex(tags); - - // Build value to insert/append. - if (length(key) != 2u) - return false; - CharString bamTagVal; - // append(bamTagVal, key); - if (!_toBamTagValue(bamTagVal, val, typeC)) - return false; - - unsigned idx = 0; - if (findTagKey(idx, tags, key)) - { - // TODO(holtgrew): Speed this up with positions? - CharString tmp; - tmp = getTagValue(tags, idx); - replace(host(tags), tags._positions[idx] + 2, tags._positions[idx] + 2 + length(tmp), bamTagVal); - } - else - { - append(host(tags), key); - append(host(tags), bamTagVal); - } - - // Remove index and return success. - clear(tags._positions); // Also necessary when appending? - return true; -} - -template -inline bool -setTagValue(BamTagsDict & tags, CharString const & key, T const & val) -{ - return setTagValue(tags, key, val, getBamTypeChar()); -} - -// ---------------------------------------------------------------------------- -// Function eraseTag() -// ---------------------------------------------------------------------------- - -/*! - * @fn BamTagsDict#eraseTag - * @brief Erase a tag from BamTagsDict. - * - * @signature bool eraseTag(tagsDict, key); - * - * @param[in,out] tagsDict The BamTagsDict to erase the tag from. - * @param[in] key The key of the tag to ersae, of type @link CharString @endlink. - * - * @return bool true if the tag was present for erasing, false if not. - */ - -/** -.Function.BamTagsDict#eraseTag -..class:Class.BamTagsDict -..summary:Erase tag from @Class.BamTagsDict@. -..cat:BAM I/O -..signature:eraseTag(tagsDict, key) -..param.tags:The dict to erase from. -...type:Class.BamTagsDict -..param.key:The key of the entry to remove. -...type:Shortcut.CharString -..returns:$bool$, indicating whether the key was present. -..include:seqan/bam_io.h - */ - -inline bool -eraseTag(BamTagsDict & tags, CharString const & key) -{ - if (!hasIndex(tags)) - buildIndex(tags); - - unsigned idx = 0; - if (!findTagKey(idx, tags, key)) - return false; - - // TODO(holtgrew): Speed this up with positions? - CharString tmp; - tmp = getTagValue(tags, idx); - erase(host(tags), tags._positions[idx], tags._positions[idx + 1]); - - // TODO(weese): is this really working and tested? Should _positions be updated as well? - // Why is tmp not used? - - return true; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_TAGS_DICT_H_ diff --git a/seqan/bam_io/bam_writer.h b/seqan/bam_io/bam_writer.h deleted file mode 100644 index 65e5fbb..0000000 --- a/seqan/bam_io/bam_writer.h +++ /dev/null @@ -1,161 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_WRITER_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_BAM_WRITER_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// TODO(holtgrew): Allow writing BAM to stdout? Extend Stream? - -class BamWriter_ : - public XamWriter_ -{ -public: - // The BGZF stream to write to. - Stream _stream; - // Flag indicating whether there was an error or not. - // TODO(holtgrew): Could we also use streamError()? - bool _isGood; - - BamWriter_() : - XamWriter_() - {} - - BamWriter_(CharString const & filename); - - // XamWriter_ interface. - - virtual int open(CharString const & filename); - virtual bool isGood(); - virtual int writeHeader(BamHeader const & header, - BamIOContext > const & context); - virtual int writeRecord(BamAlignmentRecord const & record, - BamIOContext > const & context); - virtual int flush(); - virtual int close(); -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Member Function BamWriter_::BamWriter_() -// ---------------------------------------------------------------------------- - -inline BamWriter_::BamWriter_(CharString const & filename) : - XamWriter_(filename) -{ - this->open(filename); -} - -// ---------------------------------------------------------------------------- -// Member Function BamWriter_::open() -// ---------------------------------------------------------------------------- - -inline int BamWriter_::open(CharString const & filename) -{ - if (!seqan::open(this->_stream, toCString(filename), "w")) - { - _isGood = false; - return 1; - } - - return 0; -} - -// ---------------------------------------------------------------------------- -// Member Function BamWriter_::isGood() -// ---------------------------------------------------------------------------- - -inline bool BamWriter_::isGood() -{ - return this->_isGood; -} - -// ---------------------------------------------------------------------------- -// Member Function BamWriter_::writeHeader() -// ---------------------------------------------------------------------------- - -inline int BamWriter_::writeHeader(BamHeader const & header, - BamIOContext > const & context) -{ - return write2(this->_stream, header, context, Bam()); -} - -// ---------------------------------------------------------------------------- -// Member Function BamWriter_::writeRecord() -// ---------------------------------------------------------------------------- - -inline int BamWriter_::writeRecord(BamAlignmentRecord const & record, - BamIOContext > const & context) -{ - return write2(this->_stream, record, context, Bam()); -} - -// ---------------------------------------------------------------------------- -// Member Function BamWriter_::flush() -// ---------------------------------------------------------------------------- - -inline int BamWriter_::flush() -{ - return streamFlush(this->_stream); -} - -// ---------------------------------------------------------------------------- -// Member Function BamWriter_::close() -// ---------------------------------------------------------------------------- - -inline int BamWriter_::close() -{ - seqan::close(this->_stream); - return 0; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_BAM_WRITER_H_ diff --git a/seqan/bam_io/cigar.h b/seqan/bam_io/cigar.h deleted file mode 100755 index d5b8c20..0000000 --- a/seqan/bam_io/cigar.h +++ /dev/null @@ -1,578 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: David Weese -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_CIGAR_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_CIGAR_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// struct CigarElement -// ---------------------------------------------------------------------------- - -/*! - * @class CigarElement - * @headerfile - * @brief One entry of a CIGAR string. - * - * @signature template - * class CigarElement; - * - * @tparam TOperation Type to use for storing operations, defaults to char. - * @tparam TCount Type to use for storing counts, defaults to unsigned. - */ - -/*! - * @fn CigarElement::CigarElement - * @brief Constructor - * - * @signature CigarElement::CigarElement(); - * @signature CigarElement::CigarElement(operation, count); - * - * @param[in] operation The operation to use, of type TOperation. - * @param[in] count The operation count, of type TCount. - * - * @section Remarks - * - * The default constructor initialized both @link CigarElement::operation @endlink and @link CigarElement::count - * @endlink with 0. - */ - -/*! - * @var TCount CigarElement::count - * - * @brief The number of operations. - */ - -/*! - * @var TOperation CigarElement::operation - * - * @brief The described operation. - */ - -/** -.Class.CigarElement -..cat:Fragment Store -..summary:One entry of a CIGAR string. -..signature:CigarElement -..param.TOperation:Type to use for storing operations. -...default:nolink:$char$ -..param.TCount:Type to use for storing counts. -...default:nolink:$unsigned$ -..include:seqan/store.h - -.Memfunc.CigarElement#CigarElement -..class:Class.CigarElement -..summary:Constructor -..signature:CigarElement() -..signature:CigarElement(operation, count) -..param.operation:The operation to use. -...type:nolink:$TOperation$, typically $char$. -..param.count:The operation count. -...type:nolink:$Count$, typically $unsigned$. -..remarks:The default constructor initialized both @Memvar.CigarElement#operation@ and @Memvar.CigarElement#count@ with $0$. - -.Memvar.CigarElement#operation -..class:Class.CigarElement -..summary:The described operation. -..type:nolink:$TOperation$ - -.Memvar.CigarElement#count -..class:Class.CigarElement -..summary:The number of operations. -..type:nolink:$TCount$ -*/ - -template -struct CigarElement -{ - typedef TOperation_ TOperation; - typedef TCount_ TCount; - - TOperation operation; - TCount count; - - CigarElement() : operation(0), count(0) {} - - CigarElement(TOperation o, TCount c): - operation(o), - count(c) {} -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -template -inline bool operator>(CigarElement const & lhs, - CigarElement const & rhs) -{ - return lhs.operation > rhs.operation || (lhs.operation == rhs.operation && lhs.count > rhs.count); -} - -template -inline bool operator<(CigarElement const & lhs, - CigarElement const & rhs) -{ - return lhs.operation < rhs.operation || (lhs.operation == rhs.operation && lhs.count < rhs.count); -} - -template -inline bool operator==(CigarElement const & lhs, - CigarElement const & rhs) -{ - return lhs.operation == rhs.operation && lhs.count == rhs.count; -} - -// ---------------------------------------------------------------------------- -// toBamCigarElement() -// ---------------------------------------------------------------------------- - -template -__uint32 toBamCigarElement(CigarElement const & cigarElement) -{ - char operation = 0; - switch (cigarElement.operation) { - case 'X': operation += 1; - case '=': operation += 1; - case 'P': operation += 1; - case 'H': operation += 1; - case 'S': operation += 1; - case 'N': operation += 1; - case 'D': operation += 1; - case 'I': operation += 1; - case 'M': break; - } - return (cigarElement.count << 4) | operation; -} - -// ---------------------------------------------------------------------------- -// getMDString() -// ---------------------------------------------------------------------------- - -template < - typename TMDString, - typename TGaps1, - typename TGaps2> -inline void -getMDString( - TMDString &md, - TGaps1 &gaps1, - TGaps2 &gaps2) -{ - typedef typename Value::Type TMDChar; - typename Iterator::Type it1 = begin(gaps1); - typename Iterator::Type it2 = begin(gaps2); - char op, lastOp = ' '; - unsigned numOps = 0; - - clear(md); - for (; !atEnd(it1) && !atEnd(it2); goNext(it1), goNext(it2)) - { - if (isGap(it1)) continue; - if (isGap(it2)) - { - op = 'D'; - } - else - op = (*it1 == *it2)? 'M': 'R'; - - // append match run - if (lastOp != op) - { - if (lastOp == 'M') - { - std::stringstream num; - num << numOps; - append(md, num.str()); - } - numOps = 0; - lastOp = op; - } - - // append deleted/replaced reference character - if (op != 'M') - { - // add ^ from non-deletion to deletion - if (op == 'D' && lastOp != 'D') - appendValue(md, '^'); - // add 0 from deletion to replacement - if (op == 'R' && lastOp == 'D') - appendValue(md, '0'); - appendValue(md, convert(*it1)); - } - - ++numOps; - } - SEQAN_ASSERT_EQ(atEnd(it1), atEnd(it2)); - if (lastOp == 'M') - { - std::stringstream num; - num << numOps; - append(md, num.str()); - } -} - -// ---------------------------------------------------------------------------- -// getCigarString() -// ---------------------------------------------------------------------------- - -template < - typename TCigar, - typename TGaps1, - typename TGaps2, - typename TThresh> -inline void -getCigarString( - TCigar &cigar, - TGaps1 &gaps1, - TGaps2 &gaps2, - TThresh splicedGapThresh) -{ - typename Iterator::Type it1 = begin(gaps1); - typename Iterator::Type it2 = begin(gaps2); - clear(cigar); - char op, lastOp = ' '; - unsigned numOps = 0; - - // std::cout << "gaps1\t" << gaps1 << std::endl; - // std::cout << "gaps2\t" << gaps2 << "\t" << clippedBeginPosition(gaps2) << std::endl; - for (; !atEnd(it1) && !atEnd(it2); goNext(it1), goNext(it2)) - { - if (isGap(it1)) - { - if (isGap(it2)) - op = 'P'; - else if (isClipped(it2)) - op = '?'; - else - op = 'I'; - } - else if (isClipped(it1)) - { - op = '?'; - } - else - { - if (isGap(it2)) - op = 'D'; - else if (isClipped(it2)) - op = 'S'; - else - op = 'M'; - } - - // append CIGAR operation - if (lastOp != op) - { - if (lastOp == 'D' && numOps >= (unsigned)splicedGapThresh) - lastOp = 'N'; - if (numOps > 0) - { - std::stringstream num; - num << numOps; - append(cigar, num.str()); - appendValue(cigar, lastOp); - } - numOps = 0; - lastOp = op; - } - ++numOps; - } -// if (atEnd(it1) != atEnd(it2)) -// std::cerr << "Invalid pairwise alignment:" << std::endl << gaps1 << std::endl << gaps2 << std::endl; - SEQAN_CHECK(atEnd(it1) == atEnd(it2), "Cannot get CIGAR from invalid pairwise alignment!"); - if (lastOp == 'D' && numOps >= (unsigned)splicedGapThresh) - lastOp = 'N'; - if (numOps > 0) - { - std::stringstream num; - num << numOps; - append(cigar, num.str()); - appendValue(cigar, lastOp); - } -} - -template < - typename TCigar, - typename TGaps1, - typename TGaps2> -inline void -getCigarString( - TCigar &cigar, - TGaps1 &gaps1, - TGaps2 &gaps2) -{ - return getCigarString(cigar, gaps1, gaps2, 20); -} - -template < - typename TOperation, - typename TCount, - typename TSpec, - typename TGaps1, - typename TGaps2, - typename TThresh> -inline void -getCigarString( - String, TSpec> &cigar, - TGaps1 &gaps1, - TGaps2 &gaps2, - TThresh splicedGapThresh) -{ - typename Iterator::Type it1 = begin(gaps1); - typename Iterator::Type it2 = begin(gaps2); - clear(cigar); - char op = '?', lastOp = ' '; - unsigned numOps = 0; - -// std::cout << gaps1 << std::endl; -// std::cout << gaps2 << std::endl; - for (; !atEnd(it1) && !atEnd(it2); goNext(it1), goNext(it2)) - { - if (isGap(it1)) - { - if (isGap(it2)) - op = 'P'; - else if (isClipped(it2)) - op = '?'; - else - op = 'I'; - } - else if (isClipped(it1)) - { - op = '?'; - } - else - { - if (isGap(it2)) - op = 'D'; - else if (isClipped(it2)) - op = 'S'; - else - op = 'M'; - } - if (lastOp != op) - { - if (lastOp == 'D' && numOps >= (unsigned)splicedGapThresh) - lastOp = 'N'; - if (numOps > 0) - appendValue(cigar, CigarElement<>(lastOp, numOps)); - numOps = 0; - lastOp = op; - } - ++numOps; - } - SEQAN_ASSERT_EQ(atEnd(it1), atEnd(it2)); - if (lastOp == 'D' && numOps >= (unsigned)splicedGapThresh) - lastOp = 'N'; - if (numOps > 0) - appendValue(cigar, CigarElement<>(op, numOps)); -} - -// ---------------------------------------------------------------------------- -// alignAndGetCigarString() -// ---------------------------------------------------------------------------- - -template < - typename TCigar, typename TMDString, typename TContig, typename TReadSeq, - typename TAlignedRead, typename TErrors, typename TAlignFunctor> -inline void -alignAndGetCigarString( - TCigar &cigar, TMDString &md, TContig &contig, TReadSeq &readSeq, - TAlignedRead &alignedRead, TErrors &errors, TAlignFunctor const & functor) -{ - typedef Align TAlign; - - TAlign align; - resize(rows(align), 2); - - if (alignedRead.beginPos <= alignedRead.endPos) - assignSource(row(align, 0), infix(contig.seq, alignedRead.beginPos, alignedRead.endPos)); - else - assignSource(row(align, 0), infix(contig.seq, alignedRead.endPos, alignedRead.beginPos)); - - assignSource(row(align, 1), readSeq); - - if (!(errors == 0 || (errors == 1 && length(readSeq) == length(source(row(align, 0)))))) - errors = functor.align(align); - - getCigarString(cigar, row(align, 0), row(align, 1)); - getMDString(md, row(align, 0), row(align, 1)); -} - -template -inline void -alignAndGetCigarString(TCigar &cigar, TMDString &md, TContig &contig, TReadSeq &readSeq, TAlignedRead &alignedRead, TErrors &, Nothing const &) -{ - typedef typename TContig::TContigSeq TContigSeq; - typedef Gaps > TContigGaps; - typedef Gaps > TReadGaps; - - TContigGaps contigGaps(contig.seq, contig.gaps); - - if (alignedRead.beginPos <= alignedRead.endPos) - { - setClippedBeginPosition(contigGaps, alignedRead.beginPos); - setClippedEndPosition(contigGaps, alignedRead.endPos); - } else - { - setClippedBeginPosition(contigGaps, alignedRead.endPos); - setClippedEndPosition(contigGaps, alignedRead.beginPos); - } - - TReadGaps readGaps(readSeq, alignedRead.gaps); - // TContigGaps contigGaps2(contig.seq, contig.gaps); - // if (i == 4) - // printf("It's it!\n"); - // std::cerr << "read gaps: " << readGaps << std::endl; - // std::cerr << "contig gaps:" << contigGaps << std::endl; - - getCigarString(cigar, contigGaps, readGaps); - getMDString(md, contigGaps, readGaps); -} - -// ---------------------------------------------------------------------------- -// _getClippedLength() -// ---------------------------------------------------------------------------- - -template -inline void _getClippedLength(TCigarString const & cigar, TNum & sum) -{ - typedef typename Iterator::Type TCigarIter; - - TCigarIter it = begin(cigar, Standard()); - TCigarIter itEnd = end(cigar, Standard()); - - sum = 0; - for (; it != itEnd; ++it) - if (getValue(it).operation != 'S' && getValue(it).operation != 'H') - sum += getValue(it).count; -} - -// ---------------------------------------------------------------------------- -// _getLengthInRef() -// ---------------------------------------------------------------------------- - -template -inline void _getLengthInRef(TCigarString const & cigar, TNum & sum) -{ - typedef typename Iterator::Type TCigarIter; - - TCigarIter it = begin(cigar, Standard()); - TCigarIter itEnd = end(cigar, Standard()); - - sum = 0; - for (; it != itEnd; ++it) - if (getValue(it).operation != 'S' && getValue(it).operation != 'H' && getValue(it).operation != 'I') - sum += getValue(it).count; -} - -// ---------------------------------------------------------------------------- -// cigarToGapAnchorRead() -// ---------------------------------------------------------------------------- - -template -inline unsigned -cigarToGapAnchorRead(TCigarString const & cigar, TGaps & gaps) -{ - typename Iterator::Type it = begin(gaps); - bool atBegin = true; - unsigned beginGaps = 0; - for (unsigned i = 0; i < length(cigar); ++i) - { - switch (cigar[i].operation) - { - case 'D': - case 'N': - case 'P': - if (atBegin) - beginGaps += cigar[i].count; - insertGaps(it, cigar[i].count); - case 'I': - case 'M': - case 'S': - it += cigar[i].count; - atBegin = false; - } - } - return beginGaps; -} - -// ---------------------------------------------------------------------------- -// cigarToGapAnchorContig() -// ---------------------------------------------------------------------------- - -template -inline unsigned -cigarToGapAnchorContig(TCigarString const & cigar, TGaps & gaps) -{ - typename Iterator::Type it = begin(gaps); - bool atBegin = true; - unsigned beginGaps = 0; - for (unsigned i = 0; i < length(cigar); ++i) - { - switch (cigar[i].operation) - { - case 'I': - case 'P': - if (atBegin) - beginGaps += cigar[i].count; - insertGaps(it, cigar[i].count); - case 'D': - case 'M': - case 'N': - case 'S': - it += cigar[i].count; - atBegin = false; - } - } - return beginGaps; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_CIGAR_H_ diff --git a/seqan/bam_io/read_bam.h b/seqan/bam_io/read_bam.h deleted file mode 100644 index ba55fd7..0000000 --- a/seqan/bam_io/read_bam.h +++ /dev/null @@ -1,407 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Code for reading Bam. -// ========================================================================== - -// TODO(holtgrew): Indexing. - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_READ_BAM_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_READ_BAM_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @defgroup SamBamIO SAM/BAM I/O - * @brief Tags for identifying SAM/BAM format. - */ - -/*! - * @tag SamBamIO#Bam - * @brief Identify the BAM format. - * - * @tag SamBamIO#Sam - * @brief Identify the SAM format. - */ - -/** -.Tag.Bam -..cat:BAM I/O -..signature:Bam -..summary:Tag for identifying the BAM format. -..include:seqan/bam_io.h -..see:Tag.Sam -*/ - -struct Bam_; -typedef Tag Bam; - -template -struct FileFormatExtensions -{ - static char const * VALUE[1]; -}; - -template -char const * FileFormatExtensions::VALUE[1] = { - ".bam" }; - - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function readRecord() BamHeader -// ---------------------------------------------------------------------------- - -/*! - * @fn SamBamIO#readRecord - * @brief Read a record from a SAM/BAM file. - * - * @signature int readRecord(record, context, stream, tag); - * @signature int readRecord(header, context, stream, tag); - * - * @param[out] record The @link BamAlignmentRecord @endlink object to read the information into. - * @param[out] header The @link BamHeader @endlink object to read the header information into. - * @param[in,out] context The BamIOContext object to use. - * @param[in,out] stream The @link StreamConcept Stream @endlink to read from. - * @param[in] tag The format tag, one of Sam and Bam. - * - * @return int A status code, 0 on success, != 0 on failure. - */ - -/** -.Function.readRecord -..signature:readRecord(headerRecord, context, stream, tag) -..param.header:@Class.BamHeader@ to read information into. -...type:Class.BamHeader -..param.context:The context to use for reading. -...type:Class.BamIOContext -..param.stream:The stream to read from (for BAM). -...remarks:BAM data can be read from any stream. For the proper decompression (from compressed BAM, the default) use @Spec.BGZF Stream@. -...type:Concept.StreamConcept -..param.tag:Format to read @Class.BamHeader@ from. -...type:Tag.Sam -...type:Tag.Bam -..include:seqan/bam_io.h -*/ - -template -int readRecord(BamHeader & header, - BamIOContext & context, - TStream & stream, - Bam const & /*tag*/) -{ - int res = 0; - - // Read BAM magic string. - char magic[5] = "\0\0\0\0"; - res = streamReadBlock(&magic[0], stream, 4); - if (res != 4) - return 1; // EOF or error while reading. - if (strcmp(magic, "BAM\1") != 0) - return 1; // Magic was wrong. - - // Read header text, including null padding. - __int32 lText; - res = streamReadBlock(reinterpret_cast(&lText), stream, 4); - if (res != 4) - return 1; // Error reading the length of the header text. - CharString samHeader; - resize(samHeader, lText); - res = streamReadBlock(&front(samHeader), stream, lText); - // Truncate to first position of '\0'. - typedef Iterator::Type TIter; - TIter it = begin(samHeader, Standard()); - for (; it != end(samHeader); ++it) - if (*it == '\0') - break; - resize(samHeader, it - begin(samHeader, Standard())); - - // Parse out header records. - typedef Stream > THeaderStream; - THeaderStream headerStream(&samHeader[0], &samHeader[0] + length(samHeader)); - RecordReader > headerReader(headerStream); - BamHeaderRecord headerRecord; - while (!atEnd(headerReader)) - { - clear(headerRecord); - res = readRecord(headerRecord, context, headerReader, Sam()); - if (res != 0) - return 1; // Error reading embedded SAM header. - appendValue(header.records, headerRecord); - } - - // Read # reference sequences. - __int32 nRef; - res = streamReadBlock(reinterpret_cast(&nRef), stream, 4); - if (res != 4) - return 1; // Error reading the number of sequences. - CharString name; - - clear(context.translateFile2GlobalRefId); - resize(context.translateFile2GlobalRefId, nRef, -1); - - for (__int32 i = 0; i < nRef; ++i) - { - // Read length of the reference name. - __int32 nName; - res = streamReadBlock(reinterpret_cast(&nName), stream, 4); - if (res != 4) - return 1; // Error reading the number of sequences. - // Read name of the reference sequence; - resize(name, nName); - res = streamReadBlock(&front(name), stream, nName); - if (res != nName) - return 1; // Error reading the number of sequences. - resize(name, nName - 1); - // Read length of the reference sequence. - __int32 lRef; - res = streamReadBlock(reinterpret_cast(&lRef), stream, 4); - if (res != 4) - return 1; // Error reading the number of sequences. - - // Store sequence info. - typedef typename BamHeader::TSequenceInfo TSequenceInfo; - appendValue(header.sequenceInfos, TSequenceInfo(name, lRef)); - // Append contig name to name store, if not known already. - typename Size::Type globalRId = 0; - if (!getIdByName(nameStore(context), name, globalRId, nameStoreCache(context))) - { - globalRId = length(nameStore(context)); - appendName(nameStore(context), name, nameStoreCache(context)); - } - context.translateFile2GlobalRefId[i] = globalRId; - } - - return 0; -} - -// ---------------------------------------------------------------------------- -// Function readRecord() BamAlignmentRecord -// ---------------------------------------------------------------------------- - -/** -.Function.readRecord -..signature:readRecord(alignmentRecord, context, stream, tag) -..param.alignmentRecord.type:Class.BamAlignmentRecord -*/ - -template -int readRecord(BamAlignmentRecord & record, - BamIOContext & context, - TStream & stream, - Bam const & /*tag*/) -{ - int res = 0; - (void)context; // Only used for assertions. - - // Read size of the remaining block. - __int32 remainingBytes = 0; - res = streamReadBlock(reinterpret_cast(&remainingBytes), stream, 4); - if (res != 4) - return 1; // Error reading the number of sequences. - - // Reference sequence id. - SEQAN_ASSERT_GT(remainingBytes, 4); - record.rID = 0; - res = streamReadBlock(reinterpret_cast(&record.rID), stream, 4); - if (res != 4) - return res; - SEQAN_ASSERT_GEQ(record.rID, -1); - - // Translate file local rID into a global rID that is compatible with the context nameStore. - if (record.rID >= 0 && !empty(context.translateFile2GlobalRefId)) - record.rID = context.translateFile2GlobalRefId[record.rID]; - - if (record.rID >= 0) - SEQAN_ASSERT_LT(static_cast<__uint64>(record.rID), length(nameStore(context))); - remainingBytes -= 4; - - // 0-based position. - SEQAN_ASSERT_GT(remainingBytes, 4); - record.beginPos = 0; - res = streamReadBlock(reinterpret_cast(&record.beginPos), stream, 4); - if (res != 4) - return res; - remainingBytes -= 4; - - // Bin, mapping quality, read name length. - SEQAN_ASSERT_GT(remainingBytes, 4); - __uint32 binMqNl = 0; - res = streamReadBlock(reinterpret_cast(&binMqNl), stream, 4); - if (res != 4) - return res; - remainingBytes -= 4; - record.bin = binMqNl >> 16; - record.mapQ = (binMqNl >> 8) & 0x000000ff; - __uint16 lReadName = binMqNl & 0x000000ff; - - // flag, cigar string length. - SEQAN_ASSERT_GT(remainingBytes, 4); - __uint32 flagNc = 0; - res = streamReadBlock(reinterpret_cast(&flagNc), stream, 4); - if (res != 4) - return res; - remainingBytes -= 4; - record.flag = flagNc >> 16; - __uint16 nCigarOp = flagNc & 0x0000FFFF; - - // sequence length. - SEQAN_ASSERT_GT(remainingBytes, 4); - __int32 lSeq = 0; - res = streamReadBlock(reinterpret_cast(&lSeq), stream, 4); - if (res != 4) - return res; - remainingBytes -= 4; - - // reference id of the next fragment. - SEQAN_ASSERT_GT(remainingBytes, 4); - record.rNextId = 0; - res = streamReadBlock(reinterpret_cast(&record.rNextId), stream, 4); - if (res != 4) - return res; - remainingBytes -= 4; - - // 0-based position of the next fragment. - SEQAN_ASSERT_GT(remainingBytes, 4); - res = streamReadBlock(reinterpret_cast(&record.pNext), stream, 4); - if (res != 4) - return res; - remainingBytes -= 4; - - // template length. - SEQAN_ASSERT_GT(remainingBytes, 4); - res = streamReadBlock(reinterpret_cast(&record.tLen), stream, 4); - if (res != 4) - return res; - remainingBytes -= 4; - - // read name. - SEQAN_ASSERT_GT(remainingBytes, lReadName); - resize(record.qName, lReadName); - res = streamReadBlock(reinterpret_cast(&record.qName[0]), stream, lReadName); - if (res != lReadName) - return res; - resize(record.qName, lReadName - 1); - remainingBytes -= lReadName; - - // cigar string. - SEQAN_ASSERT_GT(remainingBytes, nCigarOp * 4); - resize(record.cigar, nCigarOp, Exact()); - static char const * CIGAR_MAPPING = "MIDNSHP="; - typedef typename Iterator >, Rooted>::Type TCigarIter; - for (TCigarIter it = begin(record.cigar, Rooted()); !atEnd(it); goNext(it)) - { - __uint32 ui = 0; - res = streamReadBlock(reinterpret_cast(&ui), stream, 4); - if (res != 4) - return res; - it->operation = CIGAR_MAPPING[ui & 0x0007]; - it->count = ui >> 4; - } - remainingBytes -= nCigarOp * 4; - - // sequence, 4-bit encoded "=ACMGRSVTWYHKDBN". - SEQAN_ASSERT_GT(remainingBytes, (lSeq + 2) / 2); - resize(record.seq, lSeq + 1, Exact()); - static char const * SEQ_MAPPING = "=ACMGRSVTWYHKDBN"; - - typedef typename Iterator::Type TSeqIter; - { - // Note: Yes, we need separate index i and iterator. The iterator allows the fast iteration and i is for - // book-keeping since we potentially create too long seq records. - TSeqIter it = begin(record.seq, Rooted()); - for (__int32 i = 0; i < lSeq; i += 2) - { - __uint8 ui; - res = streamReadChar(reinterpret_cast(ui), stream); - if (res != 0) - return res; - *it++ = SEQ_MAPPING[ui >> 4]; - *it++ = SEQ_MAPPING[ui & 0x0f]; - } - } - resize(record.seq, lSeq); // Possibly trim last, overlap base. - remainingBytes -= (lSeq + 1) / 2; - - // phred quality - SEQAN_ASSERT_GEQ(remainingBytes, lSeq); - resize(record.qual, lSeq, Exact()); - if (lSeq > 0) - { - res = streamReadBlock(&(record.qual[0]), stream, lSeq); - if (res != lSeq) - return res; - } - // If qual is a sequence of 0xff (heuristic same as samtools: Only look at first byte) then we clear it, to get the - // representation of '*'; - if (!empty(record.qual) && record.qual[0] == '\xFF') - clear(record.qual); - typedef typename Iterator::Type TQualIter; - for (TQualIter it = begin(record.qual, Rooted()); !atEnd(it); goNext(it)) - *it += '!'; - remainingBytes -= lSeq; - - // tags - if (remainingBytes > 0) - { - resize(record.tags, remainingBytes); - res = streamReadBlock(&record.tags[0], stream, remainingBytes); - if (res != remainingBytes) - return 1; - } - else - { - clear(record.tags); - } - - return 0; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_READ_BAM_H_ diff --git a/seqan/bam_io/read_sam.h b/seqan/bam_io/read_sam.h deleted file mode 100644 index c822a8e..0000000 --- a/seqan/bam_io/read_sam.h +++ /dev/null @@ -1,510 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Code for reading SAM. -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_READ_SAM_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_READ_SAM_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/** -.Tag.Sam -..cat:BAM I/O -..signature:Sam -..summary:Tag for identifying the SAM format. -..include:seqan/bam_io.h -..see:Tag.Bam -*/ - -struct Sam_; -typedef Tag const Sam; - -enum SamTokenizeErrors_ -{ - SAM_INVALID_RECORD = 2048 -}; - -struct SamHeader_; -typedef Tag SamHeader; - -struct SamAlignment_; -typedef Tag SamAlignment; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function nextIs() SamHeader -// ---------------------------------------------------------------------------- - -template -inline bool nextIs(RecordReader & reader, SamHeader const & /*tag*/) -{ - if (atEnd(reader)) - return false; - return value(reader) == '@'; -} - -// ---------------------------------------------------------------------------- -// Function nextIs() SamAlignment -// ---------------------------------------------------------------------------- - -template -inline bool nextIs(RecordReader & reader, SamAlignment const & /*tag*/) -{ - if (atEnd(reader)) - return false; - return value(reader) != '@'; -} - -// ---------------------------------------------------------------------------- -// Function skipRecord() SamHeader -// ---------------------------------------------------------------------------- - -template -inline int skipRecord(RecordReader & reader, - SamHeader const & tag) -{ - if (atEnd(reader)) - return EOF_BEFORE_SUCCESS; - if (!nextIs(reader, tag)) - return SAM_INVALID_RECORD; - int res = skipLine(reader); - if (res == 0 || res == EOF_BEFORE_SUCCESS) - return 0; - else - return res; -} - -// ---------------------------------------------------------------------------- -// Function skipRecord() SamAlignment -// ---------------------------------------------------------------------------- - -template -inline int skipRecord(RecordReader & reader, - SamAlignment const & tag) -{ - if (atEnd(reader)) - return EOF_BEFORE_SUCCESS; - if (!nextIs(reader, tag)) - return SAM_INVALID_RECORD; - int res = skipLine(reader); - if (res == 0 || res == EOF_BEFORE_SUCCESS) - return 0; - else - return res; -} - -// ---------------------------------------------------------------------------- -// Function readRecord() BamHeaderRecord -// ---------------------------------------------------------------------------- - -template -int readRecord(BamHeaderRecord & record, - BamIOContext & context, - RecordReader > & reader, - Sam const & /*tag*/) -{ - clear(record); - - // Make sure the first character is '@'. - char c = value(reader); - if (c != '@') - return SAM_INVALID_RECORD; - if (goNext(reader)) - return SAM_INVALID_RECORD; - - // Read the header tag. - char c1 = value(reader); - if (goNext(reader)) - return SAM_INVALID_RECORD; - char c2 = value(reader); - if (goNext(reader)) - return SAM_INVALID_RECORD; - // Determine header type. - if (c1 == 'H' && c2 == 'D') - record.type = BAM_HEADER_FIRST; - else if (c1 == 'S' && c2 == 'Q') - record.type = BAM_HEADER_REFERENCE; - else if (c1 == 'R' && c2 == 'G') - record.type = BAM_HEADER_READ_GROUP; - else if (c1 == 'P' && c2 == 'G') - record.type = BAM_HEADER_PROGRAM; - else if (c1 == 'C' && c2 == 'O') - record.type = BAM_HEADER_COMMENT; - else - return SAM_INVALID_RECORD; - - if (record.type == BAM_HEADER_COMMENT) - { - int res = skipChar(reader, '\t'); - if (res != 0) - return res; - CharString &buffer = context.buffer; - clear(buffer); - res = readLine(buffer, reader); - if (res != 0) - return res; - appendValue(record.tags, Pair(CharString(), buffer)); - return 0; // done, do not skip line a second time below - } - else - { - // Read the rest of the line into the tag field of record. - int res = 0; - CharString key, val; - while (!atEnd(reader) && value(reader) == '\t') - { - clear(key); - clear(val); - - res = skipChar(reader, '\t'); - if (res != 0) - return res; - res = readUntilChar(key, reader, ':'); - if (res != 0) - return res; - if (goNext(reader)) - return SAM_INVALID_RECORD; - res = readUntilOneOf(val, reader, '\t', '\r', '\n'); - if (res != 0 && res != EOF_BEFORE_SUCCESS) - return res; - - appendValue(record.tags, Pair(key, val)); - } - } - - // Skip remaining line break. - int res = skipLine(reader); - if (res != 0 && res != EOF_BEFORE_SUCCESS) - return res; - return 0; -} - -// ---------------------------------------------------------------------------- -// Function readRecord() BamHeader -// ---------------------------------------------------------------------------- - -/** -.Function.readRecord -..signature:readRecord(headerRecord, context, recordReader, tag) -..param.recordReader:The RecordReader to read from. -...type:Class.RecordReader -...remarks:Use for SAM. -*/ - -template -int readRecord(BamHeader & header, - BamIOContext & context, - RecordReader > & reader, - Sam const & tag) -{ - typedef typename BamHeader::TSequenceInfo TSequenceInfo; - - BamHeaderRecord record; - while (nextIs(reader, SamHeader())) - { - clear(record); - int res = readRecord(record, context, reader, tag); - if (res != 0) - return res; - appendValue(header.records, record); - - // Get sequence information from @SQ header. - if (record.type == BAM_HEADER_REFERENCE) - { - CharString sn = "unknown"; - unsigned ln = 0; - for (unsigned i = 0; i < length(record.tags); ++i) - { - if (record.tags[i].i1 == "SN") - { - sn = record.tags[i].i2; - } - else if (record.tags[i].i1 == "LN") - { - if (!lexicalCast2(ln, record.tags[i].i2)) - ln = 0; - } - } - - // Add name to name store cache if necessary. - unsigned contigId = 0; - if (!getIdByName(nameStore(context), sn, contigId, nameStoreCache(context))) - { - contigId = length(nameStore(context)); - appendName(nameStore(context), sn, nameStoreCache(context)); - } - - if (length(header.sequenceInfos) <= contigId) - resize(header.sequenceInfos, contigId + 1); - header.sequenceInfos[contigId] = TSequenceInfo(sn, ln); - } - } - - return 0; -} - -// ---------------------------------------------------------------------------- -// Function readRecord() BamAlignmentRecord -// ---------------------------------------------------------------------------- - -/** -.Function.readRecord -..signature:readRecord(alignmentRecord, context, recordReader, tag) -*/ - -template -int readRecord(BamAlignmentRecord & record, - BamIOContext & context, - RecordReader > & reader, - Sam const & /*tag*/) -{ - clear(record); - CharString &buffer = context.buffer; - -#define SEQAN_SKIP_TAB \ - do \ - { \ - res = skipChar(reader, '\t'); \ - if (res != 0) \ - return res; \ - } \ - while (false) - - int res = 0; - - // QNAME - res = readUntilTabOrLineBreak(record.qName, reader); - if (res != 0) - return res; - SEQAN_SKIP_TAB; - - // FLAG - // TODO(holtgrew): Interpret hex and char as c-samtools -X does? - clear(buffer); - res = readDigits(buffer, reader); - if (res != 0) - return res; - record.flag = lexicalCast<__uint16>(buffer); - SEQAN_SKIP_TAB; - - // RNAME - clear(buffer); - res = readUntilTabOrLineBreak(buffer, reader); - if (res != 0) - return res; - if (buffer == "*") - { - record.rID = BamAlignmentRecord::INVALID_REFID; - } - else if (!getIdByName(nameStore(context), buffer, record.rID, nameStoreCache(context))) - { - record.rID = length(nameStore(context)); - appendName(nameStore(context), buffer, nameStoreCache(context)); - } - SEQAN_SKIP_TAB; - - // POS - clear(buffer); - res = readUntilChar(buffer, reader, '\t'); - if (res != 0) - return res; - if (buffer == "*") - record.beginPos = BamAlignmentRecord::INVALID_POS; - else - record.beginPos = lexicalCast<__uint32>(buffer) - 1; - SEQAN_SKIP_TAB; - - // MAPQ - clear(buffer); - if (value(reader) == '*') - { - record.mapQ = 255; - goNext(reader); - } - else - { - res = readDigits(buffer, reader); - if (res != 0) - return res; - record.mapQ = lexicalCast<__uint16>(buffer); - } - SEQAN_SKIP_TAB; - - // CIGAR - CigarElement<> element; - if (atEnd(reader)) - return EOF_BEFORE_SUCCESS; - if (value(reader) == '*') - { - goNext(reader); - } - else - { - do - { - clear(buffer); - res = readDigits(buffer, reader); - if (res != 0) - return res; - element.count = lexicalCast<__uint32>(buffer); - element.operation = value(reader); - if (goNext(reader)) - return EOF_BEFORE_SUCCESS; - appendValue(record.cigar, element); - } while (value(reader) != '\t'); - } - SEQAN_SKIP_TAB; - - // RNEXT - clear(buffer); - res = readUntilChar(buffer, reader, '\t'); - if (res != 0) - return res; - if (buffer == "*") - { - record.rNextId = BamAlignmentRecord::INVALID_REFID; - } - else if (buffer == "=") - { - record.rNextId = record.rID; - } - else if (!getIdByName(nameStore(context), buffer, record.rNextId, nameStoreCache(context))) - { - record.rNextId = length(nameStore(context)); - appendName(nameStore(context), buffer, nameStoreCache(context)); - } - SEQAN_SKIP_TAB; - - // PNEXT - if (atEnd(reader)) - return EOF_BEFORE_SUCCESS; - if (value(reader) == '*') - { - record.pNext = BamAlignmentRecord::INVALID_POS; - goNext(reader); - } - else - { - clear(buffer); - res = readDigits(buffer, reader); - if (res != 0) - return res; - record.pNext = lexicalCast<__uint32>(buffer) - 1; - } - SEQAN_SKIP_TAB; - - // TLEN - if (atEnd(reader)) - return EOF_BEFORE_SUCCESS; - if (value(reader) == '*') - { - record.tLen = MaxValue<__int32>::VALUE; - goNext(reader); - } - else - { - clear(buffer); - if (value(reader) == '-') - { - appendValue(buffer, value(reader)); - if (goNext(reader)) - return SAM_INVALID_RECORD; - } - res = readDigits(buffer, reader); - if (res != 0) - return res; - record.tLen = lexicalCast<__int32>(buffer); - } - SEQAN_SKIP_TAB; - - // SEQ - res = readUntilTabOrLineBreak(record.seq, reader); - if (res != 0) - return res; - // Handle case of missing sequence: Clear seq string as documented. - if (record.seq == "*") - clear(record.seq); - SEQAN_SKIP_TAB; - - // QUAL - res = readUntilTabOrLineBreak(record.qual, reader); - if (res == EOF_BEFORE_SUCCESS) // The record ends on EOF. - return 0; - if (res != 0) - return res; - // Handle case of missing quality: Clear qual string as documented. - if (record.qual == "*") - clear(record.qual); - - // The following list of tags is optional. A line break or EOF could also follow. - if (atEnd(reader)) - return 0; - if (value(reader) != '\t') - { - res = skipLine(reader); - return res; - } - SEQAN_SKIP_TAB; - - // TAGS - clear(buffer); - res = readLine(buffer, reader); - if (res != 0 && res != EOF_BEFORE_SUCCESS) - return res; - assignTagsSamToBam(record.tags, buffer); - - return 0; - -#undef SEQAN_SKIP_TAB -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_READ_SAM_H_ diff --git a/seqan/bam_io/sam_reader.h b/seqan/bam_io/sam_reader.h deleted file mode 100644 index 01f2b96..0000000 --- a/seqan/bam_io/sam_reader.h +++ /dev/null @@ -1,201 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_SAM_READER_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_SAM_READER_H_ - -#include - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// Implementation of reading BAM files. - -class SamReader_ : - public XamReader_ -{ -public: - // The size of the file in bytes. - __int64 _fileSize; - - // Pointer to the input stream to read from. Used such that we can also read from stdin. - std::ifstream _fstream; - // The file stream to read from if we do not read from stdout. Pointed to by _stream. - std::istream * _stream; - - // Record reader to use for parsing. - std::SEQAN_AUTO_PTR_NAME > > _reader; - - SamReader_() : - XamReader_(), _fileSize(0), _stream(0) - {} - - SamReader_(CharString const & filename); - - // XamReader_ interface. - - virtual int open(CharString const & filename); - virtual bool isGood(); - virtual bool atEnd(); - virtual int readHeader(BamHeader & header, BamIOContext > & context); - virtual int readRecord(BamAlignmentRecord & record, BamIOContext > & context); - virtual int close(); - - virtual __int64 fileSize() const; - virtual __int64 positionInFile() const; -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Member Function SamReader_::SamReader_() -// ---------------------------------------------------------------------------- - -inline SamReader_::SamReader_(CharString const & filename) : - XamReader_(filename), _stream(0), _reader() -{ - this->open(_filename); -} - -// ---------------------------------------------------------------------------- -// Member Function SamReader_::open() -// ---------------------------------------------------------------------------- - -inline int SamReader_::open(CharString const & filename) -{ - // Open file. - if (filename == "-") - { - this->_stream = &std::cin; - } - else - { - this->_stream = &this->_fstream; - this->_fstream.open(toCString(filename), std::ios::binary | std::ios::in); - if (!this->_fstream.good()) - return 1; - - // Determine file size. - this->_stream->seekg(0, std::ios::end); - this->_fileSize = this->_stream->tellg(); - this->_stream->seekg(0, std::ios::beg); - } - this->_reader.reset(new RecordReader >(*this->_stream)); - - return 0; -} - -// ---------------------------------------------------------------------------- -// Member Function SamReader_::isGood() -// ---------------------------------------------------------------------------- - -inline bool SamReader_::isGood() -{ - return this->_stream->good(); -} - -// ---------------------------------------------------------------------------- -// Member Function SamReader_::atEnd() -// ---------------------------------------------------------------------------- - -inline bool SamReader_::atEnd() -{ - return seqan::atEnd(*this->_reader); -} - -// ---------------------------------------------------------------------------- -// Member Function SamReader_::readHeader() -// ---------------------------------------------------------------------------- - -inline int SamReader_::readHeader(BamHeader & header, BamIOContext > & context) -{ - return seqan::readRecord(header, context, *this->_reader, Sam()); -} - -// ---------------------------------------------------------------------------- -// Member Function SamReader_::readRecord() -// ---------------------------------------------------------------------------- - -inline int SamReader_::readRecord(BamAlignmentRecord & record, BamIOContext > & context) -{ - return seqan::readRecord(record, context, *this->_reader, Sam()); -} - -// ---------------------------------------------------------------------------- -// Member Function SamReader_::readRecord() -// ---------------------------------------------------------------------------- - -inline int SamReader_::close() -{ - if (this->_stream == &this->_fstream) - this->_fstream.close(); - return 0; -} - -// ---------------------------------------------------------------------------- -// Member Function SamReader_::fileSize() -// ---------------------------------------------------------------------------- - -inline __int64 SamReader_::fileSize() const -{ - return this->_fileSize; -} - -// ---------------------------------------------------------------------------- -// Member Function SamReader_::positionInFile() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): This does not work yet. - -inline __int64 SamReader_::positionInFile() const -{ - return 0; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_SAM_READER_H_ diff --git a/seqan/bam_io/sam_writer.h b/seqan/bam_io/sam_writer.h deleted file mode 100644 index 627d7d9..0000000 --- a/seqan/bam_io/sam_writer.h +++ /dev/null @@ -1,161 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_SAM_WRITER_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_SAM_WRITER_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -class SamWriter_ : - public XamWriter_ -{ -public: - // Pointer to the output stream to write to. Used such that we can also write SAM to stdout. - std::ostream * _stream; - // The file stream to write to if we do not write to stdout. Pointed to by _stream. - std::ofstream _fstream; - - SamWriter_() : - XamWriter_(), _stream(0) - {} - - SamWriter_(CharString const & filename); - - // XamWriter_ interface. - - virtual int open(CharString const & filename); - virtual bool isGood(); - virtual int writeHeader(BamHeader const & header, BamIOContext > const & context); - virtual int writeRecord(BamAlignmentRecord const & record, BamIOContext > const & context); - virtual int flush(); - virtual int close(); -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Member Function SamWriter_::SamWriter_() -// ---------------------------------------------------------------------------- - -inline SamWriter_::SamWriter_(CharString const & filename) : - XamWriter_(filename), _stream(0) -{ - this->open(filename); -} - -// ---------------------------------------------------------------------------- -// Member Function SamWriter_::open() -// ---------------------------------------------------------------------------- - -inline int SamWriter_::open(CharString const & filename) -{ - if (filename == "-") - { - this->_stream = &std::cout; - } - else - { - this->_stream = &this->_fstream; - this->_fstream.open(toCString(filename), std::ios::binary | std::ios::out); - if (!this->_fstream.good()) - return 1; - } - - return 0; -} - -// ---------------------------------------------------------------------------- -// Member Function SamWriter_::isGood() -// ---------------------------------------------------------------------------- - -inline bool SamWriter_::isGood() -{ - return this->_stream->good(); -} - -// ---------------------------------------------------------------------------- -// Member Function SamWriter_::writeHeader() -// ---------------------------------------------------------------------------- - -inline int SamWriter_::writeHeader(BamHeader const & header, BamIOContext > const & context) -{ - return seqan::write2(*this->_stream, header, context, Sam()); -} - -// ---------------------------------------------------------------------------- -// Member Function SamWriter_::writeRecord() -// ---------------------------------------------------------------------------- - -inline int SamWriter_::writeRecord(BamAlignmentRecord const & record, BamIOContext > const & context) -{ - return seqan::write2(*this->_stream, record, context, Sam()); -} - -// ---------------------------------------------------------------------------- -// Member Function SamWriter_::flush() -// ---------------------------------------------------------------------------- - -inline int SamWriter_::flush() -{ - return streamFlush(*this->_stream); -} - -// ---------------------------------------------------------------------------- -// Member Function SamWriter_::close() -// ---------------------------------------------------------------------------- - -inline int SamWriter_::close() -{ - if (this->_stream == &this->_fstream) // not to stdout - this->_fstream.close(); - return 0; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_SAM_WRITER_H_ diff --git a/seqan/bam_io/write_bam.h b/seqan/bam_io/write_bam.h deleted file mode 100644 index 4f6c5c7..0000000 --- a/seqan/bam_io/write_bam.h +++ /dev/null @@ -1,303 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Code for writing BAM. -// ========================================================================== - -// TODO(holtgrew): Add buffer to context? -// TODO(holtgrew): Rename to writeRecord from write2! Go over deprecated alias! - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_WRITE_BAM_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_WRITE_BAM_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function writeRecord() BamHeader -// ---------------------------------------------------------------------------- - -/*! - * @fn SamBamIO#write2 - * @brief Write a record to a SAM/BAM file. - * - * @signature int writeRecord(stream, record, context, tag); - * @signature int writeRecord(stream, header, context, tag); - * - * @param[in,out] stream The @link StreamConcept Stream @endlink to write to. - * @param[out] record The @link BamAlignmentRecord @endlink object to write out. - * @param[out] header The @link BamHeader @endlink object to write out. - * @param[in,out] context The BamIOContext object to use. - * @param[in] tag The format tag, one of Sam and Bam. - * - * @return int A status code, 0 on success, != 0 on failure. - */ - - -template -int write2(TStream & stream, - BamHeader const & header, - BamIOContext const & context, - Bam const & /*tag*/) -{ - int res = streamWriteBlock(stream, "BAM\1", 4); - if (res != 4) - return 1; // Could not write magic. - - // Create text of header. - CharString headerBuffer; - for (unsigned i = 0; i < length(header.records); ++i) - { - res = write2(headerBuffer, header.records[i], context, Sam()); - if (res != 0) - return 1; // Error writing header to buffer. - } - // Note that we do not write out a null-character to terminate the header. This would be valid by the SAM standard - // but the samtools do not expect this and write out the '\0' when converting from BAM to SAM. - // appendValue(headerBuffer, '\0'); - - // Write text header. - __int32 lText = length(headerBuffer); - res = streamWriteBlock(stream, reinterpret_cast(&lText), 4); - if (res != 4) - return 1; // Error writing l_text. - - res = streamWriteBlock(stream, &headerBuffer[0], lText); - - // Write references. - __int32 nRef = _max(length(header.sequenceInfos), length(nameStore(context))); - res = streamWriteBlock(stream, reinterpret_cast(&nRef), 4); - if (res != 4) - return 1; // Error writing n_ref; - - for (unsigned i = 0; i < length(header.sequenceInfos); ++i) - { - __int32 lName = length(header.sequenceInfos[i].i1) + 1; - res = streamWriteBlock(stream, reinterpret_cast(&lName), 4); - if (res != 4) - return 1; // Error writing l_name; - - res = streamWriteBlock(stream, &header.sequenceInfos[i].i1[0], lName - 1); - if (res != lName - 1) - return 1; // Error writing name; - - char const n = '\0'; - res = streamWriteBlock(stream, &n, 1); - if (res != 1) - return 1; // Error writing trailing '\0'. - - __int32 lRef = header.sequenceInfos[i].i2; - res = streamWriteBlock(stream, reinterpret_cast(&lRef), 4); - if (res != 4) - return 1; // Error writing l_ref; - } - - return 0; -} - -// ---------------------------------------------------------------------------- -// Function writeRecord() BamAlignmentRecord -// ---------------------------------------------------------------------------- - -static inline int _reg2Bin(uint32_t beg, uint32_t end) -{ - --end; - if (beg >> 14 == end >> 14) - return 4681 + (beg >> 14); - - if (beg >> 17 == end >> 17) - return 585 + (beg >> 17); - - if (beg >> 20 == end >> 20) - return 73 + (beg >> 20); - - if (beg >> 23 == end >> 23) - return 9 + (beg >> 23); - - if (beg >> 26 == end >> 26) - return 1 + (beg >> 26); - - return 0; -} - -template -int write2(TStream & stream, - BamAlignmentRecord const & record, - BamIOContext const & /*context*/, - Bam const & /*tag*/) -{ - CharString buffer; - - // First, write record to buffer. - - // refID - streamWriteBlock(buffer, reinterpret_cast(&record.rID), 4); - - // pos - streamWriteBlock(buffer, reinterpret_cast(&record.beginPos), 4); - - // bin_mq_nl - SEQAN_ASSERT_LT(length(record.qName) + 1u, 255u); - __uint8 lReadName = length(record.qName) + 1; - unsigned l = 0; - _getLengthInRef(record.cigar, l); - __uint32 bin = _reg2Bin(record.beginPos, record.beginPos + l); - __uint32 binMqNl = (bin << 16) | (record.mapQ << 8) | lReadName; - streamWriteBlock(buffer, reinterpret_cast(&binMqNl), 4); - - // flag_nc - __uint16 nCigarOp = length(record.cigar); - __uint32 flagNc = (record.flag << 16) | nCigarOp; - streamWriteBlock(buffer, reinterpret_cast(&flagNc), 4); - - // l_seq - __int32 lSeq = length(record.seq); - streamWriteBlock(buffer, reinterpret_cast(&lSeq), 4); - - // next_refID - streamWriteBlock(buffer, reinterpret_cast(&record.rNextId), 4); - - // next_pos - streamWriteBlock(buffer, reinterpret_cast(&record.pNext), 4); - - // tlen - streamWriteBlock(buffer, reinterpret_cast(&record.tLen), 4); - - // read_name - streamWriteBlock(buffer, reinterpret_cast(&record.qName[0]), lReadName - 1); - streamWriteChar(buffer, '\0'); - - // cigar - static __uint8 const MAP[256] = - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, - 0, 0, 0, 0, 2, 0, 0, 0, 5, 1, 0, 0, 0, 0, 3, 0, - 6, 0, 0, 4, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - for (unsigned i = 0; i < length(record.cigar); ++i) - { - __uint32 x = record.cigar[i].count; - x <<= 4; - x |= MAP[static_cast(record.cigar[i].operation)]; - streamWriteBlock(buffer, reinterpret_cast(&x), 4); - } - - // seq - static __uint8 const MAP2[256] = - { - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, - 15, 1, 14, 2, 13, 15, 15, 4, 11, 15, 15, 12, 15, 3, 15, 15, - 15, 15, 5, 6, 8, 15, 7, 9, 15, 10, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 - }; - __uint8 c = 0; - for (int i = 0; i < lSeq; ++i) - { - c <<= 4; - c &= 0xf0; - c |= MAP2[static_cast(record.seq[i])]; - if (i % 2 == 1) - streamWriteChar(buffer, c); - } - if (lSeq % 2 == 1) - { - c <<= 4; - c &= 0xf0; - streamWriteChar(buffer, c); - } - - // qual - if (empty(record.qual)) - { - for (unsigned i = 0; i < length(record.qual); ++i) - streamWriteChar(buffer, static_cast(0xff)); - } - else - { - for (unsigned i = 0; i < length(record.qual); ++i) - streamWriteChar(buffer, static_cast(record.qual[i] - '!')); - } - - // tags - if (length(record.tags) > 0u) - streamWriteBlock(buffer, reinterpret_cast(&record.tags[0]), length(record.tags)); - - // buffer to stream - __uint32 blockSize = length(buffer); - streamWriteBlock(stream, reinterpret_cast(&blockSize), 4); - return streamWriteBlock(stream, &buffer[0], blockSize) != blockSize; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_WRITE_BAM_H_ diff --git a/seqan/bam_io/write_sam.h b/seqan/bam_io/write_sam.h deleted file mode 100644 index dfc2a74..0000000 --- a/seqan/bam_io/write_sam.h +++ /dev/null @@ -1,287 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Code for writing SAM. -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_WRITE_SAM_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_WRITE_SAM_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function write2() BamHeaderRecord -// ---------------------------------------------------------------------------- - -template -int write2(TStream & stream, - BamHeaderRecord const & header, - BamIOContext const & /*context*/, - Sam const & /*tag*/) -{ - char const * headerTypes[] = {"@HD", "@SQ", "@RG", "@PG", "@CO"}; - streamPut(stream, headerTypes[header.type]); - if (header.type == BAM_HEADER_COMMENT) - { - streamPut(stream, '\t'); - streamPut(stream, header.tags[0].i2); - } - else - { - for (unsigned i = 0; i < length(header.tags); ++i) - { - streamPut(stream, '\t'); - streamPut(stream, header.tags[i].i1); - streamPut(stream, ':'); - streamPut(stream, header.tags[i].i2); - } - } - - int res = streamPut(stream, '\n'); - if (res != 0) - return res; - - return 0; -} - -// ---------------------------------------------------------------------------- -// Function write2() BamHeader -// ---------------------------------------------------------------------------- - -template -int write2(TStream & stream, - BamHeader const & header, - BamIOContext const & context, - Sam const & tag) -{ - std::set writtenSeqInfos; - - for (unsigned i = 0; i < length(header.records); ++i) - { - BamHeaderRecord const & record = header.records[i]; - if (record.type == BAM_HEADER_REFERENCE) - { - for (unsigned i = 0; i < length(record.tags); ++i) - { - if (record.tags[i].i1 == "SN") - { - writtenSeqInfos.insert(record.tags[i].i2); - break; - } - } - } - - int res = write2(stream, record, context, tag); - if (res != 0) - return res; - } - - // Write missing @SQ header records. - for (unsigned i = 0; i < length(header.sequenceInfos); ++i) - { - if (writtenSeqInfos.find(header.sequenceInfos[i].i1) != writtenSeqInfos.end()) - continue; - int res = streamPut(stream, "@SQ\tSN:"); - if (res != 0) - return res; - - res = streamPut(stream, header.sequenceInfos[i].i1); - if (res != 0) - return res; - - res = streamPut(stream, "\tLN:"); - if (res != 0) - return res; - - res = streamPut(stream, header.sequenceInfos[i].i2); - if (res != 0) - return res; - - res = streamPut(stream, '\n'); - if (res != 0) - return res; - } - - return 0; -} - -// ---------------------------------------------------------------------------- -// Function write2() BamAlignmentRecord -// ---------------------------------------------------------------------------- - -template -int write2(TStream & stream, - BamAlignmentRecord const & record, - BamIOContext const & context, - Sam const & /*tag*/) -{ - int res = 0; - -#define SEQAN_PUT_TAB \ - do { \ - res = streamPut(stream, '\t'); \ - if (res != 0) \ - return res; \ - } \ - while (false) - - res = streamPut(stream, record.qName); - if (res != 0) - return res; - - SEQAN_PUT_TAB; - - res = streamPut(stream, record.flag); - if (res != 0) - return res; - - SEQAN_PUT_TAB; - - if (record.rID == BamAlignmentRecord::INVALID_REFID) - res = streamPut(stream, '*'); - else - res = streamPut(stream, nameStore(context)[record.rID]); - if (res != 0) - return res; - - SEQAN_PUT_TAB; - - res = streamPut(stream, record.beginPos + 1); - if (res != 0) - return res; - - SEQAN_PUT_TAB; - - res = streamPut(stream, static_cast<__uint16>(record.mapQ)); - if (res != 0) - return res; - - SEQAN_PUT_TAB; - - if (empty(record.cigar)) - { - res = streamPut(stream, '*'); - if (res != 0) - return res; - } - else - { - for (unsigned i = 0; i < length(record.cigar); ++i) - { - res = streamPut(stream, record.cigar[i].count); - if (res != 0) - return res; - - res = streamPut(stream, record.cigar[i].operation); - if (res != 0) - return res; - } - } - - SEQAN_PUT_TAB; - - if (record.rNextId == BamAlignmentRecord::INVALID_REFID) - res = streamPut(stream, '*'); - else if (record.rID == record.rNextId) - res = streamPut(stream, '='); - else - res = streamPut(stream, nameStore(context)[record.rNextId]); - if (res != 0) - return res; - - SEQAN_PUT_TAB; - - res = streamPut(stream, record.pNext + 1); - if (res != 0) - return res; - - SEQAN_PUT_TAB; - - if (record.tLen == BamAlignmentRecord::INVALID_LEN) - res = streamPut(stream, '0'); - else - res = streamPut(stream, record.tLen); - if (res != 0) - return res; - - SEQAN_PUT_TAB; - - if (empty(record.seq)) - res = streamPut(stream, '*'); // Case of empty seq string / "*". - else - res = streamPut(stream, record.seq); - if (res != 0) - return res; - - SEQAN_PUT_TAB; - - - if (empty(record.qual)) // Case of empty quality string / "*". - res = streamPut(stream, '*'); - else - res = streamPut(stream, record.qual); - if (res != 0) - return res; - - if (!empty(record.tags)) - { - SEQAN_PUT_TAB; - CharString buffer; - assignTagsBamToSam(buffer, record.tags); - streamPut(stream, buffer); - } - - return streamPut(stream, '\n'); - -#undef SEQAN_PUT_TAB -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_WRITE_SAM_H_ diff --git a/seqan/bam_io/xam_reader.h b/seqan/bam_io/xam_reader.h deleted file mode 100644 index c8beccb..0000000 --- a/seqan/bam_io/xam_reader.h +++ /dev/null @@ -1,103 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_XAM_READER_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_XAM_READER_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// Base class implementing reading of SAM and BAM files. - -class XamReader_ -{ -public: - CharString _filename; - - XamReader_() - {} - - XamReader_(CharString const & filename) : - _filename(filename) - {} - - virtual ~XamReader_() - {} - - // Those of the following functions that return integers return status codes. As usual, a status code of 0 means - // "OK", one != 0 means that there was an error. - - // Open file with given name. - virtual int open(CharString const & filename) = 0; - - // Return true if there is no error, false otherwise. - virtual bool isGood() = 0; - - // Return true if read is at end. - virtual bool atEnd() = 0; - - // Read the BAM header from the wrapped file. - virtual int readHeader(BamHeader & header, BamIOContext > & context) = 0; - - // Read the next BAM record from the wrapped file. - virtual int readRecord(BamAlignmentRecord & record, BamIOContext > & context) = 0; - - // Close the file again. - virtual int close() = 0; - - // Return file size in bytes. - virtual __int64 fileSize() const = 0; - - // Return approximate position in file. For BAM, position of previous chunk is returned. - virtual __int64 positionInFile() const = 0; -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_XAM_READER_H_ diff --git a/seqan/bam_io/xam_writer.h b/seqan/bam_io/xam_writer.h deleted file mode 100644 index 9961f68..0000000 --- a/seqan/bam_io/xam_writer.h +++ /dev/null @@ -1,98 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef CORE_INCLUDE_SEQAN_BAM_IO_XAM_WRITER_H_ -#define CORE_INCLUDE_SEQAN_BAM_IO_XAM_WRITER_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// Base class for writing SAM and BAM. - -class XamWriter_ -{ -public: - CharString _filename; - - XamWriter_() - {} - - XamWriter_(CharString const & filename) : - _filename(filename) - {} - - virtual ~XamWriter_() - {} - - // Those of the following functions that return integers return status codes. As usual, a status code of 0 means - // "OK", one != 0 means that there was an error. - - // Open file with given name. - virtual int open(CharString const & filename) = 0; - - // Return true if there is no error, false otherwise. - virtual bool isGood() = 0; - - // Write the BAM header to the wrapped file. - virtual int writeHeader(BamHeader const & header, BamIOContext > const & bamIOContext) = 0; - - // Write the BAM record to the wrapped file. - virtual int writeRecord(BamAlignmentRecord const & record, - BamIOContext > const & bamIOContext) = 0; - - // Flush all buffers. - virtual int flush() = 0; - - // Close the file again. - virtual int close() = 0; -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BAM_IO_XAM_WRITER_H_ diff --git a/seqan/basic.h b/seqan/basic.h deleted file mode 100644 index 9580594..0000000 --- a/seqan/basic.h +++ /dev/null @@ -1,97 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Umbrella header for the basic module. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_H_ - -// -------------------------------------------------------------------------- -// Prerequisites -// -------------------------------------------------------------------------- - -#include - -// -------------------------------------------------------------------------- -// Include Sub Modules -// -------------------------------------------------------------------------- - -// Code for debugging and testing (assertions, test system) and profiling. -#include - -// Basic exceptions. -#include - -// C++ Metaprogramming Support Code, generally independent of SeqAn. -#include - -// Fundamental meta and global functions. This is what makes SeqAn SeqAn. -#include - -// More advanced debug system constructs. -// TODO(holtgrew): Move into basic_debug subsystem, some stuff from metaprogramming and fundamental required, those should not depend on debug system. -#include - -// SeqAn Concept Checking Library (ported from Boost). -#include - -// Alphabet concept and biological implementations. -#include - -// Aggregate data types (pairs, triples, tuples). -#include - -// Memory allocation code. -#include - -// High level parallelism support. -#include - -// Mathematical functions and utilities. -#include - -// Smart pointers, including Holder<> class hierarchy. -#include - -// Iterator concept and implementation. -#include - -// Proxy class and supporting code. -#include - -// Container concept and supporting code. -#include - -// Remaining code with cyclic dependencies. -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_H_ diff --git a/seqan/basic/INFO b/seqan/basic/INFO deleted file mode 100644 index 6506f01..0000000 --- a/seqan/basic/INFO +++ /dev/null @@ -1,14 +0,0 @@ -Name: seqan-basic -Author: Andreas Gogol-Doering -Author: Tobias Rausch -Author: Anne-Katrin Emde -Author: David Weese -Author: Manuel Holtgrewe -Maintainer: Manuel Holtgrewe -License: BSD 3-clause -Copyright: 2006-2013, FU Berlin -Status: mature -Description: SeqAn core module with fundamental infrastructure. - The basic module contains the infrastructure for testing, allocators, the SeqAn - types and concepts, iterators, the Holder classes, aggregats (Pairs, Triples, - Tuples, ...) and other fundamentals. diff --git a/seqan/basic/aggregate_concept.h b/seqan/basic/aggregate_concept.h deleted file mode 100644 index 15cfa1b..0000000 --- a/seqan/basic/aggregate_concept.h +++ /dev/null @@ -1,178 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_AGGREGATE_CONCEPT_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_AGGREGATE_CONCEPT_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @concept AggregateConcept - * - * @brief Aggregate types contain a fixed number of fixed-size values (pairs, triples, tuples). - * - * @section Remarks - * - * Stream output operators are not shown in the function list below, but required. - * - * Comparison operators are not shown in the function list below, but required. - */ - -/*! - * @fn AggregateConcept#operator<< - * @brief Stream output operator. - * - * @signature TStream AggregateConcept::operator<<(stream, aggregate); - * - * @param stream The std::ostream to write to. - * @param aggregate The aggregate type to write to the stream. - * - * @return TStream Reference to stream after writing aggregate to it. - */ - -/** -.Concept.AggregateConcept -..summary:Aggregate types contain a fixed number of fixed-size values. -..remarks:Stream output operators are not shown in the function list below, but required. -..remarks:Comparison operators are not shown in the function list below, but required. - -.Function.clear.concept:Concept.AggregateConcept -.Function.value.concept:Concept.AggregateConcept -.Function.assignValue.concept:Concept.AggregateConcept - -.Metafunction.LENGTH.concept:Concept.AggregateConcept -.Metafunction.Value.concept:Concept.AggregateConcept - */ - -/*! - * @defgroup AggregateTags Aggregate Tags - * @brief Tags to use in aggregate (e.g. Pair, Triple, and Tuple) types. - */ - -/*! - * @tag AggregateTags#Pack - * @headerfile - * @brief Tag to mark a packed specialization that disables address alignment for members. - * - * @signature typedef Tag Pack; - */ - -/** -.Tag.Pack -..cat:Aggregates -..summary:Tag to mark a packed specialization that disables address alignment for members. -..signature:Pack -..include:seqan/basic.h - */ - -struct Pack_; -typedef Tag Pack; - -// TODO(holtgrew): We need @tparam for tag in the Dox system. - -/*! - * @tag AggregateTags#BitPacked - * @headerfile - * @brief Tag to mark a bit-packed specialization that avoids to waste bits. - * - * @signature template <[unsinged BITSIZE1[, unsigned BITSIZE2]]> - * struct BitPacked; - * - * BITSIZE1 The number of bits for the first entry. - * - * BITSIZE2 The number of bits for the second entry. - */ - -/** -.Tag.BitPacked -..cat:Aggregates -..summary:Tag to mark a bit-packed specialization that avoids to waste bits. -..signature:BitPacked -..param.BITSIZE1:Number of bits used for first element. -...type:nolink:$unsigned$ -..param.BITSIZE2:Number of bits used for second element. -...type:nolink:$unsigned$ -..include:seqan/basic.h - */ - -template -struct BitPacked; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -/*! - * @mfn MakePacked - * @headerfile - * @brief Return the corresponding packed type for a type. - * - * @signature MakePacked::Type; - * - * @tparam TAggregate The aggregate type to transform. - * - * @return Type The resulting packed type. - */ - -/** -.Metafunction.MakePacked -..cat:Aggregates -..summary:Return the corresponding packed type of a type. -..signature:MakePacked -..param.TAggregate:An aggregate type. -..returns:The corresponding packed aggregate. -..include:seqan/basic.h - */ - -template -struct MakePacked -{ - typedef T Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_AGGREGATE_CONCEPT_H_ diff --git a/seqan/basic/allocator_chunkpool.h b/seqan/basic/allocator_chunkpool.h deleted file mode 100644 index b40a1ff..0000000 --- a/seqan/basic/allocator_chunkpool.h +++ /dev/null @@ -1,276 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// Allocator that pools one or more consecutive memory blocks of a specific -// size. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_CHUNKPOOL_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_CHUNKPOOL_H_ - -#include - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/** -.Spec.Chunk Pool Allocator: -..cat:Allocators -..general:Class.Allocator -..summary:Allocator that pools one or more consecutive memory blocks of a specific size. -..signature:Allocator< ChunkPool > -..param.SIZE:Size of memory blocks that are pooled. -...value:An unsigned integer with $SIZE >= sizeof(void *)$. -..param.MAX_COUNT:Maximum number of consecutive memory blocks that are pooled. -...default:26 -...remarks:Longer "chunks" are allocated and deallocated without pooling. -..param.ParentAllocator:An allocator that is by the pool allocator used to allocate memory. -...default:@Spec.Simple Allocator@ -...note:The multi pool allocator only supports @Function.clear@ if this function is also implemented for $ParentAllocator$. -..remarks:A pool allocator allocates several memory blocks at once. -Freed blocks are not immediately deallocated but recycled in subsequential allocations. -This way, the number of calls to the heap manager is reduced, and that speeds up memory management. -...text:Note that memory blocks of size different than $SIZE$, $2*SIZE$, $3*SIZE$, ..., $MAX_COUNT * SIZE$ -are not pooled but immediately allocated and deallocated using $ParentAllocator$. -..include:seqan/basic.h -*/ - -template < - size_t SIZE, - size_t MAX_COUNT = 26, - typename TParentAllocator = Allocator > > -struct ChunkPool; - -template -struct Allocator > -{ - enum - { - STORAGE_SIZE_1 = 0x1000UL, - STORAGE_SIZE_2 = SIZE * MAX_COUNT * 8, - STORAGE_SIZE_UPPER = (STORAGE_SIZE_1 > STORAGE_SIZE_2) ? STORAGE_SIZE_1 : STORAGE_SIZE_2, - ITEMS_PER_STORAGE = STORAGE_SIZE_UPPER / SIZE, - STORAGE_SIZE = ITEMS_PER_STORAGE * SIZE, - - STORAGE_SIZE_MIN = SIZE * MAX_COUNT //minimal storage size - }; - - char * data_recycled_blocks [MAX_COUNT]; - char * data_current_begin; - char * data_current_end; - char * data_current_free; - Holder data_parent_allocator; - - Allocator() - { - SEQAN_CHECKPOINT; - ::std::memset(data_recycled_blocks, 0, sizeof(data_recycled_blocks)); - data_current_end = data_current_free = 0; - //dont need to initialize data_current_begin - } - - Allocator(size_t reserve_item_count) - { - SEQAN_CHECKPOINT; - ::std::memset(data_recycled_blocks, 0, sizeof(data_recycled_blocks)); - - size_t storage_size = (reserve_item_count * SIZE > STORAGE_SIZE_MIN) ? reserve_item_count * SIZE : STORAGE_SIZE_MIN; - allocate( parentAllocator( *this ), data_current_begin, storage_size ); - data_current_end = data_current_begin + storage_size; - data_current_free = data_current_begin; - } - - Allocator(TParentAllocator & parent_alloc) - { - SEQAN_CHECKPOINT; - ::std::memset(data_recycled_blocks, 0, sizeof(data_recycled_blocks)); - data_current_end = data_current_free = 0; - //dont need to initialize data_current_begin - - setValue(data_parent_allocator, parent_alloc); - } - - Allocator(size_t reserve_item_count, TParentAllocator & parent_alloc) - { - SEQAN_CHECKPOINT; - ::std::memset(data_recycled_blocks, 0, sizeof(data_recycled_blocks)); - - setValue(data_parent_allocator, parent_alloc); - - size_t storage_size = (reserve_item_count * SIZE > STORAGE_SIZE_MIN) ? reserve_item_count * SIZE : STORAGE_SIZE_MIN; - allocate( parentAllocator( *this ), data_current_begin, storage_size ); - data_current_end = data_current_begin + storage_size; - data_current_free = data_current_begin; - } - - //Dummy copy - Allocator(Allocator const &) - { - ::std::memset(data_recycled_blocks, 0, sizeof(data_recycled_blocks)); - data_current_end = data_current_free = 0; - //dont need to initialize data_current_begin - } - inline Allocator & - operator=(Allocator const &) - { - clear(*this); - return *this; - } - - ~Allocator() - { - SEQAN_CHECKPOINT; - clear(*this); - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function parentAllocator() -// ---------------------------------------------------------------------------- - -template -inline TParentAllocator & -parentAllocator(Allocator > & me) -{ - SEQAN_CHECKPOINT; - return value(me.data_parent_allocator); -} - -// ---------------------------------------------------------------------------- -// Function clear() -// ---------------------------------------------------------------------------- - -template -void -clear(Allocator > & me) -{ - SEQAN_CHECKPOINT; - ::std::memset(me.data_recycled_blocks, 0, sizeof(me.data_recycled_blocks)); - me.data_current_end = me.data_current_free = 0; - - clear(parentAllocator(me)); -} - -// ---------------------------------------------------------------------------- -// Function allocate() -// ---------------------------------------------------------------------------- - -template -inline void -allocate(Allocator > & me, - TValue * & data, - TSize count, - Tag const tag_) -{ - SEQAN_CHECKPOINT; - SEQAN_ASSERT_GT(count, static_cast(0)); - - typedef Allocator > TAllocator; - - char * ptr; - - if ((sizeof(TValue) != SIZE) || ((size_t) count > MAX_COUNT)) - {//no blocking - return allocate(parentAllocator(me), data, count, tag_); - } - - size_t bytes_needed = count * SIZE; - if (me.data_recycled_blocks[count - 1]) - {//use recycled - ptr = me.data_recycled_blocks[count - 1]; - me.data_recycled_blocks[count - 1] = * reinterpret_cast(ptr); - } - else - {//use new - ptr = me.data_current_free; - if (ptr + bytes_needed > me.data_current_end) - {//not enough free space in current storage: allocate new - size_t rest_block_number = (me.data_current_end - me.data_current_free) / SIZE; - if (ptr && rest_block_number) - {//link rest to recycle list - *reinterpret_cast(ptr) = me.data_recycled_blocks[rest_block_number - 1]; - me.data_recycled_blocks[rest_block_number - 1] = reinterpret_cast(ptr); - } - - allocate(parentAllocator(me), ptr, (size_t) TAllocator::STORAGE_SIZE, tag_); - me.data_current_begin = ptr; - me.data_current_end = ptr + TAllocator::STORAGE_SIZE; - } - me.data_current_free = ptr + bytes_needed; - } - - data = reinterpret_cast(ptr); -} - -// ---------------------------------------------------------------------------- -// Function deallocate() -// ---------------------------------------------------------------------------- - -template -inline void -deallocate(Allocator > & me, - TValue * data, - TSize count, - Tag const tag_) -{ - SEQAN_CHECKPOINT; - SEQAN_ASSERT_GT(count, 0); - - if ((sizeof(TValue) != SIZE) || (static_cast(count) > MAX_COUNT)) - {//no blocking - return deallocate(parentAllocator(me), data, count, tag_); - } - - //link in recycling list - *reinterpret_cast(data) = me.data_recycled_blocks[count - 1]; - me.data_recycled_blocks[count - 1] = reinterpret_cast(data); -} - -} // namespace seqan - -#endif // SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_CHUNKPOOL_H_ diff --git a/seqan/basic/allocator_interface.h b/seqan/basic/allocator_interface.h deleted file mode 100644 index 851fdef..0000000 --- a/seqan/basic/allocator_interface.h +++ /dev/null @@ -1,436 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// Allocator class definition and generic interface. -// ========================================================================== - -// TODO(holtgrew): Perform some benchmarks and use a better malloc, e.g. tcmalloc and see whether our allocator infrastructure is worth keeping around. -// TODO(holtgrew): Rename to allocator_base.h? - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_INTERFACE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_INTERFACE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -struct Tristate_; -typedef Tag Tristate; -template struct Holder; - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @defgroup AllocatorUsageTags Allocator Usage - * @brief The purpose of an allocated memory block. - * - * @tag AllocatorUsageTags#TagAllocateUnspecified - * @headerfile - * @brief Not specified. - * - * @tag AllocatorUsageTags#TagAllocateTemp - * @headerfile - * @brief Temporary memory. - * - * @tag AllocatorUsageTags#TagAllocateStorage - * @headerfile - * @brief Memory for storing container content. - */ - -/** -.Tag.Allocator Usage: -..cat:Memory -..summary:The purpose of an allocated memory block. -..tag.TagAllocateUnspecified:Not specified. -..tag.TagAllocateTemp:Temporary memory. -..tag.TagAllocateStorage:Memory for storing container content. -..see:Function.allocate -..see:Function.deallocate -..include:seqan/basic.h -*/ - -// TODO(holtgrew): ANY use/difference? - -struct AllocateUnspecified_; -typedef Tag TagAllocateUnspecified; - -struct AllocateTemp_; -typedef Tag TagAllocateTemp; - -struct AllocateStorage_; -typedef Tag TagAllocateStorage; - -/*! - * @class Allocator - * @headerfile - * @brief Manager for allocated memory. - * - * @signature template - * class Allocator; - * - * @tparam TSpec The specializing type. - * - * @section Remarks - * - * There are two reasons for using non-trivial allocators: - * - *
    - *
  1. Allocators support the function @link Allocator#clear @endlink for a fast deallocation of all allocated - * memory blocks.
  2. - *
  3. Some allocators are faster in allocating an deallocating memory. Pool allocators like e.g. - * @link SinglePoolAllocator @endlink or @link MultiPoolAllocator @endlink speed up - * @link Allocator#allocate @endlink, @link Allocator#deallocate * @endlink, and - * @link Allocator#clear @endlink for pooled memory blocks.
  4. - *
- */ - -/** -.Class.Allocator: -..cat:Basic -..summary:Manager for allocated memory. -..signature:Allocator -..param.TSpec:The specializing type. -...metafunction:Metafunction.Spec -..include:basic.h -..remarks:There are two reasons for using non-trivial allocators: -...text:1. Allocators support the function @Function.Allocator#clear@ for a fast deallocation of all -allocated memory blocks. -...text:2. Some allocators are faster in allocating an deallocating memory. -Pool allocators like e.g. @Spec.Single Pool Allocator@ or @Spec.Multi Pool Allocator@ -speed up @Function.allocate@, @Function.deallocate@, and @Function.Allocator#clear@ for -pooled memory blocks. -..include:seqan/basic.h -*/ - -template -struct Allocator; - -///.Function.allocate.param.object.type:Class.Allocator -///.Function.allocate.class:Class.Allocator -///.Function.deallocate.param.object.type:Class.Allocator -///.Function.deallocate.class:Class.Allocator - -// ============================================================================ -// Metafunctions -// ============================================================================ - -//.Metafunction.Spec.param.T.type:Class.Allocator - -template -struct Spec > -{ - typedef TSpec Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function allocate() -// ---------------------------------------------------------------------------- - -/*! - * @fn Allocator#allocate - * @headerfile - * @brief Allocates memory from heap. - * - * @signature void allocate(allocator, data, count[, usageTag]); - * - * @param[in] count Number of items that could be stored in the allocated memory. The type of the allocated - * items is given by the type of data. - * @param[in] usageTag A tag the specifies the purpose for the allocated memory. Values: - * @link AllocatorUsageTags @endlink. - * @param[in,out] allocator Allocator object. allocator is conceptually the "owner" of the allocated - * memory. Objects of all types can be used as allocators. If no special behavior is - * implemented, default functions allocation/deallocation are applied that uses standard - * new and delete operators. Types: Allocator - * - * @section Remarks - * - * The function allocates at least count*sizeof(data) bytes. The allocated memory is large enough to hold - * count objects of type T, where T * is type of data. - * - * These objects are not constructed by allocate. - * - * Use e.g. one of the functions @link valueConstruct @endlink, @link arrayConstruct @endlink, @link arrayConstructCopy - * @endlink or @link arrayFill @endlink to construct the objects. A new operator which is part of the C++ - * standard (defined in <new>) can also be used to construct objects at a given memory address. - * - * @section Remarks - * - * All allocated memory blocks should be deallocated by the corresponding function @link Allocator#deallocate @endlink. - */ - -/** -.Function.allocate -..class:Class.Allocator -..cat:Memory -..summary:Allocates memory from heap. -..signature:allocate(object, data, count [, usage_tag]) -..param.object:Allocator object. -...remarks:$object$ is conceptually the "owner" of the allocated memory. - Objects of all types can be used as allocators. If no special behavior is implemented, - default functions allocation/deallocation are applied that uses standard - $new$ and $delete$ operators. -..param.count:Number of items that could be stored in the allocated memory. -...text:The type of the allocated items is given by the type of $data$. -..param.usage_tag:A tag the specifies the purpose for the allocated memory. -...value:@Tag.Allocator Usage@ -..returns.param.data:Pointer to allocated memory. -...remarks:The value of this pointer is overwritten by the function. -..remarks: -...text:The function allocates at least $count*sizeof(data)$ bytes. - The allocated memory is large enough - to hold $count$ objects of type $T$, where $T *$ is type of $data$. -...note:These objects are not constructed by $allocate$. -...text:Use e.g. one of the functions @Function.valueConstruct@, @Function.arrayConstruct@, @Function.arrayConstructCopy@ or @Function.arrayFill@ -to construct the objects. -A $new$ operator which is part of the C++ standard (defined in $$) - can also be used to construct objects at a given memory address. -..note:All allocated memory blocks should be deallocated by the corresponding function @Function.deallocate@. -..see:Function.deallocate -..see:Function.valueConstruct -..see:Function.arrayFill -..see:Function.arrayConstruct -..see:Function.arrayConstructCopy -..include:seqan/basic.h -*/ - -template -inline void -allocate(T const & me, - TValue * & data, - TSize count) -{ - allocate(me, data, count, TagAllocateUnspecified()); -} - -template -inline void -allocate(T & me, - TValue * & data, - TSize count) -{ - allocate(me, data, count, TagAllocateUnspecified()); -} - -template -inline void -allocate(T const &, - TValue * & data, - TSize count, - Tag const &) -{ -// data = (TValue *) operator new(count * sizeof(TValue)); -#ifdef PLATFORM_WINDOWS_VS - data = (TValue *) _aligned_malloc(count * sizeof(TValue), __alignof(TValue)); -#else -/*#if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 - const size_t align = (__alignof__(TValue) < sizeof(void*))? sizeof(void*): __alignof__(TValue); - if (posix_memalign(&(void* &)data, align, count * sizeof(TValue))) - data = NULL; -#else - data = (TValue *) malloc(count * sizeof(TValue)); -#endif*/ - data = (TValue *) operator new(count * sizeof(TValue)); -#endif - -#ifdef SEQAN_PROFILE - if (data) - SEQAN_PROADD(SEQAN_PROMEMORY, count * sizeof(TValue)); -#endif -} - -template -inline void -allocate(T &, - TValue * & data, - TSize count, - Tag const &) -{ -// data = (TValue *) operator new(count * sizeof(TValue)); -#ifdef PLATFORM_WINDOWS_VS - data = (TValue *) _aligned_malloc(count * sizeof(TValue), __alignof(TValue)); -#else -/*#if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 - const size_t align = (__alignof__(TValue) < sizeof(void*))? sizeof(void*): __alignof__(TValue); - if (posix_memalign(&(void* &)data, align, count * sizeof(TValue))) - data = NULL; -#else - data = (TValue *) malloc(count * sizeof(TValue)); -#endif -*/ data = (TValue *) operator new(count * sizeof(TValue)); -#endif - -#ifdef SEQAN_PROFILE - if (data) - SEQAN_PROADD(SEQAN_PROMEMORY, count * sizeof(TValue)); -#endif -} - -// ---------------------------------------------------------------------------- -// Function deallocate() -// ---------------------------------------------------------------------------- - -/*! - * @fn Allocator#deallocate - * @headerfile - * @brief Deallocates memory. - * - * @signature void deallocate(object, data, count[, usageTag]) - * - * @param count Number of items that could be stored in the allocated memory. - * @param usageTag A tag the specifies the purpose for the allocated memory. - * Values: @link AllocatorUsageTags @endlink. - * @param object Allocator object.object is conceptually the "owner" of the allocated memory. Objects of - * all types can be used as allocators. If no special behavior is implemented, default - * functions allocation/deallocation are applied that uses standard new and delete - * operators. Types: Allocator - * @param data Pointer to allocated memory that was allocated by allocate. - * - * @section Remarks - * - * The values for object, count and usageTag should be the same that was used when - * allocate was called. The value of data should be the same that was returned by allocate. - * - * deallocate does not destruct objects. - * - * Use e.g. one of the functions @link valueDestruct @endlink or @link arrayDestruct @endlink to destruct the objects. - * delete and delete [] operators which are part of the C++ standard (defined in <new>) - * can also be used to destruct objects at a given memory address. - */ - -/** -.Function.deallocate -..class:Class.Allocator -..cat:Memory -..summary:Deallocates memory. -..signature:deallocate(object, data, count [, usage_tag]) -..param.object:Allocator object. -...remarks:$object$ is conceptually the "owner" of the allocated memory. - Objects of all types can be used as allocators. If no special behavior is implemented, - default functions allocation/deallocation are applied that uses standard - $new$ and $delete$ operators. -..param.data:Pointer to allocated memory that was allocated by $allocate$. -..param.count:Number of items that could be stored in the allocated memory. -..param.usage_tag:A tag the specifies the purpose for the allocated memory. -...value:@Tag.Allocator Usage@ -..remarks: -...text:The values for $object$, $count$ and $usage_tag$ should be the same that was -used when $allocate$ was called. The value of $data$ should be the same that was -returned by $allocate$. -...note:$deallocate$ does not destruct objects. -...text:Use e.g. one of the functions @Function.valueDestruct@ or @Function.arrayDestruct@ to destruct the objects. -$delete$ and $delete []$ operators which are part of the C++ standard (defined in $$) - can also be used to destruct objects at a given memory address. -..see:Function.valueDestruct -..see:Function.arrayDestruct -..include:seqan/basic.h -*/ - -template -inline void -deallocate(T const & me, - TValue * data, - TSize const count) -{ - deallocate(me, data, count, TagAllocateUnspecified()); -} - -template -inline void -deallocate(T & me, - TValue * data, - TSize const count) -{ - deallocate(me, data, count, TagAllocateUnspecified()); -} - -template -inline void -deallocate( - T const & /*me*/, - TValue * data, -#ifdef SEQAN_PROFILE - TSize count, -#else - TSize, -#endif - Tag const) -{ -#ifdef SEQAN_PROFILE - if (data && count) // .. to use count if SEQAN_PROFILE is not defined - SEQAN_PROSUB(SEQAN_PROMEMORY, count * sizeof(TValue)); -#endif -// operator delete ((void *) data); -#ifdef PLATFORM_WINDOWS_VS - _aligned_free((void *) data); -#else -// free((void *) data); - operator delete ((void *) data); -#endif -} - -template -inline void -deallocate( - T & /*me*/, - TValue * data, -#ifdef SEQAN_PROFILE - TSize count, -#else - TSize, -#endif - Tag const) -{ -#ifdef SEQAN_PROFILE - if (data && count) // .. to use count if SEQAN_PROFILE is not defined - SEQAN_PROSUB(SEQAN_PROMEMORY, count * sizeof(TValue)); -#endif -// operator delete ((void *) data); -#ifdef PLATFORM_WINDOWS_VS - _aligned_free((void *) data); -#else -// free((void *) data); - operator delete ((void *) data); -#endif -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_INTERFACE_H_ diff --git a/seqan/basic/allocator_multipool.h b/seqan/basic/allocator_multipool.h deleted file mode 100644 index 7fdbb39..0000000 --- a/seqan/basic/allocator_multipool.h +++ /dev/null @@ -1,288 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// Allocator that pools blocks up to a given size. -// ========================================================================== - -#ifndef SEQAN_BASIC_BASIC_ALLOCATOR_MULTIPOOL_H_ -#define SEQAN_BASIC_BASIC_ALLOCATOR_MULTIPOOL_H_ - -#include - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @class MultiPoolAllocator - * @headerfile - * @brief Allocator that pools memory blocks. - * - * @signature template - * class Allocator >; - * - * @tparam TParentAllocator Th eparent allocator. - * @tparam BLOCKING_LIMIT The maximum size for memory blocks to be pooled (default is 256). - * - * Freed blocks are not immediately deallocated but recycled in subsequential allocations. This way, th enumber of - * calls to the heap manager is reduced and that might speed up memory management. - * - * Note that memory block larger than BLOCKING_LIMIT are not pooled but immediately allocated and deallocated - * using ParentAllocator. - */ - -/** -.Spec.Multi Pool Allocator: -..cat:Allocators -..general:Class.Allocator -..summary:Allocator that pools memory blocks. -..signature:Allocator MultiPool > -..param.ParentAllocator:An allocator that is by the pool allocator used to allocate memory. -...default:@Spec.Simple Allocator@ -...note:The multi pool allocator only supports @Function.clear@ if this function is also implemented for $ParentAllocator$. -..remarks:A pool allocator allocates several memory blocks at once. -..param.BLOCKING_LIMIT:The maximum size for memory blocks to be pooled. -...default:256 -Freed blocks are not immediately deallocated but recycled in subsequential allocations. -This way, the number of calls to the heap manager is reduced, and that speeds up memory management. -...text:Note that memory blocks larger than $BLOCKING_LIMIT$ are not pooled -but immediately allocated and deallocated using $ParentAllocator$. -..include:seqan/basic.h -*/ - -template >, unsigned int BLOCKING_LIMIT = 0x100> -struct MultiPool; - -typedef Allocator >, 0x100> > PoolAllocator; - -template -struct Allocator > -{ - enum - { - BLOCKING_LIMIT = BLOCKING_LIMIT_, - GRANULARITY_BITS = 2, - BLOCKING_COUNT = BLOCKING_LIMIT >> GRANULARITY_BITS, - STORAGE_SIZE = 0xf80 - }; - - char * data_recycled_blocks [BLOCKING_COUNT]; - char * data_current_begin [BLOCKING_COUNT]; - char * data_current_free [BLOCKING_COUNT]; - Holder data_parent_allocator; - - Allocator() - { - SEQAN_CHECKPOINT; - // TODO(holtrew): Why not SeqAn's memset? or use using? - ::std::memset(data_recycled_blocks, 0, sizeof(data_recycled_blocks)); - ::std::memset(data_current_begin, 0, sizeof(data_current_begin)); - ::std::memset(data_current_free, 0, sizeof(data_current_free)); - } - - Allocator(TParentAllocator & parent_alloc) - { - SEQAN_CHECKPOINT; - // TODO(holtrew): Why not SeqAn's memset? or use using? - ::std::memset(data_recycled_blocks, 0, sizeof(data_recycled_blocks)); - ::std::memset(data_current_begin, 0, sizeof(data_current_begin)); - ::std::memset(data_current_free, 0, sizeof(data_current_free)); - - setValue(data_parent_allocator, parent_alloc); - } - - //Dummy copy - Allocator(Allocator const &) - { - // TODO(holtrew): Why not SeqAn's memset? or use using? - ::std::memset(data_recycled_blocks, 0, sizeof(data_recycled_blocks)); - ::std::memset(data_current_begin, 0, sizeof(data_current_begin)); - ::std::memset(data_current_free, 0, sizeof(data_current_free)); - } - - inline Allocator & - operator=(Allocator const &) - { - clear(*this); - return *this; - } - - ~Allocator() - { - SEQAN_CHECKPOINT; - clear(*this); - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function parentAllocator() -// ---------------------------------------------------------------------------- - -template -inline TParentAllocator & -parentAllocator(Allocator > & me) -{ - SEQAN_CHECKPOINT; - return value(me.data_parent_allocator); -} - -// ---------------------------------------------------------------------------- -// Function clear() -// ---------------------------------------------------------------------------- - -template -void -clear(Allocator > & me) -{ - SEQAN_CHECKPOINT; - ::std::memset(me.data_recycled_blocks, 0, sizeof(me.data_recycled_blocks)); - ::std::memset(me.data_current_begin, 0, sizeof(me.data_current_begin)); - ::std::memset(me.data_current_free, 0, sizeof(me.data_current_free)); - - clear(parentAllocator(me)); -} - -// ---------------------------------------------------------------------------- -// Helper function _allocatorBlockNumber() -// ---------------------------------------------------------------------------- - -template -inline unsigned int -_allocatorBlockNumber(Allocator > &, - size_t size_) -{ - SEQAN_CHECKPOINT; - typedef Allocator > TAllocator; - - SEQAN_ASSERT_GT(size_, 0u); - - if (size_ < BLOCKING_LIMIT) - {//blocks - return size_ >> TAllocator::GRANULARITY_BITS; - } - else - {//no blocking - return TAllocator::BLOCKING_COUNT; - } -} - -// ---------------------------------------------------------------------------- -// Function allocate() -// ---------------------------------------------------------------------------- - -template -inline void -allocate(Allocator > & me, - TValue * & data, - TSize count, - Tag const & tag_) -{ - SEQAN_CHECKPOINT; - typedef Allocator > TAllocator; - - size_t bytes_needed = count * sizeof(TValue); - char * ptr; - - unsigned int block_number = _allocatorBlockNumber(me, bytes_needed); - if (block_number == TAllocator::BLOCKING_COUNT) - {//no blocking - return allocate(parentAllocator(me), data, count, tag_); - } - - bytes_needed = (block_number + 1) << TAllocator::GRANULARITY_BITS; - - if (me.data_recycled_blocks[block_number]) - {//use recycled - ptr = me.data_recycled_blocks[block_number]; - me.data_recycled_blocks[block_number] = * reinterpret_cast(ptr); - } - else - {//use new - ptr = me.data_current_free[block_number]; - if (!ptr || (ptr + bytes_needed > me.data_current_begin[block_number] + TAllocator::STORAGE_SIZE)) - {//not enough free space in current storage: allocate new - allocate(parentAllocator(me), ptr, (size_t) TAllocator::STORAGE_SIZE, tag_); - me.data_current_begin[block_number] = ptr; - } - me.data_current_free[block_number] = ptr + bytes_needed; - } - - data = reinterpret_cast(ptr); -} - -// ---------------------------------------------------------------------------- -// Function deallocate() -// ---------------------------------------------------------------------------- - -template -inline void -deallocate(Allocator > & me, - TValue * data, - TSize count, - Tag const tag_) -{ - SEQAN_CHECKPOINT; - typedef Allocator > TAllocator; - - size_t bytes_needed = count * sizeof(TValue); - - unsigned int block_number = _allocatorBlockNumber(me, bytes_needed); - if (block_number == TAllocator::BLOCKING_COUNT) - {//no blocking - return deallocate(parentAllocator(me), data, count, tag_); - } - - bytes_needed = (block_number + 1) << TAllocator::GRANULARITY_BITS; - - //link in recycling list - *reinterpret_cast(data) = me.data_recycled_blocks[block_number]; - me.data_recycled_blocks[block_number] = reinterpret_cast(data); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_BASIC_BASIC_ALLOCATOR_MULTIPOOL_H_ diff --git a/seqan/basic/allocator_simple.h b/seqan/basic/allocator_simple.h deleted file mode 100644 index 52937bd..0000000 --- a/seqan/basic/allocator_simple.h +++ /dev/null @@ -1,275 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// General purpose allocator. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_SIMPLE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_SIMPLE_H_ - -#include - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @class SimpleAllocator - * @headerfile - * @brief General purpose allocator. - * - * @signature template - * class Allocator >; - * - * @tparam TParentAllocator An allocator that is used by the simple allocator to allocate memory. - * - * @section Remarks - * - * The tag Default used as TparentAllocator means that the default implementations of allocate and - * deallocate are used. - */ - -/** -.Spec.Simple Allocator: -..cat:Allocators -..general:Class.Allocator -..summary:General purpose allocator. -..signature:Allocator< SimpleAlloc > -..param.ParentAllocator:An allocator that is by the simple allocator used to allocate memory. -...default:@Tag.Default@ -...remarks:@Tag.Default@ used as allocator means that the default implementations -of @Function.allocate@ and @Function.deallocate@ are used. -..include:seqan/basic.h -*/ - -template -struct SimpleAlloc; - -typedef Allocator > SimpleAllocator; - -template -struct Allocator > -{ - struct Header - { - Header * left; - Header * right; - size_t size; - }; - - Header * data_storages; - Holder data_parent_allocator; - - Allocator() - : data_storages(0) - { - SEQAN_CHECKPOINT; - } - - Allocator(TParentAllocator & parent_alloc) - : data_storages(0) - { - SEQAN_CHECKPOINT; - setValue(data_parent_allocator, parent_alloc); - } - - //Dummy copy - Allocator(Allocator const &) - : data_storages(0) - { - } - - inline Allocator & - operator = (Allocator const &) - { - clear(*this); - return *this; - } - - ~Allocator() - { - SEQAN_CHECKPOINT; - clear(*this); - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function parentAllocator() -// ---------------------------------------------------------------------------- - -template -inline TParentAllocator & -parentAllocator(Allocator > & me) -{ - SEQAN_CHECKPOINT; - return value(me.data_parent_allocator); -} - -// ---------------------------------------------------------------------------- -// Function clear() -// ---------------------------------------------------------------------------- - -/*! - * @fn Allocator#clear - * @brief Deallocates all memory blocks. - * - * @signature void clear(allocator); - * - * @param[in,out] The allocator to clear. - * - * @section Remarks - * - * This function deallocates all memory block sthat were allocated using allocate() for allocator. - * The memory is not pooled but directly passed back to the heap manager. - */ - -// TODO(holtgrew): Using #-functions messes up search results. -/** -.Function.Allocator#clear -..class:Class.Allocator -..cat:Memory -..summary:Deallocates all memory blocks. -..signature:clear(allocator) -..param.allocator:Allocator object. -...type:Class.Allocator -..remarks:This function deallocates all memory blocks -that was allocated using @Function.allocate@ for $allocator$. -The memory is not pooled but directly passed back to the heap manager. -..see:Function.allocate -..see:Function.deallocate -..include:seqan/basic.h -*/ -template -void -clear(Allocator > & me) -{ - SEQAN_CHECKPOINT; - typedef Allocator > TAllocator; - - while (me.data_storages) - { - typename TAllocator::Header * next_storage = me.data_storages->right; - deallocate(parentAllocator(me), reinterpret_cast(me.data_storages), me.data_storages->size); - me.data_storages = next_storage; - } -} - -// ---------------------------------------------------------------------------- -// Function allocate() -// ---------------------------------------------------------------------------- - -template -inline void -allocate(Allocator > & me, - TValue * & data, - TSize count, - Tag const &) -{ - SEQAN_CHECKPOINT; - typedef Allocator > TAllocator; - typedef typename TAllocator::Header THeader; - - //compute needed bytes - size_t bytes_needed = count * sizeof(TValue) + sizeof(THeader); - - //allocate storage from parent - char * ptr; - allocate(parentAllocator(me), ptr, bytes_needed, TagAllocateStorage()); - - THeader * new_block = reinterpret_cast(ptr); - new_block->left = 0; - new_block->right = me.data_storages; - new_block->size = bytes_needed; - - if (me.data_storages) - { - me.data_storages->left = new_block; - } - me.data_storages = new_block; - - //return data - data = reinterpret_cast(ptr + sizeof(THeader)); -} - -// ---------------------------------------------------------------------------- -// Function deallocate() -// ---------------------------------------------------------------------------- - -template -inline void -deallocate(Allocator > & me, - TValue * data, - TSize, - Tag const &) -{ - SEQAN_CHECKPOINT; - typedef Allocator > TAllocator; - typedef typename TAllocator::Header THeader; - - //update links - THeader & header = *(reinterpret_cast(data) - 1); - if (header.left) - { - header.left->right = header.right; - } - else - { - me.data_storages = header.right; - } - if (header.right) - { - header.right->left = header.left; - } - - //deallocate storage using parent - char * ptr = reinterpret_cast(& header); - deallocate(parentAllocator(me), ptr, header.size); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_SIMPLE_H_ diff --git a/seqan/basic/allocator_singlepool.h b/seqan/basic/allocator_singlepool.h deleted file mode 100644 index 1d5b244..0000000 --- a/seqan/basic/allocator_singlepool.h +++ /dev/null @@ -1,275 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// Allocator that pools blocks of a given size; Different-sized blocks are -// not pooled. -// ========================================================================== - -#ifndef SEQAN_BASIC_BASIC_ALLOCATOR_SINGLE_POOL_H_ -#define SEQAN_BASIC_BASIC_ALLOCATOR_SINGLE_POOL_H_ - -#include - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @class SinglePoolAllocator - * @extends Allocator - * @headerfile - * @brief Allocator that pools memory blocks of a specific size. - * - * @signature template - * class Allocator; - * - * @tparam SIZE The size of the blocks. - * @tparam TParentAllocator The parent allocator to use. - * - * @section Remarks - * - * A pool allocator allocates several memory blocks at once. Freed blocks are not immediately deallocated but - * recycled in subsequential allocations. This way, the number of calls to the heap manager is reduced, and that - * might speed up memory management. - * - * The single pool allocator only pools memory blocks of size at most $SIZE$. Blocks of other sizes are allocated and - * deallocated using an allocator of type $ParentAllocator$. Using the single pool allocator for blocksizes larger - * than a few KB is not advised. - */ - -/** -.Spec.Single Pool Allocator: -..cat:Allocators -..general:Class.Allocator -..summary:Allocator that pools memory blocks of specific size. -..signature:Allocator< SinglePool > -..param.SIZE:Size of memory blocks that are pooled. -..param.ParentAllocator:An allocator that is by the pool allocator used to allocate memory. -...default:@Spec.Simple Allocator@ -...note:The single pool allocator only supports @Function.clear@ if this function is also implemented for $ParentAllocator$. -..remarks:A pool allocator allocates several memory blocks at once. -Freed blocks are not immediately deallocated but recycled in subsequential allocations. -This way, the number of calls to the heap manager is reduced, and that speeds up memory management. -...text:The single pool allocator only pools memory blocks of size at most $SIZE$. -Blocks of other sizes are allocated and deallocated using an allocator of type $ParentAllocator$. -...text:Using the single pool allocator for blocksizes larger than some KB is not advised. -..include:seqan/basic.h -*/ - -template -struct SinglePool; - -template -struct Allocator > -{ - enum - { - // item must be large enough to keep a pointer to the next free item - SIZE_PER_ITEM = SIZE < sizeof(void*)? sizeof(void*) : SIZE, - ITEMS_PER_BLOCK = (SIZE_PER_ITEM < 0x0100) ? 0x01000 / SIZE_PER_ITEM : 16, - STORAGE_SIZE = SIZE_PER_ITEM * ITEMS_PER_BLOCK, - STORAGE_SIZE_MIN = SIZE_PER_ITEM - }; - - char * data_recycled_blocks; - char * data_current_begin; - char * data_current_end; - char * data_current_free; - Holder data_parent_allocator; - - Allocator() - { - data_recycled_blocks = data_current_end = data_current_free = 0; - //dont need to initialize data_current_begin - } - - Allocator(size_t reserve_item_count) - { - data_recycled_blocks = 0; - - size_t storage_size = std::max(reserve_item_count * SIZE_PER_ITEM, STORAGE_SIZE_MIN); - allocate(parentAllocator(*this), data_current_begin, storage_size); - data_current_end = data_current_begin + storage_size; - data_current_free = data_current_begin; - } - - Allocator(TParentAllocator & parent_alloc) - { - setValue(data_parent_allocator, parent_alloc); - - data_recycled_blocks = data_current_end = data_current_free = 0; - //dont need to initialize data_current_begin - } - - Allocator(size_t reserve_item_count, TParentAllocator & parent_alloc) - { - data_recycled_blocks = 0; - - setValue(data_parent_allocator, parent_alloc); - - size_t storage_size = std::max(reserve_item_count * SIZE_PER_ITEM, STORAGE_SIZE_MIN); - allocate(parentAllocator(*this), data_current_begin, storage_size); - data_current_end = data_current_begin + storage_size; - data_current_free = data_current_begin; - } - - //Dummy copy - Allocator(Allocator const &) - { - data_recycled_blocks = data_current_end = data_current_free = 0; - //dont need to initialize data_current_begin - } - - inline Allocator & - operator=(Allocator const &) - { - clear(*this); - return *this; - } - - ~Allocator() - { - clear(*this); - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function parentAllocator() -// ---------------------------------------------------------------------------- - -template -inline TParentAllocator & -parentAllocator(Allocator > & me) -{ - return value(me.data_parent_allocator); -} - -// ---------------------------------------------------------------------------- -// Function clear() -// ---------------------------------------------------------------------------- - -template -void -clear(Allocator > & me) -{ - me.data_recycled_blocks = me.data_current_end = me.data_current_free = 0; - clear(parentAllocator(me)); -} - -// ---------------------------------------------------------------------------- -// Function allocate() -// ---------------------------------------------------------------------------- - -template -inline void -allocate(Allocator > & me, - TValue * & data, - TSize count, - Tag const tag_) -{ - typedef Allocator > TAllocator; - size_t bytes_needed = count * sizeof(TValue); - - if (bytes_needed > TAllocator::SIZE_PER_ITEM) - {//no blocking - allocate(parentAllocator(me), data, count, tag_); - return; - } - - if (bytes_needed < TAllocator::SIZE_PER_ITEM) - bytes_needed = TAllocator::SIZE_PER_ITEM; - - char * ptr; - if (me.data_recycled_blocks) - {//use recycled - ptr = me.data_recycled_blocks; - me.data_recycled_blocks = * reinterpret_cast(ptr); - } - else - {//use new - ptr = me.data_current_free; - if (ptr + bytes_needed > me.data_current_end) - {//not enough free space in current storage: allocate new - allocate(parentAllocator(me), ptr, (size_t) TAllocator::STORAGE_SIZE, tag_); - me.data_current_begin = ptr; - me.data_current_end = ptr + TAllocator::STORAGE_SIZE; - } - me.data_current_free = ptr + bytes_needed; - } - - data = reinterpret_cast(ptr); -} - -// ---------------------------------------------------------------------------- -// Function deallocate() -// ---------------------------------------------------------------------------- - -template -inline void -deallocate(Allocator > & me, - TValue * data, - TSize count, - Tag const tag_) -{ - typedef Allocator > TAllocator; - - size_t bytes_needed = count * sizeof(TValue); - - if (bytes_needed > TAllocator::SIZE_PER_ITEM) - {//no blocking - deallocate(parentAllocator(me), data, count, tag_); - return; - } - - //link in recycling list - *reinterpret_cast(data) = me.data_recycled_blocks; - me.data_recycled_blocks = reinterpret_cast(data); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_BASIC_BASIC_ALLOCATOR_SINGLE_POOL_H_ diff --git a/seqan/basic/allocator_to_std.h b/seqan/basic/allocator_to_std.h deleted file mode 100644 index d065c97..0000000 --- a/seqan/basic/allocator_to_std.h +++ /dev/null @@ -1,245 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// Wrapper that adapts SeqAn allocators to STL allocators. -// ========================================================================== - -// TODO(holtgrew): Rename STD to STL? -// TODO(holtgrew): Rename to allocator_to_stl.h, remove basic_ prefix of all other allocator headers. - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_TO_STD_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_TO_STD_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @class ToStdAllocator - * @headerfile - * @brief Emulates standard conform allocator. - * - * @signature template - * class ToStdAllocator; - * - * @tparam TValue Type of allocated items. - * @tparam THost Type of the host allocator object.This object is used to call @link allocate @endlink and - * @link deallocate @endlink. - * - * @section Remarks - * - * The member functions allocate and deallocate of ToStdAllocator call the (globale) - * functions @link Allocator#allocate @endlink and @link Allocator#deallocate @endlink, respectively. The globale - * functions get an allocator object as their first arguments. This allocator object is not the ToStdAllocator - * object itself, but the host object that was given to the constructor. - * - * @fn ToStdAllocator#ToStdAllocator - * - * @brief Constructor - * - * @signature ToStdAllocator::ToStdAllocator(host); - * - * @param host The host object that is used as allocator for @link Allocator#allocate @endlink and @link - * Allocator#deallocate @endlink. - */ - -/** -.Class.ToStdAllocator: -..summary:Emulates standard conform allocator. -..signature:ToStdAllocator -..param.THost:Type of the host allocator object. -...text:This object is used to call @Function.allocate@ and @Function.deallocate@. -..param.TValue:Type of allocated items. -..remarks:The member functions $allocate$ and $deallocate$ of $ToStdAllocator$ call -the (globale) functions @Function.allocate@ and @Function.deallocate@, respectively. The globale functions -get an allocator object as their first arguments. This allocator object is not the $ToStdAllocator$ object itself, -but the host object that was given to the constructor. -..cat:Basic -..remarks: -..see:Function.allocate -..see:Function.deallocate -..include:seqan/basic.h - -.Memfunc.ToStdAllocator: -..summary:Constructor -..signature:ToStdAllocator(host) -..class:Class.ToStdAllocator -..param.host:The host object that is used as allocator for @Function.allocate@ and @Function.deallocate@. -*/ - -template -struct ToStdAllocator -{ - typedef TValue value_type; // nolint - typedef value_type * pointer; // nolint - typedef value_type & reference; // nolint - typedef value_type const * const_pointer; // nolint - typedef value_type const & const_reference; // nolint - - typedef size_t size_type; // nolint - typedef ptrdiff_t difference_type; // nolint - - ToStdAllocator(THost & host): m_host(& host) - {} - - template - ToStdAllocator(ToStdAllocator const & alloc) - : m_host(alloc.m_host) - {} - - ToStdAllocator & operator= (ToStdAllocator const & alloc) - { - m_host = alloc.m_host; - return *this; - } - - pointer allocate(size_type count) - { - value_type * ptr; - seqan::allocate(*m_host, ptr, count); - return pointer(ptr); - } - - pointer allocate(size_type count, const void *) - { - value_type * ptr; - seqan::allocate(*m_host, ptr, count); - return pointer(ptr); - } - - void deallocate(pointer data, size_type count) - { - seqan::deallocate(*m_host, data, count); - } - - void construct(pointer ptr, const_reference data) - { - new(ptr) TValue(data); - } - - void destroy(pointer ptr) - { - ptr->~TValue(); - } - - pointer address(reference value) const - { - return (&value); - } - - const_pointer address(const_reference value) const - { - return (&value); - } - - size_type max_size() const - { - return ~0UL / sizeof(value_type); - } - - template - struct rebind // nolint - { - typedef ToStdAllocator other; // nolint - }; - - template - friend - struct ToStdAllocator; - -private: - THost * m_host; -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction ToStdAllocator() -// ---------------------------------------------------------------------------- - -template -struct StdAllocator -{ - typedef ToStdAllocator Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function host() -// ---------------------------------------------------------------------------- - -/*! - * @fn ToStdAllocator#host - * @headerfile - * @brief The object a given object depends on. - * - * @signature THost host(allocator); - * - * @param allocator The allocator to query. - * - * @return THost The host object. - */ - -/** -.Function.host -..class:Class.ToStdAllocator -..summary:The object a given object depends on. -..cat:Dependent Objects -..signature:host(object) -..param.object:An object. -...type:Class.ToStdAllocator -..returns:The host object. -..include:seqan/basic.h -*/ - -template -THost & -host(ToStdAllocator & me) -{ - return *me.m_host; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALLOCATOR_TO_STD_H_ diff --git a/seqan/basic/alphabet_adapt_builtins.h b/seqan/basic/alphabet_adapt_builtins.h deleted file mode 100644 index b22c783..0000000 --- a/seqan/basic/alphabet_adapt_builtins.h +++ /dev/null @@ -1,274 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Döring -// ========================================================================== -// Adaptions of builting types such as bool, int, but also "builtin-level" -// user defined types such as wchar_t, __int64, __uint64 to the alphabet -// concepts they are in. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_BASIC_ALPHABET_ADAPT_BUILTINS_H_ -#define SEQAN_CORE_INCLUDE_BASIC_ALPHABET_ADAPT_BUILTINS_H_ - -#include - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunctions MaxValue_, MinValue_ -// ---------------------------------------------------------------------------- - -// We would want to have this here, however this is not possible with the -// current implementation. - -// ---------------------------------------------------------------------------- -// Metafunction BitsPerValue -// ---------------------------------------------------------------------------- - -template <> -struct BitsPerValue -{ - typedef int Type; - enum { VALUE = 1 }; -}; - -// ---------------------------------------------------------------------------- -// Metafunction IsCharType -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): This should probably become a concept. - -/*! - * @mfn IsCharType - * @headerfile - * - * @brief Return whether the argument is char, wchar_t, char const, or wchar_t - * const. - * - * @signature IsCharType::Type; - * @signature IsCharType::VALUE; - * - * @tparam T Type to check type of. - * - * @section Remarks - * - * This metafunction is used to enable and disable templated adaptions of arrays to sequences for builtin character - * types only. - * - * The return value is True/true for char, wchar_t, char const, and - * wchar_t const. - */ - -/** -.Metafunction.IsCharType -..cat:Alphabets -..summary:Return whether the argument is $char$, $wchar_t$, $char const$, or $wchar_t const$. -..signature:IsCharType::Type -..signature:IsCharType::VALUE -..param.T:Type to check type of. -..remarks:This metafunction is used to enable and disable templated adaptions of arrays to sequences for builtin character types only. -..remarks:The return value is $True$/$true$ for $char$, $wchar_t$, $char const$, and $wchar_t const$. -..include:seqan/sequence.h -*/ - -template -struct IsCharType; - -template -struct IsCharType -{ - typedef False Type; - enum { VALUE = 0 }; -}; - -template -struct IsCharType - : IsCharType {}; - -template <> -struct IsCharType -{ - typedef True Type; - enum { VALUE = 1 }; -}; - -template <> -struct IsCharType -{ - typedef True Type; - enum { VALUE = 1 }; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function gapValueImpl() [char] -// ---------------------------------------------------------------------------- - -inline char const & -gapValueImpl(char *) -{ - static char const _gap = '-'; - return _gap; -} - -inline char const & -gapValueImpl(char const *) -{ - static char const _gap = '-'; - return _gap; -} - -// ---------------------------------------------------------------------------- -// Function unknownValueImpl() [char] -// ---------------------------------------------------------------------------- - -inline char const & -unknownValueImpl(char *) -{ - static char const _unknown = 'N'; - return _unknown; -} - -inline char const & -unknownValueImpl(char const *) -{ - static char const _unknown = 'N'; - return _unknown; -} - -// ---------------------------------------------------------------------------- -// Function supremumValueImpl() -// ---------------------------------------------------------------------------- - -template -inline T const & -supremumValueImpl(T *) -{ - static T const x = MaxValue::VALUE; - return x; -} - -inline long double const & -supremumValueImpl(long double *) -{ -#ifdef PLATFORM_WINDOWS - static long double const _value = ::std::numeric_limits::infinity( ); -#else - static long double const _value = 1.7976931348623157e+308; -#endif - return _value; -} - -inline double const & -supremumValueImpl(double *) -{ -#ifdef PLATFORM_WINDOWS - static double const _value = ::std::numeric_limits::infinity( ); -#else - static double const _value = 1.7976931348623157e+308; -#endif - return _value; -} -inline float const & -supremumValueImpl(float *) -{ -#ifdef PLATFORM_WINDOWS - static float const _value = ::std::numeric_limits::infinity( ); -#else - static float const _value = 3.40282347e+38F; -#endif - return _value; -} - -// ---------------------------------------------------------------------------- -// Function infimumValueImpl() -// ---------------------------------------------------------------------------- - -template -inline T const & -infimumValueImpl(T *) -{ - static T const x = MinValue::VALUE; - return x; -} - -inline float const & -infimumValueImpl(float *) -{ -#ifdef PLATFORM_WINDOWS - static float const _value = -::std::numeric_limits::infinity( ); -#else - static float const _value = -3.40282347e+38F; -#endif - return _value; -} - -inline double const & -infimumValueImpl(double *) -{ -#ifdef PLATFORM_WINDOWS - static double const _value = -::std::numeric_limits::infinity( ); -#else - static double const _value = -1.7976931348623157e+308; -#endif - return _value; -} - -inline long double const & -infimumValueImpl(long double *) -{ -#ifdef PLATFORM_WINDOWS - static long double const _value = -::std::numeric_limits::infinity( ); -#else - static long double const _value = -1.7976931348623157e+308; -#endif - return _value; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_BASIC_ALPHABET_ADAPT_BUILTINS_H_ diff --git a/seqan/basic/alphabet_bio.h b/seqan/basic/alphabet_bio.h deleted file mode 100644 index b333b30..0000000 --- a/seqan/basic/alphabet_bio.h +++ /dev/null @@ -1,101 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// Author: Manuel Holtgrewe -// ========================================================================== -// Alphabet concepts stemming from biological applications. -// ========================================================================== - -// TODO(holtgrew): Where is the documentation, shouldnt it be here? - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_BIO_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_BIO_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function gapValueImpl -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): This looks wrong. - -template -inline T -gapValueImpl(T *) -{ - static T const _gap = T(); - return _gap; -} - -// ---------------------------------------------------------------------------- -// Function gapValue -// ---------------------------------------------------------------------------- - -template -inline T -gapValue() -{ - static T * _tag = 0; - return gapValueImpl(_tag); -} - -// ---------------------------------------------------------------------------- -// Function unknownValue -// ---------------------------------------------------------------------------- - -template -inline T -unknownValue() -{ - static T * _tag = 0; - return unknownValueImpl(_tag); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_BIO_H_ diff --git a/seqan/basic/alphabet_concept.h b/seqan/basic/alphabet_concept.h deleted file mode 100644 index 459ee88..0000000 --- a/seqan/basic/alphabet_concept.h +++ /dev/null @@ -1,923 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: David Weese -// Author: Manuel Holtgrewe -// ========================================================================== -// Concept definitions for alphabets. -// ========================================================================== - -// SEQAN_NO_GENERATED_FORWARDS - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_CONCEPT_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_CONCEPT_H_ - -namespace seqan { - -// ============================================================================ -// Concepts for generic alphabets -// ============================================================================ - -/*! - * @concept AlphabetConcept - * @extends AssignableConcept - * @extends DefaultConstructibleConcept - * @extends CopyConstructibleConcept - * @headerfile - * @brief Natural container value. - * - * @signature concept AlphabetConcept; - * - * @section Examples - * - * Valid expressions (v is of type T): - * - * @code{.cpp} - * unsigned bpv = BitsPerValue::VALUE; - * @endcode - */ - -/*! - * @mfn AlphabetConcept#BitsPerValue - * @headerfile - * @brief Number of bits needed to store a value. - * - * @signature BitsPerValue::VALUE - * - * @tparam T A class. - * - * @return TReturn - */ - -/** -.Concept.AlphabetConcept -..cat:Alphabets -..baseconcept:Concept.AssignableConcept -..baseconcept:Concept.DefaultConstructibleConcept -..baseconcept:Concept.CopyConstructibleConcept -..summary:Natural container value. -..include:seqan/basic.h -..example.text:Valid expressions ($v$ is of type $T$): -..example.code: -unsigned bpv = BitsPerValue::VALUE; - -.Metafunction.BitsPerValue -..concept:Concept.AlphabetConcept -..cat:Basic -..summary:Number of bits needed to store a value. -..signature:BitsPerValue::VALUE -..param.T:A class. -...type:Concept.AlphabetConcept -..returns.param.VALUE:Number of bits needed to store $T$. -...default:$sizeof * 8$ -..see:Metafunction.ValueSize -..include:seqan/basic.h - */ - -// Forwards for Metafunctions and Functions. -template struct BitsPerValue; - -// minimal requirements for the alphabet of a String class -SEQAN_CONCEPT_REFINE(AlphabetConcept, (TValue), (Assignable)(DefaultConstructible)(CopyConstructible)) -{ - typedef typename BitsPerValue::Type TBitsPerValue; - - TValue val, val2; - - SEQAN_CONCEPT_USAGE(AlphabetConcept) - { - SEQAN_STATIC_ASSERT_MSG(BitsPerValue::VALUE != 0, "Alphabet types must implement the BitsPerValue metafunction with non-zero value."); - - // assign must be available as an equivalent to '=' - assign(val, val2); -// swap(val, val2); - - TBitsPerValue b = BitsPerValue::VALUE; - - ignoreUnusedVariableWarning(b); - } -}; - -// ============================================================================ -// Concepts For Alphabets From The Mathematics Domain. -// ============================================================================ - -/*! - * @concept OrderedAlphabetConcept - * @extends AlphabetConcept - * @extends ComparableConcept - * @headerfile - * - * @brief Totally strict ordered alphabet. - * - * @signature concept OrderedAlphabetConcept; - */ - -/*! - * @fn OrderedAlphabetConcept::operator< - * @brief Less-than operator. - * - * @signature bool OrderedAlphabetConcept::operator<(other); - * - * @param[in] other Object of the same type to compare to this. - * - * @return bool True in case of this object being smaller than other - */ - -/*! - * @mfn OrderedAlphabetConcept#MaxValue - * @headerfile - * @brief Supremum for a given type. - * - * @signature MaxValue::VALUE - * - * @tparam T An ordered type. - * - * @return VALUE The largest value that T can represent. - * - * @see OrderedAlphabetConcept#maxValue - */ - -/*! - * @mfn OrderedAlphabetConcept#MinValue - * @headerfile - * @brief Infimum for a given type. - * - * @signature MinValue::VALUE - * - * @tparam T An ordered type. - * - * @return VALUE The smallest value that T can represent. - * - * @see OrderedAlphabetConcept#minValue - */ - -/*! - * @fn OrderedAlphabetConcept#supremumValueImpl - * @brief Implements maxValue. - * - * @signature T supremumValueImpl(valuePointerTag); - * - * @param[in] valuePointerTag A pointer that is used as a tag to specify the value type. The pointer needs not to point - * to a valid object, so it is possible to use a null pointer here. - * - * @return T A value inf that holds: inf >= i for all values i. - * - * @section Remarks - * - * This function implements OrderedAlphabetConcept#maxValue. It is recommended to use OrderedAlphabetConcept#maxValue - * rather than supremumValueImpl. - * - * @section Status - * - * Deprecated, will be removed in favour of OrderedAlphabetConcept#MaxValue. - * - * @see OrderedAlphabetConcept#maxValue - */ - -/*! - * @fn OrderedAlphabetConcept#maxValue - * @brief Supremum for a given type. - * - * @signature template - * T maxValue(); - * - * @tparam T The type to get the max value of. - * - * @return T A value inf that holds: inf >= i for all values i of type T. - * - * @section Remarks - * - * The function is implemented in supremumValueImpl. Do not specialize maxValue, specialize supremumValueImpl - * instead! - * - * @section Status - * - * Deprecated, will be removed in favour of MaxValue. - * - * @see OrderedAlphabetConcept#supremumValueImpl - * @see OrderedAlphabetConcept#minValue - * @see OrderedAlphabetConcept#MaxValue - */ - -/*! - * @fn OrderedAlphabetConcept#infimumValueImpl - * @brief Implements minValue. - * - * @signature T infimumValueImpl(valuePointerTag); - * - * @param[in] valuePointerTag A pointer that is used as a tag to specify the value type. The pointer needs not to point - * to a valid object, so it is possible to use a null pointer here. - * - * @return T A value inf that holds: inf <= i for all values i. - * - * @section Remarks - * - * This function implements minValue. It is recommended to use minValue rather than infimumValueImpl. - * - * @section Status - * - * Deprecated, will be removed in favour of MinValue. - * - * @see OrderedAlphabetConcept#minValue - */ - -/*! - * @fn OrderedAlphabetConcept#minValue - * @brief Infimum for a given type. - * - * @signature template - * T minValue(); - * - * @tparam T An ordered type. - * - * @return T A value inf that holds: inf <= i for all values i of type T. - * - * @section Remarks - * - * The function is implemented in infimumValueImpl. Do not specialize minValue, specialize infimumValueImpl - * instead! - * - * @section Status - * - * Deprecated, will be removed in favour of MinValue. - * - * @see OrderedAlphabetConcept#infimumValueImpl - * @see OrderedAlphabetConcept#maxValue - * @see OrderedAlphabetConcept#MinValue - */ - -/** -.Concept.OrderedAlphabetConcept -..concept:Concept.OrderedAlphabetConcept -..cat:Alphabets -..summary:Totally strict ordered alphabet. -..baseconcept:Concept.AlphabetConcept -..baseconcept:Concept.ComparableConcept -..include:seqan/basic.h - -.Function.operator<.concept:Concept.OrderedAlphabetConcept - -.Metafunction.MaxValue -..concept:Concept.OrderedAlphabetConcept -..cat:Miscellaneous -..summary:Supremum for a given type. -..signature:MaxValue::VALUE -..param.T:An ordered type. -...type:Concept.OrderedAlphabetConcept -..returns.param.VALUE:A value $sup$ for which holds: $sup >= i$ for all values $i$ of type $T$. -..remarks:Note tat -..see:Function.maxValue -..include:seqan/basic.h - -.Metafunction.MinValue -..concept:Concept.OrderedAlphabetConcept -..cat:Miscellaneous -..summary:Infimum for a given type. -..signature:MinValue::VALUE -..param.T:An ordered type. -...type:Concept.OrderedAlphabetConcept -..returns.param.VALUE:A value $inf$ for which holds: $inf <= i$ for all values $i$ of type $T$. -..remarks:Note tat -..see:Function.minValue -..include:seqan/basic.h - -.Function.supremumValueImpl -..concept:Concept.OrderedAlphabetConcept -..hidefromindex -..cat:Alphabets -..summary:Implements @Function.maxValue@. -..signature:supremumValueImpl(value_pointer_tag) -..param.value_pointer_tag:A pointer that is used as a tag to specify the value type. -...type:Concept.OrderedAlphabetConcept -...remarks:The pointer needs not to point to a valid object, so it is possible to use a null pointer here. -..returns:A value $inf$ that holds: $inf >= i$ for all values $i$. -..remarks.text:This function implements @Function.maxValue@. -It is recommended to use @Function.maxValue@ rather than $supremumValueImpl$. -..status:deprecated, will be removed in favour of @Metafunction.MaxValue@ -..include:seqan/basic.h - -.Function.maxValue -..concept:Concept.OrderedAlphabetConcept -..cat:Alphabets -..summary:Supremum for a given type. -..signature:maxValue() -..param.T:An ordered type. -...type:Concept.OrderedAlphabetConcept -..returns:A value $inf$ that holds: $inf >= i$ for all values $i$ of type $T$. -..remarks: -The function is implemented in @Function.supremumValueImpl@. -Do not specialize $maxValue$, specialize @Function.supremumValueImpl@ instead! -..see:Function.supremumValueImpl -..status:deprecated, will be removed in favour of @Metafunction.MaxValue@ -..include:seqan/basic.h - -// TODO(holtgrew): Rename to minValueImpl? - -.Function.infimumValueImpl -..concept:Concept.OrderedAlphabetConcept -..hidefromindex -..cat:Alphabets -..summary:Implements @Function.minValue@. -..signature:infimumValueImpl(value_pointer_tag) -..param.value_pointer_tag:A pointer that is used as a tag to specify the value type. -...type:Concept.OrderedAlphabetConcept -...remarks:The pointer needs not to point to a valid object, so it is possible to use a null pointer here. -..returns:A value $inf$ that holds: $inf <= i$ for all values $i$. -..remarks.text:This function implements @Function.minValue@. -It is recommended to use @Function.minValue@ rather than $infimumValueImpl$. -..status:deprecated, will be removed in favour of @Metafunction.MinValue@ -..include:seqan/basic.h - -.Function.minValue -..concept:Concept.OrderedAlphabetConcept -..cat:Alphabets -..summary:Infimum for a given type. -..signature:minValue() -..param.T:An ordered type. -...type:Concept.OrderedAlphabetConcept -..returns:A value $inf$ that holds: $inf <= i$ for all values $i$ of type $T$. -..remarks.text:The function is implemented in @Function.infimumValueImpl@. -Do not specialize $minValue$, specialize @Function.infimumValueImpl@ instead! -..see:Function.infimumValueImpl -..see:Function.maxValue -..status:deprecated, will be removed in favour of @Metafunction.MinValue@ -..include:seqan/basic.h -*/ - -// Forwards for Metafunctions and Functions. -template struct MinValue; -template struct MaxValue; -template T const & minValue(); -template T const & minValue(T); -template T const & maxValue(); -template T const & maxValue(T); - -SEQAN_CONCEPT_REFINE(OrderedAlphabetConcept, (TValue), (AlphabetConcept)(Comparable)) -{ - TValue val; - - SEQAN_CONCEPT_USAGE(OrderedAlphabetConcept) - { - // type consistency checks - sameType(minValue(val), val); - sameType(minValue(), val); - sameType(MinValue::VALUE, val); - sameType(maxValue(val), val); - sameType(maxValue(), val); - sameType(MaxValue::VALUE, val); - - // TODO(holtgrew): This does not work in C++98, we need C++11 with constexpr. - // TODO(holtgrew): Do these tests for each alphabet in runtime tests. - // sanity checks - // SEQAN_STATIC_ASSERT_MSG(MinValue::VALUE <= MaxValue::VALUE, "Minimal alphabet value must be less or equal to the maximal value."); - - // TODO(holtgrew): This does not work in C++98, we need C++11 with constexpr, cannot cast non-integral and non-enumeration types at compile time in C++98. - // 0 must be an element of the alphabet, as we want to be able - // to initialize a TValue variable to omit uninitialized warnings. - // SEQAN_STATIC_ASSERT_MSG(MinValue::VALUE <= static_cast(0), "0 must be convertible to a valid alphabet value."); - // SEQAN_STATIC_ASSERT_MSG(static_cast(0) <= MaxValue::VALUE, "0 must be convertible to a valid alphabet value."); - } -}; - -/*! - * @concept FiniteOrderedAlphabetConcept - * @headerfile - * @extends OrderedAlphabetConcept - * @brief An type that is of finite domain and totally ordered and thus has a minimum and maximum value. - */ - -/*! - * @mfn FiniteOrderedAlphabetConcept#ValueSize - * @brief Number of different values a value type object can have. - * - * @signature ValueSize::VALUE - * - * @tparam T A class. - * - * @return VALUE The number of different values the value can have. - * - * @section Remarks - * - * This function is only defined for integral types like unsigned, int, or Dna. For floating point - * numbers and the 64 bit types __int64 and __uint64, it returns 0 since there is no standard - * compliant way to return the number of values for these types. - * - * Note that you cannot get pointers or references to ValueSize<T>::VALUE in your program. You can use - * @link FiniteOrderedAlphabetConcept#valueSize @endlink in your programs without problems, though. When you get problems in your tests, use the - * "unary plus" workaround from the examples section. - * - * @section Examples - * - * The temporary assignment workaround. - * - * @code{.cpp} - * SEQAN_ASSERT_EQ(ValueSize::VALUE, 2u); // Linker error. - * SEQAN_ASSERT_EQ(+ValueSize::VALUE, 2u); // OK - * SEQAN_ASSERT_EQ(valueSize(), 2u); // OK - * @endcode - */ - -/*! - * @fn FiniteOrderedAlphabetConcept#ordValue - * @headerfile seqan/sequence.h - * @brief Maps an alphabet 1-to-1 to the interval [0..ValueSize). - * - * @signature T ordValue(value); - * - * @param value Arbitrary character value. Types: SimpleType - * - * @return T An unsigned value (result of Size<typeof(value)> between 0 and ValueSize of the type of value. - * - * @section Remarks - * - * This function first converts value to its unsigned value type and after that to an unsigned int. You can't - * use (unsigned int)c for a character c as on some systems char is signed and a -1 - * would be mapped to 0xffffffff instead of 0x000000ff. - */ - -/*! - * @fn FiniteOrderedAlphabetConcept#valueSize - * @brief Returns size of an alphabet. - * - * @signature template - * T valueSize(); - * - * @tparam T Type to query for value size. - * - * @return T Number of values in type T. - * - * @see FiniteOrderedAlphabetConcept#ValueSize - */ - -/** -.Concept.FiniteOrderedAlphabetConcept -..cat:Alphabets -..summary:An type that is of finite domain and totally ordered and thus has a minimum and maximum value. -..baseconcept:Concept.OrderedAlphabetConcept -..include:seqan/basic.h - -.Function.ordValue -..concept:Concept.FiniteOrderedAlphabetConcept -..summary:Maps an alphabet 1-to-1 to the interval [0..ValueSize). -..cat:Alphabets -..signature:ordValue(value) -..param.value:Arbitrary character value. -...type:Class.SimpleType -..returns:An unsigned value (result of @Metafunction.Size@$$ between 0 and @Metafunction.ValueSize@ of the type of value. -..note:This function first converts value to its unsigned value type and after that to an $unsigned int$. -You can't use $(unsigned int)c$ for a character $c$ as on some systems $char$ is signed and a $-1$ would be mapped to $0xffffffff$ instead of $0x000000ff$. -..include:seqan/sequence.h - -.Function.valueSize -..concept:Concept.FiniteOrderedAlphabetConcept -..cat:Alphabets -..summary:Returns size of an alphabet. -..signature:valueSize() -..param.T:Type to query for value size. -..returns:Number of values in type $T$. -...type:Metafunction.ValueSize -..include:seqan/basic.h -..see:Metafunction.ValueSize - -.Metafunction.ValueSize: -..concept:Concept.FiniteOrderedAlphabetConcept -..cat:Basic -..summary:Number of different values a value type object can have. -..signature:ValueSize::VALUE -..param.T:A class. -...type:Concept.FiniteOrderedAlphabetConcept -..returns.param.VALUE:Value size of $T$. -..remarks: -This function is only defined for integral types like $unsigned$, $int$, or @Spec.Dna@. -For floating point numbers and the 64 bit types $__int64$ and $__uint64$, it returns 0 since there is no standard compliant way to return the number of values for these types. -..remarks: -Note that you cannot get pointers or references to $ValueSize::VALUE$ in your program. -You can use @Function.valueSize@ in your programs without problems, though. -When you get problems in your tests, use the "unary plus" workaround from the examples section. -..example.text:The temporary assignment workaround. -..example.code: -SEQAN_ASSERT_EQ(ValueSize::VALUE, 2u); // Linker error. -SEQAN_ASSERT_EQ(+ValueSize::VALUE, 2u); // OK -SEQAN_ASSERT_EQ(valueSize(), 2u); // OK -..see:Function.valueSize -..see:Metafunction.Value -..include:seqan/basic.h - */ - -// Forwards for Metafunctions and Functions. -template struct ValueSize; -template typename ValueSize::Type valueSize(); -// Forwards for Metafunctions and Functions. -template SEQAN_HOST_DEVICE inline typename ValueSize::Type ordValue(TValue const & c); - -SEQAN_CONCEPT_REFINE(FiniteOrderedAlphabetConcept, (TValue), (OrderedAlphabetConcept)) -{ - typedef typename ValueSize::Type TSize; - - TValue val; - TSize size; - - SEQAN_CONCEPT_ASSERT((UnsignedIntegerConcept)); - - SEQAN_CONCEPT_USAGE(FiniteOrderedAlphabetConcept) - { - // a finite alphabet must be countable - sameType(ordValue(val), size); - sameType(valueSize(), size); - sameType(ValueSize::VALUE, size); - - // alphabet must be non-empty - SEQAN_STATIC_ASSERT_MSG(static_cast(0) < ValueSize::VALUE, "Alphabet size be greater than zero."); - - // convert integer to alphabet value - val = 0; - val = size; - TValue val2(0); - TValue val3(size); - - ignoreUnusedVariableWarning(val2); - ignoreUnusedVariableWarning(val3); - } -}; - -// ============================================================================ -// Concepts For Alphabets From The Bioinformatics Domain. -// ============================================================================ -/*! - * @concept AlphabetWithGapsConcept - * @extends AlphabetConcept - * @headerfile - * - * @brief An alphabet that includes a specific gap character. - */ - -/*! - * @fn AlphabetWithGapsConcept#gapValueImpl - * @brief Implements gapValue. - * - * @signature T gapValueImpl(valuePointerTag); - * - * @param valuePointerTag A pointer that is used as a tag to specify the value type. The pointer needs not to point - * to a valid object, so it is possible to use a null pointer here. - * - * @return T A gap character. - * - * @section Remarks - * - * This function implements gapValue. It is recommended to use gapValue rather than gapValueImpl. - * - * @see AlphabetWithGapsConcept#gapValue - */ - -/*! - * @fn AlphabetWithGapsConcept#gapValue - * @brief Return the "gap" value from an alphabet. - * - * @signature template - * T gapValue(); - * - * @tparam T The alphabet type to query the gap value from. - * - * @return T The gap character. - * - * @section Remarks - * - * The function is implemented in gapValueImpl. Do not specialize gapValue, specialize link gapValueImpl - * instead! - * - * @see AlphabetWithGapsConcept#gapValueImpl - */ - -/** -.Concept.AlphabetWithGapsConcept -..cat:Alphabets -..baseconcept:Concept.AlphabetConcept -..summary:An alphabet that includes a specific gap character. -..include:seqan/basic.h - -.Function.gapValue -..concept:Concept.AlphabetWithGapsConcept -..cat:Alphabets -..cat:Alignments -..summary:Return the "gap" value from an alphabet. -..signature:gapValue() -..param.T:The alphabet type to query the "gap" value from. -...type:Concept.AlphabetWithGapsConcept -..returns:The gap character. -..remarks.text:The function is implemented in @Function.gapValueImpl@. -Do not specialize $gapValue$, specialize @Function.gapValueImpl@ instead! -..see:Function.gapValueImpl -..include:seqan/basic.h - -.Function.gapValueImpl -..concept:Concept.AlphabetWithGapsConcept -..hidefromindex -..cat:Alphabets -..cat:Alignments -..summary:Implements @Function.gapValue@. -..signature:gapValueImpl(valuePointerTag) -..param.valuePointerTag:A pointer that is used as a tag to specify the value type. -....type:Concept.AlphabetWithGapsConcept -...remarks:The pointer needs not to point to a valid object, so it is possible to use a null pointer here. -..returns:A gap character. -..see:Function.gapValue -..remarks.text:This function implements @Function.gapValue@. -It is recommended to use @Function.gapValue@ rather than $gapValueImpl$. -..include:seqan/basic.h -*/ - -// Forwards for Metafunctions and Functions. -template T gapValue(); -template T gapValueImpl(T *); - -SEQAN_CONCEPT_REFINE(AlphabetWithGapsConcept, (TValue), (AlphabetConcept)) -{ - TValue val; - - SEQAN_CONCEPT_USAGE(AlphabetWithGapsConcept) - { - // Test the availability and return type of gapValue() and gapValueImpl(). - sameType(gapValue(), val); - sameType(gapValueImpl(static_cast(0)), val); - } -}; - -/*! - * @concept AlphabetWithUnknownValueConcept - * @extends AlphabetConcept - * @headerfile - * - * @brief An alphabet which includes a specific "unknown" character. - */ - -/*! - * @fn AlphabetWithUnknownValueConcept#unknownValue - * - * @brief Return the "unknown" value from an alphabet. - * - * @signature template - * T unknownValue(); - * - * @tparam T The alphabet type to query the unknown value from. - * - * @return TReturn The "unknown" value. - * - * @see AlphabetWithUnknownValueConcept#unknownValueImpl - */ - -/*! - * @fn AlphabetWithUnknownValueConcept#unknownValueImpl - * @brief Implements unknownValue. - * - * @signature T gapValueImpl(valuePointerTag) - * - * @param valuePointerTag A pointer that is used as a tag to specify the value type. The pointer needs not to point - * to a valid object, so it is possible to use a null pointer here. - * - * @return TReturn A "unknown" character. - * - * @section Remarks - * - * This function implements unknownValue. It is recommended to use gapValue rather than gapValueImpl. - * - * @see AlphabetWithUnknownValueConcept#unknownValue - */ - -/** -.Concept.AlphabetWithUnknownValueConcept -..cat:Alphabets -..baseconcept:Concept.AlphabetConcept -..summary:An alphabet which includes a specific "unknown" character. -..include:seqan/basic.h - -.Function.unknownValueImpl -..concept:Concept.AlphabetWithUnknownValueConcept -..hidefromindex -..cat:Alphabets -..summary:Implements @Function.unknownValue@. -..signature:gapValueImpl(valuePointerTag) -..param.valuePointerTag:A pointer that is used as a tag to specify the value type. -...type:Concept.AlphabetWithUnknownValueConcept -...remarks:The pointer needs not to point to a valid object, so it is possible to use a null pointer here. -..returns:A "unknown" character. -..see:Function.unknownValue -..remarks.text:This function implements @Function.unknownValue@. -It is recommended to use @Function.gapValue@ rather than $gapValueImpl$. -..include:seqan/basic.h - -.Function.unknownValue -..concept:Concept.AlphabetWithUnknownValueConcept -..cat:Alphabets -..summary:Return the "unknown" value from an alphabet. -..signature:unknownValue() -..param.T:The alphabet type to query the "unknown" value from. -...type:Concept.AlphabetWithUnknownValueConcept -..returns:The "unknown" value. - */ - -// Forwards for Metafunctions and Functions. -template T unknownValue(); -template T unknownValueImpl(T *); - -SEQAN_CONCEPT_REFINE(AlphabetWithUnknownValueConcept, (TValue), (AlphabetConcept)) -{ - TValue val; - - SEQAN_CONCEPT_USAGE(AlphabetWithUnknownValueConcept) - { - // Test the availability and return type of unknownValue() and unknownValueImpl(). - sameType(unknownValue(), val); - sameType(unknownValueImpl(static_cast(0)), val); - } -}; - -/*! - * @concept AlphabetWithQualitiesConcept - * @extends AlphabetConcept - * @headerfile - * - * @brief An alphabet where qualities can be attached to the characters. - */ - -/*! - * @mfn AlphabetWithQualitiesConcept#HasQualities - * @headerfile - * @brief Return whether the given type stores qualities besides the alphabet. - * - * @signature HasQualities::VALUE; - * @signature HasQualities::Type; - * - * @tparam TAlphabet The alphabe to query. - * - * @return VALUE true or false - * @return Type True or False - */ - -/*! - * @mfn AlphabetWithQualitiesConcept#QualityValueSize - * @brief Return the number of quality values in characters from alphabet with qualities. - * - * @signature QualityValueSize::VALUE; - * - * @tparam TAlphabet The alphabet to query for its value size. - * - * @return VALUE The cardinality of the set of qualities. - */ - -/*! - * @fn AlphabetWithQualitiesConcept#getQualityValue - * @brief Returns the quality of a character from an alphabet with integrated quality, e.g. the quality associated with - * a specified element from a sequence. - * @signature int getQualityValue(c); - * - * @param[in] c Character to retrieve the quality from. - * - * @return int Quality value of c. The quality value is an int value between 0 and 62 (inclusive). - * - * @section Examples - * - * @code{.cpp} - * String seq = "TATA"; - * // Assign quality value to first 'T' in sequence seq - * assignQualityValue(seq[0], 35); - * // Print quality value of first 'T', and default quality value of first 'A' - * std::cout << getQualityValue(seq[0]) << std::endl; // Defined as 35 - * std::cout << getQualityValue(seq[1]) << std::endl; // Default value 60 - * @endcode - * - * @see AlphabetWithQualitiesConcept#assignQualityValue - * @see convertQuality - */ - -/*! - * @fn AlphabetWithQualitiesConcept#assignQualityValue - * @brief Assigns quality to a character from an alphabet with integrated quality, e.g. to a specified element from a - * sequence. - * - * @signature void assignQualityValue(c, q); - * - * @param[out] c Target character to assign quality to. - * @param[in] q Quality to assign to the character. The quality value is an integral value between 0 and 62 - * (inclusive). - * - * @section Remarks - * - * If q is a char then '!' is subtracted from q. This is useful for ASCII encoded - * PHRED scores. - * - * @see AlphabetWithQualitiesConcept#getQualityValue - * @see convertQuality - * @see assignQualities - */ - -/** -.Concept.AlphabetWithQualitiesConcept -..cat:Alphabets -..baseconcept:Concept.AlphabetConcept -..summary:An alphabet where qualities can be attached to the characters. -..include:seqan/basic.h - -.Metafunction.QualityValueSize -..concept:Concept.AlphabetWithQualitiesConcept -..cat:Alphabets -..summary:Return the number of quality values in characters from alphabet with qualities. -..signature:QualityValueSize::VALUE -..param.TAlphabet:The alphabet to query for its value size. -...type:Concept.AlphabetWithQualitiesConcept -..returns:The cardinality of the set of qualities. -..include:seqan/basic.h - -.Metafunction.HasQualities -..concept:Concept.AlphabetWithQualitiesConcept -..cat:Alphabets -..summary:Return whether the given type stores qualities besides the alphabet. -..signature:HasQualities::VALUE -..signature:HasQualities::Type -..param.TAlphabet:The alphabe to query. -..returns:$true$, $false$, $True$, or $False$. -..include:seqan/basic.h - -.Function.getQualityValue -..concept:Concept.AlphabetWithQualitiesConcept -..cat:Alphabets -..signature:getQualityValue(c) -..summary:Returns the quality of a character from an alphabet with integrated quality, e.g. the quality associated with a specified element from a sequence. -..param.c:Character to retrieve the quality from. -...type:Concept.AlphabetWithQualitiesConcept -..returns:Quality value of $c$. -...type:nolink:int -...remarks:The quality value is an integral value between 0 and 62 (inclusive). -..see:Function.assignQualityValue -..see:Function.convertQuality -..include:seqan/basic.h -..example.code: - String seq = "TATA"; - // Assign quality value to first 'T' in sequence seq - assignQualityValue(seq[0], 35); - // Print quality value of first 'T', and default quality value of first 'A' - std::cout << getQualityValue(seq[0]) << std::endl; // Defined as 35 - std::cout << getQualityValue(seq[1]) << std::endl; // Default value 60 - - -.Function.assignQualityValue -..concept:Concept.AlphabetWithQualitiesConcept -..cat:Alphabets -..signature:assignQualityValue(c, q) -..summary:Assigns quality to a character from an alphabet with integrated quality, e.g. to a specified element from a sequence. -..param.c:Target character to assign quality to. -...type:Concept.AlphabetWithQualitiesConcept -..param.q:Quality to assign to the character. -...type:nolink:int -...type:nolink:char -...remarks:The quality value is an integral value between 0 and 62 (inclusive). -..remarks:If $q$ is a $char$ then $'!'$ is subtracted from $q$. This is useful for ASCII encoded PHRED scores. -..see:Function.getQualityValue -..see:Function.convertQuality -..include:seqan/basic.h - */ - -// TODO(holtgrew): What about different quality types? Guess scaling? Look at how other packages do this. - -SEQAN_CONCEPT_REFINE(AlphabetWithQualitiesConcept, (TValue), (AlphabetConcept)) -{ - TValue val; - - SEQAN_CONCEPT_USAGE(AlphabetWithQualitiesConcept) - { - // TODO(holtgrew): Write me! - } -}; - - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_CONCEPT_H_ diff --git a/seqan/basic/alphabet_math.h b/seqan/basic/alphabet_math.h deleted file mode 100644 index 61736a2..0000000 --- a/seqan/basic/alphabet_math.h +++ /dev/null @@ -1,277 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// Author: Manuel Holtgrewe -// ========================================================================== -// Math functions for alphabets. -// ========================================================================== - -#include -#include - -#ifndef SEQAN_BASIC_ALPHABET_MATH_H_ -#define SEQAN_BASIC_ALPHABET_MATH_H_ - -// TODO(holtgrew): Move actual implementations to alphabet_adapt_builtins. IF POSSIBLE - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction MaxValue -// ---------------------------------------------------------------------------- - -#ifdef PLATFORM_CUDA -template -struct MaximumValueUnsigned_ { static const T VALUE = ~(T)0; }; -#else -template -struct MaximumValueUnsigned_ { static const T VALUE; }; - -template -const T MaximumValueUnsigned_::VALUE = ~(T)0; -#endif - -template -struct MaximumValueSigned_ { static const T VALUE; }; -template -struct MaximumValueFloat_ { static const float VALUE; }; -template -struct MaximumValueDouble_ { static const double VALUE; }; - -template -const T MaximumValueSigned_::VALUE = ((((T)1 << (BitsPerValue::VALUE - 2)) - 1) << 1) + 1; -template -const float MaximumValueFloat_::VALUE = FLT_MAX; -template -const double MaximumValueDouble_::VALUE = DBL_MAX; - -template <> -struct MaximumValueSigned_ -{ - static const bool VALUE = true; -}; - -// template <> -// const char MaximumValueUnsigned_::VALUE = CHAR_MAX; -// template <> -// const char MaximumValueSigned_::VALUE = CHAR_MAX; - -template < - typename T, - typename TParent = typename IfC< - IsSameType::VALUE, - MaximumValueDouble_<>, - typename IfC< - IsSameType::VALUE, - MaximumValueFloat_<>, - typename IfC< - IsSameType::Type, T>::VALUE, - MaximumValueSigned_, - MaximumValueUnsigned_ - >::Type - >::Type - >::Type - > -struct MaxValue_ : TParent {}; - -// We use two levels here, so we can forward declare MaxValue with one -// template parameter. - -template -struct MaxValue : MaxValue_ {}; - -// ---------------------------------------------------------------------------- -// Metafunction MinValue -// ---------------------------------------------------------------------------- - -template -struct MinimumValueUnsigned_ { static const T VALUE; }; -template -struct MinimumValueSigned_ { static const T VALUE; }; - -template -struct MinimumValueFloat_ { static const float VALUE; }; -template -struct MinimumValueDouble_ { static const double VALUE; }; - -template -const T MinimumValueUnsigned_::VALUE = T(0); -template -const T MinimumValueSigned_::VALUE = ~(T)MaximumValueSigned_::VALUE; -template -const float MinimumValueFloat_::VALUE = -FLT_MAX; -template -const double MinimumValueDouble_::VALUE = -DBL_MAX; - -template <> -struct MinimumValueSigned_ -{ - static const bool VALUE = false; -}; - -// template <> -// const char MinimumValueUnsigned_::VALUE = 0; -// template <> -// const char MinimumValueSigned_::VALUE = 0; - -template < - typename T, - typename TParent = typename IfC< - IsSameType::VALUE, - MinimumValueDouble_<>, - typename IfC< - IsSameType::VALUE, - MinimumValueFloat_<>, - typename IfC< - IsSameType::Type, T>::VALUE, - MinimumValueSigned_, - MinimumValueUnsigned_ - >::Type - >::Type - >::Type - > -struct MinValue_ : TParent {}; - -// We use two levels here, so we can forward declare MinValue with one -// template parameter. - -template -struct MinValue : MinValue_ {}; - -// ============================================================================ -// Functions -// ============================================================================ - -// -------------------------------------------------------------------------- -// Function toUpperValue() -// -------------------------------------------------------------------------- - -template -inline SEQAN_HOST_DEVICE -TValue toUpperValue(TValue c) -{ - return c; -} - -inline SEQAN_HOST_DEVICE -char toUpperValue(char c) -{ - return c >= 'a' && c <= 'z' ? c + 'A' - 'a' : c; -} - -inline SEQAN_HOST_DEVICE -signed char toUpperValue(signed char c) -{ - return toUpperValue(static_cast(c)); -} - -inline SEQAN_HOST_DEVICE -unsigned char toUpperValue(unsigned char c) -{ - return toUpperValue(static_cast(c)); -} - -// ---------------------------------------------------------------------------- -// Function supremumValueImpl -// ---------------------------------------------------------------------------- - -template inline T const & supremumValueImpl(T *); - -// ---------------------------------------------------------------------------- -// Function maxValue -// ---------------------------------------------------------------------------- - -// Forward to supremumValueImpl() only. - -template -inline T const & -maxValue() -{ - SEQAN_CHECKPOINT; - T * _tag = 0; - return supremumValueImpl(_tag); -} - -template -inline T const & -maxValue(T /*tag*/) -{ - SEQAN_CHECKPOINT; - T * _tag = 0; - return supremumValueImpl(_tag); -} - -// ---------------------------------------------------------------------------- -// Function infimumValueImpl -// ---------------------------------------------------------------------------- - -template inline T const & infimumValueImpl(T *); - -// ---------------------------------------------------------------------------- -// Function minValue -// ---------------------------------------------------------------------------- - -// Forward to infimumValueImpl() only. - -template -inline T const & -minValue() -{ - SEQAN_CHECKPOINT; - T * _tag = 0; - return infimumValueImpl(_tag); -} - -template -inline T const & -minValue(T /*tag*/) -{ - SEQAN_CHECKPOINT; - T * _tag = 0; - return infimumValueImpl(_tag); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_BASIC_ALPHABET_MATH_H_ diff --git a/seqan/basic/alphabet_profile.h b/seqan/basic/alphabet_profile.h deleted file mode 100644 index cebb8d2..0000000 --- a/seqan/basic/alphabet_profile.h +++ /dev/null @@ -1,395 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Tobias Rausch -// ========================================================================== -// Profile alphabet character code. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_PROFILE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_PROFILE_H_ - -#include - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -template -class Proxy; - -template -struct IteratorProxy; - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -/*! - * @class ProfileChar - * - * @headerfile seqan/basic.h - * - * @brief Alphabet type for profiles over another alphabet. - * - * @signature template - * class ProfileChar; - * - * @tparam TValue The underlying alphabet type. - * @tparam TCount The type to use for counting, default: unsigned int. - * @tparam TSpec Specialization tag, default: void - */ - -/*! - * @var VariableType ProfileChar::count[] - * - * @brief Array of ValueSize elements, giving counts in profile. - */ - -/** -.Class.ProfileChar -..summary:Alphabet type for profiles over another alphabet. -..cat:Alphabets -..signature:ProfileChar -..param.TValue:The underlying alphabet type. -..param.TCount:The type to use for counting. -...default:nolink:$unsigned int$ -..param.TSpec:Specialization tag. -...default:nolink:$void$ -..include:seqan/basic.h - -.Memvar.ProfileChar#count[] -..class:Class.ProfileChar -..summary:Array of @Metafunction.ValueSize@ elements, giving counts in profile. - */ - -template -class ProfileChar; - -template -class ProfileChar -{ -public: - typedef typename ValueSize::Type TSize; - - TCount count[ValueSize::VALUE]; - - // ------------------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------------------ - - ProfileChar() - { - memset::VALUE * sizeof(TCount), (unsigned char) 0>(count); - } - - ProfileChar(ProfileChar const & other_data) - { - for (TSize i = 0; i < ValueSize::VALUE; ++i) - count[i] = other_data.count[i]; - } - - // TODO(holtgrew): Limit TOther to SourceValue? - template - ProfileChar(TOther const & other_data) - { - memset::VALUE * sizeof(TCount), (unsigned char) 0>(count); - count[ordValue(TValue(other_data))] = 1; - } - - template - ProfileChar(Proxy const & proxy) - { - memset::VALUE * sizeof(TCount), (unsigned char) 0>(count); - assign(*this, getValue(proxy)); - } - - // ------------------------------------------------------------------------ - // Assignment operators; Have to be defined in class. - // ------------------------------------------------------------------------ - - ProfileChar & - operator=(ProfileChar const & other_data) - { - if (this == &other_data) return *this; - - for (TSize i = 0; i < ValueSize::VALUE; ++i) - count[i] = other_data.count[i]; - return *this; - } - - template - ProfileChar & - operator=(TOther const & other_data) - { - memset::VALUE * sizeof(TCount), 0u>(count); - count[ordValue(TValue(other_data))] = 1; - return *this; - } - - // ------------------------------------------------------------------------ - // Type conversion operators; Have to be defined in class. - // ------------------------------------------------------------------------ - - operator char() - { - typename Size::Type maxIndex = _getMaxIndex(*this); - return (maxIndex == ValueSize::VALUE - 1) ? gapValue() : (char) TValue(maxIndex); - } -}; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction ValueSize -// ---------------------------------------------------------------------------- - -/*! - * @mfn ProfileChar#ValueSize - * @brief Number of different values a value type object can have. - * - * @signature ValueSize::VALUE; - * - * @tparam T The type to query. - * - * @return VALUE Number of different values T can have. - */ - -///.Metafunction.ValueSize.param.T.type:Class.ProfileChar -///.Metafunction.ValueSize.class:Class.ProfileChar - -template -struct ValueSize > -{ - enum { VALUE = ValueSize::VALUE + 1 }; - typedef unsigned Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction SourceValue -// ---------------------------------------------------------------------------- - -/*! - * @mfn ProfileChar#SourceValue - * @brief Returns underlying value for ProfileChar. - * - * @signature SourceValue::Type - * - * @tparam T Type to query. - * - * @return Type The type of the underlying character. - * - * @section Examples - * - * @code{.cpp} - * typedef ProfileChar TProfileChar; - * typedef SourceValue::Type TType; // Is Dna. - * @endcode - */ - -/** -.Metafunction.SourceValue -..class:Class.ProfileChar -..cat:Alphabets -..summary:Returns underlying value for @Class.ProfileChar@. -..signature:SourceValue::Type -..param.T:Type to query. -...type:Class.ProfileChar -..returns:The type of the underlying character. -..example.code: -typedef ProfileChar TProfileChar; -typedef SourceValue::Type TType; // Is Dna. -..include:seqan/basic.h -*/ - -template -struct SourceValue; - -template -struct SourceValue > -{ - typedef TValue Type; -}; - -template -struct SourceValue const> : - SourceValue > -{}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function operator==() -// ---------------------------------------------------------------------------- - -template -inline bool -operator==(ProfileChar const & lhs, - ProfileChar const & rhs) -{ - typedef ProfileChar TProfileChar; - typedef typename ValueSize::Type TValueSize; - - for (TValueSize i = 0; i < ValueSize::VALUE; ++i) - if (lhs.count[i] != rhs.count[i]) - return false; - return true; -} - -// ---------------------------------------------------------------------------- -// Function operator!=() -// ---------------------------------------------------------------------------- - -template -inline -bool -operator!=(ProfileChar const & lhs, - ProfileChar const & rhs) -{ - typedef ProfileChar TProfileChar; - typedef typename ValueSize::Type TSize; - - for (TSize i = 0; i < ValueSize::VALUE; ++i) - if (lhs.count[i] != rhs.count[i]) - return true; - return false; -} - -// ---------------------------------------------------------------------------- -// Function empty() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Document. - -// Check if there are only gaps. - -template -inline bool -empty(ProfileChar const & source) -{ - typedef typename ValueSize const>::Type TSize; - - for (TSize i = 0; i < ValueSize::VALUE; ++i) - if (source.count[i]) - return false; - return true; -} - -// ---------------------------------------------------------------------------- -// Helper Function _getMaxIndex() -// ---------------------------------------------------------------------------- - -template -inline typename Size const>::Type -_getMaxIndex(ProfileChar const & source) -{ - typedef ProfileChar TProfileChar; - typedef typename Size::Type TSize; - TSize maxIndex = 0; - TSourceCount maxCount = source.count[0]; - for (TSize i = 1; i < ValueSize::VALUE; ++i) - { - if (source.count[i] > maxCount) - { - maxIndex = i; - maxCount = source.count[i]; - } - } - return maxIndex; -} - -// ---------------------------------------------------------------------------- -// Helper Function _totalCount() -// ---------------------------------------------------------------------------- - -template -inline TSourceCount -_totalCount(ProfileChar const & source) -{ - typedef ProfileChar TProfileChar; - typedef typename Size::Type TSize; - TSourceCount totalCount = source.count[0]; - for (TSize i = 1; i < ValueSize::VALUE; ++i) - totalCount += source.count[i]; - return totalCount; -} - - -// ---------------------------------------------------------------------------- -// Function assign() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): What if there only are gaps? - -template -inline void -assign(SimpleType & target, - ProfileChar const & source) -{ - target.value = _getMaxIndex(source); -} - -// ---------------------------------------------------------------------------- -// Function convertImpl() -// ---------------------------------------------------------------------------- - -template -inline typename Convert >::Type -convertImpl(Convert const &, - ProfileChar const & source) -{ - return (_getMaxIndex(source) == ValueSize::VALUE) ? convertImpl(Convert(), '-') : convertImpl(Convert(), TSourceValue(_getMaxIndex(source))); -} - -// ---------------------------------------------------------------------------- -// Function operator<<(); Stream output. -// ---------------------------------------------------------------------------- - -template -inline TStream & -operator<<(TStream & os, ProfileChar const & rhs) -{ - typedef ProfileChar TProfileChar; - typedef typename Size::Type TSize; - for (TSize i = 0; i < ValueSize::VALUE; ++i) - os << i << ':' << rhs.count[i] << ' ' << ';'; - return os; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_PROFILE_H_ diff --git a/seqan/basic/alphabet_qualities.h b/seqan/basic/alphabet_qualities.h deleted file mode 100644 index e84a635..0000000 --- a/seqan/basic/alphabet_qualities.h +++ /dev/null @@ -1,143 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: David Weese -// Author: Manuel Holtgrewe -// ========================================================================== -// Definitions for piggybacking qualities in free bits of bytes. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_QUALITIES_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_QUALITIES_H_ - -// TODO(holtgrew): Should the documentation be here? - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction QualityValueSize -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Do we want a default specialization? Should it return 0? -template -struct QualityValueSize -{ - enum { VALUE = ValueSize::VALUE }; -}; - -template -struct QualityValueSize : QualityValueSize -{}; - -// ---------------------------------------------------------------------------- -// Metafunction HasQualities -// ---------------------------------------------------------------------------- - -template -struct HasQualities -{ - enum { VALUE = false }; - typedef False Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function assignQualityValue() -// ---------------------------------------------------------------------------- - -// Documentation is in alphabet_concept.h. - -// ---------------------------------------------------------------------------- -// Function getQualityValue() -// ---------------------------------------------------------------------------- - -// Documentation is in alphabet_concept.h. - -// ---------------------------------------------------------------------------- -// Function convertQuality() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): This could use some thought, what about other scales? - -/*! - * @fn convertQuality - * @headerfile - * - * @brief Convert an integer quality value into its ASCII representation for FASTQ (Phred scale). - * - * @signature void convertQuality(c, q); - * - * @param[in] q Value of the quality to convert. The quality value is an integral value between 0 and 62 - * (inclusive), int. - * @param[out] c Character to store the quality in, char. - * - * @see AlphabetWithQualitiesConcept#getQualityValue - * @see AlphabetWithQualitiesConcept#assignQualityValue - */ - -/** -.Function.convertQuality -..cat:Alphabets -..signature:convertQuality(c, q) -..summary:Convert an integer quality value into its ASCII representation for FASTQ (Phred scale). -..param.c:Character to store the quality in. -...type:nolink:$char$ -..param.q:Value of the quality to convert. -...remarks:The quality value is an integral value between 0 and 62 (inclusive). -...type:nolink:$int$ -..see:Function.getQualityValue -..include:seqan/basic.h - */ - -inline -void convertQuality(char & c, int q) -{ - c = '!' + char(q); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_QUALITIES_H_ diff --git a/seqan/basic/alphabet_residue.h b/seqan/basic/alphabet_residue.h deleted file mode 100644 index 4aa1ac2..0000000 --- a/seqan/basic/alphabet_residue.h +++ /dev/null @@ -1,1741 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// Implementation of the biological SimpleType specializations Dna, Dna5, -// DnaQ, Dna5Q, Rna, Rna5, Iupac, and AminoAcid. The conversion tables are -// in alphabet_residue_tabs.h. -// -// This header's structure is an exception to the standard. Because -// splitting into one header for each specialization is a bit too much, we -// define all types in one header. We define the classes, metafunctions and -// functions in one section, one subsection for reach type to make the whole -// thing more readable. Conversion through assignment is defined in the -// Function section. -// ========================================================================== - -// TODO(holtgrew): Add RnaQ and Rna5Q? Can we create a tag/type for Dna and Rna that is then differentiated with one additional tag? - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_RESIDUE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_RESIDUE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -template struct BaseAlphabet; - -// ============================================================================ -// Classes, Metafunctions, Functions -// ============================================================================ - -// Also see comment at the top for more information on this exceptional -// structure. -// -// We define the SimpleType specializations, the metafunctions ValueSize and -// BitsPerValue and the functions unknownValueImpl() for each specialization in -// this section. - -// ---------------------------------------------------------------------------- -// Specialization Dna -// ---------------------------------------------------------------------------- - -/*! - * @class Dna - * @extends SimpleType - * @headerfile - * @brief Alphabet for DNA. - * - * @signature typedef SimpleType Dna; - * - * @section Remarks - * - * The ValueSize of Dna is 4. The nucleotides are enumerated this way: 'A' = 0, 'C' = 1, 'G' = 2, 'T' = - * 3. - * - * Objects of type Dna can be converted to various other types and vice versa. An object that has a value not - * in {'A', 'C', 'G', 'T'} is converted to 'A'. - * - * @see Dna5 - * @see DnaString - * @see DnaIterator - */ - -/** -.Spec.Dna -..cat:Alphabets -..summary:Alphabet for DNA. -..general:Class.SimpleType -..signature:Dna -..remarks: -...text:The @Metafunction.ValueSize@ of $Dna$ is 4. -The nucleotides are enumerated this way: $'A' = 0, 'C' = 1, 'G' = 2, 'T' = 3$. -...text:Objects of type $Dna$ can be converted to various other types and vice versa. -An object that has a value not in ${'A', 'C', 'G', 'T'}$ is converted to $'A'$. -...text:$Dna$ is typedef for $SimpleType$, while $Dna_$ is a helper -specialization tag class. -..see:Metafunction.ValueSize -..see:Spec.Dna5 -..include:seqan/basic.h -*/ - -struct Dna_ {}; -typedef SimpleType Dna; - -template <> -struct ValueSize -{ - typedef __uint8 Type; - static const Type VALUE = 4; -}; - -template <> -struct BitsPerValue< Dna > -{ - typedef __uint8 Type; - static const Type VALUE = 2; -}; - -// ---------------------------------------------------------------------------- -// Specialization Dna5 -// ---------------------------------------------------------------------------- - -/*! - * @class Dna5 - * @extends SimpleType - * @headerfile - * @brief Alphabet for DNA including 'N' character. - * - * @signature typedef SimpleType Dna5; - * - * @section Remarks - * - * The @link FiniteOrderedAlphabetConcept#ValueSize @endlink of Dna5 is 5. The nucleotides are enumerated this - * way: 'A' = 0, 'C' = 1, 'G' = 2, 'T' = 3. The 'N' character ("unkown nucleotide") is encoded by 4. - * - * Objects of type Dna5 can be converted to various other types and vice versa. An object that has a value not - * in {'A', 'C', 'G', 'T'} is converted to 'N'. - * - * @see Dna5Iterator - * @see Dna5String - * @see Dna - */ - -/** -.Spec.Dna5: -..cat:Alphabets -..summary:Alphabet for DNA including 'N' character. -..general:Class.SimpleType -..signature:Dna5 -..remarks: -...text:The @Metafunction.ValueSize@ of $Dna5$ is 5. -The nucleotides are enumerated this way: $'A' = 0, 'C' = 1, 'G' = 2, 'T' = 3$. -The 'N' character ("unkown nucleotide") is encoded by 4. -...text:Objects of type $Dna5$ can be converted to various other types and vice versa. -An object that has a value not in ${'A', 'C', 'G', 'T'}$ is converted to $'N'$. -...text:$Dna5$ is typedef for $SimpleType$, while $Dna5_$ is a helper -specialization tag class. -..see:Metafunction.ValueSize -..include:seqan/basic.h -*/ - -struct Dna5_ {}; -typedef SimpleType Dna5; - -template <> -struct ValueSize -{ - typedef __uint8 Type; - static const Type VALUE = 5; -}; - -template <> -struct BitsPerValue -{ - typedef __uint8 Type; - static const Type VALUE = 3; -}; - -inline Dna5 -unknownValueImpl(Dna5 *) -{ - static const Dna5 _result = Dna5('N'); - return _result; -} - -// ---------------------------------------------------------------------------- -// Specialization DnaQ -// ---------------------------------------------------------------------------- - -/*! - * @class DnaQ - * @extends SimpleType - * @headerfile - * @implements AlphabetWithQualitiesConcept - * @brief Alphabet for DNA plus PHRED quality. - * - * @signature typedef SimpleType DnaQ; - * - * @section Remarks - * - * The ValueSize of DnaQ is 4. The nucleotides are enumerated this way: 'A' = 0, 'C' = 1, 'G' = 2, 'T' = - * 3. - * - * Objects of type DnaQ can be converted to various other types and vice versa. - * - * Note that the default quality value is set to 60. - * - * @see Dna5Q - * @see Dna - */ - -/** -.Spec.DnaQ: -..implements:Concept.AlphabetWithQualitiesConcept -..cat:Alphabets -..summary:Alphabet for DNA plus PHRED quality. -..general:Class.SimpleType -..signature:DnaQ -..remarks: -...text:The @Metafunction.ValueSize@ of $DnaQ$ is 4. -The nucleotides are enumerated this way: $'A' = 0, 'C' = 1, 'G' = 2, 'T' = 3$. -...text:Objects of type $DnaQ$ can be converted to various other types and vice versa. -...text:$DnaQ$ is typedef for $SimpleType$, while $DnaQ_$ is a helper -specialization tag class. -...text:Note that the default quality value is set to 60. -..see:Metafunction.ValueSize -..see:Spec.Dna5Q -*/ - -struct DnaQ_ {}; -typedef SimpleType DnaQ; - -template <> struct ValueSize -{ - typedef __uint8 Type; - static const ValueSize::Type VALUE = 4; // Considering nucleotides. -}; - -template <> struct InternalValueSize_ -{ - enum { VALUE = 252 }; // Considering nucleotides x Quality 0..62. -}; - -template <> struct BitsPerValue -{ - enum { VALUE = 8 }; - typedef __uint8 Type; -}; - -template <> struct HasQualities -{ - enum { VALUE = true }; - typedef True Type; -}; - -template <> -struct BaseAlphabet -{ - typedef Dna Type; -}; - -template <> -struct QualityValueSize -{ - enum { VALUE = 63 }; // 64 - 1 (N) -}; - -///.Function.getQualityValue.param.c.type:Spec.DnaQ -///.Function.getQualityValue.class:Spec.DnaQ - -inline int getQualityValue(DnaQ const & c) -{ - return c.value >> 2; -} - -///.Function.assignQualityValue.param.c.type:Spec.DnaQ -///.Function.assignQualityValue.class:Spec.DnaQ - -inline -void assignQualityValue(DnaQ & c, int q) -{ - if (q < 0) q = 0; - if (q >= QualityValueSize::VALUE) - q = QualityValueSize::VALUE - 1; - c.value = (c.value & 3) | (q << 2); -} - -inline -void assignQualityValue(DnaQ & c, char q) -{ - int q1 = static_cast(q - '!'); - if (q1 < 0) q1 = 0; - if (q1 >= QualityValueSize::VALUE) - q1 = QualityValueSize::VALUE - 1; - assignQualityValue(c, q1); -} - -inline -void assignQualityValue(char & q, DnaQ c) -{ - q = '!' + getQualityValue(c); -} - - -// ---------------------------------------------------------------------------- -// Specialization Dna5Q -// ---------------------------------------------------------------------------- - -/*! - * @class Dna5Q - * @extends SimpleType - * @headerfile - * @implements AlphabetWithQualitiesConcept - * @brief Alphabet for DNA plus PHRED quality including 'N' character. - * - * @signature typedef SimpleType Dna5Q; - * - * @section Remarks - * - * The ValueSize of Dna5Q is 5. The nucleotides are enumerated this way: 'A' = 0, 'C' = 1, 'G' = 2, 'T' = - * 3. The 'N' character ("unknown nucleotide") is encoded by 4. - * - * Objects of type Dna5 can be converted to various other types and vice versa. - * - * Note that the default quality value is set to 60. - * - * @see Dna5 - * @see DnaQ - */ - -/** -.Spec.Dna5Q -..implements:Concept.AlphabetWithQualitiesConcept -..cat:Alphabets -..summary:Alphabet for DNA plus PHRED quality including 'N' character. -..general:Class.SimpleType -..signature:Dna5Q -..remarks: -...text:The @Metafunction.ValueSize@ of $Dna5Q$ is 5. -The nucleotides are enumerated this way: $'A' = 0, 'C' = 1, 'G' = 2, 'T' = 3$. -The 'N' character ("unkown nucleotide") is encoded by 4. -...text:Objects of type $Dna5$ can be converted to various other types and vice versa. -...text:$Dna5Q$ is typedef for $SimpleType$, while $Dna5Q_$ is a helper -specialization tag class. -...text:Note that the default quality value is set to 60. -..see:Metafunction.ValueSize -*/ - -struct Dna5Q_ {}; -typedef SimpleType Dna5Q; - -static const unsigned char Dna5QValueN_ = 252; // value representing N - -template <> struct ValueSize -{ - typedef __uint8 Type; - static const Type VALUE = 5; // Considering nucleotides + N. -}; - -template <> struct InternalValueSize_ -{ - enum { VALUE = 253 }; // Considering (nucleotides x Quality 0..62) + N. -}; - -template <> struct BitsPerValue -{ - enum { VALUE = 8 }; - typedef __uint8 Type; -}; - -template <> struct HasQualities -{ - enum { VALUE = true }; - typedef True Type; -}; - -template <> -struct BaseAlphabet -{ - typedef Dna5 Type; -}; - -template <> struct -QualityValueSize -{ - enum { VALUE = 63 }; -}; - -inline Dna5Q -unknownValueImpl(Dna5Q *) -{ - static const Dna5Q _result = Dna5Q('N'); - return _result; -} - -///.Function.getQualityValue.param.c.type:Spec.Dna5Q -///.Function.getQualityValue.class.Spec.Dna5Q - -inline int getQualityValue(Dna5Q const &c) -{ - // We use a lookup table to extract the qualities from DNA5Q. The lookup - // table based code is equivalent to the following line: - // return (c.value == Dna5QValueN_)? 0: c.value >> 2; - - static const unsigned table[] = { - 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, - 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, - 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, - 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, - 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, - 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, - 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, - 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, - 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, - 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, - 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, - 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, - 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, - 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, - 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, - 0, 0, 0, 0}; - return table[c.value]; -} - -///.Function.assignQualityValue.param.c.type:Spec.Dna5Q -///.Function.assignQualityValue.class:Spec.Dna5Q - -inline -void assignQualityValue(Dna5Q &c, int q) -{ - if (q < 0) q = 0; - if (q >= QualityValueSize::VALUE) - q = QualityValueSize::VALUE - 1; - if (c.value != Dna5QValueN_) - c.value = (c.value & 3) | (q << 2); -} - -inline -void assignQualityValue(Dna5Q &c, char q) -{ - int q1 = static_cast(q - '!'); - if (q1 < 0) q1 = 0; - if (q1 >= QualityValueSize::VALUE) - q1 = QualityValueSize::VALUE - 1; - assignQualityValue(c, q1); -} - -inline -void assignQualityValue(char & q, Dna5Q c) -{ - q = '!' + getQualityValue(c); -} - -// ---------------------------------------------------------------------------- -// Specialization Rna -// ---------------------------------------------------------------------------- - -/*! - * @class Rna - * @extends SimpleType - * @headerfile - * @brief Alphabet for RNA. - * - * @signature typedef SimpleType Rna; - * - * @section Remarks - * - * The ValueSize of Rna is 4. The nucleotides are enumerated this way: 'A' = 0, 'C' = 1, 'G' = 2, 'U' = - * 3. - * - * Objects of type Rna can be converted to various other types and vice versa. An object that has a value not - * in {'A', 'C', 'G', 'U'} is converted to 'A'. - * - * Rna is typedef for SimpleType, while Rna_ is a helper specialization tag class. - * - * @see Rna5 - * @see RnaString - * @see RnaIterator - */ - -/** -.Spec.Rna: -..cat:Alphabets -..summary:Alphabet for RNA. -..general:Class.SimpleType -..signature:Rna -..remarks: -...text:The @Metafunction.ValueSize@ of $Rna$ is 4. -The nucleotides are enumerated this way: $'A' = 0, 'C' = 1, 'G' = 2, 'U' = 3$. -...text:Objects of type $Rna$ can be converted to various other types and vice versa. -An object that has a value not in ${'A', 'C', 'G', 'U'}$ is converted to $'A'$. -...text:$Rna$ is typedef for $SimpleType$, while $Rna_$ is a helper -specialization tag class. -..see:Metafunction.ValueSize -..see:Spec.Rna5 -..include:seqan/basic.h -*/ - -struct Rna_ {}; -typedef SimpleType Rna; - -template <> -struct ValueSize -{ - typedef __uint8 Type; - static const Type VALUE = 4; -}; - -template <> -struct BitsPerValue -{ - typedef __uint8 Type; - static const Type VALUE = 2; -}; - -// ---------------------------------------------------------------------------- -// Specialization Rna5 -// ---------------------------------------------------------------------------- - -/*! - * @class Rna5 - * @extends SimpleType - * @headerfile - * @brief Alphabet for RNA including 'N' character. - * - * @signature typedef SimpleType Rna5; - * - * @section Remarks - * - * The ValueSize of Rna5 is 5. The nucleotides are enumerated this way: 'A' = 0, 'C' = 1, 'G' = 2, 'U' = - * 3. The 'N' character ("unkown nucleotide") is encoded by 4. - * - * Objects of type Rna5 can be converted to various other types and vice versa. An object that has a value not - * in {'A', 'C', 'G', 'U'} is converted to 'N'. - * - * @see Rna5Iterator - * @see Rna5String - * @see Rna - */ - -/** -.Spec.Rna5: -..cat:Alphabets -..summary:Alphabet for RNA including 'N' character. -..general:Class.SimpleType -..signature:Rna5 -..remarks: -...text:The @Metafunction.ValueSize@ of $Rna5$ is 5. -The nucleotides are enumerated this way: $'A' = 0, 'C' = 1, 'G' = 2, 'U' = 3$. -The 'N' character ("unkown nucleotide") is encoded by 4. -...text:Objects of type $Rna5$ can be converted to various other types and vice versa. -An object that has a value not in ${'A', 'C', 'G', 'U'}$ is converted to $'N'$. -...text:$Rna5$ is typedef for $SimpleType$, while $Rna5_$ is a helper -specialization tag class. -..see:Metafunction.ValueSize -..include:seqan/basic.h -*/ - -struct Rna5_ {}; -typedef SimpleType Rna5; - -template <> -struct ValueSize -{ - typedef __uint8 Type; - static const Type VALUE = 5; -}; - -template <> struct BitsPerValue -{ - typedef __uint8 Type; - static const Type VALUE = 3; -}; - -inline Rna5 -unknownValueImpl(Rna5 *) -{ - static const Rna5 _result = Rna5('N'); - return _result; -} - -// ---------------------------------------------------------------------------- -// Specialization Iupac -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): We should support retrieval of nucleotides represented by a IUPAC char. - -/*! - * @class Iupac - * @extends SimpleType - * @headerfile - * @brief Iupac code for DNA. - * - * @signature typedef SimpleType Iupac; - * - * @section Remarks - * - * The ValueSize of Iupac is 16. The nucleotides are enumerated from 0 to 19 in this order: 'U'=0, 'T', 'A', - * 'W', 'C', 'Y', 'M', 'H', 'G', 'K', 'R', 'D', 'S', 'B', 'V', 'N'=15. - * - * Objects of type Iupac can be converted to various other types and vice versa. Unknown values are converted - * to 'N'. - * - * @see IupacString - * @see IupacIterator - */ - -/** -.Spec.Iupac: -..cat:Alphabets -..summary:Iupac code for DNA. -..general:Class.SimpleType -..signature:Iupac -..remarks: -...text:The @Metafunction.ValueSize@ of $Iupac$ is 16. -The nucleotides are enumerated from 0 to 19 in this order: -'U'=0, 'T', 'A', 'W', 'C', 'Y', 'M', 'H', 'G', 'K', 'R', 'D', 'S', 'B', 'V', 'N'=15. -...text:Objects of type $Iupac$ can be converted to various other types and vice versa. -Unkown values are converted to $'N'$. -...text:$Iupac$ is typedef for $SimpleType$, while $Iupac_$ is a helper -specialization tag class. -..see:Metafunction.ValueSize -..include:seqan/basic.h -*/ - -struct Iupac_ {}; -typedef SimpleType Iupac; - -template <> struct ValueSize -{ - typedef __uint8 Type; - static const Type VALUE = 16; -}; - -template <> struct BitsPerValue -{ - typedef __uint8 Type; - static const Type VALUE = 4; -}; - -inline Iupac -unknownValueImpl(Iupac *) -{ - static const Iupac _result = Iupac('N'); - return _result; -} - -// ---------------------------------------------------------------------------- -// Specialization AminoAcid -// ---------------------------------------------------------------------------- - -/*! - * @class AminoAcid - * @extends SimpleType - * @headerfile - * @brief IUPAC code for amino acids. - * @signature typedef SingleType AminoAcid; - * - * @section Remarks - * - * The ValueSize of AminoAcid is 24. - * - * The amino acids are enumerated from 0 to 15 in this order: - * - * 'A'=0, 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y', 'V'=19. - * - * The remaining 4 symbols are: - * - * 'B'=20 (Aspartic Acid, Asparagine), 'Z'=21 (Glutamic Acid, Glutamine), 'X'=22 (unknown), '*'=23 (terminator) - * - * Objects of type AminoAcid can be converted to char and vice versa. Unknown values are converted to - * 'X'. - * - * @see FiniteOrderedAlphabetConcept#ValueSize - * @see PeptideIterator - * @see Peptide - */ - -/** -.Spec.AminoAcid: -..cat:Alphabets -..summary:Iupac code for amino acids. -..general:Class.SimpleType -..signature:AminoAcid -..remarks: -...text:The @Metafunction.ValueSize@ of $AminoAcid$ is 24. -...text:The amino acids are enumerated from 0 to 15 in this order: -...text:'A'=0, 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y', 'V'=19. -...text:The remaining 4 symbols are: -...text: 'B'=20 (Aspartic Acid, Asparagine), 'Z'=21 (Glutamic Acid, Glutamine), 'X'=22 (unknown), '*'=23 (terminator) -...text:Objects of type $AminoAcid$ can be converted to $char$ and vice versa. -Unkown values are converted to $'X'$. -...text:$AminoAcid$ is typedef for $SimpleType$, while $AminoAcid_$ is a helper -specialization tag class. -..see:Metafunction.ValueSize -..include:seqan/basic.h -*/ - -struct AminoAcid_ {}; -typedef SimpleType AminoAcid; - -template <> struct ValueSize -{ - typedef __uint8 Type; - static const Type VALUE = 24; -}; - -template <> struct BitsPerValue -{ - typedef __uint8 Type; - static const Type VALUE = 5; -}; - -inline AminoAcid -unknownValueImpl(AminoAcid *) -{ - static const AminoAcid _result = AminoAcid('X'); - return _result; -} - -// ---------------------------------------------------------------------------- -// Specialization Finite -// ---------------------------------------------------------------------------- - -/*! - * @class Finite - * @extends SimpleType - * @headerfile - * - * @brief A finite alphabet of a fixed size. - * - * @signature template - * class SimpleType >; - * - * @tparam TValue The type that is use to store the values. - * @tparam SIZE The ValueSize of the alphabet. - */ - -/** -.Spec.Finite: -..cat:Alphabets -..summary:A finite alphabet of a fixed size. -..general:Class.SimpleType -..signature:SimpleType > -..param.TValue:The type that is use to store the values. -...default:$char$ -..param.SIZE:The @Metafunction.ValueSize@ of the alphabet. -..see:Metafunction.ValueSize -..include:seqan/basic.h -*/ - -template -struct Finite; - -template -struct ValueSize > > -{ - typedef __uint8 Type; - static const Type VALUE = SIZE; -}; - -template -struct BitsPerValue > > -{ - typedef __uint8 Type; - static const Type VALUE = Log2::VALUE; -}; - -// ============================================================================ -// Assignment / Conversion Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// char -// ---------------------------------------------------------------------------- - -inline void assign(char & c_target, - Dna const & source) -{ - c_target = TranslateTableDna5ToAscii_<>::VALUE[source.value]; -} - -inline void assign(char & c_target, - Dna5 const & source) -{ - c_target = TranslateTableDna5ToAscii_<>::VALUE[source.value]; -} - -inline void assign(char& target, - Rna const & source) -{ - target = TranslateTableRna5ToAscii_<>::VALUE[source.value]; -} - -inline void assign(char& target, - Rna5 const & source) -{ - target = TranslateTableRna5ToAscii_<>::VALUE[source.value]; -} - -inline void assign(char & c_target, Iupac const & source) -{ - c_target = TranslateTableIupacToAscii_<>::VALUE[source.value]; -} - -inline void assign(char & c_target, AminoAcid const & source) -{ - c_target = TranslateTableAAToAscii_<>::VALUE[source.value]; -} - -// ---------------------------------------------------------------------------- -// Dna -// ---------------------------------------------------------------------------- - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Dna & target, __uint8 c_source) -{ - target.value = TranslateTableByteToDna_<>::VALUE[c_source]; -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Dna & target, char c_source) -{ -#ifdef __CUDA_ARCH__ - target.value = _translateAsciiToDna((unsigned char)c_source); -#else - target.value = TranslateTableAsciiToDna_<>::VALUE[(unsigned char) c_source]; -#endif -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Dna & target, Unicode c_source) -{ -#ifdef __CUDA_ARCH__ - target.value = _translateAsciiToDna((unsigned char)c_source); -#else - target.value = TranslateTableAsciiToDna_<>::VALUE[(unsigned char) c_source]; -#endif -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Dna & target, Dna5 const & c_source) -{ - target.value = c_source.value & 0x03; -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Dna & target, Iupac const & source) -{ - target.value = TranslateTableIupacToDna_<>::VALUE[source.value]; -} - -// ---------------------------------------------------------------------------- -// Dna5 -// ---------------------------------------------------------------------------- - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5 & target, __uint8 c_source) -{ - target.value = TranslateTableByteToDna5_<>::VALUE[c_source]; -} - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5 & target, char c_source) -{ - target.value = TranslateTableAsciiToDna5_<>::VALUE[(unsigned char) c_source]; -} - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5 & target, Unicode c_source) -{ - target.value = TranslateTableAsciiToDna5_<>::VALUE[(unsigned char) c_source]; -} - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5 & target, Iupac const & source) -{ - target.value = TranslateTableIupacToDna5_<>::VALUE[source.value]; -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Dna5 & target, Dna const & c_source) -{ - target.value = c_source.value; -} - -// ---------------------------------------------------------------------------- -// Rna -// ---------------------------------------------------------------------------- - -template <> -struct CompareType -{ - typedef Rna Type; -}; - -inline void assign(Rna & target, __uint8 c_source) -{ - target.value = TranslateTableByteToRna_<>::VALUE[c_source]; -} - -template <> -struct CompareType -{ - typedef Rna Type; -}; - -inline void assign(Rna & target, char c_source) -{ - target.value = TranslateTableAsciiToRna_<>::VALUE[(unsigned char)c_source]; -} - -template <> -struct CompareType -{ - typedef Rna Type; -}; - -inline void assign(Rna & target, Unicode c_source) -{ - target.value = TranslateTableAsciiToRna_<>::VALUE[(unsigned char) c_source]; -} - -template <> -struct CompareType -{ - typedef Rna Type; -}; - -inline void assign(Rna & target, Rna5 const & c_source) -{ - target.value = c_source.value & 0x03; -} - -// --------------------------------------------------------------------------- -// Rna5 -// --------------------------------------------------------------------------- - -template <> -struct CompareType -{ - typedef Rna5 Type; -}; - -inline void assign(Rna5 & target, __uint8 c_source) -{ - target.value = TranslateTableByteToRna5_<>::VALUE[c_source]; -} - -template <> -struct CompareType -{ - typedef Rna5 Type; -}; - -inline void assign(Rna5 & target, char c_source) -{ - target.value = TranslateTableAsciiToRna5_<>::VALUE[(unsigned char)c_source]; -} - -template <> -struct CompareType -{ - typedef Rna5 Type; -}; - -inline void assign(Rna5 & target, Unicode c_source) -{ - target.value = TranslateTableAsciiToRna5_<>::VALUE[(unsigned char) c_source]; -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Rna5 & target, Rna const & c_source) -{ - target.value = c_source.value; -} - -// --------------------------------------------------------------------------- -// Iupac -// --------------------------------------------------------------------------- - -template <> -struct CompareType -{ - typedef Iupac Type; -}; - -inline void assign(Iupac & target, __uint8 c_source) -{ - target.value = TranslateTableByteToIupac_<>::VALUE[c_source]; -} - -template <> -struct CompareType -{ - typedef Iupac Type; -}; - -inline void assign(Iupac & target, char c_source) -{ - target.value = TranslateTableAsciiToIupac_<>::VALUE[(unsigned char) c_source]; -} - -template <> -struct CompareType -{ - typedef Iupac Type; -}; - -inline void assign(Iupac & target, Unicode c_source) -{ - target.value = TranslateTableAsciiToIupac_<>::VALUE[(unsigned char) c_source]; -} - -inline void assign(Iupac & target, Dna const & source) -{ - target.value = TranslateTableDna5ToIupac_<>::VALUE[source.value]; -} - -inline void assign(Iupac & target, Dna5 const & source) -{ - target.value = TranslateTableDna5ToIupac_<>::VALUE[source.value]; -} - -// --------------------------------------------------------------------------- -// Amino Acid -// --------------------------------------------------------------------------- - -template <> -struct CompareType -{ - typedef AminoAcid Type; -}; - -inline void assign(AminoAcid & target, __uint8 c_source) -{ - target.value = TranslateTableByteToAA_<>::VALUE[c_source]; -} - -template <> -struct CompareType -{ - typedef AminoAcid Type; -}; - -inline void assign(AminoAcid & target, char c_source) -{ - target.value = TranslateTableAsciiToAA_<>::VALUE[(unsigned char) c_source]; -} - -template <> -struct CompareType -{ - typedef AminoAcid Type; -}; - -inline void assign(AminoAcid & target, Unicode c_source) -{ - target.value = TranslateTableAsciiToAA_<>::VALUE[(unsigned char) c_source]; -} - -// --------------------------------------------------------------------------- -// DnaQ -// --------------------------------------------------------------------------- - -// template -// struct CompareType, SimpleType > -// { -// typedef SimpleType Type; -// }; -// -// template -// struct CompareType, SimpleType > -// { -// typedef SimpleType Type; -// }; - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(DnaQ & target, Dna const & source) -{ - target.value = source.value | (60 << 2); -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Dna & target, DnaQ const & source) -{ - target.value = source.value & 3; -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(DnaQ & target, Iupac const & source) -{ - assign(target, (Dna) source); -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(DnaQ & target, Dna5 const & source) -{ - assign(target, (Dna) source); -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(DnaQ & target, __uint8 c_source) -{ - assign(target, (Dna) c_source); -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(DnaQ & target, char c_source) -{ - assign(target, (Dna) c_source); -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(DnaQ & target, Unicode c_source) -{ - assign(target, (Dna) c_source); -} - -inline void -assign(DnaQ & target, DnaQ const & source) -{ - target.value = source.value; -} - -template -inline void -assign(DnaQ & target, TSource const & source) -{ - target.value = (Dna)source; -} - -inline void -assign(__int64 & c_target, - DnaQ & source) -{ - c_target = Dna(source); -} - -inline void -assign(__int64 & c_target, - DnaQ const & source) -{ - c_target = Dna(source); -} - -// __uint64 - -inline void -assign(__uint64 & c_target, - DnaQ & source) -{ - c_target = Dna(source); -} - -inline void -assign(__uint64 & c_target, - DnaQ const & source) -{ - c_target = Dna(source); -} - -// int - -inline void -assign(int & c_target, - DnaQ & source) -{ - c_target = Dna(source); -} - -inline void -assign(int & c_target, - DnaQ const & source) -{ - c_target = Dna(source); -} - -// unsigned int - -inline void -assign(unsigned int & c_target, - DnaQ & source) -{ - c_target = Dna(source); -} - -inline void -assign(unsigned int & c_target, - DnaQ const & source) -{ - c_target = Dna(source); -} - -// short - -inline void -assign(short & c_target, - DnaQ & source) -{ - c_target = Dna(source); -} - -inline void -assign(short & c_target, - DnaQ const & source) -{ - c_target = Dna(source); -} - -// unsigned short - -inline void -assign(unsigned short & c_target, - DnaQ & source) -{ - c_target = Dna(source); -} - -inline void -assign(unsigned short & c_target, - DnaQ const & source) -{ - c_target = Dna(source); -} - -// char - -inline void -assign(char & c_target, - DnaQ & source) -{ - c_target = Dna(source); -} - -inline void -assign(char & c_target, - DnaQ const & source) -{ - c_target = Dna(source); -} - -// signed char - -inline void -assign(signed char & c_target, - DnaQ & source) -{ - c_target = Dna(source); -} - -inline void -assign(signed char & c_target, - DnaQ const & source) -{ - c_target = Dna(source); -} - -// unsigned char - -inline void -assign(unsigned char & c_target, - DnaQ & source) -{ - c_target = Dna(source); -} - -inline void -assign(unsigned char & c_target, - DnaQ const & source) -{ - c_target = Dna(source); -} - -// --------------------------------------------------------------------------- -// Dna5Q -// --------------------------------------------------------------------------- - -// template -// struct CompareType, SimpleType > -// { -// typedef SimpleType Type; -// }; -// -// template -// struct CompareType, SimpleType > -// { -// typedef SimpleType Type; -// }; - - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(DnaQ & target, Dna5Q const & source) -{ - // We perform the converstion from DNA5 to DNA5 with qualities by a simple - // table lookup. The lookup below is equivalent to the following line: - // - // target.value = (source.value == Dna5QValueN_)? 0: source.value; - - static const unsigned table[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 0, 0, 0, 0 - }; - target.value = table[source.value]; -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Dna5Q & target, DnaQ const & source) -{ - target.value = source.value; -} - - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5 & target, Dna5Q const & source) -{ - SEQAN_CHECKPOINT;; - - // We perform the conversion from DNA5 to DNA5 with qualities by a simple - // table lookup. The lookup below is equivalent to the following line: - // - // target.value = (source.value == Dna5QValueN_)? 4: source.value & 3; - - static const unsigned table[] = { - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 4, 4, 4, 4 // <-- note the 4 - }; - target.value = table[source.value]; -} - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5Q & target, Dna5 const & source) -{ - - // We perform the conversion from DNA5 with qualities to DNA5 by a simple - // table lookup. The lookup below is equivalent to the following line: - // - // target.value = (source.value == 4)? Dna5QValueN_ : source.value | (60 << 2); - - static const unsigned table[] = { - (60 << 2) + 0, (60 << 2) + 1, (60 << 2) + 2, (60 << 2) + 3, Dna5QValueN_ - }; - target.value = table[source.value]; -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Dna5Q & target, Dna const & source) -{ - assign(target, (DnaQ) source); -} - -template <> -struct CompareType -{ - typedef Dna Type; -}; - -inline void assign(Dna & target, Dna5Q const & source) -{ - assign(target, (Dna5)source); -} - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5 & target, DnaQ const & source) -{ - assign(target, (Dna5Q)source); -} - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5Q & target, __uint8 c_source) -{ - assign(target, (Dna5)c_source); -} - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5Q & target, char c_source) -{ - assign(target, (Dna5)c_source); -} - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5Q & target, Unicode c_source) -{ - assign(target, (Dna5)c_source); -} - -template <> -struct CompareType -{ - typedef Dna5 Type; -}; - -inline void assign(Dna5Q & target, Iupac const & source) -{ - assign(target, (Dna5)source); -} - -inline void -assign(Dna5Q & target, Dna5Q const & source) -{ - target.value = source.value; -} - -template -inline void -assign(Dna5Q & target, TSource const & source) -{ - assign(target, (Dna5)source); -} - -// __int64 - -inline void -assign(__int64 & c_target, - Dna5Q & source) -{ - c_target = Dna5(source); -} - -inline void -assign(__int64 & c_target, - Dna5Q const & source) -{ - c_target = Dna5(source); -} - -// __uint64 - -inline void -assign(__uint64 & c_target, - Dna5Q & source) -{ - c_target = Dna5(source); -} - -inline void -assign(__uint64 & c_target, - Dna5Q const & source) -{ - c_target = Dna5(source); -} - -// int - -inline void -assign(int & c_target, - Dna5Q & source) -{ - c_target = Dna5(source); -} - -inline void -assign(int & c_target, - Dna5Q const & source) -{ - c_target = Dna5(source); -} - -// unsigned int - -inline void -assign(unsigned int & c_target, - Dna5Q & source) -{ - c_target = Dna5(source); -} - -inline void -assign(unsigned int & c_target, - Dna5Q const & source) -{ - c_target = Dna5(source); -} - - -//short - -inline void -assign(short & c_target, - Dna5Q & source) -{ - c_target = Dna5(source); -} - -inline void -assign(short & c_target, - Dna5Q const & source) -{ - c_target = Dna5(source); -} - -//unsigned short - -inline void -assign(unsigned short & c_target, - Dna5Q & source) -{ - c_target = Dna5(source); -} - -inline void -assign(unsigned short & c_target, - Dna5Q const & source) -{ - c_target = Dna5(source); -} - -// char - -inline void -assign(char & c_target, - Dna5Q & source) -{ - c_target = Dna5(source); -} - -inline void -assign(char & c_target, - Dna5Q const & source) -{ - c_target = Dna5(source); -} - -// signed char - -inline void -assign(signed char & c_target, - Dna5Q & source) -{ - c_target = Dna5(source); -} - -inline void -assign(signed char & c_target, - Dna5Q const & source) -{ - c_target = Dna5(source); -} - -// unsigned char - -inline void -assign(unsigned char & c_target, - Dna5Q & source) -{ - c_target = Dna5(source); -} - -inline void -assign(unsigned char & c_target, - Dna5Q const & source) -{ - c_target = Dna5(source); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_RESIDUE_H_ diff --git a/seqan/basic/alphabet_residue_funcs.h b/seqan/basic/alphabet_residue_funcs.h deleted file mode 100644 index 847437c..0000000 --- a/seqan/basic/alphabet_residue_funcs.h +++ /dev/null @@ -1,63 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2013 NVIDIA Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Enrico Siragusa -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_RESIDUE_FUNCS_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_RESIDUE_FUNCS_H_ - - -namespace seqan { - -// -------------------------------------------------------------------------- -// Dna -// -------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline unsigned char -_translateAsciiToDna(unsigned char c) -{ - switch (toUpperValue(c)) - { - case 'C': - return 1; - case 'G': - return 2; - case 'T': - return 3; - default: - return 0; - }; -} -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_RESIDUE_FUNCS_H_ diff --git a/seqan/basic/alphabet_residue_tabs.h b/seqan/basic/alphabet_residue_tabs.h deleted file mode 100644 index e30fd43..0000000 --- a/seqan/basic/alphabet_residue_tabs.h +++ /dev/null @@ -1,586 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// ========================================================================== -// Conversion tables for residue SimpleType specializations. -// -// Dna and Dna5 share their tables for conversion to char. So do Rna and -// Rna5. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_RESIDUE_TABS_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_RESIDUE_TABS_H_ - - -namespace seqan { - -// -------------------------------------------------------------------------- -// Dna and Dna5 -// -------------------------------------------------------------------------- - -template -struct TranslateTableDna5ToAscii_ -{ - static char const VALUE[5]; -}; - -template -char const TranslateTableDna5ToAscii_::VALUE[5] = {'A', 'C', 'G', 'T', 'N'}; - - -template -struct TranslateTableDna5ToIupac_ -{ - static char const VALUE[5]; -}; - -template -char const TranslateTableDna5ToIupac_::VALUE[5] = {0x02, 0x04, 0x08, 0x01, 0x0f}; - -template -struct TranslateTableAsciiToDna_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableAsciiToDna_::VALUE[256] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //1 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //2 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //3 - - 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, //4 -// , A, B, C, D, E, D, G, H, I, J, K, L, M, N, O, - - 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //5 -// P, Q, R, S, T, U, V, W, X, Y, Z, , , , , - - 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, //6 -// , a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, - - 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //7 -// p, q, r, s, t, u, v, w, x, y, z, , , , , - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //8 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //9 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //10 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //11 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //12 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //13 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //14 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 //15 -}; - - -template -struct TranslateTableAsciiToDna5_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableAsciiToDna5_::VALUE[256] = -{ - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //0 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //1 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //2 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //3 - - 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, //4 -// , A, B, C, D, E, D, G, H, I, J, K, L, M, N, O, - - 4, 4, 4, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //5 -// P, Q, R, S, T, U, V, W, X, Y, Z, , , , , - - 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, //6 -// , a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, - - 4, 4, 4, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //7 -// p, q, r, s, t, u, v, w, x, y, z, , , , , - - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //8 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //9 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //10 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //11 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //12 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //13 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //14 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 //15 -}; - -template -struct TranslateTableByteToDna_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableByteToDna_::VALUE[256] = -{ - 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //1 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //2 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //3 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //4 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //5 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //6 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //7 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //8 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //9 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //10 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //11 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //12 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //13 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //14 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 //15 -}; - -template -struct TranslateTableByteToDna5_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableByteToDna5_::VALUE[256] = -{ - 0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //0 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //1 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //2 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //3 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //4 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //5 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //6 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //7 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //8 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //9 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //10 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //11 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //12 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //13 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //14 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 //15 -}; - -// -------------------------------------------------------------------------- -// Rna and Rna5 -// -------------------------------------------------------------------------- - -template -struct TranslateTableRna5ToAscii_ -{ - static char const VALUE[5]; -}; - -template -char const TranslateTableRna5ToAscii_::VALUE[5] = {'A', 'C', 'G', 'U', 'N'}; - -template -struct TranslateTableAsciiToRna_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableAsciiToRna_::VALUE[256] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //1 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //2 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //3 - - 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, //4 -// , A, B, C, D, E, D, G, H, I, J, K, L, M, N, O, - - 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //5 -// P, Q, R, S, T, U, V, W, X, Y, Z, , , , , - - 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, //6 -// , a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, - - 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //7 -// p, q, r, s, t, u, v, w, x, y, z, , , , , - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //8 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //9 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //10 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //11 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //12 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //13 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //14 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 //15 -}; - -template -struct TranslateTableAsciiToRna5_ -{ - static char const VALUE[256]; -}; -template -char const TranslateTableAsciiToRna5_::VALUE[256] = -{ - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //0 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //1 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //2 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //3 - - 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, //4 -// , A, B, C, D, E, D, G, H, I, J, K, L, M, N, O, - - 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //5 -// P, Q, R, S, T, U, V, W, X, Y, Z, , , , , - - 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, //6 -// , a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, - - 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //7 -// p, q, r, s, t, u, v, w, x, y, z, , , , , - - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //8 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //9 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //10 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //11 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //12 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //13 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, //14 - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 //15 -}; - - -template -struct TranslateTableByteToRna_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableByteToRna_::VALUE[256] = -{ - 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //1 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //2 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //3 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //4 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //5 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //6 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //7 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //8 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //9 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //10 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //11 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //12 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //13 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //14 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 //15 -}; - -template -struct TranslateTableByteToRna5_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableByteToRna5_::VALUE[256] = -{ - 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //1 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //2 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //3 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //4 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //5 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //6 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //7 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //8 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //9 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //10 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //11 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //12 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //13 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //14 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 //15 -}; - -// -------------------------------------------------------------------------- -// Iupac -// -------------------------------------------------------------------------- - -template -struct TranslateTableIupacToAscii_ -{ - static char const VALUE[16]; -}; - -template -char const TranslateTableIupacToAscii_::VALUE[16] = -{ - 'U', //0000=0 - 'T', //0001=1 //T=1: change between U and T is just inc/dec - 'A', //0010=2 - 'W', //0011=3 TA - 'C', //0100=4 - 'Y', //0101=5 TC (pyrimidine) - 'M', //0110=6 AC - 'H', //0111=7 not-G - 'G', //1000=8 - 'K', //1001=9 TG - 'R', //1010=A AG (purine) - 'D', //1011=B not-C - 'S', //1100=C CG - 'B', //1101=D non-A - 'V', //1110=E non-T - 'N' //1111=F any -}; - -template -struct TranslateTableIupacToDna_ -{ - static char const VALUE[16]; -}; - -template -char const TranslateTableIupacToDna_::VALUE[16] = -{ - 3, //'U' - 3, //'T' - 0, //'A' - 0, //'W' = TA - 1, //'C' - 1, //'Y' = TC - 0, //'M' = AC - 0, //'H' = not-G - 2, //'G' - 2, //'K' = TG - 0, //'R' = AG - 0, //'D' = not-C - 1, //'S' = CG - 1, //'B' = non-A - 0, //'V' = non-T - 0 //'N' = any -}; - -template -struct TranslateTableIupacToDna5_ -{ - static char const VALUE[16]; -}; - -template -char const TranslateTableIupacToDna5_::VALUE[16] = -{ - 3, //'U' - 3, //'T' - 0, //'A' - 4, //'W' = TA - 1, //'C' - 4, //'Y' = TC - 4, //'M' = AC - 4, //'H' = not-G - 2, //'G' - 4, //'K' = TG - 4, //'R' = AG - 4, //'D' = not-C - 4, //'S' = CG - 4, //'B' = non-A - 4, //'V' = non-T - 4 //'N' = any -}; - -template -struct TranslateTableAsciiToIupac_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableAsciiToIupac_::VALUE[256] = -{ - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //0 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //1 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //2 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //3 - - 15, 2, 13, 4, 11, 15, 15, 8, 7, 15, 15, 9, 15, 6, 15, 15, //4 - // , A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, - - 15, 15, 10, 12, 1, 0, 14, 3, 15, 5, 15, 15, 15, 15, 15, 15, //5 - // P, Q, R, S, T, U, V, W, X, Y, Z, , , , , - - 15, 2, 13, 4, 11, 15, 15, 8, 7, 15, 15, 9, 15, 6, 15, 15, //6 - // , a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, - - 15, 15, 10, 12, 1, 0, 14, 3, 15, 5, 15, 15, 15, 15, 15, 15, //7 - // p, q, r, s, t, u, v, w, x, y, z, , , , , - - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //8 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //9 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //10 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //11 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //12 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //13 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //14 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 //15 -}; - -template -struct TranslateTableByteToIupac_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableByteToIupac_::VALUE[256] = -{ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, //0 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //1 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //2 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //3 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //4 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //5 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //6 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //7 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //8 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //9 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //10 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //11 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //12 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //13 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, //14 - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 //15 -}; - -// -------------------------------------------------------------------------- -// Amino Acid -// -------------------------------------------------------------------------- - -template -struct TranslateTableAAToAscii_ -{ - static char const VALUE[24]; -}; -template -char const TranslateTableAAToAscii_::VALUE[24] = -{ - 'A', // 0 Ala Alanine - 'R', // 1 Arg Arginine - 'N', // 2 Asn Asparagine - 'D', // 3 Asp Aspartic Acid - 'C', // 4 Cys Cystine - 'Q', // 5 Gln Glutamine - 'E', // 6 Glu Glutamic Acid - 'G', // 7 Gly Glycine - 'H', // 8 His Histidine - 'I', // 9 Ile Isoleucine - 'L', //10 Leu Leucine - 'K', //11 Lys Lysine - 'M', //12 Met Methionine - 'F', //13 Phe Phenylalanine - 'P', //14 Pro Proline - 'S', //15 Ser Serine - 'T', //16 Thr Threonine - 'W', //17 Trp Tryptophan - 'Y', //18 Tyr Tyrosine - 'V', //19 Val Valine - 'B', //20 Aspartic Acid, Asparagine - 'Z', //21 Glutamic Acid, Glutamine - 'X', //22 Unknown - '*' //23 Terminator -}; - -template -struct TranslateTableAsciiToAA_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableAsciiToAA_::VALUE[256] = -{ - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //0 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //1 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 22, 22, 22, 22, 22, //2 -// * - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //3 - 22, 0, 20, 4, 3, 6, 13, 7, 8, 9, 22, 11, 10, 12, 2, 22, //4 -// , A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, - - 14, 5, 1, 15, 16, 22, 19, 17, 22, 18, 21, 22, 22, 22, 22, 22, //5 -// P, Q, R, S, T, U, V, W, X, Y, Z, , , , , , - - 22, 0, 20, 4, 3, 6, 13, 7, 8, 9, 22, 11, 10, 12, 2, 22, //6 -// , a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, - - 14, 5, 1, 15, 16, 22, 19, 17, 22, 18, 21, 22, 22, 22, 22, 22, //7 -// p, q, r, s, t, u, v, w, x, y, z, , , , , , - - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //8 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //9 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //10 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //11 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //12 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //13 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //14 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 //15 -}; - -template -struct TranslateTableByteToAA_ -{ - static char const VALUE[256]; -}; - -template -char const TranslateTableByteToAA_::VALUE[256] = -{ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, //0 - 16, 17, 18, 19, 20, 21, 22, 23, 22, 22, 22, 22, 22, 22, 22, 22, //1 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //2 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //3 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //4 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //5 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //6 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //7 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //8 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //9 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //10 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //11 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //12 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //13 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, //14 - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 //15 -}; - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_RESIDUE_TABS_H_ diff --git a/seqan/basic/alphabet_simple_type.h b/seqan/basic/alphabet_simple_type.h deleted file mode 100644 index 2d392c6..0000000 --- a/seqan/basic/alphabet_simple_type.h +++ /dev/null @@ -1,1081 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// Author: Manuel Holtgrewe -// ========================================================================== -// The SimpleType alphabet type is the base class for all residue types. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_SIMPLE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_SIMPLE_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class SimpleType -// ---------------------------------------------------------------------------- - -/*! - * @class SimpleType - * @implements FiniteOrderedAlphabetConcept - * @headerfile - * - * @brief Implementation for "simple" types. - * - * @signature template - * class SimpleType; - * - * @tparam TSpec Specialization tag. - * @tparam TValue Type that stores the values of an instance. TValue must be a simple type. - * - * @section Remarks - * - * A "simple type" is a C++ type that can be constructed without constructor, destructed without destructor and copied - * without copy constructor or assignment operator. All basic types (like char, int or - * float) are simple. Pointers, references and arrays of simple types are simple. POD types ("plain old data - * types"), that are - simplified spoken - C++-types that already existed in C, are simple too. - * - * Arrays of simple types can be copied very fast by memory manipulation routines, but the default implementation of - * functions like arrayCopyForward and arrayCopy are not optimized for simple types this way. But for classes derived - * from SimpleType, optimized variants of array manipulation functions are applied. - * - * Note that simple types need not to be derived or specialized from SimpleType, but it could be convenient to - * do so. - * - * @see IsSimple - */ - -/** -.Class.SimpleType: -..cat:Basic -..implements:Concept.FiniteOrderedAlphabetConcept -..summary:Implementation for "simple" types. -..signature:SimpleType -..param.TValue:Type that stores the values of an instance. -...remarks:TValue must be a simple type. -...metafunction:Metafunction.Value -..param.TSpec:Specialization tag. -...metafunction:Metafunction.Spec -..remarks: -...text:A "simple type" is a C++ type that can be constructed without constructor, -destructed without destructor and copied without copy constructor or assignment operator. -All basic types (like $char$, $int$ or $float$) are simple. Pointers, references and arrays of -simple types are simple. -POD types ("plain old data types"), that are - simplified spoken - C++-types that already existed in C, -are simple too. -...text:Arrays of simple types can be copied very fast by memory manipulation routines, -but the default implementation of functions like @Function.arrayCopyForward@ and @Function.arrayCopy@ -are not optimized for simple types this way. -But for classes derived from $SimpleType$, optimized variants of array manipulation functions are applied. -...text:Note that simple types need not to be derived or specialized from $SimpleType$, but -it could be convenient to do so. -..include:seqan/basic.h -*/ - -#ifdef PLATFORM_WINDOWS - #pragma pack(push,1) -#endif -template -class SimpleType -{ -public: - // ------------------------------------------------------------------------ - // Members; Have to be defined in class. - // ------------------------------------------------------------------------ - - TValue value; - - // ------------------------------------------------------------------------ - // Constructors; Have to be defined in class. - // ------------------------------------------------------------------------ - - // TODO(holtgrew): Do we want default initialization? - SEQAN_HOST_DEVICE - SimpleType() : value(0) - {} - - SEQAN_HOST_DEVICE - SimpleType(SimpleType const & other) - { - assign(*this, other); - } - - // TODO(holtgrew): Do we want an explicit here? - template - SEQAN_HOST_DEVICE - SimpleType(T const & other) - { - assign(*this, other); - } - - // ------------------------------------------------------------------------ - // Assignment Operator; Have to be defined in class. - // ------------------------------------------------------------------------ - - SEQAN_HOST_DEVICE - SimpleType & operator=(SimpleType const & other) - { - assign(*this, other); - return *this; - } - - template - SEQAN_HOST_DEVICE inline SimpleType & - operator=(T const & other) - { - assign(*this, other); - return *this; - } - - // ------------------------------------------------------------------------ - // Conversion Operators; Have to be defined in class. - // ------------------------------------------------------------------------ - - // Class.SimpleType specifies type conversion operators for all built-in - // integer types since there is no way to extend the build-in types with - // copy and assignment constructors in C++. - // - // This cannot be a template since it would conflict to the template - // constructor. - - SEQAN_HOST_DEVICE - operator __int64() const - { - __int64 c; - assign(c, *this); - return c; - } - - SEQAN_HOST_DEVICE - operator __uint64() const - { - __uint64 c; - assign(c, *this); - return c; - } - - SEQAN_HOST_DEVICE - operator int() const - { - int c; - assign(c, *this); - return c; - } - - SEQAN_HOST_DEVICE - operator unsigned int() const - { - unsigned int c; - assign(c, *this); - return c; - } - - SEQAN_HOST_DEVICE - operator short() const - { - short c; - assign(c, *this); - return c; - } - - SEQAN_HOST_DEVICE - operator unsigned short() const - { - unsigned short c; - assign(c, *this); - return c; - } - - SEQAN_HOST_DEVICE - operator char() const - { - char c; - assign(c, *this); - return c; - } - - SEQAN_HOST_DEVICE - operator signed char() const - { - signed char c; - assign(c, *this); - return c; - } - - SEQAN_HOST_DEVICE - operator unsigned char() const - { - unsigned char c; - assign(c, *this); - return c; - } -} -#ifndef PLATFORM_WINDOWS - __attribute__((packed)) -#endif - ; -#ifdef PLATFORM_WINDOWS - #pragma pack(pop) -#endif - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction IsSimple -// ---------------------------------------------------------------------------- - -///.Metafunction.IsSimple.param.T.type:Class.SimpleType - -template -struct IsSimple > -{ - typedef True Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Value -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Rename? SimpleType is no container! - -///.Metafunction.Value.param.T.type:Class.SimpleType - -template -struct Value > -{ - typedef TValue Type; -}; - -template -struct Value const> -{ - typedef TValue const Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction MinValue -// ---------------------------------------------------------------------------- - -template -struct MinValue > -{ - static const SimpleType VALUE; -}; - -template -const SimpleType MinValue >::VALUE = SimpleType(0); - -template -SEQAN_HOST_DEVICE inline SimpleType const & -infimumValueImpl(SimpleType *) -{ - return MinValue >::VALUE; -} - -// ---------------------------------------------------------------------------- -// Metafunction MaxValue -// ---------------------------------------------------------------------------- - -template -struct MaxValue > -{ - static const SimpleType VALUE; -}; - -template -const SimpleType MaxValue >::VALUE = SimpleType(((TValue)ValueSize >::VALUE - 1)); - -template -SEQAN_HOST_DEVICE inline SimpleType const & -supremumValueImpl(SimpleType *) -{ - return MaxValue >::VALUE; -} - -// ---------------------------------------------------------------------------- -// Metafunction Spec -// ---------------------------------------------------------------------------- - -///.Metafunction.Spec.param.T.type:Class.SimpleType - -template -struct Spec > -{ - typedef TSpec Type; -}; - -template -struct Spec const> -{ - typedef TSpec Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction CompareType -// ---------------------------------------------------------------------------- - -// TODO(doering): muss geprueft werden, ob diese Metafunktion noch ausgeweitet oder aber versteckt wird. -// TODO(holtgrew): Is this at the right place here? Do we need it for all types? -// TODO(holtgrew): CompareType is not symmetric because of class instantiation conflicts. Evaluate these problems and possibly fix them. -// TODO(holtgrew): Is some of the code below redundant, can we lose some copy and paste here? - -template -struct CompareType, TRight> -{ - typedef TRight Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// TODO(holtgrew): Why are functions with Proxies defined here? Better in Proxy header? Or externalize? - -// ---------------------------------------------------------------------------- -// Function convertImpl() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Document - -template -SEQAN_HOST_DEVICE inline typename RemoveConst_::Type -convertImpl(Convert const, - SimpleType const & source_) -{ - typename RemoveConst_::Type target_; - assign(target_, source_); - return target_; -} - -// ---------------------------------------------------------------------------- -// Function operator<<() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline TStream & -operator<<(TStream & stream, - SimpleType const & data) -{ - stream << convert(data); - return stream; -} - -// ---------------------------------------------------------------------------- -// Function operator>>() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline TStream & -operator>>(TStream & stream, - SimpleType & data) -{ - char c; - stream >> c; - assign(data, c); - return stream; -} - -// ---------------------------------------------------------------------------- -// Function assign() -// ---------------------------------------------------------------------------- - -///.Function.assign.param.target.type:Class.SimpleType -///.Function.assign.param.target.type:Class.SimpleType -///.Function.assign.class:Class.SimpleType - -template -SEQAN_HOST_DEVICE inline void -assign(SimpleType & target, - SimpleType & source) -{ - target.value = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(SimpleType & target, - SimpleType const & source) -{ - target.value = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(SimpleType & target, - TSource & source) -{ - target.value = source; -} - -template -SEQAN_HOST_DEVICE inline void -assign(SimpleType & target, - TSource const & source) -{ - target.value = source; -} - -// Assign Proxy to SimpleType -// NOTE(doering): Diese Funktionen wurden noetig wegen eines seltsamen VC++-Verhaltens -// TODO(holtgrew): Still necessary with dropped 2003 support? - -template -SEQAN_HOST_DEVICE inline void -assign(SimpleType & target, - Proxy & source) -{ - target.value = getValue(source); -} - -template -SEQAN_HOST_DEVICE inline void -assign(SimpleType & target, - Proxy const & source) -{ - target.value = getValue(source); -} - -//INTEGRAL TYPES -// NOTE(doering): It is not possible to write a single function here since "assign" must be specialized for the first argument at the first place - -template -SEQAN_HOST_DEVICE inline void -assign(__int64 & c_target, - SimpleType & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(__int64 & c_target, - SimpleType const & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(__uint64 & c_target, - SimpleType & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(__uint64 & c_target, - SimpleType const & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(int & c_target, - SimpleType & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(int & c_target, - SimpleType const & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(unsigned int & c_target, - SimpleType & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(unsigned int & c_target, - SimpleType const & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(short & c_target, - SimpleType & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(short & c_target, - SimpleType const & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(unsigned short & c_target, - SimpleType & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(unsigned short & c_target, - SimpleType const & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(char & c_target, - SimpleType & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(char & c_target, - SimpleType const & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(signed char & c_target, - SimpleType & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(signed char & c_target, - SimpleType const & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(unsigned char & c_target, - SimpleType & source) -{ - c_target = source.value; -} - -template -SEQAN_HOST_DEVICE inline void -assign(unsigned char & c_target, - SimpleType const & source) -{ - c_target = source.value; -} - -// ---------------------------------------------------------------------------- -// Function operator==() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline bool -operator==(SimpleType const & left_, - TRight const & right_) -{ - typedef SimpleType TLeft; - typedef typename CompareType::Type TCompareType; - return convert(left_) == convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator==(TLeft const & left_, - SimpleType const & right_) -{ - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) == convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator==(SimpleType const & left_, - SimpleType const & right_) -{ - typedef SimpleType TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) == convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator==(SimpleType const & left_, - SimpleType const & right_) -{ - return convert(left_) == convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator==(Proxy const & left_, - SimpleType const & right_) -{ - typedef Proxy TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) == convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator==(SimpleType const & left_, - Proxy const & right_) -{ - typedef SimpleType TLeft; - typedef Proxy TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) == convert(right_); -} - -// ---------------------------------------------------------------------------- -// Function operator!=() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline bool -operator!=(SimpleType const & left_, - TRight const & right_) -{ - typedef SimpleType TLeft; - typedef typename CompareType::Type TCompareType; - return convert(left_) != convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator!=(TLeft const & left_, - SimpleType const & right_) -{ - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) != convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator!=(SimpleType const & left_, - SimpleType const & right_) -{ - typedef SimpleType TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) != convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator!=(SimpleType const & left_, - SimpleType const & right_) -{ - return convert(left_) != convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator!=(Proxy const & left_, - SimpleType const & right_) -{ - typedef Proxy TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) != convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator!=(SimpleType const & left_, - Proxy const & right_) -{ - typedef SimpleType TLeft; - typedef Proxy TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) != convert(right_); -} - -// ---------------------------------------------------------------------------- -// Function operator<() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline bool -operator<(SimpleType const & left_, - TRight const & right_) -{ - typedef SimpleType TLeft; - typedef typename CompareType::Type TCompareType; - return convert(left_) < convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator<(TLeft const & left_, - SimpleType const & right_) -{ - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) < convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator<(SimpleType const & left_, - SimpleType const & right_) -{ - typedef SimpleType TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) < convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator<(SimpleType const & left_, - SimpleType const & right_) -{ - return convert(left_) < convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator<(Proxy const & left_, - SimpleType const & right_) -{ - typedef Proxy TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) < convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator<(SimpleType const & left_, - Proxy const & right_) -{ - typedef SimpleType TLeft; - typedef Proxy TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) < convert(right_); -} - -// ---------------------------------------------------------------------------- -// Function operator<=() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline bool -operator<=(SimpleType const & left_, - TRight const & right_) -{ - typedef SimpleType TLeft; - typedef typename CompareType::Type TCompareType; - return convert(left_) <= convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator<=(TLeft const & left_, - SimpleType const & right_) -{ - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) <= convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator<=(SimpleType const & left_, - SimpleType const & right_) -{ - typedef SimpleType TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) <= convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator<=(SimpleType const & left_, - SimpleType const & right_) -{ - return convert(left_) <= convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator<=(Proxy const & left_, - SimpleType const & right_) -{ - typedef Proxy TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) <= convert(right_); -} -template -SEQAN_HOST_DEVICE inline bool -operator<=(SimpleType const & left_, - Proxy const & right_) -{ - typedef SimpleType TLeft; - typedef Proxy TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) <= convert(right_); -} - -// ---------------------------------------------------------------------------- -// Function operator>() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline bool -operator>(SimpleType const & left_, - TRight const & right_) -{ - typedef SimpleType TLeft; - typedef typename CompareType::Type TCompareType; - return convert(left_) > convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator>(TLeft const & left_, - SimpleType const & right_) -{ - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) > convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator>(SimpleType const & left_, - SimpleType const & right_) -{ - typedef SimpleType TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) > convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator>(SimpleType const & left_, - SimpleType const & right_) -{ - return convert(left_) > convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator>(Proxy const & left_, - SimpleType const & right_) -{ - typedef Proxy TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) > convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator>(SimpleType const & left_, - Proxy const & right_) -{ - typedef SimpleType TLeft; - typedef Proxy TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) > convert(right_); -} - -// ---------------------------------------------------------------------------- -// Function operator>=() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline bool -operator>=(SimpleType const & left_, - TRight const & right_) -{ - typedef SimpleType TLeft; - typedef typename CompareType::Type TCompareType; - return convert(left_) >= convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator>=(TLeft const & left_, - SimpleType const & right_) -{ - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) >= convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator>=(SimpleType const & left_, - SimpleType const & right_) -{ - typedef SimpleType TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) >= convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator>=(SimpleType const & left_, - SimpleType const & right_) -{ - return convert(left_) >= convert(right_); -} - -template -SEQAN_HOST_DEVICE inline bool -operator>=(Proxy const & left_, - SimpleType const & right_) -{ - typedef Proxy TLeft; - typedef SimpleType TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) >= convert(right_); -} -template -SEQAN_HOST_DEVICE inline bool -operator>=(SimpleType const & left_, - Proxy const & right_) -{ - typedef SimpleType TLeft; - typedef Proxy TRight; - typedef typename CompareType::Type TCompareType; - return convert(left_) >= convert(right_); -} - -// ---------------------------------------------------------------------------- -// Function operator++() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline SimpleType & -operator++(SimpleType & me) -{ - ++me.value; - return me; -} - -template -SEQAN_HOST_DEVICE inline SimpleType -operator++(SimpleType & me, int) -{ - SimpleType dummy = me; - ++me.value; - return dummy; -} - -// ---------------------------------------------------------------------------- -// Function operator--() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline SimpleType & -operator--(SimpleType & me) -{ - --me.value; - return me; -} - -template -SEQAN_HOST_DEVICE inline SimpleType -operator--(SimpleType & me, int) -{ - SimpleType dummy = me; - --me.value; - return dummy; -} - -// ---------------------------------------------------------------------------- -// Function operator+() [unary] -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline SimpleType -operator+(SimpleType const & v) -{ - return v; -} - -template -SEQAN_HOST_DEVICE inline typename ValueSize >::Type -_internalOrdValue(SimpleType const & c) -{ - return c.value; -} - -template -SEQAN_HOST_DEVICE inline typename ValueSize >::Type -ordValue(SimpleType const & c) -{ - return convert(c); -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_SIMPLE_H_ diff --git a/seqan/basic/alphabet_storage.h b/seqan/basic/alphabet_storage.h deleted file mode 100644 index a2e7ba9..0000000 --- a/seqan/basic/alphabet_storage.h +++ /dev/null @@ -1,335 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Doering -// Author: Manuel Holtgrewe -// ========================================================================== -// Storage-related alphabet interface part. This means both -// construction type (simple, non-simple) and storage size. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_STORAGE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_STORAGE_H_ - -#include - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -template -class SimpleType; - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// TODO(holtgrew): Remove Ascii and Unicode alias. Also see #849. -typedef char Ascii; -//typedef unsigned char Byte; // TODO(holtgrew): Disabling, remove together with Ascii and Unicode with #849 -typedef wchar_t Unicode; - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction BitsPerValue -// ---------------------------------------------------------------------------- - -template -struct BitsPerValue -{ - static const unsigned VALUE = sizeof(TValue) * 8; - typedef unsigned Type; -}; - -template -struct BitsPerValue : public BitsPerValue -{}; - -// template -// const unsigned BitsPerValue::VALUE = ; - -// ---------------------------------------------------------------------------- -// Metafunction ValueSize -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Enable default implementation only for integers? Move to adapt builtins? - -template -struct ValueSize -{ - typedef __uint64 Type; - static const Type VALUE = (BitsPerValue::VALUE < 64)? 1ull << (BitsPerValue::VALUE & 63) : 0ull; -}; - -template -struct ValueSize : ValueSize -{}; - -// TODO(holtgrew): Use static assertion to make sure that ValueSize is never called on floating point numbers? Include assertion for __int64 and __uint64? - -template <> -struct ValueSize<__int64> -{ - typedef __uint64 Type; - static const Type VALUE = 0; -}; - -template <> -struct ValueSize<__uint64> -{ - typedef __uint64 Type; - static const Type VALUE = 0; -}; - -template <> -struct ValueSize -{ - typedef __uint64 Type; - static const Type VALUE = 0; -}; - -template <> -struct ValueSize -{ - typedef __uint64 Type; - static const Type VALUE = 0; -}; - - -// The internal value size is used for alphabets with piggyback qualities, -// for example Dna5Q. Here, the public value size is 5 but the internal -// value size is 256. - -template -struct InternalValueSize_ - : public ValueSize -{}; - -// ---------------------------------------------------------------------------- -// Metafunction BytesPerValue -// ---------------------------------------------------------------------------- - -/*! - * @mfn BytesPerValue - * @headerfile - * @brief Number of bytes needed to store a value. - * - * @signature BytesPerValue::VALUE - * - * @tparam T The type to query. - * - * @return VALUE The number of bytes to store on T object. - * - * @section Remarks - * - * By default, this function returns ceil(BitsPerValue<T>::VALUE). For built-in types, this is the same - * as sizeof(T). - * - * @see FiniteOrderedAlphabetConcept#ValueSize - * @see AlphabetConcept#BitsPerValue - * @see IntegralForValue - */ - -/** -.Metafunction.BytesPerValue: -..cat:Basic -..summary:Number of bytes needed to store a value. -..signature:BytesPerValue::VALUE -..param.T:A class. -..returns.param.VALUE:Number of bytes needed to store $T$. -...default:$BitsPerValue / 8$, rounded up. For built-in types, this is the same as $sizeof(T)$. -..see:Metafunction.ValueSize -..see:Metafunction.BitsPerValue -..include:seqan/basic.h -*/ - -template -struct BytesPerValue -{ - enum { VALUE = (BitsPerValue::VALUE + 7) / 8 }; -}; - -// ---------------------------------------------------------------------------- -// Metafunction IntegralForValue -// ---------------------------------------------------------------------------- - -/*! - * @mfn IntegralForValue - * @headerfile - * @brief Returns an itegral type that provides sufficient space to store a value. - * - * @signature IntegralForValue::Type - * - * @tparam T The type to query. - * - * @return Type An integral type. - * - * @section Remarks - * - * The type is the smallest unsigned integral type that has a size of at least BytesPerValue bytes. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
sizeof(T) in bytesintegral types
1unsigned char
2unsigned short
3unsigned int
4unsigned int
> 4__int64
- * - * Note that the returned integral type cannot store T values, if T takes more than 8 bytes, since - * there exists no integral type that provides sufficient space to store types of this size. - * - * @see FiniteOrderedAlphabetConcept#ValueSize - * @see AlphabetConcept#BitsPerValue - * @see BytesPerValue - */ - -/** -.Metafunction.IntegralForValue: -..cat:Basic -..summary:Returns an itegral type that provides sufficient space to store a value. -..signature:IntegralForValue::Type -..param.T:A class. -..returns.param.Type:An integral type that can store $T$ values. -..remarks:The type is the smallest unsigned integral type that has a size of at least @Metafunction.BytesPerValue@ bytes. -...tableheader:bytes|integral type -...table:1|$unsigned char$ -...table:2|$unsigned short$ -...table:3|$unsigned int$ -...table:4|$unsigned int$ -...table:5 and above|$__int64$ -..remarks:Note that the returned integral type cannot store $T$ values, if $T$ takes more than 8 bytes, - since there exists no integral type that provides sufficient space to store types of this size. -..see:Metafunction.ValueSize -..see:Metafunction.BitsPerValue -..see:Metafunction.BytesPerValue -..include:seqan/basic.h -*/ - -template -struct IntegralForValueImpl_ -{ - typedef __int64 Type; -}; - -// TODO(holtgrew): Switch to __uint8, __uint16, __uint32? -template <> -struct IntegralForValueImpl_<1> -{ - typedef unsigned char Type; -}; - -template <> -struct IntegralForValueImpl_<2> -{ - typedef unsigned short Type; -}; - -template <> -struct IntegralForValueImpl_<3> -{ - typedef unsigned int Type; -}; - -template <> -struct IntegralForValueImpl_<4> -{ - typedef unsigned int Type; -}; - -template -struct IntegralForValue : IntegralForValueImpl_::VALUE> -{}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function ordValue() -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Enable only for integers, move to adapt builtins? - -template -SEQAN_HOST_DEVICE inline typename ValueSize::Type -ordValue(TValue const & c) -{ - return convert(static_cast::Type const &>(c)); -} - -// The internal ord value is used for alphabets with piggyback qualities. - -template -SEQAN_HOST_DEVICE inline typename ValueSize::Type -_internalOrdValue(TValue const & c) -{ - return ordValue(c); -} - -// ---------------------------------------------------------------------------- -// Function valueSize() -// ---------------------------------------------------------------------------- - -template -SEQAN_HOST_DEVICE inline typename ValueSize::Type -valueSize() -{ - return +ValueSize::VALUE; -} - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ALPHABET_STORAGE_H_ diff --git a/seqan/basic/array_construct_destruct.h b/seqan/basic/array_construct_destruct.h deleted file mode 100644 index 3e983f2..0000000 --- a/seqan/basic/array_construct_destruct.h +++ /dev/null @@ -1,1687 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Döring -// ========================================================================== -// Functions for destructing and several ways of constructing (e.g. copy, -// move) values or arrays of values. -// ========================================================================== - -// TODO(holtgrew): Order of parameters should be (target1, target2, ..., source1, source2, ...). -// TODO(holtgrew): Can we maybe replace at least part with http://www.cplusplus.com/reference/std/memory/? -// TODO(holtgrew): The metafunction should go into the alphabet submodule, the functions into the sequence/string module. - -#include - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ARRAY_CONSTRUCT_DESTRUCT_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_ARRAY_CONSTRUCT_DESTRUCT_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Metafunction IsSimple -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): This has to go to alphabet sub module, storage section, adaption. - -/*! - * @mfn IsSimple - * @headerfile - * @brief Tests type to be simple. - * - * @signature IsSimple::Type; - * - * @tparam T Type that is tested. - * - * @return Type Either True or False, depending on T being a "POD" type. - * - * @section Remarks - * - * A simple type is a type that does not need constructors to be created, a destructor to be destroyed, and copy - * assignment operators or copy constructors to be copied. All POD ("plain old data") types are simple, but some - * non-POD types could be simple too, e.g. some specializations of SimpleType. - * - * @see SimpleType - */ - -/** -.Metafunction.IsSimple -..cat:Basic -..summary:Tests type to be simple. -..signature:IsSimple::Type -..param.T:Type that is tested. -..returns.param.Type:@Tag.Logical Values.True@, if $T$ is a simple type, @Tag.Logical Values.False@ otherwise. -...default:@Tag.Logical Values.False@ -..remarks:A simple type is a type that does not need constructors to be created, -a destructor to be destroyed, and copy assignment operators or copy constructors -to be copied. All POD ("plain old data") types are simple, but some -non-POD types could be simple too, e.g. some specializations of @Class.SimpleType@. -..see:Class.SimpleType -..include:seqan/basic.h -*/ - -template -struct IsSimple_ -{ - typedef False Type; - enum { VALUE = 0 }; -}; - -// ---------------------------------------------------------------------------- -// Metafunction IsSimple -// ---------------------------------------------------------------------------- - -template <> struct IsSimple_ { typedef True Type; }; -template <> struct IsSimple_ { typedef True Type; }; - -template <> struct IsSimple_ { typedef True Type; }; -template <> struct IsSimple_ { typedef True Type; }; -template <> struct IsSimple_ { typedef True Type; }; -template <> struct IsSimple_ { typedef True Type; }; - -template <> struct IsSimple_ { typedef True Type; }; -template <> struct IsSimple_ { typedef True Type; }; -template <> struct IsSimple_ { typedef True Type; }; -template <> struct IsSimple_ { typedef True Type; }; - -template <> struct IsSimple_ { typedef True Type; }; -template <> struct IsSimple_ { typedef True Type; }; -template <> struct IsSimple_ { typedef True Type; }; - -template -struct IsSimple -{ - typedef typename IsSimple_::Type Type; - enum { VALUE = Type::VALUE }; -}; - -// user defined types (re-specializations are allowed here) -template <> struct IsSimple { typedef True Type; }; -template <> struct IsSimple<__int64> { typedef True Type; }; -template <> struct IsSimple<__uint64> { typedef True Type; }; - -template -struct IsSimple : public IsSimple {}; - -// ---------------------------------------------------------------------------- -// Metafunction Value -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): This should probably to into sequence module along with this header. - -///.Metafunction.Value.param.T.type:Adaption.char array -///.Metafunction.Value.class:Adaption.char array - -template -struct Value -{ - typedef TValue Type; -}; - -template -struct Value -{ - typedef TValue Type; -}; - -// TODO(holtgrew): Is this still a problem with dropped 2003 support of VC++? - -//The next two metafunctions dont work in VC++ due to a compiler bug. -//(the default implementation in common_type.h is called instead) -//work-around: convert arrays to pointers. -template -struct Value -{ - typedef TValue Type; -}; - -template -struct Value -{ - typedef TValue Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Reference -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): This should probably to into sequence module along with this header. - -///.Metafunction.Reference.param.T.type:Adaption.char array -///.Metafunction.Reference.class:Adaption.char array - -template -struct Reference -{ - typedef TValue & Type; -}; - -template -struct Reference -{ - typedef TValue const & Type; -}; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function value() for pointers. -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): This has to go to iterator module, adaption of pointers to iterators. - -template -SEQAN_HOST_DEVICE inline T & -value(T * me) -{ - SEQAN_CHECKPOINT; - return *me; -} - -// ---------------------------------------------------------------------------- -// Function getValue() for pointers. -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): This has to go to iterator module, adaption of pointers to iterators. - -template -SEQAN_HOST_DEVICE inline T & -getValue(T * me) -{ - SEQAN_CHECKPOINT; - return value(me); -} - -// TODO(holtgrew): All of the helper structs could be replaced by global functions. - -// TODO(holtgrew): First, the generic versions for iterators are defined. Below are the versions for pointers. - -// ---------------------------------------------------------------------------- -// Function valueConstruct() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn valueConstruct - * @headerfile - * @brief Constructs an object at specified position. - * - * @signature void valueConstruct(iterator [, param [, move_tag]]); - * - * @param iterator Pointer or iterator to position where the object should be constructed. - * @param param Parameter that is forwarded to constructor. - * @param moveTag Instance of the move tag. If the tag is specified, it is forwarded to the constructor, so the - * constructed object must support move construction. - * - * @section Remarks - * - * The type of the destructed object is the value type of iterator. - */ - -/** -.Function.valueConstruct -..cat:Content Manipulation -..summary:Constructs an object at specified position. -..signature:valueConstruct(iterator [, param [, move_tag] ]) -..param.iterator:Pointer or iterator to position where the object should be constructed. -..param.param:Parameter that is forwarded to constructor. (optional) -..param.move_tag:Instance of the @Tag.Move Switch.move switch tag@. (optional) -...remarks:If the @Tag.Move Switch.move switch tag@ is specified, it is forwarded to the constructor, -so the constructed object must support move construction. -..remarks:The type of the destructed object is the @Metafunction.Value.value type@ of $iterator$. -..include:seqan/basic.h -*/ - -// Helper code for constructing values behind iterators that do not return -// proxies from their value() functions but references. -struct ValueConstructor_ -{ - template - static inline void - construct(TIterator it) - { - typedef typename Value::Type TValue; - typedef typename RemoveConst::Type TNonConstValue; - new( (void*) & value(it) ) TNonConstValue; - } - - template - static inline void - construct(TIterator it, - TParam const & param_) - { - typedef typename Value::Type TValue; - typedef typename RemoveConst::Type TNonConstValue; - new( (void*) & value(it) ) TNonConstValue(param_); - } - - template - static inline void - construct(TIterator it, - TParam & param_, - Move const & tag) - { - typedef typename Value::Type TValue; - typedef typename RemoveConst::Type TNonConstValue; - new( (void*) & value(it) ) TNonConstValue(param_, tag); - } -}; - -// Helper code for constructing values behind iterators that return proxies -// from their value() function. -// -// TODO(holtgrew): These implementations are empty and to be overwritten. Should we have dynamic/static asserstions here? -struct ValueConstructorProxy_ -{ - template - static inline void construct(TIterator) {} - - template - static inline void construct(TIterator, TParam const &) {} - - template - static inline void construct(TIterator, TParam &, Move const & ) {} -}; - -template -inline void -valueConstruct(TIterator it) -{ - SEQAN_CHECKPOINT; - typedef typename IfC< - IsSameType< - typename Value::Type &, - typename Reference::Type - >::VALUE, - // THEN - ValueConstructor_, // true, types are equal - // ELSE - ValueConstructorProxy_ // false, types differ -> value() returns a proxy - >::Type TConstructor; - - TConstructor::construct(it); -} - -template -inline void -valueConstruct(TIterator it, - TParam const & param_) -{ - SEQAN_CHECKPOINT; - typedef typename IfC< - IsSameType< - typename Value::Type &, - typename Reference::Type - >::VALUE, - // THEN - ValueConstructor_, // true, types are equal - // ELSE - ValueConstructorProxy_ // false, types differ -> value() returns a proxy - >::Type TConstructor; - - TConstructor::construct(it, param_); -} - -template -inline void -valueConstruct(TIterator it, - TParam & param_, - Move const & tag) -{ - SEQAN_CHECKPOINT; - typedef typename IfC< - IsSameType< - typename Value::Type &, - typename Reference::Type - >::VALUE, - // THEN - ValueConstructor_, // true, types are equal - // ELSE - ValueConstructorProxy_ // false, types differ -> value() returns a proxy - >::Type TConstructor; - - TConstructor::construct(it, param_, tag); -} - -// ---------------------------------------------------------------------------- -// Function valueDestruct() using iterators -// ---------------------------------------------------------------------------- - -// Helper code for destructing values behind iterators that do not return -// proxies from their value() function but references. -struct ValueDestructor_ -{ - template - static inline void - _destruct(TValue * p) - { - p->~TValue(); - } - - template - static inline void - destruct(TIterator it) - { - _destruct(&value(it)); - } -}; - -// Helper code for destructing values behind iterators that return proxies -// from their value() function. -// -// TODO(holtgrew): These implementations are empty and to be overwritten. Should we have dynamic/static asserstions here? -struct ValueDestructorProxy_ -{ - template - static inline void destruct(TIterator) {} -}; - -/*! - * @fn valueDestruct - * @headerfile - * @brief Destoys an object at specified position. - * - * @signature void valueDestruct(iterator); - * - * @param iterator Pointer or iterator to position where the object should be destructed. - * - * @section Remarks - * - * The type of the constructed object is the value type of iterator. - */ - -/** -.Function.valueDestruct -..cat:Content Manipulation -..summary:Destoys an object at specified position. -..signature:valueDestruct(iterator) -..param.iterator:Pointer or iterator to position where the object should be destructed. -..remarks:The type of the constructed object is the @Metafunction.Value.value type@ of $iterator$. -..see:Function.valueConstruct -..include:seqan/basic.h -*/ - -template -inline void -valueDestruct(TIterator it) -{ - SEQAN_CHECKPOINT; - typedef typename IfC< - IsSameType< - typename Value::Type &, - typename Reference::Type - >::VALUE, - // THEN - ValueDestructor_, // true, types are equal - // ELSE - ValueDestructorProxy_ // false, types differ -> value() returns a proxy - >::Type TDestructor; - - TDestructor::destruct(it); -} - -// ---------------------------------------------------------------------------- -// Function arrayConstruct() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayConstruct - * @headerfile - * @brief Construct objects in a given memory buffer. - * - * @signature void arrayConstruct(begin, end[, value]); - * - * @param begin Iterator to the begin of the range that is to be constructed. - * @param end Iterator behind the end of the range. - * @param value Argument that is forwarded to the constructor. An appropriate constructor is required. If - * value is not specified, the default constructor is used. - * - * @section Remarks - * - * The type of the constructed Objects is the value type of begin and end. - */ - -/** -.Function.arrayConstruct -..cat:Array Handling -..summary:Construct objects in a given memory buffer. -..signature:arrayConstruct(begin, end [, value]) -..param.begin:Iterator to the begin of the range that is to be constructed. -..param.end:Iterator behind the end of the range. -..param.value:Argument that is forwarded to the constructor. (optional) -...text:An appropriate constructor is required. -If $value$ is not specified, the default constructor is used. -..remarks:The type of the constructed Objects is the @Metafunction.Value.value type@ -of $begin$ and $end$. -..see:Function.arrayDestruct -..see:Function.arrayConstructCopy -..see:Function.arrayFill -..see:Class.SimpleType -..see:Function.valueConstruct -..include:seqan/basic.h -*/ - -// NOTE(holtgrew): Of course, it does not make sense to declare this in a move version! - -template -inline void -_arrayConstructDefault(TIterator1 begin_, - TIterator2 end_) -{ - SEQAN_CHECKPOINT; - while (begin_ != end_) - { - valueConstruct(begin_); - ++begin_; - } -} - -template -inline void -arrayConstruct(TIterator1 begin_, - TIterator2 end_) -{ - SEQAN_CHECKPOINT; - _arrayConstructDefault(begin_, end_); -} - -template -inline void -_arrayConstructDefault(TIterator1 begin_, - TIterator2 end_, - TParam const & param_) -{ - SEQAN_CHECKPOINT; - while (begin_ != end_) - { - valueConstruct(begin_, param_); - ++begin_; - } -} - -template -inline void -arrayConstruct(TIterator1 begin_, - TIterator2 end_, - TParam const & param_) -{ - SEQAN_CHECKPOINT; - _arrayConstructDefault(begin_, end_, param_); -} - -// ---------------------------------------------------------------------------- -// Function arrayConstructCopy() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayConstructCopy - * @headerfile - * @brief Copy constructs an array of objects into in a given memory buffer. - * - * @signature void arrayConstructCopy(sourceBegin, sourceEnd, target); - * - * @param sourceBegin Iterator to the first element of the source range. - * @param sourceEnd Iterator behind the last element of the source range. sourceEnd should have the same - * type as sourceBegin. - * @param target Pointer to the memory block the new objects will be constructed in. The type of target - * specifies the type of the constructed objects: If T* is the type of target, then - * the function constructs objects of type T. The memory buffer should be large enough to - * store sourceEnd - sourceBegin objects. An appropriate (copy-) constructor that - * constructs an target objects given a source object is required. - */ - -/** -.Function.arrayConstructCopy -..cat:Array Handling -..summary:Copy constructs an array of objects into in a given memory buffer. -..signature:arrayConstructCopy(source_begin, source_end, target) -..param.source_begin:Iterator to the first element of the source range. -..param.source_end:Iterator behind the last element of the source range. -...text:$source_end$ should have the same type as $source_begin$. -..param.target:Pointer to the memory block the new objects will be constructed in. -...text:The type of $target$ specifies the type of the constructed objects: -If $T*$ is the type of $target$, then the function constructs objects of type $T$. -...text:The memory buffer should be large enough to store $source_end$ - $source_begin$ objects. -An appropriate (copy-) constructor that constructs an target objects given a source object is required. -..see:Function.arrayDestruct -..see:Function.arrayCopyForward -..see:Function.arrayCopy -..see:Function.valueConstruct -..include:seqan/basic.h -*/ - -template -inline void -_arrayConstructCopyDefault(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - while (source_begin != source_end) - { - // NOTE(holtgrew): getValue() is used here since value() could return - // a proxy! - valueConstruct(target_begin, getValue(source_begin)); - ++source_begin; - ++target_begin; - } -} - -template -inline void -arrayConstructCopy(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - _arrayConstructCopyDefault(source_begin, source_end, target_begin); -} - -// ---------------------------------------------------------------------------- -// Function arrayConstructMove() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayConstructMove - * @headerfile - * @brief Move constructs an array of objects into in a given memory buffer. - * - * @signature void arrayConstructMove(sourceBegin, sourceEnd, target); - * - * @param sourceEnd Iterator behind the last element of the source range. sourceEnd should have the same - * type as sourceBegin. - * @param sourceBegin Iterator to the first element of the source range. - * @param target Pointer to the memory block the new objects will be constructed in. The type of target - * specifies the type of the constructed objects: If T* is the type of target, then - * the function constructs objects of type T. The memory buffer should be large enough to - * store sourceEnd - sourceBegin objects. An appropriate move constructor that - * constructs an target objects given a source object is required. - */ - -/** -.Function.arrayConstructMove -..cat:Array Handling -..summary:Move constructs an array of objects into in a given memory buffer. -..signature:arrayConstructMove(source_begin, source_end, target) -..param.source_begin:Iterator to the first element of the source range. -..param.source_end:Iterator behind the last element of the source range. -...text:$source_end$ should have the same type as $source_begin$. -..param.target:Pointer to the memory block the new objects will be constructed in. -...text:The type of $target$ specifies the type of the constructed objects: -If $T*$ is the type of $target$, then the function constructs objects of type $T$. -...text:The memory buffer should be large enough to store $source_end$ - $source_begin$ objects. -An appropriate move constructor that constructs an target objects given a source object is required. -..see:Function.arrayDestruct -..see:Function.arrayConstructCopy -..see:Function.arrayMoveForward -..see:Function.arrayMove -..see:Function.valueConstruct -..include:seqan/basic.h -*/ - -template -inline void -_arrayConstructMoveDefault(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - while (source_begin < source_end) - { - // NOTE(holtgrew): Using value() here, used to be getValue() but - // cannot move from const reference or proxy. - // valueConstruct(target_begin, value(source_begin), Move()); - // TODO(holtgrew): We need a "has move constructor" metafunction to switch between move/copy constructing before we can use the line here. - valueConstruct(target_begin, value(source_begin)); - ++source_begin; - ++target_begin; - } -} - -template -inline void -arrayConstructMove(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - _arrayConstructMoveDefault(source_begin, source_end, target_begin); -} - -// ---------------------------------------------------------------------------- -// Function arrayDestruct() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayDestruct - * @headerfile - * @brief Destroys an array of objects. - * - * @signature void arrayDestruct(begin, end); - * - * @param begin Iterator to the begin of the range that is to be destructed. - * @param end Iterator behind the end of the range. - * - * @section Remarks - * - * This function does not deallocates the memory. - */ - -/** -.Function.arrayDestruct -..cat:Array Handling -..summary:Destroys an array of objects. -..signature:arrayDestruct(begin, end) -..param.begin:Iterator to the begin of the range that is to be destructed. -..param.end:Iterator behind the end of the range. -..remarks:This function does not deallocates the memory. -..see:Class.SimpleType -..see:Function.valueDestruct -..include:seqan/basic.h -*/ - -template -inline void -_arrayDestructDefault(TIterator1 begin_, - TIterator2 end_) -{ - SEQAN_CHECKPOINT; - while (begin_ != end_) - { - valueDestruct(begin_); - ++begin_; - } -} - -template -inline void -arrayDestruct(TIterator1 begin_, - TIterator2 end_) -{ - SEQAN_CHECKPOINT; - _arrayDestructDefault(begin_, end_); -} - -// ---------------------------------------------------------------------------- -// Function arrayFill() using iterators -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): What is the advantage over arrayConstruct() with prototype? - -/*! - * @fn arrayFill - * @headerfile - * @brief Assigns one object to each element of a range. - * - * @signature void arrayFill(begin, end, value[, parallelTag]); - * - * @param begin Iterator to the begin of the range that is to be filled. - * @param end Iterator behind the end of the range. - * @param value Argument that is assigned to all count objects in array. - * @param parallelTag Tag to enable/disable parallelism. Types: Serial, Parallel - * - * @section Remarks - * - * All objects target_begin[0] to target_begin[count-1] are set to value. - */ - -/** -.Function.arrayFill -..cat:Array Handling -..summary:Assigns one object to each element of a range. -..signature:arrayFill(begin, end, value) -..param.begin:Iterator to the begin of the range that is to be filled. -..param.end:Iterator behind the end of the range. -..param.value:Argument that is assigned to all $count$ objects in $array$. -..remarks:All objects $target_begin[0]$ to $target_begin[count-1]$ are set to $value$. -..see:Function.arrayCopy -..see:Function.arrayCopyForward -..include:seqan/basic.h -*/ - -// TODO(holtgrew): Redirects to fill_n. What are the exact semantics here? Do the array elements have to be initialized already? fill_n uses assignment, not copy construction! - -template -inline void -arrayFill(TIterator begin_, - TIterator end_, - TValue const & value) -{ - SEQAN_CHECKPOINT; - ::std::fill_n(begin_, end_ - begin_, value); -} - -template -inline void -arrayFill(TIterator begin_, - TIterator end_, - TValue const & value, - Serial) -{ - arrayFill(begin_, end_, value); -} - -// ---------------------------------------------------------------------------- -// Function arrayCopyForward() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayCopyForward - * @headerfile - * @brief Copies a range of objects into another range of objects starting from the first element. - * - * @signature void arrayCopyForward(sourceBegin, sourceEnd, target); - * - * @param sourceEnd Iterator behind the last element of the source array. sourceEnd must have the same type - * as sourceBegin. - * @param sourceBegin Iterator to the first element of the source array. - * @param target Iterator to the first element of the target array. The target capacity should be at least as - * long as the source range. - * - * @section Remarks - * - * Be careful if source and target range overlap, because in this case some source elements could be accidently - * overwritten before they are copied. - * - * If there is no need for the source elements to persist, consider to use arrayMoveForward instead to improve - * performance. - */ - -/** -.Function.arrayCopyForward -..cat:Array Handling -..summary:Copies a range of objects into another range of objects starting from the first element. -..signature:arrayCopyForward(source_begin, source_end, target) -..param.source_begin:Iterator to the first element of the source array. -..param.source_end:Iterator behind the last element of the source array. -...text:$source_end$ must have the same type as $source_begin$. -..param.target:Iterator to the first element of the target array. -...text:The target capacity should be at least as long as the source range. -..remarks.note:Be careful if source and target range overlap, because in this case some source elements could be accidently overwritten before they are copied. -..remarks:If there is no need for the source elements to persist, consider to use -@Function.arrayMoveForward@ instead to improve performance. -..see:Class.SimpleType -..include:seqan/basic.h -*/ - -template -inline void -_arrayCopyForwardDefault(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - ::std::copy(source_begin, source_end, target_begin); -} - -template -inline void -arrayCopyForward(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - _arrayCopyForwardDefault(source_begin, source_end, target_begin); -} - -// ---------------------------------------------------------------------------- -// Function arrayCopyBackward() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayCopyBackward - * @headerfile - * @brief Copies a range of objects into another range of objects starting from the last element. - * - * @signature void arrayCopyBackward(source_begin, source_end, target); - * - * @param sourceBegin Iterator to the first element of the source array. - * @param sourceEnd Iterator behind the last element of the source array. sourceEnd must have the same type - * as source_begin. - * @param target Iterator to the first element of the target array. The target capacity should be at least as - * long as the source range. - * - * @section Remarks - * - * Be careful if source and target range overlap, because in this case some source elements could be accidently - * overwritten before they are moved. - * - * If source and target do not overlap, consider to use the function arrayCopyForward instead that is faster in some - * cases. - * - * If there is no need for the source elements to persist, consider to use arrayMoveBackward instead to improve - * performance. - * - * The semantic of this function's argument target differ from the arguments of ::std::copy_backward. - */ - -/** -.Function.arrayCopyBackward -..cat:Array Handling -..summary:Copies a range of objects into another range of objects starting from the last element. -..signature:arrayCopyBackward(source_begin, source_end, target) -..param.source_begin:Iterator to the first element of the source array. -..param.source_end:Iterator behind the last element of the source array. -...text:$source_end$ must have the same type as $source_begin$. -..param.target:Iterator to the first element of the target array. -...text:The target capacity should be at least as long as the source range. -..remarks.note:Be careful if source and target range overlap, because in this case - some source elements could be accidently overwritten before they are moved. -..remarks.text:If source and target do not overlap, consider to use the function -@Function.arrayCopyForward@ instead that is faster in some cases. -..remarks:If there is no need for the source elements to persist, consider to use -@Function.arrayMoveBackward@ instead to improve performance. -..remarks.note:The semantic of this function's argument $target$ differ from the arguments of $::std::copy_backward$. -..see:Function.arrayCopyForward -..see:Class.SimpleType -..include:seqan/basic.h -*/ - -template -inline void -_arrayCopyBackwardDefault(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - ::std::copy_backward(source_begin, source_end, target_begin + (source_end - source_begin)); -} - -template -inline void -arrayCopyBackward(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - _arrayCopyBackwardDefault(source_begin, source_end, target_begin); -} - -// ---------------------------------------------------------------------------- -// Function arrayCopy() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayCopy - * - * @headerfile seqan/basic.h - * - * @brief Copies a range of objects into another range of objects. - * - * @signature void arrayCopy(sourceBegin, sourceEnd, target); - * - * @param sourceEnd Iterator behind the last element of the source range. sourceEnd must have the same type - * as sourceBegin. - * @param sourceBegin Iterator to the first element of the source range. - * @param target Iterator to the first element of the target range.The target capacity should be at least as long - * as the source range. - * - * @section Remarks - * - * If source and target range do not overlap, consider to use arrayCopyForward instead to improve performance. - * - * If there is no need for the source elements to persist, consider to use arrayMoveForward instead to improve - * performance. - */ - -/** -.Function.arrayCopy -..cat:Array Handling -..summary:Copies a range of objects into another range of objects. -..signature:arrayCopy(source_begin, source_end, target) -..param.source_begin:Iterator to the first element of the source range. -..param.source_end:Iterator behind the last element of the source range. -...text:$source_end$ must have the same type as $source_begin$. -..param.target:Iterator to the first element of the target range. -...text:The target capacity should be at least as long as the source range. -..remarks.text:If source and target range do not overlap, consider to use - @Function.arrayCopyForward@ instead to improve performance. -..remarks:If there is no need for the source elements to persist, consider to use - @Function.arrayMoveForward@ instead to improve performance. -..DISABLED.remarks.note:Be careful if source and target range overlap and the size of the - source elements differ from the size of target elements, because in this case - some source elements could be accidently overwritten before they are moved. -..see:Function.arrayCopyForward -..see:Function.arrayCopyBackward -..see:Class.SimpleType -..include:seqan/basic.h -*/ - -template -inline void arrayCopy(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - if (target_begin <= source_begin) - arrayCopyForward(source_begin, source_end, target_begin); - else - arrayCopyBackward(source_begin, source_end, target_begin); -} - -// ---------------------------------------------------------------------------- -// Function arrayMoveForward() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayMoveForward - * @headerfile - * @brief Moves a range of objects into another range of objects starting from the first element. - * - * @signature void arrayMoveForward(sourceBegin, sourceEnd, target); - * - * @param sourceEnd Iterator behind the last element of the source array. sourceEnd must have the same type - * as sourceBegin. - * @param sourceBegin Iterator to the first element of the source array. - * @param target Iterator to the first element of the target array. The target capacity should be at least as - * long as the source range. - * - * @section Remarks - * - * The function possibly clears (but does not destroy) the source elements. If source elements must persist, consider - * to use arrayCopyForward instead. - * - * Be careful if source and target range overlap, because in this case some source elements could be accidently - * overwritten before they are moved. - */ - -/** -.Function.arrayMoveForward -..cat:Array Handling -..summary:Moves a range of objects into another range of objects starting from the first element. -..signature:arrayMoveForward(source_begin, source_end, target) -..param.source_begin:Iterator to the first element of the source array. -..param.source_end:Iterator behind the last element of the source array. -...text:$source_end$ must have the same type as $source_begin$. -..param.target:Iterator to the first element of the target array. -...text:The target capacity should be at least as long as the source range. -..remarks:The function possibly clears (but does not destroy) the source elements. - If source elements must persist, consider to use @Function.arrayCopyForward@ instead. -..remarks.note:Be careful if source and target range overlap, because in this case - some source elements could be accidently overwritten before they are moved. -..see:Function.arrayCopyForward -..see:Class.SimpleType -..include:seqan/basic.h -*/ - -template -inline void -_arrayMoveForwardDefault(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - while (source_begin != source_end) - { - move(*target_begin, *source_begin); - ++source_begin; - ++target_begin; - } -} - -template -inline void -arrayMoveForward(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - _arrayMoveForwardDefault(source_begin, source_end, target_begin); -} - -// ---------------------------------------------------------------------------- -// Function arrayMoveBackward() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayMoveBackward - * @headerfile - * @brief Moves a range of objects into another range of objects starting from the last element. - * - * @signature void arrayMoveBackward(sourceBegin, sourceEnd, target); - * - * @param sourceEnd Iterator behind the last element of the source array. sourceEnd must have the same type - * as sourceBegin. - * @param sourceBegin Iterator to the first element of the source array. - * @param target Iterator to the first element of the target array.The target capacity should be at least as long - * as the source range. - * - * @section Remarks - * - * The function possibly clears (but does not destroy) the source elements. If source elements must persist, consider - * to use arrayCopyBackward instead. - * - * Be careful if source and target range overlap, because in this case some source elements could be accidently - * overwritten before they are moved. - * - * If source and target do not overlap, consider to use the function arrayMoveForward instead that is faster in some - * cases. - * - * The semantic of this function's argument target differ from the arguments of ::std::copy_backward. - */ - -/** -.Function.arrayMoveBackward -..cat:Array Handling -..summary:Moves a range of objects into another range of objects starting from the last element. -..signature:arrayMoveBackward(source_begin, source_end, target) -..param.source_begin:Iterator to the first element of the source array. -..param.source_end:Iterator behind the last element of the source array. -...text:$source_end$ must have the same type as $source_begin$. -..param.target:Iterator to the first element of the target array. -...text:The target capacity should be at least as long as the source range. -..remarks:The function possibly clears (but does not destroy) the source elements. - If source elements must persist, consider to use @Function.arrayCopyBackward@ instead. -..remarks.note:Be careful if source and target range overlap, because in this case - some source elements could be accidently overwritten before they are moved. -..remarks.text:If source and target do not overlap, consider to use the function -@Function.arrayMoveForward@ instead that is faster in some cases. -..remarks.note:The semantic of this function's argument $target$ differ from the arguments of $::std::copy_backward$. -..see:Function.arrayMoveForward -..see:Function.arrayCopyBackward -..see:Class.SimpleType -..include:seqan/basic.h -*/ - -template -inline void -_arrayMoveBackwardDefault(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - target_begin += (source_end - source_begin); - while (source_end != source_begin) { - --source_end; - --target_begin; - move(*target_begin, *source_end); - } -} - -template -inline void -arrayMoveBackward(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - SEQAN_CHECKPOINT; - _arrayMoveBackwardDefault(source_begin, source_end, target_begin); -} - -// ---------------------------------------------------------------------------- -// Function arrayMove using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayMove - * @headerfile - * @brief Moves a range of objects into another range of objects. - * - * @signature void arrayMove(sourceBegin, sourceEnd, target); - * - * @param sourceBegin Iterator to the first element of the source range. - * @param sourceEnd Iterator behind the last element of the source range. sourceEnd must have the same type - * as sourceBegin. - * @param target Iterator to the first element of the target range. The target capacity should be at least as - * long as the source range. - * - * @section Remarks - * - * The function possibly clears (but does not destroy) the source elements. If source elements must persist, consider - * to use arrayCopy instead. - * - * If source and target range do not overlap, consider to use arrayMoveForward instead to improve performance. - * - * Don't confuse this function with the standard move function that resembles arrayCopy. - */ - -/** -.Function.arrayMove -..cat:Array Handling -..summary:Moves a range of objects into another range of objects. -..signature:arrayMove(source_begin, source_end, target) -..param.source_begin:Iterator to the first element of the source range. -..param.source_end:Iterator behind the last element of the source range. -...text:$source_end$ must have the same type as $source_begin$. -..param.target:Iterator to the first element of the target range. -...text:The target capacity should be at least as long as the source range. -..remarks:The function possibly clears (but does not destroy) the source elements. - If source elements must persist, consider to use @Function.arrayCopy@ instead. -..remarks.text:If source and target range do not overlap, consider to use - @Function.arrayMoveForward@ instead to improve performance. -..DISABLED.remarks.note:Be careful if source and target range overlap and the size of the - source elements differ from the size of target elements, because in this case - some source elements could be accidently overwritten before they are moved. -..remarks.note:Don't confuse this function with the standard $move$ function that -resembles @Function.arrayCopy@. -..see:Function.arrayMoveForward -..see:Function.arrayMoveBackward -..see:Function.arrayCopy -..see:Class.SimpleType -..include:seqan/basic.h -*/ - -template -inline void -arrayMove(TSource1 source_begin, - TSource2 source_end, - TTarget target_begin) -{ - if (target_begin <= source_begin) - arrayMoveForward(source_begin, source_end, target_begin); - else - arrayMoveBackward(source_begin, source_end, target_begin); -} - -// ---------------------------------------------------------------------------- -// Function arrayClearSpace() using iterators -// ---------------------------------------------------------------------------- - -/*! - * @fn arrayClearSpace - * @headerfile - * @brief Destroys the begin of an array and keeps the rest. - * - * @signature void arrayClearSpace(arrBegin, arrLength, keepFrom, moveTo); - * - * @param arrBegin Pointer to the first element of the array. - * @param keepFrom Offset of the first object that will be kept. - * @param arrLength Length of the array. - * @param moveTo Offset the first kept object will get at the end of the function. - * - * @section Remarks - * - * The objects arr[keep_from] to arr[arr_length-1] are moved to the area beginning at positions - * move_to. All objects in arr[0] to arr[keep_from-1] are destroyed. After this function, the - * first move_to positions of the array are free and dont contain objects. - * - * The array must have at least enough space to store arr_length + move_to - keep_from objects. - * - * The objects from arr[0] to arr[array_length-1] have to be initialized/constructed, arrays beyond - * arr[array_length-1] are assumed not to be constructed. If this assumption is violated, memory might leak. - */ - -/** -.Function.arrayClearSpace -..cat:Array Handling -..summary:Destroys the begin of an array and keeps the rest. -..signature:arrayClearSpace(arr_begin, arr_length, keep_from, move_to) -..param.arr_begin:Pointer to the first element of the array. -..param.arr_length:Length of the array. -..param.keep_from:Offset of the first object that will be kept. -..param.move_to:Offset the first kept object will get at the end of the function. -..remarks.text:The objects $arr[keep_from]$ to $arr[arr_length-1]$ -are moved to the area beginning at positions $move_to$. -All objects in $arr[0]$ to $arr[keep_from-1]$ are destroyed. -After this function, the first $move_to$ positions of the array -are free and dont contain objects. -..remarks.text:The array must have at least enough space to store $arr_length + move_to - keep_from$ objects. -..remarks.text:The objects from $arr[0]$ to $arr[array_length-1]$ have to be initialized/constructed, arrays beyond $arr[array_length-1]$ are assumed not to be constructed. If this assumption is violated, memory might leak. -..see:Function.arrayCopy -..see:Function.arrayDestruct -..see:Function.arrayCopyForward -..see:Class.SimpleType -..include:seqan/basic.h -*/ - -// TODO(holtgrew): The feature that the range [0, array_begin) is deleted is used nowhere. Can this be removed to simplify behaviour? - -template -void _arrayClearSpaceDefault(TIterator array_begin, - size_t array_length, - size_t keep_from, - size_t move_to) -{ - if (keep_from == array_length) { - // In the simplest case, we only destruct elements. - arrayDestruct(array_begin, array_begin + array_length); - return; - } - - // Otherwise, we will perform the destruction & movement. - SEQAN_ASSERT_LT(keep_from, array_length); - if (keep_from == move_to) { - // Case 1: No movement, just destroy elements. - arrayDestruct(array_begin, array_begin + move_to); - return; - } else if (keep_from < move_to) { - // Case 2: Move to the right. - if (array_length > move_to) { - // Case 2a: Moving right of array_length, i.e. we can move a part - // of the objects and have to move-construct the rest. - SEQAN_CHECKPOINT; - size_t middle = array_length - (move_to - keep_from); - arrayConstructMove(array_begin + middle, array_begin + array_length, array_begin + array_length); - arrayMove(array_begin + keep_from, array_begin + middle, array_begin + move_to); - arrayDestruct(array_begin, array_begin + move_to); - } else { - // Case 2b: We have to move-construct all target objects. - SEQAN_CHECKPOINT; - arrayConstructMove(array_begin + keep_from, array_begin + array_length, array_begin + move_to); - arrayDestruct(array_begin, array_begin + array_length); - } - } else { - // Case 3: Move to the left. - SEQAN_CHECKPOINT; - arrayMove(array_begin + keep_from, array_begin + array_length, array_begin + move_to); - arrayDestruct(array_begin, array_begin + move_to); - arrayDestruct(array_begin + array_length - (keep_from - move_to), array_begin + array_length); - } -} - -template -void arrayClearSpace(TIterator array_begin, - size_t array_length, - size_t keep_from, - size_t move_to) -{ - _arrayClearSpaceDefault(array_begin, array_length, keep_from, move_to); -} - -// ---------------------------------------------------------------------------- -// Function arrayConstruct() using pointers -// ---------------------------------------------------------------------------- - -template -inline void -_arrayConstructPointer(TIterator, - TIterator, - True) -{ - SEQAN_CHECKPOINT; - //nothing to do -} - -template -inline void -_arrayConstructPointer(TIterator begin_, - TIterator end_, - False) -{ - SEQAN_CHECKPOINT; - _arrayConstructDefault(begin_, end_); -} - -template -inline void -arrayConstruct(TValue * begin_, - TValue * end_) -{ - SEQAN_CHECKPOINT; - _arrayConstructPointer(begin_, end_, typename IsSimple::Type() ); -} - -template -inline void -_arrayConstructPointer(TValue * begin_, - TValue * end_, - TParam const & param_, - True) -{ - SEQAN_CHECKPOINT; - arrayFill(begin_, end_, static_cast(param_)); -} - -template -inline void -_arrayConstructPointer(TValue * begin_, - TValue * end_, - TParam const & param_, - False) -{ - SEQAN_CHECKPOINT; - _arrayConstructDefault(begin_, end_, param_); -} - -template -inline void -arrayConstruct(TValue * begin_, - TValue * end_, - TParam const & param_) -{ - SEQAN_CHECKPOINT; - _arrayConstructPointer(begin_, end_, param_, typename IsSimple::Type()); -} - -// ---------------------------------------------------------------------------- -// Function arrayConstructCopy() using pointers -// ---------------------------------------------------------------------------- - -template -inline void -_arrayConstructCopyPointer(TValueSource * source_begin, - TValueSource * source_end, - TValueTarget * target_begin, - True) -{ - SEQAN_CHECKPOINT; - arrayCopyForward(source_begin, source_end, target_begin); -} - -template -inline void -_arrayConstructCopyPointer(TValueSource * source_begin, - TValueSource * source_end, - TValueTarget const* target_begin, - True) -{ - SEQAN_CHECKPOINT; - arrayCopyForward(source_begin, source_end, const_cast(target_begin)); -} - -template -inline void -_arrayConstructCopyPointer(TValueSource * source_begin, - TValueSource * source_end, - TValueTarget * target_begin, - False) -{ - SEQAN_CHECKPOINT; - _arrayConstructCopyDefault(source_begin, source_end, target_begin); -} -template -inline void -arrayConstructCopy(TValueSource * source_begin, - TValueSource * source_end, - TValueTarget * target_begin) -{ - SEQAN_CHECKPOINT; - _arrayConstructCopyPointer(source_begin, source_end, target_begin, typename IsSimple::Type() ); -} - -// ---------------------------------------------------------------------------- -// Function arrayConstructMove() using pointers -// ---------------------------------------------------------------------------- - -template -inline void -_arrayConstructMovePointer(TValue * source_begin, - TValue * source_end, - TValue * target_begin, - True) -{ - SEQAN_CHECKPOINT; - arrayMoveForward(source_begin, source_end, target_begin); -} - -template -inline void -_arrayConstructMovePointer(TValue * source_begin, - TValue * source_end, - TValue * target_begin, - False) -{ - SEQAN_CHECKPOINT; - _arrayConstructMoveDefault(source_begin, source_end, target_begin); -} - -template -inline void -arrayConstructMove(TValue * source_begin, - TValue * source_end, - TValue * target_begin) -{ - SEQAN_CHECKPOINT; - _arrayConstructMovePointer(source_begin, source_end, target_begin, typename IsSimple::Type() ); -} - -// ---------------------------------------------------------------------------- -// Function arrayDestruct() using pointers -// ---------------------------------------------------------------------------- - -template -inline void -_arrayDestructPointer(TValue * /*begin_*/, - TValue * /*end_*/, - True) -{ - SEQAN_CHECKPOINT; - //do nothing -} - -template -inline void -_arrayDestructPointer(TValue * begin_, - TValue * end_, - False) -{ - SEQAN_CHECKPOINT; - _arrayDestructDefault(begin_, end_); -} - -template -inline void -arrayDestruct(TValue * begin_, - TValue * end_) -{ - SEQAN_CHECKPOINT; - _arrayDestructPointer(begin_, end_, typename IsSimple::Type() ); -} - -// ---------------------------------------------------------------------------- -// Function arrayFill() using pointers -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Missing? - -//no specializiation for pointer to simple - -// ---------------------------------------------------------------------------- -// Function arrayCopyBackward() using pointers -// ---------------------------------------------------------------------------- - -template -inline void -_arrayCopyForwardPointer(TValue * source_begin, - TValue * source_end, - TValue * target_begin, - True) -{ - SEQAN_CHECKPOINT; - ::std::memmove(target_begin, source_begin, (source_end - source_begin) * sizeof(TValue)); -} - -template -inline void -_arrayCopyForwardPointer(TValue * source_begin, - TValue * source_end, - TValue * target_begin, - False) -{ - SEQAN_CHECKPOINT; - _arrayCopyForwardDefault(source_begin, source_end, target_begin); -} - -template -inline void -arrayCopyForward(TValue * source_begin, - TValue * source_end, - TValue * target_begin) -{ - SEQAN_CHECKPOINT; - _arrayCopyForwardPointer(source_begin, source_end, target_begin, typename IsSimple::Type() ); -} - -template -inline void -_arrayCopyBackwardPointer(TValue * source_begin, - TValue * source_end, - TValue * target_begin, - True) -{ - SEQAN_CHECKPOINT; - ::std::memmove(target_begin, source_begin, (source_end - source_begin) * sizeof(TValue)); -} - -template -inline void -_arrayCopyBackwardPointer(TValue * source_begin, - TValue * source_end, - TValue * target_begin, - False) -{ - SEQAN_CHECKPOINT; - _arrayCopyBackwardDefault(source_begin, source_end, target_begin); -} - -template -inline void -arrayCopyBackward(TValue * source_begin, - TValue * source_end, - TValue * target_begin) -{ - SEQAN_CHECKPOINT; - _arrayCopyBackwardPointer(source_begin, source_end, target_begin, typename IsSimple::Type() ); -} - -// ---------------------------------------------------------------------------- -// Function arrayMoveBackward() using pointers -// ---------------------------------------------------------------------------- - -template -inline void -_arrayMoveForwardPointer(TValue * source_begin, - TValue * source_end, - TValue * target_begin, - True) -{ - SEQAN_CHECKPOINT; - ::std::memmove(target_begin, source_begin, (source_end - source_begin) * sizeof(TValue)); -} - -template -inline void -_arrayMoveForwardPointer(TValue * source_begin, - TValue * source_end, - TValue * target_begin, - False) -{ - SEQAN_CHECKPOINT; - _arrayMoveForwardDefault(source_begin, source_end, target_begin); -} - -template -inline void -arrayMoveForward(TValue * source_begin, - TValue * source_end, - TValue * target_begin) -{ - SEQAN_CHECKPOINT; - _arrayMoveForwardPointer(source_begin, source_end, target_begin, typename IsSimple::Type() ); -} - -template -inline void -_arrayMoveBackwardPointer(TValue * source_begin, - TValue * source_end, - TValue * target_begin, - True) -{ - SEQAN_CHECKPOINT; - ::std::memmove(target_begin, source_begin, (source_end - source_begin) * sizeof(TValue)); -} -template -inline void -_arrayMoveBackwardPointer(TValue * source_begin, - TValue * source_end, - TValue * target_begin, - False) -{ - SEQAN_CHECKPOINT; - _arrayMoveBackwardDefault(source_begin, source_end, target_begin); -} - -template -inline void -arrayMoveBackward(TValue * source_begin, - TValue * source_end, - TValue * target_begin) -{ - SEQAN_CHECKPOINT; - _arrayMoveBackwardPointer(source_begin, source_end, target_begin, typename IsSimple::Type() ); -} - -// ---------------------------------------------------------------------------- -// Function arrayClearSpace() using pointers -// ---------------------------------------------------------------------------- - -// clearSpace() on simple type using pointers. -template -inline void -_arrayClearSpacePointer(TValue * array_begin, - size_t array_length, - size_t keep_from, - size_t move_to, - True const & /*isSimple*/) -{ - if (keep_from == move_to) return; - SEQAN_CHECKPOINT; - // TODO(holtgrew): arrayCopy is more appropriate here since we are dealing with the IsSimple case. - arrayMove(array_begin + keep_from, array_begin + array_length, array_begin + move_to); -} - -// clearSpace() on non-simple type using pointers. -template -inline void -_arrayClearSpacePointer(TValue * array_begin, - size_t array_length, - size_t keep_from, - size_t move_to, - False const & /*isSimple*/) -{ - _arrayClearSpaceDefault(array_begin, array_length, keep_from, move_to); -} - -template -void arrayClearSpace(TValue * array_begin, - size_t array_length, - size_t keep_from, - size_t move_to) -{ - _arrayClearSpacePointer(array_begin, array_length, keep_from, move_to, typename IsSimple::Type()); -} - - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_ARRAY_CONSTRUCT_DESTRUCT_H_ diff --git a/seqan/basic/basic_aggregate.h b/seqan/basic/basic_aggregate.h deleted file mode 100644 index 2945299..0000000 --- a/seqan/basic/basic_aggregate.h +++ /dev/null @@ -1,62 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade header for basic/aggregate submodule. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_AGGREGATE_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_AGGREGATE_H_ - -// -------------------------------------------------------------------------- -// Prerequisites -// -------------------------------------------------------------------------- - -#include -#include -#include -#include - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_AGGREGATE_H_ diff --git a/seqan/basic/basic_allocator.h b/seqan/basic/basic_allocator.h deleted file mode 100644 index 70c238f..0000000 --- a/seqan/basic/basic_allocator.h +++ /dev/null @@ -1,64 +0,0 @@ -// ========================================================================== -// basic_allocator.h -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade header for basic/allocator submodule. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALLOCATOR_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALLOCATOR_H_ - -// -------------------------------------------------------------------------- -// Dependencies -// -------------------------------------------------------------------------- - -#include -#include -#include - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -// The allocator interface definitions. -#include - -// The allocator specializations. -#include -#include -#include -#include - -// Adaption from SeqAn allocator to STL allocator. -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALLOCATOR_H_ diff --git a/seqan/basic/basic_alphabet.h b/seqan/basic/basic_alphabet.h deleted file mode 100644 index f52a467..0000000 --- a/seqan/basic/basic_alphabet.h +++ /dev/null @@ -1,98 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade header for the basic/alphabet sub module. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_H_ - -// -------------------------------------------------------------------------- -// Dependencies -// -------------------------------------------------------------------------- - -#include -#include -#include -#include - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -// The first, more generic part of this sub module contains concepts, and the -// necessary metafunction and function prototypes as well as some forward and -// default implementations. - -// The alphabet concepts. -#include - -// Alphabet math functions / metafunctions forwards and default -// implementations. -#include - -// Adaptions for builtin C++ types to the alphabet concepts. -// TODO(holtgrew): Move into second part? -#include - -// Alphabets from Bioinformatics application - gapped unknown values. -#include - -// Alphabet with qualities metafunction and function forwards and default -// implementations -#include - -// Forward declarations and default implementations for storage related -// aspects of alphabets. -#include - -// The second part contains basic alphabets, namely the SimpleType class with -// the specialization for the biological data types, such as Dna, Rna, and -// Amino Acid. Furthermore, it contains a character storing profile entries. - -// The SimpleType class. -#include - -// Conversion tables for the biological SimpleType specializations. -#include - -// Conversion functions for the biological SimpleType specializations. -#include - -// The actual biological SimpleType specializations. -#include - -// The profile character implementation. -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ALPHABET_H_ diff --git a/seqan/basic/basic_concept.h b/seqan/basic/basic_concept.h deleted file mode 100644 index c841da3..0000000 --- a/seqan/basic/basic_concept.h +++ /dev/null @@ -1,66 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade header for sub module basic_concept. -// -// This sub module contains the SeqAn Concept Checking library (ported from -// Boost Concept Checking Library) and fundamental concepts (based both on -// Boost concepts and ConceptC++ concepts). -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_CONCEPT_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_CONCEPT_H_ - -// -------------------------------------------------------------------------- -// Prerequisites -// -------------------------------------------------------------------------- - -#include -#include -#include - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -// Minimal subset of the boost preprocessor library, required for concept -// checknig library port. -#include - -// SeqAn Concept Checking Library (ported from Boost). -#include - -// Fundamental concepts such as Assignable. -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_CONCEPT_H_ diff --git a/seqan/basic/basic_container.h b/seqan/basic/basic_container.h deleted file mode 100644 index e8a4b06..0000000 --- a/seqan/basic/basic_container.h +++ /dev/null @@ -1,56 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade header for the basic_container submodule. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_CONTAINER_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_CONTAINER_H_ - -// -------------------------------------------------------------------------- -// Dependencies -// -------------------------------------------------------------------------- - -#include -#include -#include -#include - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -// The container concept. -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_CONTAINER_H_ diff --git a/seqan/basic/basic_debug.h b/seqan/basic/basic_debug.h deleted file mode 100644 index abe12ab..0000000 --- a/seqan/basic/basic_debug.h +++ /dev/null @@ -1,60 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// The submodule basic/debug contains supporting codes for debugging, the -// assert macros double for test checks. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_DEBUG_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_DEBUG_H_ - -// -------------------------------------------------------------------------- -// Prerequisites -// -------------------------------------------------------------------------- - -#include - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -// The debug system with assertions. -#include - -// Test and debug helpers. -#include - -// Code for profiling. -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_DEBUG_H_ diff --git a/seqan/basic/basic_exception.h b/seqan/basic/basic_exception.h deleted file mode 100644 index 8d84db9..0000000 --- a/seqan/basic/basic_exception.h +++ /dev/null @@ -1,246 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Enrico Siragusa -// ========================================================================== -// Definition of basic exceptions. -// ========================================================================== - -#ifndef SEQAN_BASIC_BASIC_EXCEPTION_H_ -#define SEQAN_BASIC_BASIC_EXCEPTION_H_ - -// ============================================================================ -// Prerequisites -// ============================================================================ - -#include -#include -#include - -// ============================================================================ -// Macros -// ============================================================================ - -/*! - * @macro SEQAN_EXCEPTIONS - * @headerfile - * @brief Determines whether exceptions are enabled or not. - * - * @signature SEQAN_EXCEPTIONS - * - * @see SEQAN_TRY - * @see SEQAN_CATCH - * @see SEQAN_THROW - * @see Exception - */ - -#define SEQAN_EXCEPTIONS __EXCEPTIONS - -/*! - * @macro SEQAN_TRY - * @headerfile - * @brief Replaces the C++ try keyword. - * - * @signature SEQAN_TRY {} SEQAN_CATCH() {} - * - * @section Remarks - * - * When exceptions are disabled, i.e. SEQAN_EXCEPTIONS is set to false, the code inside the try block is always executed". - * - * @see SEQAN_CATCH - * @see SEQAN_THROW - * @see Exception - * - * @section Examples - * - * @code{.cpp} - * - * SEQAN_TRY - * { - * SEQAN_THROW(Exception) - * } - * SEQAN_CATCH(Exception const & e) - * { - * std::cerr << e.what() << std::endl; - * } - * - * @endcode - */ - -/*! - * @macro SEQAN_CATCH - * @headerfile - * @brief Replaces the C++ catch keyword. - * - * @signature SEQAN_TRY {} SEQAN_CATCH() {} - * - * @section Remarks - * - * When exceptions are disabled, i.e. SEQAN_EXCEPTIONS is set to false, the code inside the catch block is never executed". - * - * @see SEQAN_TRY - * @see SEQAN_THROW - * @see Exception - * - * @section Examples - * - * See @link SEQAN_TRY @endlink for a full example. - */ - -/*! - * @macro SEQAN_THROW - * @headerfile - * @brief Replaces the C++ throw keyword. - * - * @signature SEQAN_THROW(Exception); - * - * @section Remarks - * - * When exceptions are disabled, i.e. SEQAN_EXCEPTIONS is set to false, the macro turns into SEQAN_FAIL". - * - * @see SEQAN_TRY - * @see SEQAN_CATCH - * @see SEQAN_FAIL - * @see Exception - * - * @section Examples - * - * See @link SEQAN_TRY @endlink for a full example. - */ - -#ifdef SEQAN_EXCEPTIONS - -#define SEQAN_TRY try -#define SEQAN_CATCH(E) catch(E) -#define SEQAN_THROW(E) throw E -#define SEQAN_RETHROW throw - -#else - -#define SEQAN_TRY if (true) -#define SEQAN_CATCH(E) if (false) -//#define SEQAN_CATCH(E) for (E ; false; ) -#define SEQAN_THROW(E) SEQAN_FAIL(#E) -#define SEQAN_RETHROW - -#endif // #ifdef SEQAN_EXCEPTIONS - -namespace seqan { - -// ============================================================================ -// Classes -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Class Exception -// ---------------------------------------------------------------------------- - -/*! - * @class Exception - * @headerfile - * @brief Generic SeqAn exception. - * @signature Exception; - */ - -typedef std::exception Exception; - -// ---------------------------------------------------------------------------- -// Class BadAlloc -// ---------------------------------------------------------------------------- - -/*! - * @class BadAlloc - * @headerfile - * @brief Bad memory allocation exception. - * @signature BadAlloc; - */ - -typedef std::bad_alloc BadAlloc; - -// ---------------------------------------------------------------------------- -// Classes Bad* -// ---------------------------------------------------------------------------- -// NOTE(esiragusa): These exceptions can be introduced as long as we need them. - -//typedef std::bad_exception BadException; -//typedef std::bad_cast BadCast; -//typedef std::bad_typeid BadTypeId; -//typedef std::bad_function_call BadFunctionCall; -//typedef std::bad_weak_ptr BadWeakPtr; - -// ---------------------------------------------------------------------------- -// Class RuntimeError -// ---------------------------------------------------------------------------- - -/*! - * @class RuntimeError - * @headerfile - * @brief Runtime error exception. - * @signature RuntimeError("Message"); - */ - -typedef std::runtime_error RuntimeError; - -// ---------------------------------------------------------------------------- -// Class LogicError -// ---------------------------------------------------------------------------- -// NOTE(esiragusa): Always prefer SEQAN_ASSERT to logic error exceptions. - -//typedef std::logic_error LogicError; - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function globalExceptionHandler() -// ---------------------------------------------------------------------------- - -#ifdef SEQAN_EXCEPTIONS -static void globalExceptionHandler() -{ - SEQAN_TRY - { - SEQAN_RETHROW; - } - SEQAN_CATCH(Exception & e) - { - SEQAN_FAIL("Uncaught exception of type %s: %s", typeid(e).name(), e.what()); - } -} - -// Install global exception handler. -static const std::terminate_handler _globalExceptionHandler = std::set_terminate(globalExceptionHandler); -#endif - -} // namespace seqan - -#endif // #ifndef SEQAN_BASIC_BASIC_EXCEPTION_H_ diff --git a/seqan/basic/basic_fundamental.h b/seqan/basic/basic_fundamental.h deleted file mode 100644 index 2296de3..0000000 --- a/seqan/basic/basic_fundamental.h +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade hader for the submodule basic_fundamental. -// -// This module contains fundamental code such as forward declarations and -// prototypes for common metafunctions like Value<>, functions assign() etc. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_FUNDAMENTAL_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_FUNDAMENTAL_H_ - -// -------------------------------------------------------------------------- -// Prerequisites -// -------------------------------------------------------------------------- - -#include - -#include -#include - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -// Macros for deprecating code. -#include - -// Pseudo header with documentation for builtin functions. -#include - -// Common metafunctions such as Value<>. -#include - -// Basic tag-related code. -#include - -// Definition of assign(), set(), move(). -#include - -// Code supporting comparison. -#include - -// Conversion support. -#include - -// TODO(holtgrew): This is not fundamental. Should go into sequence module. -// Construct/destruct functions for arrays. -#include - -// TODO(holtgrew): This is not really fundamental, either. Should go into its own sub module. -// Hosted type. -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_HOSTED_TYPE_INTERFACE_H_ diff --git a/seqan/basic/basic_iterator.h b/seqan/basic/basic_iterator.h deleted file mode 100644 index ca6e41f..0000000 --- a/seqan/basic/basic_iterator.h +++ /dev/null @@ -1,77 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade header for basic_iterator submodule. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ITERATOR_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ITERATOR_H_ - -// -------------------------------------------------------------------------- -// Dependencies -// -------------------------------------------------------------------------- - -#include -#include -#include -#include - -#include // TODO(holtgrew): Temporary dependency - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -// Iterator interface definition. -#include - -// Iter base class. -#include - -// Iterator concept. -#include - -// Iterator for adapting iterators to Rooted Iterators. -#include - -// Positional iterator. -#include - -// Adaption between STL iterators and SeqAn iterators. -#include - -// TODO(holtgrew): Does proxy really belong here? -#include -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_ITERATOR_H_ diff --git a/seqan/basic/basic_math.h b/seqan/basic/basic_math.h deleted file mode 100644 index 30ae4df..0000000 --- a/seqan/basic/basic_math.h +++ /dev/null @@ -1,58 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade header for the basic/math sub module. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_MATH_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_MATH_H_ - -// -------------------------------------------------------------------------- -// Dependencies -// -------------------------------------------------------------------------- - -#include -#include - -#include -#include - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -#include -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_MATH_H_ - diff --git a/seqan/basic/basic_metaprogramming.h b/seqan/basic/basic_metaprogramming.h deleted file mode 100644 index b43cee5..0000000 --- a/seqan/basic/basic_metaprogramming.h +++ /dev/null @@ -1,59 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade header for the basic/metaprogramming submodule. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_METAPROGRAMMING_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_METAPROGRAMMING_H_ - -#include - -#include - -// Metaprogramming logical operations. -#include - -// Metaprogramming control structures. -#include - -// Metaprogramming mathematics. -#include - -// Metaprogramming for querying and modifying types. -#include - -// Metaprogramming for conditional enabling/disabling of code. -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_METAPROGRAMMING_H_ diff --git a/seqan/basic/basic_parallelism.h b/seqan/basic/basic_parallelism.h deleted file mode 100644 index db7761a..0000000 --- a/seqan/basic/basic_parallelism.h +++ /dev/null @@ -1,94 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// This sub module contains simple, generic support code for parallelism in -// SeqAn. -// -// It mainly defines the macro SEQAN_ENABLE_PARALLELISM. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_PARALLELISM_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_PARALLELISM_H_ - -/*! - * @macro SEQAN_ENABLE_PARALLELISM - * @headerfile - * @brief Indicates whether parallelism is enabled with value 0/1. - * - * @signature SEQAN_ENABLE_PARALLELISM - * - * By default, set to 1 if _OPENMP is defined and set to 0 otherwise. - * - * @section Examples - * - * If you want to change tihs value then you have to define this value before include any SeqAn header. - * - * @code{.cpp} - * #define SEQAN_ENABLE_PARALLELISM 0 // ALWAYS switch off parallelism! - * - * #include - * - * int main(int argc, char ** argv) - * { - * return 0; - * } - * @endcode - */ - -/** -.Macro.SEQAN_ENABLE_PARALLELISM -..summary:Indicates whether parallelism is enabled with value 0/1. -..cat:Parallelism -..signature:SEQAN_ENABLE_PARALLELISM -..remarks:By default, set to 1 if $_OPENMP$ is defined and set to 0 otherwise. -..example:If you want to change this value, you have to define this value before including any SeqAn header. -...code:#define SEQAN_ENABLE_PARALLELISM 0 // ALWAYS switch off parallelism! - -#include - -int main(int argc, char ** argv) -{ - return 0; -} -..include:seqan/basic.h - */ - -#if !defined(SEQAN_ENABLE_PARALLELISM) -#if defined(_OPENMP) -#define SEQAN_ENABLE_PARALLELISM 1 -#else // defined(_OPENMP) -#define SEQAN_ENABLE_PARALLELISM 0 -#endif // defined(_OPENMP) -#endif // !defined(SEQAN_ENABLE_PARALLELISM) - -#endif // SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_PARALLELISM_H_ diff --git a/seqan/basic/basic_proxy.h b/seqan/basic/basic_proxy.h deleted file mode 100644 index eda6402..0000000 --- a/seqan/basic/basic_proxy.h +++ /dev/null @@ -1,59 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Proxy definition. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_PROXY_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_PROXY_H_ - -// -------------------------------------------------------------------------- -// Dependencies -// -------------------------------------------------------------------------- - -#include -#include -#include - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -// Proxy base class. -#include - -// Implementation of a proxy through an iterator (the latter only needs -// assignValue() and setValue()). -#include - -#endif // SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_PROXY_H_ diff --git a/seqan/basic/basic_smart_pointer.h b/seqan/basic/basic_smart_pointer.h deleted file mode 100644 index bc020e1..0000000 --- a/seqan/basic/basic_smart_pointer.h +++ /dev/null @@ -1,59 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Facade header for the basic/smart_pointer sub module. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_SMART_POINTER_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_SMART_POINTER_H_ - -// -------------------------------------------------------------------------- -// Dependencies -// -------------------------------------------------------------------------- - -#include -#include -#include // TODO(holtgrew): Drop dependency, only for pointer holder which does not work anyway. -#include // TODO(holtgrew): Really required? Deprecated header? - -// -------------------------------------------------------------------------- -// Sub Module Headers -// -------------------------------------------------------------------------- - -#include -#include -#include - -#include - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BASIC_SMART_POINTER_H_ diff --git a/seqan/basic/basic_tangle.h b/seqan/basic/basic_tangle.h deleted file mode 100644 index 393a7a9..0000000 --- a/seqan/basic/basic_tangle.h +++ /dev/null @@ -1,175 +0,0 @@ -// ========================================================================== -// basic_tangle.h -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== - -// TODO(holtgrew): This header contains code that does not clearly belongs somewhere else. - -#ifndef CORE_INCLUDE_SEQAN_BASIC_BASIC_TANGLE_H_ -#define CORE_INCLUDE_SEQAN_BASIC_BASIC_TANGLE_H_ - -namespace seqan { - -// TODO(holtgrew): Remove this define. -#define SEQAN_NAMESPACE_MAIN seqan - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// TODO(holtgrew): Remove auto-sequence! -template -struct Iterator, Standard> -{ - typedef SimpleType * Type; -// typedef Iter, SimpleIterator> * Type; -}; - -template -struct Iterator const, Standard> -{ - typedef SimpleType const * Type; -// typedef Iter const, SimpleIterator> * Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Key -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Is this part of some adaption? - -///.Metafunction.Key.param.T.type:Class.Pair - -template -struct Key > -{ - typedef TKey Type; -}; - -// ---------------------------------------------------------------------------- -// Metafunction Cargo -// ---------------------------------------------------------------------------- - -// TODO(holtgrew): Is this part of some adaption? - -///.Metafunction.Cargo.param.T.type:Class.Pair - -template -struct Cargo > -{ - typedef TCargo Type; -}; - - -// ============================================================================ -// Functions -// ============================================================================ - -// ---------------------------------------------------------------------------- -// Function assignQualities() -// ---------------------------------------------------------------------------- - -/*! - * @fn assignQualities - * @headerfile - * @brief Assign quality values between strings. - * - * @signature void assignQualities(target, source); - * - * @param[out] target Target string, can be a String of DnaQ or Dna5Q characters. - * @param[in] source Source string. Can be a String of int or char. - * - * @section Remarks - * - * The target is resized to the length of source. This function calls assignQualityValue for all entries of - * target and source, look at the documentation of assignQualityValue on how the values of - * source are interpreted. - * - * Note that qualities are expected to be in PHRED scale. - * - * @see AlphabetWithQualitiesConcept#assignQualityValue - */ - -/** -.Function.assignQualities -..cat:Alphabets -..summary:Assign quality values between strings. -..signature:assignQualities(target, source) -..param.target:Target string -...type:nolink:@Class.String@ of any alphabet with qualities, e.g. @Spec.DnaQ@, @Spec.Dna5Q@ -..param.source:Source string. -...type:nolink:@Class.String@ of $int$ or $char$. -..remarks: -The target is resized to the length of source. -This function calls @Function.assignQualityValue@ for all entries of $target$ and $source$, look at the documentation of @Function.assignQualityValue@ on how the values of $source$ are interpreted. -..remarks: -Note that qualities are expected to be in PHRED scale. -..see:Function.assignQualityValue -..include:seqan/basic.h -*/ - -// TODO(holtgrew): Uncomment, place somewhere that knows both iterators and assignQualityValue, maybe in module sequence? -template -void assignQualities(TDest &dst, TSource const &src) -{ - typedef typename Iterator::Type TDestIter; - typedef typename Iterator::Type TSourceIter; - - if (length(dst) < length(src)) - resize(dst, length(src)); - - TDestIter itDst = begin(dst, Standard()); - TSourceIter itSrcEnd = end(src, Standard()); - - for (TSourceIter itSrc = begin(src, Standard()); itSrc != itSrcEnd; ++itDst, ++itSrc) - assignQualityValue(*itDst, *itSrc); -} - -template -inline T -unknownValueImpl(T *) -{ - SEQAN_CHECKPOINT; - return 'N'; -} - -} // namespace seqan - -#endif // #ifndef CORE_INCLUDE_SEQAN_BASIC_BASIC_TANGLE_H_ diff --git a/seqan/basic/basic_type.h b/seqan/basic/basic_type.h deleted file mode 100644 index b23f7f5..0000000 --- a/seqan/basic/basic_type.h +++ /dev/null @@ -1,718 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// Copyright (c) 2013 NVIDIA Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Andreas Gogol-Döring -// ========================================================================== -// Definition of basic Metafunctions. -// ========================================================================== - -// TODO(holtgrew): Rename to "shared metafunctions.h"? -// TODO(holtgrew): This could use some cleanup. - -#ifndef SEQAN_BASIC_BASIC_TYPE_H_ -#define SEQAN_BASIC_BASIC_TYPE_H_ - -#include - -namespace seqan { - -////////////////////////////////////////////////////////////////////////////// - -// TODO(holtgrew): Remove default implementation. -// SEQREV: elements-are-containers should not have a default implementation - -template -struct Value -{ - typedef T Type; -}; - -template -struct Value -{ - typedef T const Type; -}; - -//____________________________________________________________________________ - - -// TODO(holtgrew): Remove default implementation. -template -struct GetValue -{ - typedef typename Value::Type const & Type; -}; - -template -struct GetValue: - public GetValue -{ -}; - -//____________________________________________________________________________ - -// TODO(holtgrew): Remove default implementation. -template -struct Reference -{ - typedef typename Value::Type & Type; -}; - -template -struct Reference -{ - typedef typename Value::Type const & Type; -}; - -//____________________________________________________________________________ - - -// TODO(holtgrew): Remove default implementation. -template -struct Size -{ - typedef size_t Type; -}; - -template -struct Size: - Size -{ -}; - -//____________________________________________________________________________ - - - -// TODO(holtgrew): Remove default implementation. -template -struct Difference -{ - typedef ptrdiff_t Type; -}; - -template -struct Difference: - Difference -{ -}; - -//____________________________________________________________________________ - - -// TODO(holtgrew): Remove default implementation. -template -struct Position -{ - typedef typename Size::Type Type; -}; - -template -struct Position: - Position -{ -}; - -//____________________________________________________________________________ - -// SEQREV: elements-are-containers should not have a default implementation, if a type has no host, do not return self - -template -struct Host -{ - typedef T Type; -}; - -//____________________________________________________________________________ - -//____________________________________________________________________________ - -/*! - * @mfn Cargo - * @brief Type of additional data stored in an object. - * - * @signature Cargo::Type - * - * @tparam T Type for which the cargo tpye is queried. - * - * @return Type The cargo type of T. - * - * @section Remarks - * - * The definition of Cargo allows the addition of user-specified data into existing data structures. - */ - -/** -.Metafunction.Cargo: -..cat:Basic -..summary:Type of additional data stored in an object. -..signature:Cargo::Type -..param.T:Type for which the cargo tyoe is determined. -..returns.param.Type:Cargo of $T$. -..remarks:The definition of Cargo allows the addition of user specific data to existing data structures. -..include:seqan/basic.h -*/ - -// TODO(holtgrew): Should this have a default implementation? - -template -struct Cargo { - typedef Nothing Type; -}; -template -struct Cargo { - typedef typename Cargo::Type const Type; -}; - -//____________________________________________________________________________ - -/*! - * @mfn VertexDescriptor - * @headerfile - * @brief Type of an object that represents a vertex descriptor. - * - * @signature VertexDescriptor::Type; - * - * @tparam T The graph type to query. - * - * @return Type The resulting vertex descriptor type. - */ - -/** -.Metafunction.VertexDescriptor: -..cat:Graph -..summary:Type of an object that represents a vertex descriptor. -..signature:VertexDescriptor::Type -..param.T:Type T must be a graph. All graphs currently use ids as vertex descriptors. -..returns.param.Type:VertexDescriptor type. -..remarks.text:The vertex descriptor is a unique handle to a vertex in a graph. -It is used in various graph functions, e.g., to add edges, to create OutEdge Iterators or to remove a vertex. -It is also used to attach properties to vertices. -..example.code:VertexDescriptor >::Type vD; //vD is a vertex descriptor -..include:seqan/basic.h -*/ - -// TODO(holtgrew): Should this have a default implementation? For all graphs -- OK but for all types? - -template -struct VertexDescriptor { - typedef void* Type; -}; -template -struct VertexDescriptor: - public VertexDescriptor {}; - - -//____________________________________________________________________________ - -/*! - * @mfn Id - * @headerfile - * @brief Type of an object that represents an id. - * - * @signature Id::Type - * - * @tparam T The type to query for its id type. - * - * @return Type The resulting identifier type. - */ - -/** -.Metafunction.Id: -..cat:Graph -..summary:Type of an object that represents an id. -..signature:Id::Type -..param.T:Type for which a suitable id type is determined. -..returns.param.Type:Id type. -..remarks.text:The id type of a container is the type that is used to uniquely identify its elements. -In most cases this type is unsigned int. -..example.code:Id >::Type id; //id has type unsigned int -..include:seqan/basic.h -*/ - -// TODO(holtgrew): Should this have a default implementation? - -template -struct Id { - typedef unsigned int Type; -}; - -template -struct Id : Id {}; - -//____________________________________________________________________________ - -/*! - * @mfn Key - * @headerfile - * @brief Key type of a key to cargo mapping. - * - * @signature Key::Type; - * - * @tparam T Type for which a key type is determined. - * - * @return Type The key type. - */ - -/** -.Metafunction.Key: -..cat:Graph -..summary:Key type of a key to cargo mapping. -..signature:Key::Type -..param.T:Type for which a key type is determined. -..returns.param.Type:Key type. -...default:The type $T$ itself. -..include:seqan/basic.h -*/ - -// TODO(holtgrew): Should this have a default implementation? - -template< typename T > -struct Key -{ - typedef T Type; -}; - -template -struct Key: - Key {}; - -//____________________________________________________________________________ - -/*VERALTET -.Metafunction.Object: -..summary:Object type of a key to object mapping. -..signature:Object::Type -..param.T:Type for which a object type is determined. -..returns.param.Type:Object type. -..include:seqan/basic.h -*/ - -template -struct Object; - -template -struct Object: - Object {}; - - -//____________________________________________________________________________ - -// TODO(holtgrew): Move to alignments? -// TODO(holtgrew): Is this default implementation what we want? - -/** -.Metafunction.Source -..cat:Alignments -*/ - -template < typename TSpec = void > -struct Source -{ - typedef TSpec Type; -}; - -template -struct Source: - Source -{ -}; - - -//____________________________________________________________________________ - -/*! - * @mfn IsLightWeight - * @headerfile - * @brief Determines whether an object can efficiently be passed by copy. - * - * @signature IsLightWeight::Type; - * - * @tparam T The type to query. - * - * @return Type Either True or False. True if the object can efficiently be copied. - */ - -/** -.Metafunction.IsLightWeight: -..cat:Metafunctions -..summary:Determines whether an object can efficiently be passed by copy. -..signature:IsLightWeight::Type -..param.T:A type. -..returns.param.Type:@Tag.Logical Values.tag.True@ if the object is light-weight and can efficiently be copied, e.g. @Class.Segment@, otherwise @Tag.Logical Values.tag.False@. -*/ - -template -struct IsLightWeight: - False {}; - -//____________________________________________________________________________ - -/** -.Internal.Parameter_: -..cat:Metafunctions -..summary:Type for function parameters and return values. -..signature:Parameter_::Type -..param.T:A type. -..returns.param.Type:The parameter type for arguments of type $T$. -...text:If $T$ is a pointer or array type, then $Parameter_::Type$ is $T$, -otherwise $Parameter_::Type$ is $T &$. -*/ - -// TODO(holtgrew): Really required? - -template -struct Parameter_ -{ - typedef T & Type; -}; - -template -struct Parameter_ -{ - typedef T * Type; -}; - -template -struct Parameter_ -{ - typedef T * Type; -}; - -/** -.Internal._toParameter: -..cat:Functions -..summary:Transforms pointers to parameter types. -..signature:_toParameter(pointer) -..param.pointer:A pointer. -..param.T:A Type. -...text:$object$ is transformed into the parameter type of $T$ that is given by @Internal.Parameter_@. -...note:This type must be explicitely specified. -..returns:To $TParameter$ transformed $object$. -..see:Internal.Parameter_ -*/ - -// TODO(holtgrew): Really required? - -template -typename Parameter_::Type -SEQAN_HOST_DEVICE inline _toParameter(T * _object) -{ - return * _object; -} - -template -typename Parameter_::Type -SEQAN_HOST_DEVICE inline _toParameter(T & _object) -{ - return _object; -} - -template -typename Parameter_::Type -SEQAN_HOST_DEVICE inline _toParameter(T const & _object) -{ - return _object; -} - -//____________________________________________________________________________ - -/** -.Internal.ConstParameter_: -..cat:Metafunctions -..summary:Type for constant function parameters and return values. -..signature:ConstParameter_::Type -..param.T:A type. -..returns.param.Type:The const parameter type for arguments of type $T$. -...text:If $T$ is a pointer or array type, then $Parameter_::Type$ is a pointer to a const array, -otherwise $Parameter_::Type$ is $T const &$. -..see:Internal.Parameter_ -*/ - -// TODO(holtgrew): Really required? - -template -struct ConstParameter_ -{ - typedef T const & Type; -}; - -template -struct ConstParameter_: - public ConstParameter_ {}; - -template -struct ConstParameter_ -{ - typedef T const * Type; -}; - -template -struct ConstParameter_ -{ - typedef T const * Type; -}; - -template -struct ConstParameter_ -{ - typedef T const * Type; -}; - -template -struct ConstParameter_ -{ - typedef T const * Type; -}; - -//____________________________________________________________________________ - -/*! - * @mfn Member - * @headerfile - * @brief Type of a member of an object. - * - * @signature Member::Type; - * @tparam TObject The object holding the member. - * @tparam TSpec A tag to identify the object's member. - * @return Type The resulting object's member type. - * - * @section Remarks - * - * This metafunction is used to control the type of a member of a given object. It works analogously to @link Index#Fibre @endlink. - * For instance, it is used to change the relationship between two objects from aggregation to composition and vice versa. - * - * @see Index#Fibre - */ - -template -struct Member; - -template -struct Member : - Member {}; - -//____________________________________________________________________________ - -/** -.Internal.Pointer_: -..cat:Metafunctions -..summary:The associated pointer type. -..signature:Pointer_::Type -..param.T:A type. -..returns.param.Type:A pointer type for $T$. -...text:if $T$ is already a pointer type, then $Pointer_::Type$ is $T$, -otherwise $Pointer_::Type$ is $T *$. -..see:Internal.Parameter_ -..see:Internal._toParameter -*/ - -// TODO(holtgrew): Really required? - -template -struct Pointer_ -{ - typedef T * Type; -}; - -template -struct Pointer_ -{ - typedef T * Type; -}; -template -struct Pointer_ -{ - typedef T * Type; -}; - -template -struct Pointer_ -{ - typedef T * Type; -}; - -//non const version of Pointer_ for return values - -template -struct NonConstPointer_: - Pointer_ -{ -}; -template -struct NonConstPointer_ -{ - typedef T * Type; -}; - -/** -.Internal._toPointer: -..cat:Functions -..summary:Transforms types into pointers. -..signature:_toPointer(object) -..param.object:An object. -..returns:$object$, transformed to a pointer. -...text:The type of the returned pointer is given by @Internal.Pointer_@. -..see:Internal.Pointer_ -*/ - -// TODO(holtgrew): Really required? - -template -SEQAN_HOST_DEVICE inline typename NonConstPointer_::Type -_toPointer(T & _object) -{ -SEQAN_CHECKPOINT - return & _object; -} -template -SEQAN_HOST_DEVICE inline typename NonConstPointer_::Type -_toPointer(T const & _object) -{ -SEQAN_CHECKPOINT - return & _object; -} - -template -SEQAN_HOST_DEVICE inline typename NonConstPointer_::Type -_toPointer(T * _object) -{ -SEQAN_CHECKPOINT - return _object; -} - -// -------------------------------------------------------------------------- -// Function _dereference() -// -------------------------------------------------------------------------- - -// explicitly give desired dereferenced type as first argument, -// e.g. _dereference(int*) or _dereference &>(Segment<..> &) -template -inline T -_dereference(typename RemoveReference::Type & ptr) -{ - return ptr; -} - -template -inline T -_dereference(typename RemoveReference::Type * ptr) -{ - return *ptr; -} - - -//____________________________________________________________________________ - -/*! - * @mfn LENGTH - * @brief Number of elements in a fixed-size container/vector. - * - * @signature LENGTH::VALUE; - * - * @tparam T The type to query for its length. - * - * @return VALUE The length of T. - */ - -/** -.Metafunction.LENGTH: -..cat:Basic -..summary:Number of elements in a fixed-size container. -..signature:LENGTH::VALUE -..param.T:Type for which the number of elements is determined. -..returns.param.VALUE:Number of elements. -..remarks.text:The default return value is 1 for dynamic-size containers. -..include:seqan/basic.h -*/ - -// SEQREV: elements-are-containers should probably not have a default implementation -// TODO(holtgrew): Rather switch to static const unsigned VALUE = ? - -template -struct LENGTH -{ - enum { VALUE = 1 }; -}; - -template -struct LENGTH: - LENGTH -{ -}; - -/*! - * @mfn WEIGHT - * @brief Number of relevant positions in a shape. - * - * @signature WEIGHT::VALUE; - * - * @tparam T The Shape type to query. - * @return VALUE The number of relevant positions in a shape. - */ - -/** -.Metafunction.WEIGHT: -..cat:Index -..summary:Number of relevant positions in a shape. -..signature:WEIGHT::Type -..param.T:Shape type for which the number of relevant positions is determined. -...type:Class.Shape -..returns.param.VALUE:Number of relevant positions. -..remarks.text:The default return value is the result of the @Metafunction.LENGTH@ function. -For gapped shapes this is the number of '1's. -..include:seqan/basic.h -*/ - -// TODO(holtgrew): Should probably go to wherever shapes are defined. - -template -struct WEIGHT: - LENGTH -{ -}; -template -struct WEIGHT: - WEIGHT -{ -}; - -////////////////////////////////////////////////////////////////////////////// - -//Iterator: see basic_iterator.h - -////////////////////////////////////////////////////////////////////////////// - - -} // namespace seqan - -#endif // #ifndef SEQAN_BASIC_BASIC_TYPE_H_ diff --git a/seqan/basic/boost_preprocessor_subset.h b/seqan/basic/boost_preprocessor_subset.h deleted file mode 100644 index bef6d2b..0000000 --- a/seqan/basic/boost_preprocessor_subset.h +++ /dev/null @@ -1,5138 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Taken from Boost preprocessors library, Boost version 1.47. We extracted -// the minimal subset (header-wise) for supporting the concepts. -// -// There is currently no plan to incorporate more of Boost into SeqAn and -// thus this can be seen as a quick hack to get BCCL's nice syntax. It is -// probably a bad idea to repeat this. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_SEQAN_PREPROCESSOR_SUBSET_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_SEQAN_PREPROCESSOR_SUBSET_H_ - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/tuple/rem.hpp <== -// -------------------------------------------------------------------------- - -# /* ************************************************************************** -# * * -# * (C) Copyright Paul Mensonides 2002. -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# * * -# ************************************************************************** */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_TUPLE_REM_HPP -// # define SEQAN_PREPROCESSOR_TUPLE_REM_HPP -# -// # include -# -# /* SEQAN_PP_TUPLE_REM */ -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_TUPLE_REM(size) SEQAN_PP_TUPLE_REM_I(size) -// # else -// # define SEQAN_PP_TUPLE_REM(size) SEQAN_PP_TUPLE_REM_OO((size)) -// # define SEQAN_PP_TUPLE_REM_OO(par) SEQAN_PP_TUPLE_REM_I ## par -// # endif -# -# define SEQAN_PP_TUPLE_REM_I(size) SEQAN_PP_TUPLE_REM_ ## size -# -# define SEQAN_PP_TUPLE_REM_0() -# define SEQAN_PP_TUPLE_REM_1(a) a -# define SEQAN_PP_TUPLE_REM_2(a, b) a, b -# define SEQAN_PP_TUPLE_REM_3(a, b, c) a, b, c -# define SEQAN_PP_TUPLE_REM_4(a, b, c, d) a, b, c, d -# define SEQAN_PP_TUPLE_REM_5(a, b, c, d, e) a, b, c, d, e -# define SEQAN_PP_TUPLE_REM_6(a, b, c, d, e, f) a, b, c, d, e, f -# define SEQAN_PP_TUPLE_REM_7(a, b, c, d, e, f, g) a, b, c, d, e, f, g -# define SEQAN_PP_TUPLE_REM_8(a, b, c, d, e, f, g, h) a, b, c, d, e, f, g, h -# define SEQAN_PP_TUPLE_REM_9(a, b, c, d, e, f, g, h, i) a, b, c, d, e, f, g, h, i -# define SEQAN_PP_TUPLE_REM_10(a, b, c, d, e, f, g, h, i, j) a, b, c, d, e, f, g, h, i, j -# define SEQAN_PP_TUPLE_REM_11(a, b, c, d, e, f, g, h, i, j, k) a, b, c, d, e, f, g, h, i, j, k -# define SEQAN_PP_TUPLE_REM_12(a, b, c, d, e, f, g, h, i, j, k, l) a, b, c, d, e, f, g, h, i, j, k, l -# define SEQAN_PP_TUPLE_REM_13(a, b, c, d, e, f, g, h, i, j, k, l, m) a, b, c, d, e, f, g, h, i, j, k, l, m -# define SEQAN_PP_TUPLE_REM_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n) a, b, c, d, e, f, g, h, i, j, k, l, m, n -# define SEQAN_PP_TUPLE_REM_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o -# define SEQAN_PP_TUPLE_REM_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p -# define SEQAN_PP_TUPLE_REM_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q -# define SEQAN_PP_TUPLE_REM_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r -# define SEQAN_PP_TUPLE_REM_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s -# define SEQAN_PP_TUPLE_REM_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t -# define SEQAN_PP_TUPLE_REM_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u -# define SEQAN_PP_TUPLE_REM_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v -# define SEQAN_PP_TUPLE_REM_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w -# define SEQAN_PP_TUPLE_REM_24(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x -# define SEQAN_PP_TUPLE_REM_25(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y -# -# /* SEQAN_PP_TUPLE_REM_CTOR */ -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() -# define SEQAN_PP_TUPLE_REM_CTOR(size, tuple) SEQAN_PP_TUPLE_REM_CTOR_I(SEQAN_PP_TUPLE_REM(size), tuple) -// # else -// # define SEQAN_PP_TUPLE_REM_CTOR(size, tuple) SEQAN_PP_TUPLE_REM_CTOR_D(size, tuple) -// # define SEQAN_PP_TUPLE_REM_CTOR_D(size, tuple) SEQAN_PP_TUPLE_REM_CTOR_I(SEQAN_PP_TUPLE_REM(size), tuple) -// # endif -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_TUPLE_REM_CTOR_I(ext, tuple) ext tuple -// # else -// # define SEQAN_PP_TUPLE_REM_CTOR_I(ext, tuple) SEQAN_PP_TUPLE_REM_CTOR_OO((ext, tuple)) -// # define SEQAN_PP_TUPLE_REM_CTOR_OO(par) SEQAN_PP_TUPLE_REM_CTOR_II ## par -// # define SEQAN_PP_TUPLE_REM_CTOR_II(ext, tuple) ext ## tuple -// # endif -# -// # endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/tuple/elem.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_TUPLE_ELEM_HPP -// # define SEQAN_PREPROCESSOR_TUPLE_ELEM_HPP -# -// # include -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_TUPLE_ELEM(size, index, tuple) SEQAN_PP_TUPLE_ELEM_I(size, index, tuple) -// # else -// # define SEQAN_PP_TUPLE_ELEM(size, index, tuple) SEQAN_PP_TUPLE_ELEM_OO((size, index, tuple)) -// # define SEQAN_PP_TUPLE_ELEM_OO(par) SEQAN_PP_TUPLE_ELEM_I ## par -// # endif -# -// # if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -// # define SEQAN_PP_TUPLE_ELEM_I(s, i, t) SEQAN_PP_TUPLE_ELEM_ ## s ## _ ## i ## t -#ifdef PLATFORM_WINDOWS_VS // # elif SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MSVC() -# define SEQAN_PP_TUPLE_ELEM_I(s, i, t) SEQAN_PP_TUPLE_ELEM_II(SEQAN_PP_TUPLE_ELEM_ ## s ## _ ## i t) -# define SEQAN_PP_TUPLE_ELEM_II(res) res -#else // #ifdef PLATFORM_WINDOWS_VS -# define SEQAN_PP_TUPLE_ELEM_I(s, i, t) SEQAN_PP_TUPLE_ELEM_ ## s ## _ ## i t -#endif // #ifdef PLATFORM_WINDOWS_VS -# -# define SEQAN_PP_TUPLE_ELEM_1_0(a) a -# -# define SEQAN_PP_TUPLE_ELEM_2_0(a, b) a -# define SEQAN_PP_TUPLE_ELEM_2_1(a, b) b -# -# define SEQAN_PP_TUPLE_ELEM_3_0(a, b, c) a -# define SEQAN_PP_TUPLE_ELEM_3_1(a, b, c) b -# define SEQAN_PP_TUPLE_ELEM_3_2(a, b, c) c -# -# define SEQAN_PP_TUPLE_ELEM_4_0(a, b, c, d) a -# define SEQAN_PP_TUPLE_ELEM_4_1(a, b, c, d) b -# define SEQAN_PP_TUPLE_ELEM_4_2(a, b, c, d) c -# define SEQAN_PP_TUPLE_ELEM_4_3(a, b, c, d) d -# -# define SEQAN_PP_TUPLE_ELEM_5_0(a, b, c, d, e) a -# define SEQAN_PP_TUPLE_ELEM_5_1(a, b, c, d, e) b -# define SEQAN_PP_TUPLE_ELEM_5_2(a, b, c, d, e) c -# define SEQAN_PP_TUPLE_ELEM_5_3(a, b, c, d, e) d -# define SEQAN_PP_TUPLE_ELEM_5_4(a, b, c, d, e) e -# -# define SEQAN_PP_TUPLE_ELEM_6_0(a, b, c, d, e, f) a -# define SEQAN_PP_TUPLE_ELEM_6_1(a, b, c, d, e, f) b -# define SEQAN_PP_TUPLE_ELEM_6_2(a, b, c, d, e, f) c -# define SEQAN_PP_TUPLE_ELEM_6_3(a, b, c, d, e, f) d -# define SEQAN_PP_TUPLE_ELEM_6_4(a, b, c, d, e, f) e -# define SEQAN_PP_TUPLE_ELEM_6_5(a, b, c, d, e, f) f -# -# define SEQAN_PP_TUPLE_ELEM_7_0(a, b, c, d, e, f, g) a -# define SEQAN_PP_TUPLE_ELEM_7_1(a, b, c, d, e, f, g) b -# define SEQAN_PP_TUPLE_ELEM_7_2(a, b, c, d, e, f, g) c -# define SEQAN_PP_TUPLE_ELEM_7_3(a, b, c, d, e, f, g) d -# define SEQAN_PP_TUPLE_ELEM_7_4(a, b, c, d, e, f, g) e -# define SEQAN_PP_TUPLE_ELEM_7_5(a, b, c, d, e, f, g) f -# define SEQAN_PP_TUPLE_ELEM_7_6(a, b, c, d, e, f, g) g -# -# define SEQAN_PP_TUPLE_ELEM_8_0(a, b, c, d, e, f, g, h) a -# define SEQAN_PP_TUPLE_ELEM_8_1(a, b, c, d, e, f, g, h) b -# define SEQAN_PP_TUPLE_ELEM_8_2(a, b, c, d, e, f, g, h) c -# define SEQAN_PP_TUPLE_ELEM_8_3(a, b, c, d, e, f, g, h) d -# define SEQAN_PP_TUPLE_ELEM_8_4(a, b, c, d, e, f, g, h) e -# define SEQAN_PP_TUPLE_ELEM_8_5(a, b, c, d, e, f, g, h) f -# define SEQAN_PP_TUPLE_ELEM_8_6(a, b, c, d, e, f, g, h) g -# define SEQAN_PP_TUPLE_ELEM_8_7(a, b, c, d, e, f, g, h) h -# -# define SEQAN_PP_TUPLE_ELEM_9_0(a, b, c, d, e, f, g, h, i) a -# define SEQAN_PP_TUPLE_ELEM_9_1(a, b, c, d, e, f, g, h, i) b -# define SEQAN_PP_TUPLE_ELEM_9_2(a, b, c, d, e, f, g, h, i) c -# define SEQAN_PP_TUPLE_ELEM_9_3(a, b, c, d, e, f, g, h, i) d -# define SEQAN_PP_TUPLE_ELEM_9_4(a, b, c, d, e, f, g, h, i) e -# define SEQAN_PP_TUPLE_ELEM_9_5(a, b, c, d, e, f, g, h, i) f -# define SEQAN_PP_TUPLE_ELEM_9_6(a, b, c, d, e, f, g, h, i) g -# define SEQAN_PP_TUPLE_ELEM_9_7(a, b, c, d, e, f, g, h, i) h -# define SEQAN_PP_TUPLE_ELEM_9_8(a, b, c, d, e, f, g, h, i) i -# -# define SEQAN_PP_TUPLE_ELEM_10_0(a, b, c, d, e, f, g, h, i, j) a -# define SEQAN_PP_TUPLE_ELEM_10_1(a, b, c, d, e, f, g, h, i, j) b -# define SEQAN_PP_TUPLE_ELEM_10_2(a, b, c, d, e, f, g, h, i, j) c -# define SEQAN_PP_TUPLE_ELEM_10_3(a, b, c, d, e, f, g, h, i, j) d -# define SEQAN_PP_TUPLE_ELEM_10_4(a, b, c, d, e, f, g, h, i, j) e -# define SEQAN_PP_TUPLE_ELEM_10_5(a, b, c, d, e, f, g, h, i, j) f -# define SEQAN_PP_TUPLE_ELEM_10_6(a, b, c, d, e, f, g, h, i, j) g -# define SEQAN_PP_TUPLE_ELEM_10_7(a, b, c, d, e, f, g, h, i, j) h -# define SEQAN_PP_TUPLE_ELEM_10_8(a, b, c, d, e, f, g, h, i, j) i -# define SEQAN_PP_TUPLE_ELEM_10_9(a, b, c, d, e, f, g, h, i, j) j -# -# define SEQAN_PP_TUPLE_ELEM_11_0(a, b, c, d, e, f, g, h, i, j, k) a -# define SEQAN_PP_TUPLE_ELEM_11_1(a, b, c, d, e, f, g, h, i, j, k) b -# define SEQAN_PP_TUPLE_ELEM_11_2(a, b, c, d, e, f, g, h, i, j, k) c -# define SEQAN_PP_TUPLE_ELEM_11_3(a, b, c, d, e, f, g, h, i, j, k) d -# define SEQAN_PP_TUPLE_ELEM_11_4(a, b, c, d, e, f, g, h, i, j, k) e -# define SEQAN_PP_TUPLE_ELEM_11_5(a, b, c, d, e, f, g, h, i, j, k) f -# define SEQAN_PP_TUPLE_ELEM_11_6(a, b, c, d, e, f, g, h, i, j, k) g -# define SEQAN_PP_TUPLE_ELEM_11_7(a, b, c, d, e, f, g, h, i, j, k) h -# define SEQAN_PP_TUPLE_ELEM_11_8(a, b, c, d, e, f, g, h, i, j, k) i -# define SEQAN_PP_TUPLE_ELEM_11_9(a, b, c, d, e, f, g, h, i, j, k) j -# define SEQAN_PP_TUPLE_ELEM_11_10(a, b, c, d, e, f, g, h, i, j, k) k -# -# define SEQAN_PP_TUPLE_ELEM_12_0(a, b, c, d, e, f, g, h, i, j, k, l) a -# define SEQAN_PP_TUPLE_ELEM_12_1(a, b, c, d, e, f, g, h, i, j, k, l) b -# define SEQAN_PP_TUPLE_ELEM_12_2(a, b, c, d, e, f, g, h, i, j, k, l) c -# define SEQAN_PP_TUPLE_ELEM_12_3(a, b, c, d, e, f, g, h, i, j, k, l) d -# define SEQAN_PP_TUPLE_ELEM_12_4(a, b, c, d, e, f, g, h, i, j, k, l) e -# define SEQAN_PP_TUPLE_ELEM_12_5(a, b, c, d, e, f, g, h, i, j, k, l) f -# define SEQAN_PP_TUPLE_ELEM_12_6(a, b, c, d, e, f, g, h, i, j, k, l) g -# define SEQAN_PP_TUPLE_ELEM_12_7(a, b, c, d, e, f, g, h, i, j, k, l) h -# define SEQAN_PP_TUPLE_ELEM_12_8(a, b, c, d, e, f, g, h, i, j, k, l) i -# define SEQAN_PP_TUPLE_ELEM_12_9(a, b, c, d, e, f, g, h, i, j, k, l) j -# define SEQAN_PP_TUPLE_ELEM_12_10(a, b, c, d, e, f, g, h, i, j, k, l) k -# define SEQAN_PP_TUPLE_ELEM_12_11(a, b, c, d, e, f, g, h, i, j, k, l) l -# -# define SEQAN_PP_TUPLE_ELEM_13_0(a, b, c, d, e, f, g, h, i, j, k, l, m) a -# define SEQAN_PP_TUPLE_ELEM_13_1(a, b, c, d, e, f, g, h, i, j, k, l, m) b -# define SEQAN_PP_TUPLE_ELEM_13_2(a, b, c, d, e, f, g, h, i, j, k, l, m) c -# define SEQAN_PP_TUPLE_ELEM_13_3(a, b, c, d, e, f, g, h, i, j, k, l, m) d -# define SEQAN_PP_TUPLE_ELEM_13_4(a, b, c, d, e, f, g, h, i, j, k, l, m) e -# define SEQAN_PP_TUPLE_ELEM_13_5(a, b, c, d, e, f, g, h, i, j, k, l, m) f -# define SEQAN_PP_TUPLE_ELEM_13_6(a, b, c, d, e, f, g, h, i, j, k, l, m) g -# define SEQAN_PP_TUPLE_ELEM_13_7(a, b, c, d, e, f, g, h, i, j, k, l, m) h -# define SEQAN_PP_TUPLE_ELEM_13_8(a, b, c, d, e, f, g, h, i, j, k, l, m) i -# define SEQAN_PP_TUPLE_ELEM_13_9(a, b, c, d, e, f, g, h, i, j, k, l, m) j -# define SEQAN_PP_TUPLE_ELEM_13_10(a, b, c, d, e, f, g, h, i, j, k, l, m) k -# define SEQAN_PP_TUPLE_ELEM_13_11(a, b, c, d, e, f, g, h, i, j, k, l, m) l -# define SEQAN_PP_TUPLE_ELEM_13_12(a, b, c, d, e, f, g, h, i, j, k, l, m) m -# -# define SEQAN_PP_TUPLE_ELEM_14_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n) a -# define SEQAN_PP_TUPLE_ELEM_14_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n) b -# define SEQAN_PP_TUPLE_ELEM_14_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n) c -# define SEQAN_PP_TUPLE_ELEM_14_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n) d -# define SEQAN_PP_TUPLE_ELEM_14_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n) e -# define SEQAN_PP_TUPLE_ELEM_14_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n) f -# define SEQAN_PP_TUPLE_ELEM_14_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n) g -# define SEQAN_PP_TUPLE_ELEM_14_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n) h -# define SEQAN_PP_TUPLE_ELEM_14_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n) i -# define SEQAN_PP_TUPLE_ELEM_14_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n) j -# define SEQAN_PP_TUPLE_ELEM_14_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n) k -# define SEQAN_PP_TUPLE_ELEM_14_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n) l -# define SEQAN_PP_TUPLE_ELEM_14_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n) m -# define SEQAN_PP_TUPLE_ELEM_14_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n) n -# -# define SEQAN_PP_TUPLE_ELEM_15_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) a -# define SEQAN_PP_TUPLE_ELEM_15_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) b -# define SEQAN_PP_TUPLE_ELEM_15_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) c -# define SEQAN_PP_TUPLE_ELEM_15_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) d -# define SEQAN_PP_TUPLE_ELEM_15_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) e -# define SEQAN_PP_TUPLE_ELEM_15_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) f -# define SEQAN_PP_TUPLE_ELEM_15_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) g -# define SEQAN_PP_TUPLE_ELEM_15_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) h -# define SEQAN_PP_TUPLE_ELEM_15_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) i -# define SEQAN_PP_TUPLE_ELEM_15_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) j -# define SEQAN_PP_TUPLE_ELEM_15_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) k -# define SEQAN_PP_TUPLE_ELEM_15_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) l -# define SEQAN_PP_TUPLE_ELEM_15_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) m -# define SEQAN_PP_TUPLE_ELEM_15_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) n -# define SEQAN_PP_TUPLE_ELEM_15_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) o -# -# define SEQAN_PP_TUPLE_ELEM_16_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) a -# define SEQAN_PP_TUPLE_ELEM_16_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) b -# define SEQAN_PP_TUPLE_ELEM_16_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) c -# define SEQAN_PP_TUPLE_ELEM_16_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) d -# define SEQAN_PP_TUPLE_ELEM_16_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) e -# define SEQAN_PP_TUPLE_ELEM_16_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) f -# define SEQAN_PP_TUPLE_ELEM_16_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) g -# define SEQAN_PP_TUPLE_ELEM_16_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) h -# define SEQAN_PP_TUPLE_ELEM_16_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) i -# define SEQAN_PP_TUPLE_ELEM_16_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) j -# define SEQAN_PP_TUPLE_ELEM_16_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) k -# define SEQAN_PP_TUPLE_ELEM_16_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) l -# define SEQAN_PP_TUPLE_ELEM_16_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) m -# define SEQAN_PP_TUPLE_ELEM_16_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) n -# define SEQAN_PP_TUPLE_ELEM_16_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) o -# define SEQAN_PP_TUPLE_ELEM_16_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) p -# -# define SEQAN_PP_TUPLE_ELEM_17_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) a -# define SEQAN_PP_TUPLE_ELEM_17_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) b -# define SEQAN_PP_TUPLE_ELEM_17_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) c -# define SEQAN_PP_TUPLE_ELEM_17_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) d -# define SEQAN_PP_TUPLE_ELEM_17_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) e -# define SEQAN_PP_TUPLE_ELEM_17_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) f -# define SEQAN_PP_TUPLE_ELEM_17_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) g -# define SEQAN_PP_TUPLE_ELEM_17_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) h -# define SEQAN_PP_TUPLE_ELEM_17_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) i -# define SEQAN_PP_TUPLE_ELEM_17_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) j -# define SEQAN_PP_TUPLE_ELEM_17_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) k -# define SEQAN_PP_TUPLE_ELEM_17_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) l -# define SEQAN_PP_TUPLE_ELEM_17_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) m -# define SEQAN_PP_TUPLE_ELEM_17_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) n -# define SEQAN_PP_TUPLE_ELEM_17_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) o -# define SEQAN_PP_TUPLE_ELEM_17_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) p -# define SEQAN_PP_TUPLE_ELEM_17_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) q -# -# define SEQAN_PP_TUPLE_ELEM_18_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) a -# define SEQAN_PP_TUPLE_ELEM_18_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) b -# define SEQAN_PP_TUPLE_ELEM_18_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) c -# define SEQAN_PP_TUPLE_ELEM_18_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) d -# define SEQAN_PP_TUPLE_ELEM_18_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) e -# define SEQAN_PP_TUPLE_ELEM_18_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) f -# define SEQAN_PP_TUPLE_ELEM_18_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) g -# define SEQAN_PP_TUPLE_ELEM_18_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) h -# define SEQAN_PP_TUPLE_ELEM_18_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) i -# define SEQAN_PP_TUPLE_ELEM_18_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) j -# define SEQAN_PP_TUPLE_ELEM_18_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) k -# define SEQAN_PP_TUPLE_ELEM_18_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) l -# define SEQAN_PP_TUPLE_ELEM_18_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) m -# define SEQAN_PP_TUPLE_ELEM_18_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) n -# define SEQAN_PP_TUPLE_ELEM_18_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) o -# define SEQAN_PP_TUPLE_ELEM_18_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) p -# define SEQAN_PP_TUPLE_ELEM_18_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) q -# define SEQAN_PP_TUPLE_ELEM_18_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) r -# -# define SEQAN_PP_TUPLE_ELEM_19_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) a -# define SEQAN_PP_TUPLE_ELEM_19_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) b -# define SEQAN_PP_TUPLE_ELEM_19_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) c -# define SEQAN_PP_TUPLE_ELEM_19_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) d -# define SEQAN_PP_TUPLE_ELEM_19_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) e -# define SEQAN_PP_TUPLE_ELEM_19_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) f -# define SEQAN_PP_TUPLE_ELEM_19_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) g -# define SEQAN_PP_TUPLE_ELEM_19_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) h -# define SEQAN_PP_TUPLE_ELEM_19_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) i -# define SEQAN_PP_TUPLE_ELEM_19_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) j -# define SEQAN_PP_TUPLE_ELEM_19_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) k -# define SEQAN_PP_TUPLE_ELEM_19_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) l -# define SEQAN_PP_TUPLE_ELEM_19_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) m -# define SEQAN_PP_TUPLE_ELEM_19_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) n -# define SEQAN_PP_TUPLE_ELEM_19_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) o -# define SEQAN_PP_TUPLE_ELEM_19_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) p -# define SEQAN_PP_TUPLE_ELEM_19_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) q -# define SEQAN_PP_TUPLE_ELEM_19_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) r -# define SEQAN_PP_TUPLE_ELEM_19_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) s -# -# define SEQAN_PP_TUPLE_ELEM_20_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) a -# define SEQAN_PP_TUPLE_ELEM_20_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) b -# define SEQAN_PP_TUPLE_ELEM_20_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) c -# define SEQAN_PP_TUPLE_ELEM_20_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) d -# define SEQAN_PP_TUPLE_ELEM_20_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) e -# define SEQAN_PP_TUPLE_ELEM_20_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) f -# define SEQAN_PP_TUPLE_ELEM_20_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) g -# define SEQAN_PP_TUPLE_ELEM_20_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) h -# define SEQAN_PP_TUPLE_ELEM_20_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) i -# define SEQAN_PP_TUPLE_ELEM_20_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) j -# define SEQAN_PP_TUPLE_ELEM_20_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) k -# define SEQAN_PP_TUPLE_ELEM_20_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) l -# define SEQAN_PP_TUPLE_ELEM_20_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) m -# define SEQAN_PP_TUPLE_ELEM_20_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) n -# define SEQAN_PP_TUPLE_ELEM_20_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) o -# define SEQAN_PP_TUPLE_ELEM_20_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) p -# define SEQAN_PP_TUPLE_ELEM_20_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) q -# define SEQAN_PP_TUPLE_ELEM_20_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) r -# define SEQAN_PP_TUPLE_ELEM_20_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) s -# define SEQAN_PP_TUPLE_ELEM_20_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) t -# -# define SEQAN_PP_TUPLE_ELEM_21_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) a -# define SEQAN_PP_TUPLE_ELEM_21_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) b -# define SEQAN_PP_TUPLE_ELEM_21_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) c -# define SEQAN_PP_TUPLE_ELEM_21_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) d -# define SEQAN_PP_TUPLE_ELEM_21_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) e -# define SEQAN_PP_TUPLE_ELEM_21_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) f -# define SEQAN_PP_TUPLE_ELEM_21_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) g -# define SEQAN_PP_TUPLE_ELEM_21_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) h -# define SEQAN_PP_TUPLE_ELEM_21_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) i -# define SEQAN_PP_TUPLE_ELEM_21_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) j -# define SEQAN_PP_TUPLE_ELEM_21_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) k -# define SEQAN_PP_TUPLE_ELEM_21_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) l -# define SEQAN_PP_TUPLE_ELEM_21_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) m -# define SEQAN_PP_TUPLE_ELEM_21_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) n -# define SEQAN_PP_TUPLE_ELEM_21_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) o -# define SEQAN_PP_TUPLE_ELEM_21_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) p -# define SEQAN_PP_TUPLE_ELEM_21_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) q -# define SEQAN_PP_TUPLE_ELEM_21_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) r -# define SEQAN_PP_TUPLE_ELEM_21_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) s -# define SEQAN_PP_TUPLE_ELEM_21_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) t -# define SEQAN_PP_TUPLE_ELEM_21_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) u -# -# define SEQAN_PP_TUPLE_ELEM_22_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) a -# define SEQAN_PP_TUPLE_ELEM_22_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) b -# define SEQAN_PP_TUPLE_ELEM_22_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) c -# define SEQAN_PP_TUPLE_ELEM_22_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) d -# define SEQAN_PP_TUPLE_ELEM_22_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) e -# define SEQAN_PP_TUPLE_ELEM_22_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) f -# define SEQAN_PP_TUPLE_ELEM_22_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) g -# define SEQAN_PP_TUPLE_ELEM_22_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) h -# define SEQAN_PP_TUPLE_ELEM_22_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) i -# define SEQAN_PP_TUPLE_ELEM_22_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) j -# define SEQAN_PP_TUPLE_ELEM_22_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) k -# define SEQAN_PP_TUPLE_ELEM_22_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) l -# define SEQAN_PP_TUPLE_ELEM_22_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) m -# define SEQAN_PP_TUPLE_ELEM_22_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) n -# define SEQAN_PP_TUPLE_ELEM_22_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) o -# define SEQAN_PP_TUPLE_ELEM_22_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) p -# define SEQAN_PP_TUPLE_ELEM_22_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) q -# define SEQAN_PP_TUPLE_ELEM_22_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) r -# define SEQAN_PP_TUPLE_ELEM_22_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) s -# define SEQAN_PP_TUPLE_ELEM_22_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) t -# define SEQAN_PP_TUPLE_ELEM_22_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) u -# define SEQAN_PP_TUPLE_ELEM_22_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) v -# -# define SEQAN_PP_TUPLE_ELEM_23_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) a -# define SEQAN_PP_TUPLE_ELEM_23_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) b -# define SEQAN_PP_TUPLE_ELEM_23_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) c -# define SEQAN_PP_TUPLE_ELEM_23_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) d -# define SEQAN_PP_TUPLE_ELEM_23_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) e -# define SEQAN_PP_TUPLE_ELEM_23_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) f -# define SEQAN_PP_TUPLE_ELEM_23_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) g -# define SEQAN_PP_TUPLE_ELEM_23_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) h -# define SEQAN_PP_TUPLE_ELEM_23_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) i -# define SEQAN_PP_TUPLE_ELEM_23_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) j -# define SEQAN_PP_TUPLE_ELEM_23_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) k -# define SEQAN_PP_TUPLE_ELEM_23_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) l -# define SEQAN_PP_TUPLE_ELEM_23_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) m -# define SEQAN_PP_TUPLE_ELEM_23_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) n -# define SEQAN_PP_TUPLE_ELEM_23_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) o -# define SEQAN_PP_TUPLE_ELEM_23_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) p -# define SEQAN_PP_TUPLE_ELEM_23_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) q -# define SEQAN_PP_TUPLE_ELEM_23_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) r -# define SEQAN_PP_TUPLE_ELEM_23_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) s -# define SEQAN_PP_TUPLE_ELEM_23_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) t -# define SEQAN_PP_TUPLE_ELEM_23_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) u -# define SEQAN_PP_TUPLE_ELEM_23_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) v -# define SEQAN_PP_TUPLE_ELEM_23_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) w -# -# define SEQAN_PP_TUPLE_ELEM_24_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) a -# define SEQAN_PP_TUPLE_ELEM_24_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) b -# define SEQAN_PP_TUPLE_ELEM_24_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) c -# define SEQAN_PP_TUPLE_ELEM_24_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) d -# define SEQAN_PP_TUPLE_ELEM_24_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) e -# define SEQAN_PP_TUPLE_ELEM_24_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) f -# define SEQAN_PP_TUPLE_ELEM_24_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) g -# define SEQAN_PP_TUPLE_ELEM_24_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) h -# define SEQAN_PP_TUPLE_ELEM_24_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) i -# define SEQAN_PP_TUPLE_ELEM_24_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) j -# define SEQAN_PP_TUPLE_ELEM_24_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) k -# define SEQAN_PP_TUPLE_ELEM_24_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) l -# define SEQAN_PP_TUPLE_ELEM_24_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) m -# define SEQAN_PP_TUPLE_ELEM_24_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) n -# define SEQAN_PP_TUPLE_ELEM_24_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) o -# define SEQAN_PP_TUPLE_ELEM_24_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) p -# define SEQAN_PP_TUPLE_ELEM_24_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) q -# define SEQAN_PP_TUPLE_ELEM_24_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) r -# define SEQAN_PP_TUPLE_ELEM_24_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) s -# define SEQAN_PP_TUPLE_ELEM_24_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) t -# define SEQAN_PP_TUPLE_ELEM_24_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) u -# define SEQAN_PP_TUPLE_ELEM_24_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) v -# define SEQAN_PP_TUPLE_ELEM_24_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) w -# define SEQAN_PP_TUPLE_ELEM_24_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) x -# -# define SEQAN_PP_TUPLE_ELEM_25_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) a -# define SEQAN_PP_TUPLE_ELEM_25_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) b -# define SEQAN_PP_TUPLE_ELEM_25_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) c -# define SEQAN_PP_TUPLE_ELEM_25_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) d -# define SEQAN_PP_TUPLE_ELEM_25_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) e -# define SEQAN_PP_TUPLE_ELEM_25_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) f -# define SEQAN_PP_TUPLE_ELEM_25_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) g -# define SEQAN_PP_TUPLE_ELEM_25_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) h -# define SEQAN_PP_TUPLE_ELEM_25_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) i -# define SEQAN_PP_TUPLE_ELEM_25_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) j -# define SEQAN_PP_TUPLE_ELEM_25_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) k -# define SEQAN_PP_TUPLE_ELEM_25_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) l -# define SEQAN_PP_TUPLE_ELEM_25_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) m -# define SEQAN_PP_TUPLE_ELEM_25_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) n -# define SEQAN_PP_TUPLE_ELEM_25_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) o -# define SEQAN_PP_TUPLE_ELEM_25_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) p -# define SEQAN_PP_TUPLE_ELEM_25_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) q -# define SEQAN_PP_TUPLE_ELEM_25_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) r -# define SEQAN_PP_TUPLE_ELEM_25_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) s -# define SEQAN_PP_TUPLE_ELEM_25_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) t -# define SEQAN_PP_TUPLE_ELEM_25_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) u -# define SEQAN_PP_TUPLE_ELEM_25_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) v -# define SEQAN_PP_TUPLE_ELEM_25_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) w -# define SEQAN_PP_TUPLE_ELEM_25_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) x -# define SEQAN_PP_TUPLE_ELEM_25_24(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) y - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/seq/size.hpp <== -// -------------------------------------------------------------------------- - -# /* ************************************************************************** -# * * -# * (C) Copyright Paul Mensonides 2002. -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# * * -# ************************************************************************** */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_SEQ_SIZE_HPP -// # define SEQAN_PREPROCESSOR_SEQ_SIZE_HPP -# -// # include -// # include -# -// # if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -// # define SEQAN_PP_SEQ_SIZE(seq) SEQAN_PP_SEQ_SIZE_I((seq)) -// # define SEQAN_PP_SEQ_SIZE_I(par) SEQAN_PP_SEQ_SIZE_II ## par -// # define SEQAN_PP_SEQ_SIZE_II(seq) SEQAN_PP_CAT(SEQAN_PP_SEQ_SIZE_, SEQAN_PP_SEQ_SIZE_0 ## seq) -// # elif SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() || SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MSVC() -#ifdef PLATFORM_WINDOWS_VS -# define SEQAN_PP_SEQ_SIZE(seq) SEQAN_PP_SEQ_SIZE_I(seq) -# define SEQAN_PP_SEQ_SIZE_I(seq) SEQAN_PP_CAT(SEQAN_PP_SEQ_SIZE_, SEQAN_PP_SEQ_SIZE_0 seq) -#else // #ifdef PLATFORM_WINDOWS_VS -// # elif defined(__IBMC__) || defined(__IBMCPP__) -// # define SEQAN_PP_SEQ_SIZE(seq) SEQAN_PP_CAT(SEQAN_PP_SEQ_SIZE_, SEQAN_PP_CAT(SEQAN_PP_SEQ_SIZE_0, seq)) -// # else -# define SEQAN_PP_SEQ_SIZE(seq) SEQAN_PP_CAT(SEQAN_PP_SEQ_SIZE_, SEQAN_PP_SEQ_SIZE_0 seq) -#endif // #ifdef PLATFORM_WINDOWS_VS - -# define SEQAN_PP_SEQ_SIZE_0(_) SEQAN_PP_SEQ_SIZE_1 -# define SEQAN_PP_SEQ_SIZE_1(_) SEQAN_PP_SEQ_SIZE_2 -# define SEQAN_PP_SEQ_SIZE_2(_) SEQAN_PP_SEQ_SIZE_3 -# define SEQAN_PP_SEQ_SIZE_3(_) SEQAN_PP_SEQ_SIZE_4 -# define SEQAN_PP_SEQ_SIZE_4(_) SEQAN_PP_SEQ_SIZE_5 -# define SEQAN_PP_SEQ_SIZE_5(_) SEQAN_PP_SEQ_SIZE_6 -# define SEQAN_PP_SEQ_SIZE_6(_) SEQAN_PP_SEQ_SIZE_7 -# define SEQAN_PP_SEQ_SIZE_7(_) SEQAN_PP_SEQ_SIZE_8 -# define SEQAN_PP_SEQ_SIZE_8(_) SEQAN_PP_SEQ_SIZE_9 -# define SEQAN_PP_SEQ_SIZE_9(_) SEQAN_PP_SEQ_SIZE_10 -# define SEQAN_PP_SEQ_SIZE_10(_) SEQAN_PP_SEQ_SIZE_11 -# define SEQAN_PP_SEQ_SIZE_11(_) SEQAN_PP_SEQ_SIZE_12 -# define SEQAN_PP_SEQ_SIZE_12(_) SEQAN_PP_SEQ_SIZE_13 -# define SEQAN_PP_SEQ_SIZE_13(_) SEQAN_PP_SEQ_SIZE_14 -# define SEQAN_PP_SEQ_SIZE_14(_) SEQAN_PP_SEQ_SIZE_15 -# define SEQAN_PP_SEQ_SIZE_15(_) SEQAN_PP_SEQ_SIZE_16 -# define SEQAN_PP_SEQ_SIZE_16(_) SEQAN_PP_SEQ_SIZE_17 -# define SEQAN_PP_SEQ_SIZE_17(_) SEQAN_PP_SEQ_SIZE_18 -# define SEQAN_PP_SEQ_SIZE_18(_) SEQAN_PP_SEQ_SIZE_19 -# define SEQAN_PP_SEQ_SIZE_19(_) SEQAN_PP_SEQ_SIZE_20 -# define SEQAN_PP_SEQ_SIZE_20(_) SEQAN_PP_SEQ_SIZE_21 -# define SEQAN_PP_SEQ_SIZE_21(_) SEQAN_PP_SEQ_SIZE_22 -# define SEQAN_PP_SEQ_SIZE_22(_) SEQAN_PP_SEQ_SIZE_23 -# define SEQAN_PP_SEQ_SIZE_23(_) SEQAN_PP_SEQ_SIZE_24 -# define SEQAN_PP_SEQ_SIZE_24(_) SEQAN_PP_SEQ_SIZE_25 -# define SEQAN_PP_SEQ_SIZE_25(_) SEQAN_PP_SEQ_SIZE_26 -# define SEQAN_PP_SEQ_SIZE_26(_) SEQAN_PP_SEQ_SIZE_27 -# define SEQAN_PP_SEQ_SIZE_27(_) SEQAN_PP_SEQ_SIZE_28 -# define SEQAN_PP_SEQ_SIZE_28(_) SEQAN_PP_SEQ_SIZE_29 -# define SEQAN_PP_SEQ_SIZE_29(_) SEQAN_PP_SEQ_SIZE_30 -# define SEQAN_PP_SEQ_SIZE_30(_) SEQAN_PP_SEQ_SIZE_31 -# define SEQAN_PP_SEQ_SIZE_31(_) SEQAN_PP_SEQ_SIZE_32 -# define SEQAN_PP_SEQ_SIZE_32(_) SEQAN_PP_SEQ_SIZE_33 -# define SEQAN_PP_SEQ_SIZE_33(_) SEQAN_PP_SEQ_SIZE_34 -# define SEQAN_PP_SEQ_SIZE_34(_) SEQAN_PP_SEQ_SIZE_35 -# define SEQAN_PP_SEQ_SIZE_35(_) SEQAN_PP_SEQ_SIZE_36 -# define SEQAN_PP_SEQ_SIZE_36(_) SEQAN_PP_SEQ_SIZE_37 -# define SEQAN_PP_SEQ_SIZE_37(_) SEQAN_PP_SEQ_SIZE_38 -# define SEQAN_PP_SEQ_SIZE_38(_) SEQAN_PP_SEQ_SIZE_39 -# define SEQAN_PP_SEQ_SIZE_39(_) SEQAN_PP_SEQ_SIZE_40 -# define SEQAN_PP_SEQ_SIZE_40(_) SEQAN_PP_SEQ_SIZE_41 -# define SEQAN_PP_SEQ_SIZE_41(_) SEQAN_PP_SEQ_SIZE_42 -# define SEQAN_PP_SEQ_SIZE_42(_) SEQAN_PP_SEQ_SIZE_43 -# define SEQAN_PP_SEQ_SIZE_43(_) SEQAN_PP_SEQ_SIZE_44 -# define SEQAN_PP_SEQ_SIZE_44(_) SEQAN_PP_SEQ_SIZE_45 -# define SEQAN_PP_SEQ_SIZE_45(_) SEQAN_PP_SEQ_SIZE_46 -# define SEQAN_PP_SEQ_SIZE_46(_) SEQAN_PP_SEQ_SIZE_47 -# define SEQAN_PP_SEQ_SIZE_47(_) SEQAN_PP_SEQ_SIZE_48 -# define SEQAN_PP_SEQ_SIZE_48(_) SEQAN_PP_SEQ_SIZE_49 -# define SEQAN_PP_SEQ_SIZE_49(_) SEQAN_PP_SEQ_SIZE_50 -# define SEQAN_PP_SEQ_SIZE_50(_) SEQAN_PP_SEQ_SIZE_51 -# define SEQAN_PP_SEQ_SIZE_51(_) SEQAN_PP_SEQ_SIZE_52 -# define SEQAN_PP_SEQ_SIZE_52(_) SEQAN_PP_SEQ_SIZE_53 -# define SEQAN_PP_SEQ_SIZE_53(_) SEQAN_PP_SEQ_SIZE_54 -# define SEQAN_PP_SEQ_SIZE_54(_) SEQAN_PP_SEQ_SIZE_55 -# define SEQAN_PP_SEQ_SIZE_55(_) SEQAN_PP_SEQ_SIZE_56 -# define SEQAN_PP_SEQ_SIZE_56(_) SEQAN_PP_SEQ_SIZE_57 -# define SEQAN_PP_SEQ_SIZE_57(_) SEQAN_PP_SEQ_SIZE_58 -# define SEQAN_PP_SEQ_SIZE_58(_) SEQAN_PP_SEQ_SIZE_59 -# define SEQAN_PP_SEQ_SIZE_59(_) SEQAN_PP_SEQ_SIZE_60 -# define SEQAN_PP_SEQ_SIZE_60(_) SEQAN_PP_SEQ_SIZE_61 -# define SEQAN_PP_SEQ_SIZE_61(_) SEQAN_PP_SEQ_SIZE_62 -# define SEQAN_PP_SEQ_SIZE_62(_) SEQAN_PP_SEQ_SIZE_63 -# define SEQAN_PP_SEQ_SIZE_63(_) SEQAN_PP_SEQ_SIZE_64 -# define SEQAN_PP_SEQ_SIZE_64(_) SEQAN_PP_SEQ_SIZE_65 -# define SEQAN_PP_SEQ_SIZE_65(_) SEQAN_PP_SEQ_SIZE_66 -# define SEQAN_PP_SEQ_SIZE_66(_) SEQAN_PP_SEQ_SIZE_67 -# define SEQAN_PP_SEQ_SIZE_67(_) SEQAN_PP_SEQ_SIZE_68 -# define SEQAN_PP_SEQ_SIZE_68(_) SEQAN_PP_SEQ_SIZE_69 -# define SEQAN_PP_SEQ_SIZE_69(_) SEQAN_PP_SEQ_SIZE_70 -# define SEQAN_PP_SEQ_SIZE_70(_) SEQAN_PP_SEQ_SIZE_71 -# define SEQAN_PP_SEQ_SIZE_71(_) SEQAN_PP_SEQ_SIZE_72 -# define SEQAN_PP_SEQ_SIZE_72(_) SEQAN_PP_SEQ_SIZE_73 -# define SEQAN_PP_SEQ_SIZE_73(_) SEQAN_PP_SEQ_SIZE_74 -# define SEQAN_PP_SEQ_SIZE_74(_) SEQAN_PP_SEQ_SIZE_75 -# define SEQAN_PP_SEQ_SIZE_75(_) SEQAN_PP_SEQ_SIZE_76 -# define SEQAN_PP_SEQ_SIZE_76(_) SEQAN_PP_SEQ_SIZE_77 -# define SEQAN_PP_SEQ_SIZE_77(_) SEQAN_PP_SEQ_SIZE_78 -# define SEQAN_PP_SEQ_SIZE_78(_) SEQAN_PP_SEQ_SIZE_79 -# define SEQAN_PP_SEQ_SIZE_79(_) SEQAN_PP_SEQ_SIZE_80 -# define SEQAN_PP_SEQ_SIZE_80(_) SEQAN_PP_SEQ_SIZE_81 -# define SEQAN_PP_SEQ_SIZE_81(_) SEQAN_PP_SEQ_SIZE_82 -# define SEQAN_PP_SEQ_SIZE_82(_) SEQAN_PP_SEQ_SIZE_83 -# define SEQAN_PP_SEQ_SIZE_83(_) SEQAN_PP_SEQ_SIZE_84 -# define SEQAN_PP_SEQ_SIZE_84(_) SEQAN_PP_SEQ_SIZE_85 -# define SEQAN_PP_SEQ_SIZE_85(_) SEQAN_PP_SEQ_SIZE_86 -# define SEQAN_PP_SEQ_SIZE_86(_) SEQAN_PP_SEQ_SIZE_87 -# define SEQAN_PP_SEQ_SIZE_87(_) SEQAN_PP_SEQ_SIZE_88 -# define SEQAN_PP_SEQ_SIZE_88(_) SEQAN_PP_SEQ_SIZE_89 -# define SEQAN_PP_SEQ_SIZE_89(_) SEQAN_PP_SEQ_SIZE_90 -# define SEQAN_PP_SEQ_SIZE_90(_) SEQAN_PP_SEQ_SIZE_91 -# define SEQAN_PP_SEQ_SIZE_91(_) SEQAN_PP_SEQ_SIZE_92 -# define SEQAN_PP_SEQ_SIZE_92(_) SEQAN_PP_SEQ_SIZE_93 -# define SEQAN_PP_SEQ_SIZE_93(_) SEQAN_PP_SEQ_SIZE_94 -# define SEQAN_PP_SEQ_SIZE_94(_) SEQAN_PP_SEQ_SIZE_95 -# define SEQAN_PP_SEQ_SIZE_95(_) SEQAN_PP_SEQ_SIZE_96 -# define SEQAN_PP_SEQ_SIZE_96(_) SEQAN_PP_SEQ_SIZE_97 -# define SEQAN_PP_SEQ_SIZE_97(_) SEQAN_PP_SEQ_SIZE_98 -# define SEQAN_PP_SEQ_SIZE_98(_) SEQAN_PP_SEQ_SIZE_99 -# define SEQAN_PP_SEQ_SIZE_99(_) SEQAN_PP_SEQ_SIZE_100 -# define SEQAN_PP_SEQ_SIZE_100(_) SEQAN_PP_SEQ_SIZE_101 -# define SEQAN_PP_SEQ_SIZE_101(_) SEQAN_PP_SEQ_SIZE_102 -# define SEQAN_PP_SEQ_SIZE_102(_) SEQAN_PP_SEQ_SIZE_103 -# define SEQAN_PP_SEQ_SIZE_103(_) SEQAN_PP_SEQ_SIZE_104 -# define SEQAN_PP_SEQ_SIZE_104(_) SEQAN_PP_SEQ_SIZE_105 -# define SEQAN_PP_SEQ_SIZE_105(_) SEQAN_PP_SEQ_SIZE_106 -# define SEQAN_PP_SEQ_SIZE_106(_) SEQAN_PP_SEQ_SIZE_107 -# define SEQAN_PP_SEQ_SIZE_107(_) SEQAN_PP_SEQ_SIZE_108 -# define SEQAN_PP_SEQ_SIZE_108(_) SEQAN_PP_SEQ_SIZE_109 -# define SEQAN_PP_SEQ_SIZE_109(_) SEQAN_PP_SEQ_SIZE_110 -# define SEQAN_PP_SEQ_SIZE_110(_) SEQAN_PP_SEQ_SIZE_111 -# define SEQAN_PP_SEQ_SIZE_111(_) SEQAN_PP_SEQ_SIZE_112 -# define SEQAN_PP_SEQ_SIZE_112(_) SEQAN_PP_SEQ_SIZE_113 -# define SEQAN_PP_SEQ_SIZE_113(_) SEQAN_PP_SEQ_SIZE_114 -# define SEQAN_PP_SEQ_SIZE_114(_) SEQAN_PP_SEQ_SIZE_115 -# define SEQAN_PP_SEQ_SIZE_115(_) SEQAN_PP_SEQ_SIZE_116 -# define SEQAN_PP_SEQ_SIZE_116(_) SEQAN_PP_SEQ_SIZE_117 -# define SEQAN_PP_SEQ_SIZE_117(_) SEQAN_PP_SEQ_SIZE_118 -# define SEQAN_PP_SEQ_SIZE_118(_) SEQAN_PP_SEQ_SIZE_119 -# define SEQAN_PP_SEQ_SIZE_119(_) SEQAN_PP_SEQ_SIZE_120 -# define SEQAN_PP_SEQ_SIZE_120(_) SEQAN_PP_SEQ_SIZE_121 -# define SEQAN_PP_SEQ_SIZE_121(_) SEQAN_PP_SEQ_SIZE_122 -# define SEQAN_PP_SEQ_SIZE_122(_) SEQAN_PP_SEQ_SIZE_123 -# define SEQAN_PP_SEQ_SIZE_123(_) SEQAN_PP_SEQ_SIZE_124 -# define SEQAN_PP_SEQ_SIZE_124(_) SEQAN_PP_SEQ_SIZE_125 -# define SEQAN_PP_SEQ_SIZE_125(_) SEQAN_PP_SEQ_SIZE_126 -# define SEQAN_PP_SEQ_SIZE_126(_) SEQAN_PP_SEQ_SIZE_127 -# define SEQAN_PP_SEQ_SIZE_127(_) SEQAN_PP_SEQ_SIZE_128 -# define SEQAN_PP_SEQ_SIZE_128(_) SEQAN_PP_SEQ_SIZE_129 -# define SEQAN_PP_SEQ_SIZE_129(_) SEQAN_PP_SEQ_SIZE_130 -# define SEQAN_PP_SEQ_SIZE_130(_) SEQAN_PP_SEQ_SIZE_131 -# define SEQAN_PP_SEQ_SIZE_131(_) SEQAN_PP_SEQ_SIZE_132 -# define SEQAN_PP_SEQ_SIZE_132(_) SEQAN_PP_SEQ_SIZE_133 -# define SEQAN_PP_SEQ_SIZE_133(_) SEQAN_PP_SEQ_SIZE_134 -# define SEQAN_PP_SEQ_SIZE_134(_) SEQAN_PP_SEQ_SIZE_135 -# define SEQAN_PP_SEQ_SIZE_135(_) SEQAN_PP_SEQ_SIZE_136 -# define SEQAN_PP_SEQ_SIZE_136(_) SEQAN_PP_SEQ_SIZE_137 -# define SEQAN_PP_SEQ_SIZE_137(_) SEQAN_PP_SEQ_SIZE_138 -# define SEQAN_PP_SEQ_SIZE_138(_) SEQAN_PP_SEQ_SIZE_139 -# define SEQAN_PP_SEQ_SIZE_139(_) SEQAN_PP_SEQ_SIZE_140 -# define SEQAN_PP_SEQ_SIZE_140(_) SEQAN_PP_SEQ_SIZE_141 -# define SEQAN_PP_SEQ_SIZE_141(_) SEQAN_PP_SEQ_SIZE_142 -# define SEQAN_PP_SEQ_SIZE_142(_) SEQAN_PP_SEQ_SIZE_143 -# define SEQAN_PP_SEQ_SIZE_143(_) SEQAN_PP_SEQ_SIZE_144 -# define SEQAN_PP_SEQ_SIZE_144(_) SEQAN_PP_SEQ_SIZE_145 -# define SEQAN_PP_SEQ_SIZE_145(_) SEQAN_PP_SEQ_SIZE_146 -# define SEQAN_PP_SEQ_SIZE_146(_) SEQAN_PP_SEQ_SIZE_147 -# define SEQAN_PP_SEQ_SIZE_147(_) SEQAN_PP_SEQ_SIZE_148 -# define SEQAN_PP_SEQ_SIZE_148(_) SEQAN_PP_SEQ_SIZE_149 -# define SEQAN_PP_SEQ_SIZE_149(_) SEQAN_PP_SEQ_SIZE_150 -# define SEQAN_PP_SEQ_SIZE_150(_) SEQAN_PP_SEQ_SIZE_151 -# define SEQAN_PP_SEQ_SIZE_151(_) SEQAN_PP_SEQ_SIZE_152 -# define SEQAN_PP_SEQ_SIZE_152(_) SEQAN_PP_SEQ_SIZE_153 -# define SEQAN_PP_SEQ_SIZE_153(_) SEQAN_PP_SEQ_SIZE_154 -# define SEQAN_PP_SEQ_SIZE_154(_) SEQAN_PP_SEQ_SIZE_155 -# define SEQAN_PP_SEQ_SIZE_155(_) SEQAN_PP_SEQ_SIZE_156 -# define SEQAN_PP_SEQ_SIZE_156(_) SEQAN_PP_SEQ_SIZE_157 -# define SEQAN_PP_SEQ_SIZE_157(_) SEQAN_PP_SEQ_SIZE_158 -# define SEQAN_PP_SEQ_SIZE_158(_) SEQAN_PP_SEQ_SIZE_159 -# define SEQAN_PP_SEQ_SIZE_159(_) SEQAN_PP_SEQ_SIZE_160 -# define SEQAN_PP_SEQ_SIZE_160(_) SEQAN_PP_SEQ_SIZE_161 -# define SEQAN_PP_SEQ_SIZE_161(_) SEQAN_PP_SEQ_SIZE_162 -# define SEQAN_PP_SEQ_SIZE_162(_) SEQAN_PP_SEQ_SIZE_163 -# define SEQAN_PP_SEQ_SIZE_163(_) SEQAN_PP_SEQ_SIZE_164 -# define SEQAN_PP_SEQ_SIZE_164(_) SEQAN_PP_SEQ_SIZE_165 -# define SEQAN_PP_SEQ_SIZE_165(_) SEQAN_PP_SEQ_SIZE_166 -# define SEQAN_PP_SEQ_SIZE_166(_) SEQAN_PP_SEQ_SIZE_167 -# define SEQAN_PP_SEQ_SIZE_167(_) SEQAN_PP_SEQ_SIZE_168 -# define SEQAN_PP_SEQ_SIZE_168(_) SEQAN_PP_SEQ_SIZE_169 -# define SEQAN_PP_SEQ_SIZE_169(_) SEQAN_PP_SEQ_SIZE_170 -# define SEQAN_PP_SEQ_SIZE_170(_) SEQAN_PP_SEQ_SIZE_171 -# define SEQAN_PP_SEQ_SIZE_171(_) SEQAN_PP_SEQ_SIZE_172 -# define SEQAN_PP_SEQ_SIZE_172(_) SEQAN_PP_SEQ_SIZE_173 -# define SEQAN_PP_SEQ_SIZE_173(_) SEQAN_PP_SEQ_SIZE_174 -# define SEQAN_PP_SEQ_SIZE_174(_) SEQAN_PP_SEQ_SIZE_175 -# define SEQAN_PP_SEQ_SIZE_175(_) SEQAN_PP_SEQ_SIZE_176 -# define SEQAN_PP_SEQ_SIZE_176(_) SEQAN_PP_SEQ_SIZE_177 -# define SEQAN_PP_SEQ_SIZE_177(_) SEQAN_PP_SEQ_SIZE_178 -# define SEQAN_PP_SEQ_SIZE_178(_) SEQAN_PP_SEQ_SIZE_179 -# define SEQAN_PP_SEQ_SIZE_179(_) SEQAN_PP_SEQ_SIZE_180 -# define SEQAN_PP_SEQ_SIZE_180(_) SEQAN_PP_SEQ_SIZE_181 -# define SEQAN_PP_SEQ_SIZE_181(_) SEQAN_PP_SEQ_SIZE_182 -# define SEQAN_PP_SEQ_SIZE_182(_) SEQAN_PP_SEQ_SIZE_183 -# define SEQAN_PP_SEQ_SIZE_183(_) SEQAN_PP_SEQ_SIZE_184 -# define SEQAN_PP_SEQ_SIZE_184(_) SEQAN_PP_SEQ_SIZE_185 -# define SEQAN_PP_SEQ_SIZE_185(_) SEQAN_PP_SEQ_SIZE_186 -# define SEQAN_PP_SEQ_SIZE_186(_) SEQAN_PP_SEQ_SIZE_187 -# define SEQAN_PP_SEQ_SIZE_187(_) SEQAN_PP_SEQ_SIZE_188 -# define SEQAN_PP_SEQ_SIZE_188(_) SEQAN_PP_SEQ_SIZE_189 -# define SEQAN_PP_SEQ_SIZE_189(_) SEQAN_PP_SEQ_SIZE_190 -# define SEQAN_PP_SEQ_SIZE_190(_) SEQAN_PP_SEQ_SIZE_191 -# define SEQAN_PP_SEQ_SIZE_191(_) SEQAN_PP_SEQ_SIZE_192 -# define SEQAN_PP_SEQ_SIZE_192(_) SEQAN_PP_SEQ_SIZE_193 -# define SEQAN_PP_SEQ_SIZE_193(_) SEQAN_PP_SEQ_SIZE_194 -# define SEQAN_PP_SEQ_SIZE_194(_) SEQAN_PP_SEQ_SIZE_195 -# define SEQAN_PP_SEQ_SIZE_195(_) SEQAN_PP_SEQ_SIZE_196 -# define SEQAN_PP_SEQ_SIZE_196(_) SEQAN_PP_SEQ_SIZE_197 -# define SEQAN_PP_SEQ_SIZE_197(_) SEQAN_PP_SEQ_SIZE_198 -# define SEQAN_PP_SEQ_SIZE_198(_) SEQAN_PP_SEQ_SIZE_199 -# define SEQAN_PP_SEQ_SIZE_199(_) SEQAN_PP_SEQ_SIZE_200 -# define SEQAN_PP_SEQ_SIZE_200(_) SEQAN_PP_SEQ_SIZE_201 -# define SEQAN_PP_SEQ_SIZE_201(_) SEQAN_PP_SEQ_SIZE_202 -# define SEQAN_PP_SEQ_SIZE_202(_) SEQAN_PP_SEQ_SIZE_203 -# define SEQAN_PP_SEQ_SIZE_203(_) SEQAN_PP_SEQ_SIZE_204 -# define SEQAN_PP_SEQ_SIZE_204(_) SEQAN_PP_SEQ_SIZE_205 -# define SEQAN_PP_SEQ_SIZE_205(_) SEQAN_PP_SEQ_SIZE_206 -# define SEQAN_PP_SEQ_SIZE_206(_) SEQAN_PP_SEQ_SIZE_207 -# define SEQAN_PP_SEQ_SIZE_207(_) SEQAN_PP_SEQ_SIZE_208 -# define SEQAN_PP_SEQ_SIZE_208(_) SEQAN_PP_SEQ_SIZE_209 -# define SEQAN_PP_SEQ_SIZE_209(_) SEQAN_PP_SEQ_SIZE_210 -# define SEQAN_PP_SEQ_SIZE_210(_) SEQAN_PP_SEQ_SIZE_211 -# define SEQAN_PP_SEQ_SIZE_211(_) SEQAN_PP_SEQ_SIZE_212 -# define SEQAN_PP_SEQ_SIZE_212(_) SEQAN_PP_SEQ_SIZE_213 -# define SEQAN_PP_SEQ_SIZE_213(_) SEQAN_PP_SEQ_SIZE_214 -# define SEQAN_PP_SEQ_SIZE_214(_) SEQAN_PP_SEQ_SIZE_215 -# define SEQAN_PP_SEQ_SIZE_215(_) SEQAN_PP_SEQ_SIZE_216 -# define SEQAN_PP_SEQ_SIZE_216(_) SEQAN_PP_SEQ_SIZE_217 -# define SEQAN_PP_SEQ_SIZE_217(_) SEQAN_PP_SEQ_SIZE_218 -# define SEQAN_PP_SEQ_SIZE_218(_) SEQAN_PP_SEQ_SIZE_219 -# define SEQAN_PP_SEQ_SIZE_219(_) SEQAN_PP_SEQ_SIZE_220 -# define SEQAN_PP_SEQ_SIZE_220(_) SEQAN_PP_SEQ_SIZE_221 -# define SEQAN_PP_SEQ_SIZE_221(_) SEQAN_PP_SEQ_SIZE_222 -# define SEQAN_PP_SEQ_SIZE_222(_) SEQAN_PP_SEQ_SIZE_223 -# define SEQAN_PP_SEQ_SIZE_223(_) SEQAN_PP_SEQ_SIZE_224 -# define SEQAN_PP_SEQ_SIZE_224(_) SEQAN_PP_SEQ_SIZE_225 -# define SEQAN_PP_SEQ_SIZE_225(_) SEQAN_PP_SEQ_SIZE_226 -# define SEQAN_PP_SEQ_SIZE_226(_) SEQAN_PP_SEQ_SIZE_227 -# define SEQAN_PP_SEQ_SIZE_227(_) SEQAN_PP_SEQ_SIZE_228 -# define SEQAN_PP_SEQ_SIZE_228(_) SEQAN_PP_SEQ_SIZE_229 -# define SEQAN_PP_SEQ_SIZE_229(_) SEQAN_PP_SEQ_SIZE_230 -# define SEQAN_PP_SEQ_SIZE_230(_) SEQAN_PP_SEQ_SIZE_231 -# define SEQAN_PP_SEQ_SIZE_231(_) SEQAN_PP_SEQ_SIZE_232 -# define SEQAN_PP_SEQ_SIZE_232(_) SEQAN_PP_SEQ_SIZE_233 -# define SEQAN_PP_SEQ_SIZE_233(_) SEQAN_PP_SEQ_SIZE_234 -# define SEQAN_PP_SEQ_SIZE_234(_) SEQAN_PP_SEQ_SIZE_235 -# define SEQAN_PP_SEQ_SIZE_235(_) SEQAN_PP_SEQ_SIZE_236 -# define SEQAN_PP_SEQ_SIZE_236(_) SEQAN_PP_SEQ_SIZE_237 -# define SEQAN_PP_SEQ_SIZE_237(_) SEQAN_PP_SEQ_SIZE_238 -# define SEQAN_PP_SEQ_SIZE_238(_) SEQAN_PP_SEQ_SIZE_239 -# define SEQAN_PP_SEQ_SIZE_239(_) SEQAN_PP_SEQ_SIZE_240 -# define SEQAN_PP_SEQ_SIZE_240(_) SEQAN_PP_SEQ_SIZE_241 -# define SEQAN_PP_SEQ_SIZE_241(_) SEQAN_PP_SEQ_SIZE_242 -# define SEQAN_PP_SEQ_SIZE_242(_) SEQAN_PP_SEQ_SIZE_243 -# define SEQAN_PP_SEQ_SIZE_243(_) SEQAN_PP_SEQ_SIZE_244 -# define SEQAN_PP_SEQ_SIZE_244(_) SEQAN_PP_SEQ_SIZE_245 -# define SEQAN_PP_SEQ_SIZE_245(_) SEQAN_PP_SEQ_SIZE_246 -# define SEQAN_PP_SEQ_SIZE_246(_) SEQAN_PP_SEQ_SIZE_247 -# define SEQAN_PP_SEQ_SIZE_247(_) SEQAN_PP_SEQ_SIZE_248 -# define SEQAN_PP_SEQ_SIZE_248(_) SEQAN_PP_SEQ_SIZE_249 -# define SEQAN_PP_SEQ_SIZE_249(_) SEQAN_PP_SEQ_SIZE_250 -# define SEQAN_PP_SEQ_SIZE_250(_) SEQAN_PP_SEQ_SIZE_251 -# define SEQAN_PP_SEQ_SIZE_251(_) SEQAN_PP_SEQ_SIZE_252 -# define SEQAN_PP_SEQ_SIZE_252(_) SEQAN_PP_SEQ_SIZE_253 -# define SEQAN_PP_SEQ_SIZE_253(_) SEQAN_PP_SEQ_SIZE_254 -# define SEQAN_PP_SEQ_SIZE_254(_) SEQAN_PP_SEQ_SIZE_255 -# define SEQAN_PP_SEQ_SIZE_255(_) SEQAN_PP_SEQ_SIZE_256 -# define SEQAN_PP_SEQ_SIZE_256(_) SEQAN_PP_SEQ_SIZE_257 -# -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_0 0 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_1 1 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_2 2 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_3 3 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_4 4 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_5 5 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_6 6 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_7 7 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_8 8 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_9 9 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_10 10 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_11 11 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_12 12 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_13 13 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_14 14 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_15 15 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_16 16 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_17 17 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_18 18 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_19 19 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_20 20 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_21 21 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_22 22 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_23 23 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_24 24 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_25 25 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_26 26 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_27 27 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_28 28 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_29 29 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_30 30 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_31 31 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_32 32 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_33 33 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_34 34 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_35 35 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_36 36 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_37 37 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_38 38 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_39 39 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_40 40 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_41 41 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_42 42 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_43 43 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_44 44 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_45 45 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_46 46 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_47 47 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_48 48 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_49 49 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_50 50 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_51 51 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_52 52 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_53 53 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_54 54 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_55 55 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_56 56 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_57 57 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_58 58 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_59 59 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_60 60 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_61 61 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_62 62 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_63 63 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_64 64 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_65 65 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_66 66 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_67 67 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_68 68 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_69 69 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_70 70 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_71 71 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_72 72 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_73 73 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_74 74 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_75 75 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_76 76 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_77 77 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_78 78 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_79 79 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_80 80 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_81 81 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_82 82 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_83 83 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_84 84 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_85 85 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_86 86 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_87 87 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_88 88 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_89 89 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_90 90 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_91 91 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_92 92 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_93 93 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_94 94 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_95 95 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_96 96 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_97 97 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_98 98 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_99 99 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_100 100 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_101 101 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_102 102 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_103 103 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_104 104 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_105 105 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_106 106 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_107 107 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_108 108 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_109 109 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_110 110 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_111 111 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_112 112 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_113 113 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_114 114 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_115 115 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_116 116 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_117 117 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_118 118 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_119 119 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_120 120 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_121 121 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_122 122 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_123 123 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_124 124 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_125 125 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_126 126 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_127 127 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_128 128 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_129 129 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_130 130 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_131 131 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_132 132 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_133 133 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_134 134 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_135 135 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_136 136 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_137 137 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_138 138 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_139 139 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_140 140 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_141 141 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_142 142 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_143 143 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_144 144 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_145 145 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_146 146 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_147 147 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_148 148 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_149 149 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_150 150 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_151 151 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_152 152 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_153 153 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_154 154 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_155 155 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_156 156 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_157 157 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_158 158 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_159 159 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_160 160 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_161 161 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_162 162 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_163 163 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_164 164 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_165 165 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_166 166 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_167 167 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_168 168 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_169 169 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_170 170 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_171 171 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_172 172 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_173 173 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_174 174 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_175 175 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_176 176 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_177 177 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_178 178 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_179 179 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_180 180 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_181 181 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_182 182 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_183 183 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_184 184 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_185 185 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_186 186 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_187 187 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_188 188 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_189 189 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_190 190 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_191 191 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_192 192 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_193 193 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_194 194 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_195 195 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_196 196 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_197 197 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_198 198 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_199 199 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_200 200 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_201 201 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_202 202 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_203 203 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_204 204 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_205 205 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_206 206 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_207 207 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_208 208 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_209 209 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_210 210 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_211 211 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_212 212 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_213 213 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_214 214 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_215 215 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_216 216 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_217 217 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_218 218 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_219 219 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_220 220 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_221 221 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_222 222 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_223 223 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_224 224 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_225 225 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_226 226 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_227 227 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_228 228 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_229 229 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_230 230 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_231 231 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_232 232 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_233 233 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_234 234 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_235 235 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_236 236 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_237 237 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_238 238 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_239 239 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_240 240 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_241 241 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_242 242 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_243 243 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_244 244 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_245 245 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_246 246 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_247 247 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_248 248 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_249 249 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_250 250 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_251 251 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_252 252 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_253 253 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_254 254 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_255 255 -# define SEQAN_PP_SEQ_SIZE_SEQAN_PP_SEQ_SIZE_256 256 - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/cat.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_CAT_HPP -// # define SEQAN_PREPROCESSOR_CAT_HPP -# -// # include -# -# /* SEQAN_PP_CAT */ -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_CAT(a, b) SEQAN_PP_CAT_I(a, b) -// # else -// # define SEQAN_PP_CAT(a, b) SEQAN_PP_CAT_OO((a, b)) -// # define SEQAN_PP_CAT_OO(par) SEQAN_PP_CAT_I ## par -// # endif -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MSVC() -#ifndef PLATFORM_WINDOWS_VS -# define SEQAN_PP_CAT_I(a, b) a ## b -#else // #ifndef PLATFORM_WINDOWS_VS -# define SEQAN_PP_CAT_I(a, b) SEQAN_PP_CAT_II(a ## b) -# define SEQAN_PP_CAT_II(res) res -#endif // #ifndef PLATFORM_WINDOWS_VS -# -// # endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/seq/enum.hpp <== -// -------------------------------------------------------------------------- - -# /* ************************************************************************** -# * * -# * (C) Copyright Paul Mensonides 2002. -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# * * -# ************************************************************************** */ -# -# /* See http://www.boost.org for most recent version. */ -# -//# ifndef SEQAN_PREPROCESSOR_SEQ_ENUM_HPP -//# define SEQAN_PREPROCESSOR_SEQ_ENUM_HPP -# -//# include -//# include -//# include -# -# /* SEQAN_PP_SEQ_ENUM */ -# -//# if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() -# define SEQAN_PP_SEQ_ENUM(seq) SEQAN_PP_SEQ_ENUM_I(seq) -# define SEQAN_PP_SEQ_ENUM_I(seq) SEQAN_PP_CAT(SEQAN_PP_SEQ_ENUM_, SEQAN_PP_SEQ_SIZE(seq)) seq -//# elif SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -//# define SEQAN_PP_SEQ_ENUM(seq) SEQAN_PP_SEQ_ENUM_I(SEQAN_PP_SEQ_SIZE(seq), seq) -//# define SEQAN_PP_SEQ_ENUM_I(size, seq) SEQAN_PP_CAT(SEQAN_PP_SEQ_ENUM_, size) seq -//# else -//# define SEQAN_PP_SEQ_ENUM(seq) SEQAN_PP_CAT(SEQAN_PP_SEQ_ENUM_, SEQAN_PP_SEQ_SIZE(seq)) seq -//# endif -# -# define SEQAN_PP_SEQ_ENUM_1(x) x -# define SEQAN_PP_SEQ_ENUM_2(x) x, SEQAN_PP_SEQ_ENUM_1 -# define SEQAN_PP_SEQ_ENUM_3(x) x, SEQAN_PP_SEQ_ENUM_2 -# define SEQAN_PP_SEQ_ENUM_4(x) x, SEQAN_PP_SEQ_ENUM_3 -# define SEQAN_PP_SEQ_ENUM_5(x) x, SEQAN_PP_SEQ_ENUM_4 -# define SEQAN_PP_SEQ_ENUM_6(x) x, SEQAN_PP_SEQ_ENUM_5 -# define SEQAN_PP_SEQ_ENUM_7(x) x, SEQAN_PP_SEQ_ENUM_6 -# define SEQAN_PP_SEQ_ENUM_8(x) x, SEQAN_PP_SEQ_ENUM_7 -# define SEQAN_PP_SEQ_ENUM_9(x) x, SEQAN_PP_SEQ_ENUM_8 -# define SEQAN_PP_SEQ_ENUM_10(x) x, SEQAN_PP_SEQ_ENUM_9 -# define SEQAN_PP_SEQ_ENUM_11(x) x, SEQAN_PP_SEQ_ENUM_10 -# define SEQAN_PP_SEQ_ENUM_12(x) x, SEQAN_PP_SEQ_ENUM_11 -# define SEQAN_PP_SEQ_ENUM_13(x) x, SEQAN_PP_SEQ_ENUM_12 -# define SEQAN_PP_SEQ_ENUM_14(x) x, SEQAN_PP_SEQ_ENUM_13 -# define SEQAN_PP_SEQ_ENUM_15(x) x, SEQAN_PP_SEQ_ENUM_14 -# define SEQAN_PP_SEQ_ENUM_16(x) x, SEQAN_PP_SEQ_ENUM_15 -# define SEQAN_PP_SEQ_ENUM_17(x) x, SEQAN_PP_SEQ_ENUM_16 -# define SEQAN_PP_SEQ_ENUM_18(x) x, SEQAN_PP_SEQ_ENUM_17 -# define SEQAN_PP_SEQ_ENUM_19(x) x, SEQAN_PP_SEQ_ENUM_18 -# define SEQAN_PP_SEQ_ENUM_20(x) x, SEQAN_PP_SEQ_ENUM_19 -# define SEQAN_PP_SEQ_ENUM_21(x) x, SEQAN_PP_SEQ_ENUM_20 -# define SEQAN_PP_SEQ_ENUM_22(x) x, SEQAN_PP_SEQ_ENUM_21 -# define SEQAN_PP_SEQ_ENUM_23(x) x, SEQAN_PP_SEQ_ENUM_22 -# define SEQAN_PP_SEQ_ENUM_24(x) x, SEQAN_PP_SEQ_ENUM_23 -# define SEQAN_PP_SEQ_ENUM_25(x) x, SEQAN_PP_SEQ_ENUM_24 -# define SEQAN_PP_SEQ_ENUM_26(x) x, SEQAN_PP_SEQ_ENUM_25 -# define SEQAN_PP_SEQ_ENUM_27(x) x, SEQAN_PP_SEQ_ENUM_26 -# define SEQAN_PP_SEQ_ENUM_28(x) x, SEQAN_PP_SEQ_ENUM_27 -# define SEQAN_PP_SEQ_ENUM_29(x) x, SEQAN_PP_SEQ_ENUM_28 -# define SEQAN_PP_SEQ_ENUM_30(x) x, SEQAN_PP_SEQ_ENUM_29 -# define SEQAN_PP_SEQ_ENUM_31(x) x, SEQAN_PP_SEQ_ENUM_30 -# define SEQAN_PP_SEQ_ENUM_32(x) x, SEQAN_PP_SEQ_ENUM_31 -# define SEQAN_PP_SEQ_ENUM_33(x) x, SEQAN_PP_SEQ_ENUM_32 -# define SEQAN_PP_SEQ_ENUM_34(x) x, SEQAN_PP_SEQ_ENUM_33 -# define SEQAN_PP_SEQ_ENUM_35(x) x, SEQAN_PP_SEQ_ENUM_34 -# define SEQAN_PP_SEQ_ENUM_36(x) x, SEQAN_PP_SEQ_ENUM_35 -# define SEQAN_PP_SEQ_ENUM_37(x) x, SEQAN_PP_SEQ_ENUM_36 -# define SEQAN_PP_SEQ_ENUM_38(x) x, SEQAN_PP_SEQ_ENUM_37 -# define SEQAN_PP_SEQ_ENUM_39(x) x, SEQAN_PP_SEQ_ENUM_38 -# define SEQAN_PP_SEQ_ENUM_40(x) x, SEQAN_PP_SEQ_ENUM_39 -# define SEQAN_PP_SEQ_ENUM_41(x) x, SEQAN_PP_SEQ_ENUM_40 -# define SEQAN_PP_SEQ_ENUM_42(x) x, SEQAN_PP_SEQ_ENUM_41 -# define SEQAN_PP_SEQ_ENUM_43(x) x, SEQAN_PP_SEQ_ENUM_42 -# define SEQAN_PP_SEQ_ENUM_44(x) x, SEQAN_PP_SEQ_ENUM_43 -# define SEQAN_PP_SEQ_ENUM_45(x) x, SEQAN_PP_SEQ_ENUM_44 -# define SEQAN_PP_SEQ_ENUM_46(x) x, SEQAN_PP_SEQ_ENUM_45 -# define SEQAN_PP_SEQ_ENUM_47(x) x, SEQAN_PP_SEQ_ENUM_46 -# define SEQAN_PP_SEQ_ENUM_48(x) x, SEQAN_PP_SEQ_ENUM_47 -# define SEQAN_PP_SEQ_ENUM_49(x) x, SEQAN_PP_SEQ_ENUM_48 -# define SEQAN_PP_SEQ_ENUM_50(x) x, SEQAN_PP_SEQ_ENUM_49 -# define SEQAN_PP_SEQ_ENUM_51(x) x, SEQAN_PP_SEQ_ENUM_50 -# define SEQAN_PP_SEQ_ENUM_52(x) x, SEQAN_PP_SEQ_ENUM_51 -# define SEQAN_PP_SEQ_ENUM_53(x) x, SEQAN_PP_SEQ_ENUM_52 -# define SEQAN_PP_SEQ_ENUM_54(x) x, SEQAN_PP_SEQ_ENUM_53 -# define SEQAN_PP_SEQ_ENUM_55(x) x, SEQAN_PP_SEQ_ENUM_54 -# define SEQAN_PP_SEQ_ENUM_56(x) x, SEQAN_PP_SEQ_ENUM_55 -# define SEQAN_PP_SEQ_ENUM_57(x) x, SEQAN_PP_SEQ_ENUM_56 -# define SEQAN_PP_SEQ_ENUM_58(x) x, SEQAN_PP_SEQ_ENUM_57 -# define SEQAN_PP_SEQ_ENUM_59(x) x, SEQAN_PP_SEQ_ENUM_58 -# define SEQAN_PP_SEQ_ENUM_60(x) x, SEQAN_PP_SEQ_ENUM_59 -# define SEQAN_PP_SEQ_ENUM_61(x) x, SEQAN_PP_SEQ_ENUM_60 -# define SEQAN_PP_SEQ_ENUM_62(x) x, SEQAN_PP_SEQ_ENUM_61 -# define SEQAN_PP_SEQ_ENUM_63(x) x, SEQAN_PP_SEQ_ENUM_62 -# define SEQAN_PP_SEQ_ENUM_64(x) x, SEQAN_PP_SEQ_ENUM_63 -# define SEQAN_PP_SEQ_ENUM_65(x) x, SEQAN_PP_SEQ_ENUM_64 -# define SEQAN_PP_SEQ_ENUM_66(x) x, SEQAN_PP_SEQ_ENUM_65 -# define SEQAN_PP_SEQ_ENUM_67(x) x, SEQAN_PP_SEQ_ENUM_66 -# define SEQAN_PP_SEQ_ENUM_68(x) x, SEQAN_PP_SEQ_ENUM_67 -# define SEQAN_PP_SEQ_ENUM_69(x) x, SEQAN_PP_SEQ_ENUM_68 -# define SEQAN_PP_SEQ_ENUM_70(x) x, SEQAN_PP_SEQ_ENUM_69 -# define SEQAN_PP_SEQ_ENUM_71(x) x, SEQAN_PP_SEQ_ENUM_70 -# define SEQAN_PP_SEQ_ENUM_72(x) x, SEQAN_PP_SEQ_ENUM_71 -# define SEQAN_PP_SEQ_ENUM_73(x) x, SEQAN_PP_SEQ_ENUM_72 -# define SEQAN_PP_SEQ_ENUM_74(x) x, SEQAN_PP_SEQ_ENUM_73 -# define SEQAN_PP_SEQ_ENUM_75(x) x, SEQAN_PP_SEQ_ENUM_74 -# define SEQAN_PP_SEQ_ENUM_76(x) x, SEQAN_PP_SEQ_ENUM_75 -# define SEQAN_PP_SEQ_ENUM_77(x) x, SEQAN_PP_SEQ_ENUM_76 -# define SEQAN_PP_SEQ_ENUM_78(x) x, SEQAN_PP_SEQ_ENUM_77 -# define SEQAN_PP_SEQ_ENUM_79(x) x, SEQAN_PP_SEQ_ENUM_78 -# define SEQAN_PP_SEQ_ENUM_80(x) x, SEQAN_PP_SEQ_ENUM_79 -# define SEQAN_PP_SEQ_ENUM_81(x) x, SEQAN_PP_SEQ_ENUM_80 -# define SEQAN_PP_SEQ_ENUM_82(x) x, SEQAN_PP_SEQ_ENUM_81 -# define SEQAN_PP_SEQ_ENUM_83(x) x, SEQAN_PP_SEQ_ENUM_82 -# define SEQAN_PP_SEQ_ENUM_84(x) x, SEQAN_PP_SEQ_ENUM_83 -# define SEQAN_PP_SEQ_ENUM_85(x) x, SEQAN_PP_SEQ_ENUM_84 -# define SEQAN_PP_SEQ_ENUM_86(x) x, SEQAN_PP_SEQ_ENUM_85 -# define SEQAN_PP_SEQ_ENUM_87(x) x, SEQAN_PP_SEQ_ENUM_86 -# define SEQAN_PP_SEQ_ENUM_88(x) x, SEQAN_PP_SEQ_ENUM_87 -# define SEQAN_PP_SEQ_ENUM_89(x) x, SEQAN_PP_SEQ_ENUM_88 -# define SEQAN_PP_SEQ_ENUM_90(x) x, SEQAN_PP_SEQ_ENUM_89 -# define SEQAN_PP_SEQ_ENUM_91(x) x, SEQAN_PP_SEQ_ENUM_90 -# define SEQAN_PP_SEQ_ENUM_92(x) x, SEQAN_PP_SEQ_ENUM_91 -# define SEQAN_PP_SEQ_ENUM_93(x) x, SEQAN_PP_SEQ_ENUM_92 -# define SEQAN_PP_SEQ_ENUM_94(x) x, SEQAN_PP_SEQ_ENUM_93 -# define SEQAN_PP_SEQ_ENUM_95(x) x, SEQAN_PP_SEQ_ENUM_94 -# define SEQAN_PP_SEQ_ENUM_96(x) x, SEQAN_PP_SEQ_ENUM_95 -# define SEQAN_PP_SEQ_ENUM_97(x) x, SEQAN_PP_SEQ_ENUM_96 -# define SEQAN_PP_SEQ_ENUM_98(x) x, SEQAN_PP_SEQ_ENUM_97 -# define SEQAN_PP_SEQ_ENUM_99(x) x, SEQAN_PP_SEQ_ENUM_98 -# define SEQAN_PP_SEQ_ENUM_100(x) x, SEQAN_PP_SEQ_ENUM_99 -# define SEQAN_PP_SEQ_ENUM_101(x) x, SEQAN_PP_SEQ_ENUM_100 -# define SEQAN_PP_SEQ_ENUM_102(x) x, SEQAN_PP_SEQ_ENUM_101 -# define SEQAN_PP_SEQ_ENUM_103(x) x, SEQAN_PP_SEQ_ENUM_102 -# define SEQAN_PP_SEQ_ENUM_104(x) x, SEQAN_PP_SEQ_ENUM_103 -# define SEQAN_PP_SEQ_ENUM_105(x) x, SEQAN_PP_SEQ_ENUM_104 -# define SEQAN_PP_SEQ_ENUM_106(x) x, SEQAN_PP_SEQ_ENUM_105 -# define SEQAN_PP_SEQ_ENUM_107(x) x, SEQAN_PP_SEQ_ENUM_106 -# define SEQAN_PP_SEQ_ENUM_108(x) x, SEQAN_PP_SEQ_ENUM_107 -# define SEQAN_PP_SEQ_ENUM_109(x) x, SEQAN_PP_SEQ_ENUM_108 -# define SEQAN_PP_SEQ_ENUM_110(x) x, SEQAN_PP_SEQ_ENUM_109 -# define SEQAN_PP_SEQ_ENUM_111(x) x, SEQAN_PP_SEQ_ENUM_110 -# define SEQAN_PP_SEQ_ENUM_112(x) x, SEQAN_PP_SEQ_ENUM_111 -# define SEQAN_PP_SEQ_ENUM_113(x) x, SEQAN_PP_SEQ_ENUM_112 -# define SEQAN_PP_SEQ_ENUM_114(x) x, SEQAN_PP_SEQ_ENUM_113 -# define SEQAN_PP_SEQ_ENUM_115(x) x, SEQAN_PP_SEQ_ENUM_114 -# define SEQAN_PP_SEQ_ENUM_116(x) x, SEQAN_PP_SEQ_ENUM_115 -# define SEQAN_PP_SEQ_ENUM_117(x) x, SEQAN_PP_SEQ_ENUM_116 -# define SEQAN_PP_SEQ_ENUM_118(x) x, SEQAN_PP_SEQ_ENUM_117 -# define SEQAN_PP_SEQ_ENUM_119(x) x, SEQAN_PP_SEQ_ENUM_118 -# define SEQAN_PP_SEQ_ENUM_120(x) x, SEQAN_PP_SEQ_ENUM_119 -# define SEQAN_PP_SEQ_ENUM_121(x) x, SEQAN_PP_SEQ_ENUM_120 -# define SEQAN_PP_SEQ_ENUM_122(x) x, SEQAN_PP_SEQ_ENUM_121 -# define SEQAN_PP_SEQ_ENUM_123(x) x, SEQAN_PP_SEQ_ENUM_122 -# define SEQAN_PP_SEQ_ENUM_124(x) x, SEQAN_PP_SEQ_ENUM_123 -# define SEQAN_PP_SEQ_ENUM_125(x) x, SEQAN_PP_SEQ_ENUM_124 -# define SEQAN_PP_SEQ_ENUM_126(x) x, SEQAN_PP_SEQ_ENUM_125 -# define SEQAN_PP_SEQ_ENUM_127(x) x, SEQAN_PP_SEQ_ENUM_126 -# define SEQAN_PP_SEQ_ENUM_128(x) x, SEQAN_PP_SEQ_ENUM_127 -# define SEQAN_PP_SEQ_ENUM_129(x) x, SEQAN_PP_SEQ_ENUM_128 -# define SEQAN_PP_SEQ_ENUM_130(x) x, SEQAN_PP_SEQ_ENUM_129 -# define SEQAN_PP_SEQ_ENUM_131(x) x, SEQAN_PP_SEQ_ENUM_130 -# define SEQAN_PP_SEQ_ENUM_132(x) x, SEQAN_PP_SEQ_ENUM_131 -# define SEQAN_PP_SEQ_ENUM_133(x) x, SEQAN_PP_SEQ_ENUM_132 -# define SEQAN_PP_SEQ_ENUM_134(x) x, SEQAN_PP_SEQ_ENUM_133 -# define SEQAN_PP_SEQ_ENUM_135(x) x, SEQAN_PP_SEQ_ENUM_134 -# define SEQAN_PP_SEQ_ENUM_136(x) x, SEQAN_PP_SEQ_ENUM_135 -# define SEQAN_PP_SEQ_ENUM_137(x) x, SEQAN_PP_SEQ_ENUM_136 -# define SEQAN_PP_SEQ_ENUM_138(x) x, SEQAN_PP_SEQ_ENUM_137 -# define SEQAN_PP_SEQ_ENUM_139(x) x, SEQAN_PP_SEQ_ENUM_138 -# define SEQAN_PP_SEQ_ENUM_140(x) x, SEQAN_PP_SEQ_ENUM_139 -# define SEQAN_PP_SEQ_ENUM_141(x) x, SEQAN_PP_SEQ_ENUM_140 -# define SEQAN_PP_SEQ_ENUM_142(x) x, SEQAN_PP_SEQ_ENUM_141 -# define SEQAN_PP_SEQ_ENUM_143(x) x, SEQAN_PP_SEQ_ENUM_142 -# define SEQAN_PP_SEQ_ENUM_144(x) x, SEQAN_PP_SEQ_ENUM_143 -# define SEQAN_PP_SEQ_ENUM_145(x) x, SEQAN_PP_SEQ_ENUM_144 -# define SEQAN_PP_SEQ_ENUM_146(x) x, SEQAN_PP_SEQ_ENUM_145 -# define SEQAN_PP_SEQ_ENUM_147(x) x, SEQAN_PP_SEQ_ENUM_146 -# define SEQAN_PP_SEQ_ENUM_148(x) x, SEQAN_PP_SEQ_ENUM_147 -# define SEQAN_PP_SEQ_ENUM_149(x) x, SEQAN_PP_SEQ_ENUM_148 -# define SEQAN_PP_SEQ_ENUM_150(x) x, SEQAN_PP_SEQ_ENUM_149 -# define SEQAN_PP_SEQ_ENUM_151(x) x, SEQAN_PP_SEQ_ENUM_150 -# define SEQAN_PP_SEQ_ENUM_152(x) x, SEQAN_PP_SEQ_ENUM_151 -# define SEQAN_PP_SEQ_ENUM_153(x) x, SEQAN_PP_SEQ_ENUM_152 -# define SEQAN_PP_SEQ_ENUM_154(x) x, SEQAN_PP_SEQ_ENUM_153 -# define SEQAN_PP_SEQ_ENUM_155(x) x, SEQAN_PP_SEQ_ENUM_154 -# define SEQAN_PP_SEQ_ENUM_156(x) x, SEQAN_PP_SEQ_ENUM_155 -# define SEQAN_PP_SEQ_ENUM_157(x) x, SEQAN_PP_SEQ_ENUM_156 -# define SEQAN_PP_SEQ_ENUM_158(x) x, SEQAN_PP_SEQ_ENUM_157 -# define SEQAN_PP_SEQ_ENUM_159(x) x, SEQAN_PP_SEQ_ENUM_158 -# define SEQAN_PP_SEQ_ENUM_160(x) x, SEQAN_PP_SEQ_ENUM_159 -# define SEQAN_PP_SEQ_ENUM_161(x) x, SEQAN_PP_SEQ_ENUM_160 -# define SEQAN_PP_SEQ_ENUM_162(x) x, SEQAN_PP_SEQ_ENUM_161 -# define SEQAN_PP_SEQ_ENUM_163(x) x, SEQAN_PP_SEQ_ENUM_162 -# define SEQAN_PP_SEQ_ENUM_164(x) x, SEQAN_PP_SEQ_ENUM_163 -# define SEQAN_PP_SEQ_ENUM_165(x) x, SEQAN_PP_SEQ_ENUM_164 -# define SEQAN_PP_SEQ_ENUM_166(x) x, SEQAN_PP_SEQ_ENUM_165 -# define SEQAN_PP_SEQ_ENUM_167(x) x, SEQAN_PP_SEQ_ENUM_166 -# define SEQAN_PP_SEQ_ENUM_168(x) x, SEQAN_PP_SEQ_ENUM_167 -# define SEQAN_PP_SEQ_ENUM_169(x) x, SEQAN_PP_SEQ_ENUM_168 -# define SEQAN_PP_SEQ_ENUM_170(x) x, SEQAN_PP_SEQ_ENUM_169 -# define SEQAN_PP_SEQ_ENUM_171(x) x, SEQAN_PP_SEQ_ENUM_170 -# define SEQAN_PP_SEQ_ENUM_172(x) x, SEQAN_PP_SEQ_ENUM_171 -# define SEQAN_PP_SEQ_ENUM_173(x) x, SEQAN_PP_SEQ_ENUM_172 -# define SEQAN_PP_SEQ_ENUM_174(x) x, SEQAN_PP_SEQ_ENUM_173 -# define SEQAN_PP_SEQ_ENUM_175(x) x, SEQAN_PP_SEQ_ENUM_174 -# define SEQAN_PP_SEQ_ENUM_176(x) x, SEQAN_PP_SEQ_ENUM_175 -# define SEQAN_PP_SEQ_ENUM_177(x) x, SEQAN_PP_SEQ_ENUM_176 -# define SEQAN_PP_SEQ_ENUM_178(x) x, SEQAN_PP_SEQ_ENUM_177 -# define SEQAN_PP_SEQ_ENUM_179(x) x, SEQAN_PP_SEQ_ENUM_178 -# define SEQAN_PP_SEQ_ENUM_180(x) x, SEQAN_PP_SEQ_ENUM_179 -# define SEQAN_PP_SEQ_ENUM_181(x) x, SEQAN_PP_SEQ_ENUM_180 -# define SEQAN_PP_SEQ_ENUM_182(x) x, SEQAN_PP_SEQ_ENUM_181 -# define SEQAN_PP_SEQ_ENUM_183(x) x, SEQAN_PP_SEQ_ENUM_182 -# define SEQAN_PP_SEQ_ENUM_184(x) x, SEQAN_PP_SEQ_ENUM_183 -# define SEQAN_PP_SEQ_ENUM_185(x) x, SEQAN_PP_SEQ_ENUM_184 -# define SEQAN_PP_SEQ_ENUM_186(x) x, SEQAN_PP_SEQ_ENUM_185 -# define SEQAN_PP_SEQ_ENUM_187(x) x, SEQAN_PP_SEQ_ENUM_186 -# define SEQAN_PP_SEQ_ENUM_188(x) x, SEQAN_PP_SEQ_ENUM_187 -# define SEQAN_PP_SEQ_ENUM_189(x) x, SEQAN_PP_SEQ_ENUM_188 -# define SEQAN_PP_SEQ_ENUM_190(x) x, SEQAN_PP_SEQ_ENUM_189 -# define SEQAN_PP_SEQ_ENUM_191(x) x, SEQAN_PP_SEQ_ENUM_190 -# define SEQAN_PP_SEQ_ENUM_192(x) x, SEQAN_PP_SEQ_ENUM_191 -# define SEQAN_PP_SEQ_ENUM_193(x) x, SEQAN_PP_SEQ_ENUM_192 -# define SEQAN_PP_SEQ_ENUM_194(x) x, SEQAN_PP_SEQ_ENUM_193 -# define SEQAN_PP_SEQ_ENUM_195(x) x, SEQAN_PP_SEQ_ENUM_194 -# define SEQAN_PP_SEQ_ENUM_196(x) x, SEQAN_PP_SEQ_ENUM_195 -# define SEQAN_PP_SEQ_ENUM_197(x) x, SEQAN_PP_SEQ_ENUM_196 -# define SEQAN_PP_SEQ_ENUM_198(x) x, SEQAN_PP_SEQ_ENUM_197 -# define SEQAN_PP_SEQ_ENUM_199(x) x, SEQAN_PP_SEQ_ENUM_198 -# define SEQAN_PP_SEQ_ENUM_200(x) x, SEQAN_PP_SEQ_ENUM_199 -# define SEQAN_PP_SEQ_ENUM_201(x) x, SEQAN_PP_SEQ_ENUM_200 -# define SEQAN_PP_SEQ_ENUM_202(x) x, SEQAN_PP_SEQ_ENUM_201 -# define SEQAN_PP_SEQ_ENUM_203(x) x, SEQAN_PP_SEQ_ENUM_202 -# define SEQAN_PP_SEQ_ENUM_204(x) x, SEQAN_PP_SEQ_ENUM_203 -# define SEQAN_PP_SEQ_ENUM_205(x) x, SEQAN_PP_SEQ_ENUM_204 -# define SEQAN_PP_SEQ_ENUM_206(x) x, SEQAN_PP_SEQ_ENUM_205 -# define SEQAN_PP_SEQ_ENUM_207(x) x, SEQAN_PP_SEQ_ENUM_206 -# define SEQAN_PP_SEQ_ENUM_208(x) x, SEQAN_PP_SEQ_ENUM_207 -# define SEQAN_PP_SEQ_ENUM_209(x) x, SEQAN_PP_SEQ_ENUM_208 -# define SEQAN_PP_SEQ_ENUM_210(x) x, SEQAN_PP_SEQ_ENUM_209 -# define SEQAN_PP_SEQ_ENUM_211(x) x, SEQAN_PP_SEQ_ENUM_210 -# define SEQAN_PP_SEQ_ENUM_212(x) x, SEQAN_PP_SEQ_ENUM_211 -# define SEQAN_PP_SEQ_ENUM_213(x) x, SEQAN_PP_SEQ_ENUM_212 -# define SEQAN_PP_SEQ_ENUM_214(x) x, SEQAN_PP_SEQ_ENUM_213 -# define SEQAN_PP_SEQ_ENUM_215(x) x, SEQAN_PP_SEQ_ENUM_214 -# define SEQAN_PP_SEQ_ENUM_216(x) x, SEQAN_PP_SEQ_ENUM_215 -# define SEQAN_PP_SEQ_ENUM_217(x) x, SEQAN_PP_SEQ_ENUM_216 -# define SEQAN_PP_SEQ_ENUM_218(x) x, SEQAN_PP_SEQ_ENUM_217 -# define SEQAN_PP_SEQ_ENUM_219(x) x, SEQAN_PP_SEQ_ENUM_218 -# define SEQAN_PP_SEQ_ENUM_220(x) x, SEQAN_PP_SEQ_ENUM_219 -# define SEQAN_PP_SEQ_ENUM_221(x) x, SEQAN_PP_SEQ_ENUM_220 -# define SEQAN_PP_SEQ_ENUM_222(x) x, SEQAN_PP_SEQ_ENUM_221 -# define SEQAN_PP_SEQ_ENUM_223(x) x, SEQAN_PP_SEQ_ENUM_222 -# define SEQAN_PP_SEQ_ENUM_224(x) x, SEQAN_PP_SEQ_ENUM_223 -# define SEQAN_PP_SEQ_ENUM_225(x) x, SEQAN_PP_SEQ_ENUM_224 -# define SEQAN_PP_SEQ_ENUM_226(x) x, SEQAN_PP_SEQ_ENUM_225 -# define SEQAN_PP_SEQ_ENUM_227(x) x, SEQAN_PP_SEQ_ENUM_226 -# define SEQAN_PP_SEQ_ENUM_228(x) x, SEQAN_PP_SEQ_ENUM_227 -# define SEQAN_PP_SEQ_ENUM_229(x) x, SEQAN_PP_SEQ_ENUM_228 -# define SEQAN_PP_SEQ_ENUM_230(x) x, SEQAN_PP_SEQ_ENUM_229 -# define SEQAN_PP_SEQ_ENUM_231(x) x, SEQAN_PP_SEQ_ENUM_230 -# define SEQAN_PP_SEQ_ENUM_232(x) x, SEQAN_PP_SEQ_ENUM_231 -# define SEQAN_PP_SEQ_ENUM_233(x) x, SEQAN_PP_SEQ_ENUM_232 -# define SEQAN_PP_SEQ_ENUM_234(x) x, SEQAN_PP_SEQ_ENUM_233 -# define SEQAN_PP_SEQ_ENUM_235(x) x, SEQAN_PP_SEQ_ENUM_234 -# define SEQAN_PP_SEQ_ENUM_236(x) x, SEQAN_PP_SEQ_ENUM_235 -# define SEQAN_PP_SEQ_ENUM_237(x) x, SEQAN_PP_SEQ_ENUM_236 -# define SEQAN_PP_SEQ_ENUM_238(x) x, SEQAN_PP_SEQ_ENUM_237 -# define SEQAN_PP_SEQ_ENUM_239(x) x, SEQAN_PP_SEQ_ENUM_238 -# define SEQAN_PP_SEQ_ENUM_240(x) x, SEQAN_PP_SEQ_ENUM_239 -# define SEQAN_PP_SEQ_ENUM_241(x) x, SEQAN_PP_SEQ_ENUM_240 -# define SEQAN_PP_SEQ_ENUM_242(x) x, SEQAN_PP_SEQ_ENUM_241 -# define SEQAN_PP_SEQ_ENUM_243(x) x, SEQAN_PP_SEQ_ENUM_242 -# define SEQAN_PP_SEQ_ENUM_244(x) x, SEQAN_PP_SEQ_ENUM_243 -# define SEQAN_PP_SEQ_ENUM_245(x) x, SEQAN_PP_SEQ_ENUM_244 -# define SEQAN_PP_SEQ_ENUM_246(x) x, SEQAN_PP_SEQ_ENUM_245 -# define SEQAN_PP_SEQ_ENUM_247(x) x, SEQAN_PP_SEQ_ENUM_246 -# define SEQAN_PP_SEQ_ENUM_248(x) x, SEQAN_PP_SEQ_ENUM_247 -# define SEQAN_PP_SEQ_ENUM_249(x) x, SEQAN_PP_SEQ_ENUM_248 -# define SEQAN_PP_SEQ_ENUM_250(x) x, SEQAN_PP_SEQ_ENUM_249 -# define SEQAN_PP_SEQ_ENUM_251(x) x, SEQAN_PP_SEQ_ENUM_250 -# define SEQAN_PP_SEQ_ENUM_252(x) x, SEQAN_PP_SEQ_ENUM_251 -# define SEQAN_PP_SEQ_ENUM_253(x) x, SEQAN_PP_SEQ_ENUM_252 -# define SEQAN_PP_SEQ_ENUM_254(x) x, SEQAN_PP_SEQ_ENUM_253 -# define SEQAN_PP_SEQ_ENUM_255(x) x, SEQAN_PP_SEQ_ENUM_254 -# define SEQAN_PP_SEQ_ENUM_256(x) x, SEQAN_PP_SEQ_ENUM_255 -# -//# endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/tuple/eat.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_TUPLE_EAT_HPP -// # define SEQAN_PREPROCESSOR_TUPLE_EAT_HPP -# -// # include -# -# /* SEQAN_PP_TUPLE_EAT */ -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_TUPLE_EAT(size) SEQAN_PP_TUPLE_EAT_I(size) -// # else -// # define SEQAN_PP_TUPLE_EAT(size) SEQAN_PP_TUPLE_EAT_OO((size)) -// # define SEQAN_PP_TUPLE_EAT_OO(par) SEQAN_PP_TUPLE_EAT_I ## par -// # endif -# -# define SEQAN_PP_TUPLE_EAT_I(size) SEQAN_PP_TUPLE_EAT_ ## size -# -# define SEQAN_PP_TUPLE_EAT_0() -# define SEQAN_PP_TUPLE_EAT_1(a) -# define SEQAN_PP_TUPLE_EAT_2(a, b) -# define SEQAN_PP_TUPLE_EAT_3(a, b, c) -# define SEQAN_PP_TUPLE_EAT_4(a, b, c, d) -# define SEQAN_PP_TUPLE_EAT_5(a, b, c, d, e) -# define SEQAN_PP_TUPLE_EAT_6(a, b, c, d, e, f) -# define SEQAN_PP_TUPLE_EAT_7(a, b, c, d, e, f, g) -# define SEQAN_PP_TUPLE_EAT_8(a, b, c, d, e, f, g, h) -# define SEQAN_PP_TUPLE_EAT_9(a, b, c, d, e, f, g, h, i) -# define SEQAN_PP_TUPLE_EAT_10(a, b, c, d, e, f, g, h, i, j) -# define SEQAN_PP_TUPLE_EAT_11(a, b, c, d, e, f, g, h, i, j, k) -# define SEQAN_PP_TUPLE_EAT_12(a, b, c, d, e, f, g, h, i, j, k, l) -# define SEQAN_PP_TUPLE_EAT_13(a, b, c, d, e, f, g, h, i, j, k, l, m) -# define SEQAN_PP_TUPLE_EAT_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n) -# define SEQAN_PP_TUPLE_EAT_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -# define SEQAN_PP_TUPLE_EAT_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) -# define SEQAN_PP_TUPLE_EAT_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) -# define SEQAN_PP_TUPLE_EAT_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) -# define SEQAN_PP_TUPLE_EAT_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) -# define SEQAN_PP_TUPLE_EAT_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) -# define SEQAN_PP_TUPLE_EAT_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) -# define SEQAN_PP_TUPLE_EAT_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) -# define SEQAN_PP_TUPLE_EAT_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) -# define SEQAN_PP_TUPLE_EAT_24(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) -# define SEQAN_PP_TUPLE_EAT_25(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) -# -// # endif - -#ifdef SEQAN_PLATFORM_WINDOWS_VS - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/repetition/detail/msvc/for.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_REPETITION_DETAIL_MSVC_FOR_HPP -// # define SEQAN_PREPROCESSOR_REPETITION_DETAIL_MSVC_FOR_HPP -# -// # include -// # include -# -# define SEQAN_PP_FOR_1(s, p, o, m) SEQAN_PP_IF(p(2, s), m, SEQAN_PP_TUPLE_EAT_2)(2, s) SEQAN_PP_IF(p(2, s), SEQAN_PP_FOR_2, SEQAN_PP_TUPLE_EAT_4)(o(2, s), p, o, m) -# define SEQAN_PP_FOR_2(s, p, o, m) SEQAN_PP_IF(p(3, s), m, SEQAN_PP_TUPLE_EAT_2)(3, s) SEQAN_PP_IF(p(3, s), SEQAN_PP_FOR_3, SEQAN_PP_TUPLE_EAT_4)(o(3, s), p, o, m) -# define SEQAN_PP_FOR_3(s, p, o, m) SEQAN_PP_IF(p(4, s), m, SEQAN_PP_TUPLE_EAT_2)(4, s) SEQAN_PP_IF(p(4, s), SEQAN_PP_FOR_4, SEQAN_PP_TUPLE_EAT_4)(o(4, s), p, o, m) -# define SEQAN_PP_FOR_4(s, p, o, m) SEQAN_PP_IF(p(5, s), m, SEQAN_PP_TUPLE_EAT_2)(5, s) SEQAN_PP_IF(p(5, s), SEQAN_PP_FOR_5, SEQAN_PP_TUPLE_EAT_4)(o(5, s), p, o, m) -# define SEQAN_PP_FOR_5(s, p, o, m) SEQAN_PP_IF(p(6, s), m, SEQAN_PP_TUPLE_EAT_2)(6, s) SEQAN_PP_IF(p(6, s), SEQAN_PP_FOR_6, SEQAN_PP_TUPLE_EAT_4)(o(6, s), p, o, m) -# define SEQAN_PP_FOR_6(s, p, o, m) SEQAN_PP_IF(p(7, s), m, SEQAN_PP_TUPLE_EAT_2)(7, s) SEQAN_PP_IF(p(7, s), SEQAN_PP_FOR_7, SEQAN_PP_TUPLE_EAT_4)(o(7, s), p, o, m) -# define SEQAN_PP_FOR_7(s, p, o, m) SEQAN_PP_IF(p(8, s), m, SEQAN_PP_TUPLE_EAT_2)(8, s) SEQAN_PP_IF(p(8, s), SEQAN_PP_FOR_8, SEQAN_PP_TUPLE_EAT_4)(o(8, s), p, o, m) -# define SEQAN_PP_FOR_8(s, p, o, m) SEQAN_PP_IF(p(9, s), m, SEQAN_PP_TUPLE_EAT_2)(9, s) SEQAN_PP_IF(p(9, s), SEQAN_PP_FOR_9, SEQAN_PP_TUPLE_EAT_4)(o(9, s), p, o, m) -# define SEQAN_PP_FOR_9(s, p, o, m) SEQAN_PP_IF(p(10, s), m, SEQAN_PP_TUPLE_EAT_2)(10, s) SEQAN_PP_IF(p(10, s), SEQAN_PP_FOR_10, SEQAN_PP_TUPLE_EAT_4)(o(10, s), p, o, m) -# define SEQAN_PP_FOR_10(s, p, o, m) SEQAN_PP_IF(p(11, s), m, SEQAN_PP_TUPLE_EAT_2)(11, s) SEQAN_PP_IF(p(11, s), SEQAN_PP_FOR_11, SEQAN_PP_TUPLE_EAT_4)(o(11, s), p, o, m) -# define SEQAN_PP_FOR_11(s, p, o, m) SEQAN_PP_IF(p(12, s), m, SEQAN_PP_TUPLE_EAT_2)(12, s) SEQAN_PP_IF(p(12, s), SEQAN_PP_FOR_12, SEQAN_PP_TUPLE_EAT_4)(o(12, s), p, o, m) -# define SEQAN_PP_FOR_12(s, p, o, m) SEQAN_PP_IF(p(13, s), m, SEQAN_PP_TUPLE_EAT_2)(13, s) SEQAN_PP_IF(p(13, s), SEQAN_PP_FOR_13, SEQAN_PP_TUPLE_EAT_4)(o(13, s), p, o, m) -# define SEQAN_PP_FOR_13(s, p, o, m) SEQAN_PP_IF(p(14, s), m, SEQAN_PP_TUPLE_EAT_2)(14, s) SEQAN_PP_IF(p(14, s), SEQAN_PP_FOR_14, SEQAN_PP_TUPLE_EAT_4)(o(14, s), p, o, m) -# define SEQAN_PP_FOR_14(s, p, o, m) SEQAN_PP_IF(p(15, s), m, SEQAN_PP_TUPLE_EAT_2)(15, s) SEQAN_PP_IF(p(15, s), SEQAN_PP_FOR_15, SEQAN_PP_TUPLE_EAT_4)(o(15, s), p, o, m) -# define SEQAN_PP_FOR_15(s, p, o, m) SEQAN_PP_IF(p(16, s), m, SEQAN_PP_TUPLE_EAT_2)(16, s) SEQAN_PP_IF(p(16, s), SEQAN_PP_FOR_16, SEQAN_PP_TUPLE_EAT_4)(o(16, s), p, o, m) -# define SEQAN_PP_FOR_16(s, p, o, m) SEQAN_PP_IF(p(17, s), m, SEQAN_PP_TUPLE_EAT_2)(17, s) SEQAN_PP_IF(p(17, s), SEQAN_PP_FOR_17, SEQAN_PP_TUPLE_EAT_4)(o(17, s), p, o, m) -# define SEQAN_PP_FOR_17(s, p, o, m) SEQAN_PP_IF(p(18, s), m, SEQAN_PP_TUPLE_EAT_2)(18, s) SEQAN_PP_IF(p(18, s), SEQAN_PP_FOR_18, SEQAN_PP_TUPLE_EAT_4)(o(18, s), p, o, m) -# define SEQAN_PP_FOR_18(s, p, o, m) SEQAN_PP_IF(p(19, s), m, SEQAN_PP_TUPLE_EAT_2)(19, s) SEQAN_PP_IF(p(19, s), SEQAN_PP_FOR_19, SEQAN_PP_TUPLE_EAT_4)(o(19, s), p, o, m) -# define SEQAN_PP_FOR_19(s, p, o, m) SEQAN_PP_IF(p(20, s), m, SEQAN_PP_TUPLE_EAT_2)(20, s) SEQAN_PP_IF(p(20, s), SEQAN_PP_FOR_20, SEQAN_PP_TUPLE_EAT_4)(o(20, s), p, o, m) -# define SEQAN_PP_FOR_20(s, p, o, m) SEQAN_PP_IF(p(21, s), m, SEQAN_PP_TUPLE_EAT_2)(21, s) SEQAN_PP_IF(p(21, s), SEQAN_PP_FOR_21, SEQAN_PP_TUPLE_EAT_4)(o(21, s), p, o, m) -# define SEQAN_PP_FOR_21(s, p, o, m) SEQAN_PP_IF(p(22, s), m, SEQAN_PP_TUPLE_EAT_2)(22, s) SEQAN_PP_IF(p(22, s), SEQAN_PP_FOR_22, SEQAN_PP_TUPLE_EAT_4)(o(22, s), p, o, m) -# define SEQAN_PP_FOR_22(s, p, o, m) SEQAN_PP_IF(p(23, s), m, SEQAN_PP_TUPLE_EAT_2)(23, s) SEQAN_PP_IF(p(23, s), SEQAN_PP_FOR_23, SEQAN_PP_TUPLE_EAT_4)(o(23, s), p, o, m) -# define SEQAN_PP_FOR_23(s, p, o, m) SEQAN_PP_IF(p(24, s), m, SEQAN_PP_TUPLE_EAT_2)(24, s) SEQAN_PP_IF(p(24, s), SEQAN_PP_FOR_24, SEQAN_PP_TUPLE_EAT_4)(o(24, s), p, o, m) -# define SEQAN_PP_FOR_24(s, p, o, m) SEQAN_PP_IF(p(25, s), m, SEQAN_PP_TUPLE_EAT_2)(25, s) SEQAN_PP_IF(p(25, s), SEQAN_PP_FOR_25, SEQAN_PP_TUPLE_EAT_4)(o(25, s), p, o, m) -# define SEQAN_PP_FOR_25(s, p, o, m) SEQAN_PP_IF(p(26, s), m, SEQAN_PP_TUPLE_EAT_2)(26, s) SEQAN_PP_IF(p(26, s), SEQAN_PP_FOR_26, SEQAN_PP_TUPLE_EAT_4)(o(26, s), p, o, m) -# define SEQAN_PP_FOR_26(s, p, o, m) SEQAN_PP_IF(p(27, s), m, SEQAN_PP_TUPLE_EAT_2)(27, s) SEQAN_PP_IF(p(27, s), SEQAN_PP_FOR_27, SEQAN_PP_TUPLE_EAT_4)(o(27, s), p, o, m) -# define SEQAN_PP_FOR_27(s, p, o, m) SEQAN_PP_IF(p(28, s), m, SEQAN_PP_TUPLE_EAT_2)(28, s) SEQAN_PP_IF(p(28, s), SEQAN_PP_FOR_28, SEQAN_PP_TUPLE_EAT_4)(o(28, s), p, o, m) -# define SEQAN_PP_FOR_28(s, p, o, m) SEQAN_PP_IF(p(29, s), m, SEQAN_PP_TUPLE_EAT_2)(29, s) SEQAN_PP_IF(p(29, s), SEQAN_PP_FOR_29, SEQAN_PP_TUPLE_EAT_4)(o(29, s), p, o, m) -# define SEQAN_PP_FOR_29(s, p, o, m) SEQAN_PP_IF(p(30, s), m, SEQAN_PP_TUPLE_EAT_2)(30, s) SEQAN_PP_IF(p(30, s), SEQAN_PP_FOR_30, SEQAN_PP_TUPLE_EAT_4)(o(30, s), p, o, m) -# define SEQAN_PP_FOR_30(s, p, o, m) SEQAN_PP_IF(p(31, s), m, SEQAN_PP_TUPLE_EAT_2)(31, s) SEQAN_PP_IF(p(31, s), SEQAN_PP_FOR_31, SEQAN_PP_TUPLE_EAT_4)(o(31, s), p, o, m) -# define SEQAN_PP_FOR_31(s, p, o, m) SEQAN_PP_IF(p(32, s), m, SEQAN_PP_TUPLE_EAT_2)(32, s) SEQAN_PP_IF(p(32, s), SEQAN_PP_FOR_32, SEQAN_PP_TUPLE_EAT_4)(o(32, s), p, o, m) -# define SEQAN_PP_FOR_32(s, p, o, m) SEQAN_PP_IF(p(33, s), m, SEQAN_PP_TUPLE_EAT_2)(33, s) SEQAN_PP_IF(p(33, s), SEQAN_PP_FOR_33, SEQAN_PP_TUPLE_EAT_4)(o(33, s), p, o, m) -# define SEQAN_PP_FOR_33(s, p, o, m) SEQAN_PP_IF(p(34, s), m, SEQAN_PP_TUPLE_EAT_2)(34, s) SEQAN_PP_IF(p(34, s), SEQAN_PP_FOR_34, SEQAN_PP_TUPLE_EAT_4)(o(34, s), p, o, m) -# define SEQAN_PP_FOR_34(s, p, o, m) SEQAN_PP_IF(p(35, s), m, SEQAN_PP_TUPLE_EAT_2)(35, s) SEQAN_PP_IF(p(35, s), SEQAN_PP_FOR_35, SEQAN_PP_TUPLE_EAT_4)(o(35, s), p, o, m) -# define SEQAN_PP_FOR_35(s, p, o, m) SEQAN_PP_IF(p(36, s), m, SEQAN_PP_TUPLE_EAT_2)(36, s) SEQAN_PP_IF(p(36, s), SEQAN_PP_FOR_36, SEQAN_PP_TUPLE_EAT_4)(o(36, s), p, o, m) -# define SEQAN_PP_FOR_36(s, p, o, m) SEQAN_PP_IF(p(37, s), m, SEQAN_PP_TUPLE_EAT_2)(37, s) SEQAN_PP_IF(p(37, s), SEQAN_PP_FOR_37, SEQAN_PP_TUPLE_EAT_4)(o(37, s), p, o, m) -# define SEQAN_PP_FOR_37(s, p, o, m) SEQAN_PP_IF(p(38, s), m, SEQAN_PP_TUPLE_EAT_2)(38, s) SEQAN_PP_IF(p(38, s), SEQAN_PP_FOR_38, SEQAN_PP_TUPLE_EAT_4)(o(38, s), p, o, m) -# define SEQAN_PP_FOR_38(s, p, o, m) SEQAN_PP_IF(p(39, s), m, SEQAN_PP_TUPLE_EAT_2)(39, s) SEQAN_PP_IF(p(39, s), SEQAN_PP_FOR_39, SEQAN_PP_TUPLE_EAT_4)(o(39, s), p, o, m) -# define SEQAN_PP_FOR_39(s, p, o, m) SEQAN_PP_IF(p(40, s), m, SEQAN_PP_TUPLE_EAT_2)(40, s) SEQAN_PP_IF(p(40, s), SEQAN_PP_FOR_40, SEQAN_PP_TUPLE_EAT_4)(o(40, s), p, o, m) -# define SEQAN_PP_FOR_40(s, p, o, m) SEQAN_PP_IF(p(41, s), m, SEQAN_PP_TUPLE_EAT_2)(41, s) SEQAN_PP_IF(p(41, s), SEQAN_PP_FOR_41, SEQAN_PP_TUPLE_EAT_4)(o(41, s), p, o, m) -# define SEQAN_PP_FOR_41(s, p, o, m) SEQAN_PP_IF(p(42, s), m, SEQAN_PP_TUPLE_EAT_2)(42, s) SEQAN_PP_IF(p(42, s), SEQAN_PP_FOR_42, SEQAN_PP_TUPLE_EAT_4)(o(42, s), p, o, m) -# define SEQAN_PP_FOR_42(s, p, o, m) SEQAN_PP_IF(p(43, s), m, SEQAN_PP_TUPLE_EAT_2)(43, s) SEQAN_PP_IF(p(43, s), SEQAN_PP_FOR_43, SEQAN_PP_TUPLE_EAT_4)(o(43, s), p, o, m) -# define SEQAN_PP_FOR_43(s, p, o, m) SEQAN_PP_IF(p(44, s), m, SEQAN_PP_TUPLE_EAT_2)(44, s) SEQAN_PP_IF(p(44, s), SEQAN_PP_FOR_44, SEQAN_PP_TUPLE_EAT_4)(o(44, s), p, o, m) -# define SEQAN_PP_FOR_44(s, p, o, m) SEQAN_PP_IF(p(45, s), m, SEQAN_PP_TUPLE_EAT_2)(45, s) SEQAN_PP_IF(p(45, s), SEQAN_PP_FOR_45, SEQAN_PP_TUPLE_EAT_4)(o(45, s), p, o, m) -# define SEQAN_PP_FOR_45(s, p, o, m) SEQAN_PP_IF(p(46, s), m, SEQAN_PP_TUPLE_EAT_2)(46, s) SEQAN_PP_IF(p(46, s), SEQAN_PP_FOR_46, SEQAN_PP_TUPLE_EAT_4)(o(46, s), p, o, m) -# define SEQAN_PP_FOR_46(s, p, o, m) SEQAN_PP_IF(p(47, s), m, SEQAN_PP_TUPLE_EAT_2)(47, s) SEQAN_PP_IF(p(47, s), SEQAN_PP_FOR_47, SEQAN_PP_TUPLE_EAT_4)(o(47, s), p, o, m) -# define SEQAN_PP_FOR_47(s, p, o, m) SEQAN_PP_IF(p(48, s), m, SEQAN_PP_TUPLE_EAT_2)(48, s) SEQAN_PP_IF(p(48, s), SEQAN_PP_FOR_48, SEQAN_PP_TUPLE_EAT_4)(o(48, s), p, o, m) -# define SEQAN_PP_FOR_48(s, p, o, m) SEQAN_PP_IF(p(49, s), m, SEQAN_PP_TUPLE_EAT_2)(49, s) SEQAN_PP_IF(p(49, s), SEQAN_PP_FOR_49, SEQAN_PP_TUPLE_EAT_4)(o(49, s), p, o, m) -# define SEQAN_PP_FOR_49(s, p, o, m) SEQAN_PP_IF(p(50, s), m, SEQAN_PP_TUPLE_EAT_2)(50, s) SEQAN_PP_IF(p(50, s), SEQAN_PP_FOR_50, SEQAN_PP_TUPLE_EAT_4)(o(50, s), p, o, m) -# define SEQAN_PP_FOR_50(s, p, o, m) SEQAN_PP_IF(p(51, s), m, SEQAN_PP_TUPLE_EAT_2)(51, s) SEQAN_PP_IF(p(51, s), SEQAN_PP_FOR_51, SEQAN_PP_TUPLE_EAT_4)(o(51, s), p, o, m) -# define SEQAN_PP_FOR_51(s, p, o, m) SEQAN_PP_IF(p(52, s), m, SEQAN_PP_TUPLE_EAT_2)(52, s) SEQAN_PP_IF(p(52, s), SEQAN_PP_FOR_52, SEQAN_PP_TUPLE_EAT_4)(o(52, s), p, o, m) -# define SEQAN_PP_FOR_52(s, p, o, m) SEQAN_PP_IF(p(53, s), m, SEQAN_PP_TUPLE_EAT_2)(53, s) SEQAN_PP_IF(p(53, s), SEQAN_PP_FOR_53, SEQAN_PP_TUPLE_EAT_4)(o(53, s), p, o, m) -# define SEQAN_PP_FOR_53(s, p, o, m) SEQAN_PP_IF(p(54, s), m, SEQAN_PP_TUPLE_EAT_2)(54, s) SEQAN_PP_IF(p(54, s), SEQAN_PP_FOR_54, SEQAN_PP_TUPLE_EAT_4)(o(54, s), p, o, m) -# define SEQAN_PP_FOR_54(s, p, o, m) SEQAN_PP_IF(p(55, s), m, SEQAN_PP_TUPLE_EAT_2)(55, s) SEQAN_PP_IF(p(55, s), SEQAN_PP_FOR_55, SEQAN_PP_TUPLE_EAT_4)(o(55, s), p, o, m) -# define SEQAN_PP_FOR_55(s, p, o, m) SEQAN_PP_IF(p(56, s), m, SEQAN_PP_TUPLE_EAT_2)(56, s) SEQAN_PP_IF(p(56, s), SEQAN_PP_FOR_56, SEQAN_PP_TUPLE_EAT_4)(o(56, s), p, o, m) -# define SEQAN_PP_FOR_56(s, p, o, m) SEQAN_PP_IF(p(57, s), m, SEQAN_PP_TUPLE_EAT_2)(57, s) SEQAN_PP_IF(p(57, s), SEQAN_PP_FOR_57, SEQAN_PP_TUPLE_EAT_4)(o(57, s), p, o, m) -# define SEQAN_PP_FOR_57(s, p, o, m) SEQAN_PP_IF(p(58, s), m, SEQAN_PP_TUPLE_EAT_2)(58, s) SEQAN_PP_IF(p(58, s), SEQAN_PP_FOR_58, SEQAN_PP_TUPLE_EAT_4)(o(58, s), p, o, m) -# define SEQAN_PP_FOR_58(s, p, o, m) SEQAN_PP_IF(p(59, s), m, SEQAN_PP_TUPLE_EAT_2)(59, s) SEQAN_PP_IF(p(59, s), SEQAN_PP_FOR_59, SEQAN_PP_TUPLE_EAT_4)(o(59, s), p, o, m) -# define SEQAN_PP_FOR_59(s, p, o, m) SEQAN_PP_IF(p(60, s), m, SEQAN_PP_TUPLE_EAT_2)(60, s) SEQAN_PP_IF(p(60, s), SEQAN_PP_FOR_60, SEQAN_PP_TUPLE_EAT_4)(o(60, s), p, o, m) -# define SEQAN_PP_FOR_60(s, p, o, m) SEQAN_PP_IF(p(61, s), m, SEQAN_PP_TUPLE_EAT_2)(61, s) SEQAN_PP_IF(p(61, s), SEQAN_PP_FOR_61, SEQAN_PP_TUPLE_EAT_4)(o(61, s), p, o, m) -# define SEQAN_PP_FOR_61(s, p, o, m) SEQAN_PP_IF(p(62, s), m, SEQAN_PP_TUPLE_EAT_2)(62, s) SEQAN_PP_IF(p(62, s), SEQAN_PP_FOR_62, SEQAN_PP_TUPLE_EAT_4)(o(62, s), p, o, m) -# define SEQAN_PP_FOR_62(s, p, o, m) SEQAN_PP_IF(p(63, s), m, SEQAN_PP_TUPLE_EAT_2)(63, s) SEQAN_PP_IF(p(63, s), SEQAN_PP_FOR_63, SEQAN_PP_TUPLE_EAT_4)(o(63, s), p, o, m) -# define SEQAN_PP_FOR_63(s, p, o, m) SEQAN_PP_IF(p(64, s), m, SEQAN_PP_TUPLE_EAT_2)(64, s) SEQAN_PP_IF(p(64, s), SEQAN_PP_FOR_64, SEQAN_PP_TUPLE_EAT_4)(o(64, s), p, o, m) -# define SEQAN_PP_FOR_64(s, p, o, m) SEQAN_PP_IF(p(65, s), m, SEQAN_PP_TUPLE_EAT_2)(65, s) SEQAN_PP_IF(p(65, s), SEQAN_PP_FOR_65, SEQAN_PP_TUPLE_EAT_4)(o(65, s), p, o, m) -# define SEQAN_PP_FOR_65(s, p, o, m) SEQAN_PP_IF(p(66, s), m, SEQAN_PP_TUPLE_EAT_2)(66, s) SEQAN_PP_IF(p(66, s), SEQAN_PP_FOR_66, SEQAN_PP_TUPLE_EAT_4)(o(66, s), p, o, m) -# define SEQAN_PP_FOR_66(s, p, o, m) SEQAN_PP_IF(p(67, s), m, SEQAN_PP_TUPLE_EAT_2)(67, s) SEQAN_PP_IF(p(67, s), SEQAN_PP_FOR_67, SEQAN_PP_TUPLE_EAT_4)(o(67, s), p, o, m) -# define SEQAN_PP_FOR_67(s, p, o, m) SEQAN_PP_IF(p(68, s), m, SEQAN_PP_TUPLE_EAT_2)(68, s) SEQAN_PP_IF(p(68, s), SEQAN_PP_FOR_68, SEQAN_PP_TUPLE_EAT_4)(o(68, s), p, o, m) -# define SEQAN_PP_FOR_68(s, p, o, m) SEQAN_PP_IF(p(69, s), m, SEQAN_PP_TUPLE_EAT_2)(69, s) SEQAN_PP_IF(p(69, s), SEQAN_PP_FOR_69, SEQAN_PP_TUPLE_EAT_4)(o(69, s), p, o, m) -# define SEQAN_PP_FOR_69(s, p, o, m) SEQAN_PP_IF(p(70, s), m, SEQAN_PP_TUPLE_EAT_2)(70, s) SEQAN_PP_IF(p(70, s), SEQAN_PP_FOR_70, SEQAN_PP_TUPLE_EAT_4)(o(70, s), p, o, m) -# define SEQAN_PP_FOR_70(s, p, o, m) SEQAN_PP_IF(p(71, s), m, SEQAN_PP_TUPLE_EAT_2)(71, s) SEQAN_PP_IF(p(71, s), SEQAN_PP_FOR_71, SEQAN_PP_TUPLE_EAT_4)(o(71, s), p, o, m) -# define SEQAN_PP_FOR_71(s, p, o, m) SEQAN_PP_IF(p(72, s), m, SEQAN_PP_TUPLE_EAT_2)(72, s) SEQAN_PP_IF(p(72, s), SEQAN_PP_FOR_72, SEQAN_PP_TUPLE_EAT_4)(o(72, s), p, o, m) -# define SEQAN_PP_FOR_72(s, p, o, m) SEQAN_PP_IF(p(73, s), m, SEQAN_PP_TUPLE_EAT_2)(73, s) SEQAN_PP_IF(p(73, s), SEQAN_PP_FOR_73, SEQAN_PP_TUPLE_EAT_4)(o(73, s), p, o, m) -# define SEQAN_PP_FOR_73(s, p, o, m) SEQAN_PP_IF(p(74, s), m, SEQAN_PP_TUPLE_EAT_2)(74, s) SEQAN_PP_IF(p(74, s), SEQAN_PP_FOR_74, SEQAN_PP_TUPLE_EAT_4)(o(74, s), p, o, m) -# define SEQAN_PP_FOR_74(s, p, o, m) SEQAN_PP_IF(p(75, s), m, SEQAN_PP_TUPLE_EAT_2)(75, s) SEQAN_PP_IF(p(75, s), SEQAN_PP_FOR_75, SEQAN_PP_TUPLE_EAT_4)(o(75, s), p, o, m) -# define SEQAN_PP_FOR_75(s, p, o, m) SEQAN_PP_IF(p(76, s), m, SEQAN_PP_TUPLE_EAT_2)(76, s) SEQAN_PP_IF(p(76, s), SEQAN_PP_FOR_76, SEQAN_PP_TUPLE_EAT_4)(o(76, s), p, o, m) -# define SEQAN_PP_FOR_76(s, p, o, m) SEQAN_PP_IF(p(77, s), m, SEQAN_PP_TUPLE_EAT_2)(77, s) SEQAN_PP_IF(p(77, s), SEQAN_PP_FOR_77, SEQAN_PP_TUPLE_EAT_4)(o(77, s), p, o, m) -# define SEQAN_PP_FOR_77(s, p, o, m) SEQAN_PP_IF(p(78, s), m, SEQAN_PP_TUPLE_EAT_2)(78, s) SEQAN_PP_IF(p(78, s), SEQAN_PP_FOR_78, SEQAN_PP_TUPLE_EAT_4)(o(78, s), p, o, m) -# define SEQAN_PP_FOR_78(s, p, o, m) SEQAN_PP_IF(p(79, s), m, SEQAN_PP_TUPLE_EAT_2)(79, s) SEQAN_PP_IF(p(79, s), SEQAN_PP_FOR_79, SEQAN_PP_TUPLE_EAT_4)(o(79, s), p, o, m) -# define SEQAN_PP_FOR_79(s, p, o, m) SEQAN_PP_IF(p(80, s), m, SEQAN_PP_TUPLE_EAT_2)(80, s) SEQAN_PP_IF(p(80, s), SEQAN_PP_FOR_80, SEQAN_PP_TUPLE_EAT_4)(o(80, s), p, o, m) -# define SEQAN_PP_FOR_80(s, p, o, m) SEQAN_PP_IF(p(81, s), m, SEQAN_PP_TUPLE_EAT_2)(81, s) SEQAN_PP_IF(p(81, s), SEQAN_PP_FOR_81, SEQAN_PP_TUPLE_EAT_4)(o(81, s), p, o, m) -# define SEQAN_PP_FOR_81(s, p, o, m) SEQAN_PP_IF(p(82, s), m, SEQAN_PP_TUPLE_EAT_2)(82, s) SEQAN_PP_IF(p(82, s), SEQAN_PP_FOR_82, SEQAN_PP_TUPLE_EAT_4)(o(82, s), p, o, m) -# define SEQAN_PP_FOR_82(s, p, o, m) SEQAN_PP_IF(p(83, s), m, SEQAN_PP_TUPLE_EAT_2)(83, s) SEQAN_PP_IF(p(83, s), SEQAN_PP_FOR_83, SEQAN_PP_TUPLE_EAT_4)(o(83, s), p, o, m) -# define SEQAN_PP_FOR_83(s, p, o, m) SEQAN_PP_IF(p(84, s), m, SEQAN_PP_TUPLE_EAT_2)(84, s) SEQAN_PP_IF(p(84, s), SEQAN_PP_FOR_84, SEQAN_PP_TUPLE_EAT_4)(o(84, s), p, o, m) -# define SEQAN_PP_FOR_84(s, p, o, m) SEQAN_PP_IF(p(85, s), m, SEQAN_PP_TUPLE_EAT_2)(85, s) SEQAN_PP_IF(p(85, s), SEQAN_PP_FOR_85, SEQAN_PP_TUPLE_EAT_4)(o(85, s), p, o, m) -# define SEQAN_PP_FOR_85(s, p, o, m) SEQAN_PP_IF(p(86, s), m, SEQAN_PP_TUPLE_EAT_2)(86, s) SEQAN_PP_IF(p(86, s), SEQAN_PP_FOR_86, SEQAN_PP_TUPLE_EAT_4)(o(86, s), p, o, m) -# define SEQAN_PP_FOR_86(s, p, o, m) SEQAN_PP_IF(p(87, s), m, SEQAN_PP_TUPLE_EAT_2)(87, s) SEQAN_PP_IF(p(87, s), SEQAN_PP_FOR_87, SEQAN_PP_TUPLE_EAT_4)(o(87, s), p, o, m) -# define SEQAN_PP_FOR_87(s, p, o, m) SEQAN_PP_IF(p(88, s), m, SEQAN_PP_TUPLE_EAT_2)(88, s) SEQAN_PP_IF(p(88, s), SEQAN_PP_FOR_88, SEQAN_PP_TUPLE_EAT_4)(o(88, s), p, o, m) -# define SEQAN_PP_FOR_88(s, p, o, m) SEQAN_PP_IF(p(89, s), m, SEQAN_PP_TUPLE_EAT_2)(89, s) SEQAN_PP_IF(p(89, s), SEQAN_PP_FOR_89, SEQAN_PP_TUPLE_EAT_4)(o(89, s), p, o, m) -# define SEQAN_PP_FOR_89(s, p, o, m) SEQAN_PP_IF(p(90, s), m, SEQAN_PP_TUPLE_EAT_2)(90, s) SEQAN_PP_IF(p(90, s), SEQAN_PP_FOR_90, SEQAN_PP_TUPLE_EAT_4)(o(90, s), p, o, m) -# define SEQAN_PP_FOR_90(s, p, o, m) SEQAN_PP_IF(p(91, s), m, SEQAN_PP_TUPLE_EAT_2)(91, s) SEQAN_PP_IF(p(91, s), SEQAN_PP_FOR_91, SEQAN_PP_TUPLE_EAT_4)(o(91, s), p, o, m) -# define SEQAN_PP_FOR_91(s, p, o, m) SEQAN_PP_IF(p(92, s), m, SEQAN_PP_TUPLE_EAT_2)(92, s) SEQAN_PP_IF(p(92, s), SEQAN_PP_FOR_92, SEQAN_PP_TUPLE_EAT_4)(o(92, s), p, o, m) -# define SEQAN_PP_FOR_92(s, p, o, m) SEQAN_PP_IF(p(93, s), m, SEQAN_PP_TUPLE_EAT_2)(93, s) SEQAN_PP_IF(p(93, s), SEQAN_PP_FOR_93, SEQAN_PP_TUPLE_EAT_4)(o(93, s), p, o, m) -# define SEQAN_PP_FOR_93(s, p, o, m) SEQAN_PP_IF(p(94, s), m, SEQAN_PP_TUPLE_EAT_2)(94, s) SEQAN_PP_IF(p(94, s), SEQAN_PP_FOR_94, SEQAN_PP_TUPLE_EAT_4)(o(94, s), p, o, m) -# define SEQAN_PP_FOR_94(s, p, o, m) SEQAN_PP_IF(p(95, s), m, SEQAN_PP_TUPLE_EAT_2)(95, s) SEQAN_PP_IF(p(95, s), SEQAN_PP_FOR_95, SEQAN_PP_TUPLE_EAT_4)(o(95, s), p, o, m) -# define SEQAN_PP_FOR_95(s, p, o, m) SEQAN_PP_IF(p(96, s), m, SEQAN_PP_TUPLE_EAT_2)(96, s) SEQAN_PP_IF(p(96, s), SEQAN_PP_FOR_96, SEQAN_PP_TUPLE_EAT_4)(o(96, s), p, o, m) -# define SEQAN_PP_FOR_96(s, p, o, m) SEQAN_PP_IF(p(97, s), m, SEQAN_PP_TUPLE_EAT_2)(97, s) SEQAN_PP_IF(p(97, s), SEQAN_PP_FOR_97, SEQAN_PP_TUPLE_EAT_4)(o(97, s), p, o, m) -# define SEQAN_PP_FOR_97(s, p, o, m) SEQAN_PP_IF(p(98, s), m, SEQAN_PP_TUPLE_EAT_2)(98, s) SEQAN_PP_IF(p(98, s), SEQAN_PP_FOR_98, SEQAN_PP_TUPLE_EAT_4)(o(98, s), p, o, m) -# define SEQAN_PP_FOR_98(s, p, o, m) SEQAN_PP_IF(p(99, s), m, SEQAN_PP_TUPLE_EAT_2)(99, s) SEQAN_PP_IF(p(99, s), SEQAN_PP_FOR_99, SEQAN_PP_TUPLE_EAT_4)(o(99, s), p, o, m) -# define SEQAN_PP_FOR_99(s, p, o, m) SEQAN_PP_IF(p(100, s), m, SEQAN_PP_TUPLE_EAT_2)(100, s) SEQAN_PP_IF(p(100, s), SEQAN_PP_FOR_100, SEQAN_PP_TUPLE_EAT_4)(o(100, s), p, o, m) -# define SEQAN_PP_FOR_100(s, p, o, m) SEQAN_PP_IF(p(101, s), m, SEQAN_PP_TUPLE_EAT_2)(101, s) SEQAN_PP_IF(p(101, s), SEQAN_PP_FOR_101, SEQAN_PP_TUPLE_EAT_4)(o(101, s), p, o, m) -# define SEQAN_PP_FOR_101(s, p, o, m) SEQAN_PP_IF(p(102, s), m, SEQAN_PP_TUPLE_EAT_2)(102, s) SEQAN_PP_IF(p(102, s), SEQAN_PP_FOR_102, SEQAN_PP_TUPLE_EAT_4)(o(102, s), p, o, m) -# define SEQAN_PP_FOR_102(s, p, o, m) SEQAN_PP_IF(p(103, s), m, SEQAN_PP_TUPLE_EAT_2)(103, s) SEQAN_PP_IF(p(103, s), SEQAN_PP_FOR_103, SEQAN_PP_TUPLE_EAT_4)(o(103, s), p, o, m) -# define SEQAN_PP_FOR_103(s, p, o, m) SEQAN_PP_IF(p(104, s), m, SEQAN_PP_TUPLE_EAT_2)(104, s) SEQAN_PP_IF(p(104, s), SEQAN_PP_FOR_104, SEQAN_PP_TUPLE_EAT_4)(o(104, s), p, o, m) -# define SEQAN_PP_FOR_104(s, p, o, m) SEQAN_PP_IF(p(105, s), m, SEQAN_PP_TUPLE_EAT_2)(105, s) SEQAN_PP_IF(p(105, s), SEQAN_PP_FOR_105, SEQAN_PP_TUPLE_EAT_4)(o(105, s), p, o, m) -# define SEQAN_PP_FOR_105(s, p, o, m) SEQAN_PP_IF(p(106, s), m, SEQAN_PP_TUPLE_EAT_2)(106, s) SEQAN_PP_IF(p(106, s), SEQAN_PP_FOR_106, SEQAN_PP_TUPLE_EAT_4)(o(106, s), p, o, m) -# define SEQAN_PP_FOR_106(s, p, o, m) SEQAN_PP_IF(p(107, s), m, SEQAN_PP_TUPLE_EAT_2)(107, s) SEQAN_PP_IF(p(107, s), SEQAN_PP_FOR_107, SEQAN_PP_TUPLE_EAT_4)(o(107, s), p, o, m) -# define SEQAN_PP_FOR_107(s, p, o, m) SEQAN_PP_IF(p(108, s), m, SEQAN_PP_TUPLE_EAT_2)(108, s) SEQAN_PP_IF(p(108, s), SEQAN_PP_FOR_108, SEQAN_PP_TUPLE_EAT_4)(o(108, s), p, o, m) -# define SEQAN_PP_FOR_108(s, p, o, m) SEQAN_PP_IF(p(109, s), m, SEQAN_PP_TUPLE_EAT_2)(109, s) SEQAN_PP_IF(p(109, s), SEQAN_PP_FOR_109, SEQAN_PP_TUPLE_EAT_4)(o(109, s), p, o, m) -# define SEQAN_PP_FOR_109(s, p, o, m) SEQAN_PP_IF(p(110, s), m, SEQAN_PP_TUPLE_EAT_2)(110, s) SEQAN_PP_IF(p(110, s), SEQAN_PP_FOR_110, SEQAN_PP_TUPLE_EAT_4)(o(110, s), p, o, m) -# define SEQAN_PP_FOR_110(s, p, o, m) SEQAN_PP_IF(p(111, s), m, SEQAN_PP_TUPLE_EAT_2)(111, s) SEQAN_PP_IF(p(111, s), SEQAN_PP_FOR_111, SEQAN_PP_TUPLE_EAT_4)(o(111, s), p, o, m) -# define SEQAN_PP_FOR_111(s, p, o, m) SEQAN_PP_IF(p(112, s), m, SEQAN_PP_TUPLE_EAT_2)(112, s) SEQAN_PP_IF(p(112, s), SEQAN_PP_FOR_112, SEQAN_PP_TUPLE_EAT_4)(o(112, s), p, o, m) -# define SEQAN_PP_FOR_112(s, p, o, m) SEQAN_PP_IF(p(113, s), m, SEQAN_PP_TUPLE_EAT_2)(113, s) SEQAN_PP_IF(p(113, s), SEQAN_PP_FOR_113, SEQAN_PP_TUPLE_EAT_4)(o(113, s), p, o, m) -# define SEQAN_PP_FOR_113(s, p, o, m) SEQAN_PP_IF(p(114, s), m, SEQAN_PP_TUPLE_EAT_2)(114, s) SEQAN_PP_IF(p(114, s), SEQAN_PP_FOR_114, SEQAN_PP_TUPLE_EAT_4)(o(114, s), p, o, m) -# define SEQAN_PP_FOR_114(s, p, o, m) SEQAN_PP_IF(p(115, s), m, SEQAN_PP_TUPLE_EAT_2)(115, s) SEQAN_PP_IF(p(115, s), SEQAN_PP_FOR_115, SEQAN_PP_TUPLE_EAT_4)(o(115, s), p, o, m) -# define SEQAN_PP_FOR_115(s, p, o, m) SEQAN_PP_IF(p(116, s), m, SEQAN_PP_TUPLE_EAT_2)(116, s) SEQAN_PP_IF(p(116, s), SEQAN_PP_FOR_116, SEQAN_PP_TUPLE_EAT_4)(o(116, s), p, o, m) -# define SEQAN_PP_FOR_116(s, p, o, m) SEQAN_PP_IF(p(117, s), m, SEQAN_PP_TUPLE_EAT_2)(117, s) SEQAN_PP_IF(p(117, s), SEQAN_PP_FOR_117, SEQAN_PP_TUPLE_EAT_4)(o(117, s), p, o, m) -# define SEQAN_PP_FOR_117(s, p, o, m) SEQAN_PP_IF(p(118, s), m, SEQAN_PP_TUPLE_EAT_2)(118, s) SEQAN_PP_IF(p(118, s), SEQAN_PP_FOR_118, SEQAN_PP_TUPLE_EAT_4)(o(118, s), p, o, m) -# define SEQAN_PP_FOR_118(s, p, o, m) SEQAN_PP_IF(p(119, s), m, SEQAN_PP_TUPLE_EAT_2)(119, s) SEQAN_PP_IF(p(119, s), SEQAN_PP_FOR_119, SEQAN_PP_TUPLE_EAT_4)(o(119, s), p, o, m) -# define SEQAN_PP_FOR_119(s, p, o, m) SEQAN_PP_IF(p(120, s), m, SEQAN_PP_TUPLE_EAT_2)(120, s) SEQAN_PP_IF(p(120, s), SEQAN_PP_FOR_120, SEQAN_PP_TUPLE_EAT_4)(o(120, s), p, o, m) -# define SEQAN_PP_FOR_120(s, p, o, m) SEQAN_PP_IF(p(121, s), m, SEQAN_PP_TUPLE_EAT_2)(121, s) SEQAN_PP_IF(p(121, s), SEQAN_PP_FOR_121, SEQAN_PP_TUPLE_EAT_4)(o(121, s), p, o, m) -# define SEQAN_PP_FOR_121(s, p, o, m) SEQAN_PP_IF(p(122, s), m, SEQAN_PP_TUPLE_EAT_2)(122, s) SEQAN_PP_IF(p(122, s), SEQAN_PP_FOR_122, SEQAN_PP_TUPLE_EAT_4)(o(122, s), p, o, m) -# define SEQAN_PP_FOR_122(s, p, o, m) SEQAN_PP_IF(p(123, s), m, SEQAN_PP_TUPLE_EAT_2)(123, s) SEQAN_PP_IF(p(123, s), SEQAN_PP_FOR_123, SEQAN_PP_TUPLE_EAT_4)(o(123, s), p, o, m) -# define SEQAN_PP_FOR_123(s, p, o, m) SEQAN_PP_IF(p(124, s), m, SEQAN_PP_TUPLE_EAT_2)(124, s) SEQAN_PP_IF(p(124, s), SEQAN_PP_FOR_124, SEQAN_PP_TUPLE_EAT_4)(o(124, s), p, o, m) -# define SEQAN_PP_FOR_124(s, p, o, m) SEQAN_PP_IF(p(125, s), m, SEQAN_PP_TUPLE_EAT_2)(125, s) SEQAN_PP_IF(p(125, s), SEQAN_PP_FOR_125, SEQAN_PP_TUPLE_EAT_4)(o(125, s), p, o, m) -# define SEQAN_PP_FOR_125(s, p, o, m) SEQAN_PP_IF(p(126, s), m, SEQAN_PP_TUPLE_EAT_2)(126, s) SEQAN_PP_IF(p(126, s), SEQAN_PP_FOR_126, SEQAN_PP_TUPLE_EAT_4)(o(126, s), p, o, m) -# define SEQAN_PP_FOR_126(s, p, o, m) SEQAN_PP_IF(p(127, s), m, SEQAN_PP_TUPLE_EAT_2)(127, s) SEQAN_PP_IF(p(127, s), SEQAN_PP_FOR_127, SEQAN_PP_TUPLE_EAT_4)(o(127, s), p, o, m) -# define SEQAN_PP_FOR_127(s, p, o, m) SEQAN_PP_IF(p(128, s), m, SEQAN_PP_TUPLE_EAT_2)(128, s) SEQAN_PP_IF(p(128, s), SEQAN_PP_FOR_128, SEQAN_PP_TUPLE_EAT_4)(o(128, s), p, o, m) -# define SEQAN_PP_FOR_128(s, p, o, m) SEQAN_PP_IF(p(129, s), m, SEQAN_PP_TUPLE_EAT_2)(129, s) SEQAN_PP_IF(p(129, s), SEQAN_PP_FOR_129, SEQAN_PP_TUPLE_EAT_4)(o(129, s), p, o, m) -# define SEQAN_PP_FOR_129(s, p, o, m) SEQAN_PP_IF(p(130, s), m, SEQAN_PP_TUPLE_EAT_2)(130, s) SEQAN_PP_IF(p(130, s), SEQAN_PP_FOR_130, SEQAN_PP_TUPLE_EAT_4)(o(130, s), p, o, m) -# define SEQAN_PP_FOR_130(s, p, o, m) SEQAN_PP_IF(p(131, s), m, SEQAN_PP_TUPLE_EAT_2)(131, s) SEQAN_PP_IF(p(131, s), SEQAN_PP_FOR_131, SEQAN_PP_TUPLE_EAT_4)(o(131, s), p, o, m) -# define SEQAN_PP_FOR_131(s, p, o, m) SEQAN_PP_IF(p(132, s), m, SEQAN_PP_TUPLE_EAT_2)(132, s) SEQAN_PP_IF(p(132, s), SEQAN_PP_FOR_132, SEQAN_PP_TUPLE_EAT_4)(o(132, s), p, o, m) -# define SEQAN_PP_FOR_132(s, p, o, m) SEQAN_PP_IF(p(133, s), m, SEQAN_PP_TUPLE_EAT_2)(133, s) SEQAN_PP_IF(p(133, s), SEQAN_PP_FOR_133, SEQAN_PP_TUPLE_EAT_4)(o(133, s), p, o, m) -# define SEQAN_PP_FOR_133(s, p, o, m) SEQAN_PP_IF(p(134, s), m, SEQAN_PP_TUPLE_EAT_2)(134, s) SEQAN_PP_IF(p(134, s), SEQAN_PP_FOR_134, SEQAN_PP_TUPLE_EAT_4)(o(134, s), p, o, m) -# define SEQAN_PP_FOR_134(s, p, o, m) SEQAN_PP_IF(p(135, s), m, SEQAN_PP_TUPLE_EAT_2)(135, s) SEQAN_PP_IF(p(135, s), SEQAN_PP_FOR_135, SEQAN_PP_TUPLE_EAT_4)(o(135, s), p, o, m) -# define SEQAN_PP_FOR_135(s, p, o, m) SEQAN_PP_IF(p(136, s), m, SEQAN_PP_TUPLE_EAT_2)(136, s) SEQAN_PP_IF(p(136, s), SEQAN_PP_FOR_136, SEQAN_PP_TUPLE_EAT_4)(o(136, s), p, o, m) -# define SEQAN_PP_FOR_136(s, p, o, m) SEQAN_PP_IF(p(137, s), m, SEQAN_PP_TUPLE_EAT_2)(137, s) SEQAN_PP_IF(p(137, s), SEQAN_PP_FOR_137, SEQAN_PP_TUPLE_EAT_4)(o(137, s), p, o, m) -# define SEQAN_PP_FOR_137(s, p, o, m) SEQAN_PP_IF(p(138, s), m, SEQAN_PP_TUPLE_EAT_2)(138, s) SEQAN_PP_IF(p(138, s), SEQAN_PP_FOR_138, SEQAN_PP_TUPLE_EAT_4)(o(138, s), p, o, m) -# define SEQAN_PP_FOR_138(s, p, o, m) SEQAN_PP_IF(p(139, s), m, SEQAN_PP_TUPLE_EAT_2)(139, s) SEQAN_PP_IF(p(139, s), SEQAN_PP_FOR_139, SEQAN_PP_TUPLE_EAT_4)(o(139, s), p, o, m) -# define SEQAN_PP_FOR_139(s, p, o, m) SEQAN_PP_IF(p(140, s), m, SEQAN_PP_TUPLE_EAT_2)(140, s) SEQAN_PP_IF(p(140, s), SEQAN_PP_FOR_140, SEQAN_PP_TUPLE_EAT_4)(o(140, s), p, o, m) -# define SEQAN_PP_FOR_140(s, p, o, m) SEQAN_PP_IF(p(141, s), m, SEQAN_PP_TUPLE_EAT_2)(141, s) SEQAN_PP_IF(p(141, s), SEQAN_PP_FOR_141, SEQAN_PP_TUPLE_EAT_4)(o(141, s), p, o, m) -# define SEQAN_PP_FOR_141(s, p, o, m) SEQAN_PP_IF(p(142, s), m, SEQAN_PP_TUPLE_EAT_2)(142, s) SEQAN_PP_IF(p(142, s), SEQAN_PP_FOR_142, SEQAN_PP_TUPLE_EAT_4)(o(142, s), p, o, m) -# define SEQAN_PP_FOR_142(s, p, o, m) SEQAN_PP_IF(p(143, s), m, SEQAN_PP_TUPLE_EAT_2)(143, s) SEQAN_PP_IF(p(143, s), SEQAN_PP_FOR_143, SEQAN_PP_TUPLE_EAT_4)(o(143, s), p, o, m) -# define SEQAN_PP_FOR_143(s, p, o, m) SEQAN_PP_IF(p(144, s), m, SEQAN_PP_TUPLE_EAT_2)(144, s) SEQAN_PP_IF(p(144, s), SEQAN_PP_FOR_144, SEQAN_PP_TUPLE_EAT_4)(o(144, s), p, o, m) -# define SEQAN_PP_FOR_144(s, p, o, m) SEQAN_PP_IF(p(145, s), m, SEQAN_PP_TUPLE_EAT_2)(145, s) SEQAN_PP_IF(p(145, s), SEQAN_PP_FOR_145, SEQAN_PP_TUPLE_EAT_4)(o(145, s), p, o, m) -# define SEQAN_PP_FOR_145(s, p, o, m) SEQAN_PP_IF(p(146, s), m, SEQAN_PP_TUPLE_EAT_2)(146, s) SEQAN_PP_IF(p(146, s), SEQAN_PP_FOR_146, SEQAN_PP_TUPLE_EAT_4)(o(146, s), p, o, m) -# define SEQAN_PP_FOR_146(s, p, o, m) SEQAN_PP_IF(p(147, s), m, SEQAN_PP_TUPLE_EAT_2)(147, s) SEQAN_PP_IF(p(147, s), SEQAN_PP_FOR_147, SEQAN_PP_TUPLE_EAT_4)(o(147, s), p, o, m) -# define SEQAN_PP_FOR_147(s, p, o, m) SEQAN_PP_IF(p(148, s), m, SEQAN_PP_TUPLE_EAT_2)(148, s) SEQAN_PP_IF(p(148, s), SEQAN_PP_FOR_148, SEQAN_PP_TUPLE_EAT_4)(o(148, s), p, o, m) -# define SEQAN_PP_FOR_148(s, p, o, m) SEQAN_PP_IF(p(149, s), m, SEQAN_PP_TUPLE_EAT_2)(149, s) SEQAN_PP_IF(p(149, s), SEQAN_PP_FOR_149, SEQAN_PP_TUPLE_EAT_4)(o(149, s), p, o, m) -# define SEQAN_PP_FOR_149(s, p, o, m) SEQAN_PP_IF(p(150, s), m, SEQAN_PP_TUPLE_EAT_2)(150, s) SEQAN_PP_IF(p(150, s), SEQAN_PP_FOR_150, SEQAN_PP_TUPLE_EAT_4)(o(150, s), p, o, m) -# define SEQAN_PP_FOR_150(s, p, o, m) SEQAN_PP_IF(p(151, s), m, SEQAN_PP_TUPLE_EAT_2)(151, s) SEQAN_PP_IF(p(151, s), SEQAN_PP_FOR_151, SEQAN_PP_TUPLE_EAT_4)(o(151, s), p, o, m) -# define SEQAN_PP_FOR_151(s, p, o, m) SEQAN_PP_IF(p(152, s), m, SEQAN_PP_TUPLE_EAT_2)(152, s) SEQAN_PP_IF(p(152, s), SEQAN_PP_FOR_152, SEQAN_PP_TUPLE_EAT_4)(o(152, s), p, o, m) -# define SEQAN_PP_FOR_152(s, p, o, m) SEQAN_PP_IF(p(153, s), m, SEQAN_PP_TUPLE_EAT_2)(153, s) SEQAN_PP_IF(p(153, s), SEQAN_PP_FOR_153, SEQAN_PP_TUPLE_EAT_4)(o(153, s), p, o, m) -# define SEQAN_PP_FOR_153(s, p, o, m) SEQAN_PP_IF(p(154, s), m, SEQAN_PP_TUPLE_EAT_2)(154, s) SEQAN_PP_IF(p(154, s), SEQAN_PP_FOR_154, SEQAN_PP_TUPLE_EAT_4)(o(154, s), p, o, m) -# define SEQAN_PP_FOR_154(s, p, o, m) SEQAN_PP_IF(p(155, s), m, SEQAN_PP_TUPLE_EAT_2)(155, s) SEQAN_PP_IF(p(155, s), SEQAN_PP_FOR_155, SEQAN_PP_TUPLE_EAT_4)(o(155, s), p, o, m) -# define SEQAN_PP_FOR_155(s, p, o, m) SEQAN_PP_IF(p(156, s), m, SEQAN_PP_TUPLE_EAT_2)(156, s) SEQAN_PP_IF(p(156, s), SEQAN_PP_FOR_156, SEQAN_PP_TUPLE_EAT_4)(o(156, s), p, o, m) -# define SEQAN_PP_FOR_156(s, p, o, m) SEQAN_PP_IF(p(157, s), m, SEQAN_PP_TUPLE_EAT_2)(157, s) SEQAN_PP_IF(p(157, s), SEQAN_PP_FOR_157, SEQAN_PP_TUPLE_EAT_4)(o(157, s), p, o, m) -# define SEQAN_PP_FOR_157(s, p, o, m) SEQAN_PP_IF(p(158, s), m, SEQAN_PP_TUPLE_EAT_2)(158, s) SEQAN_PP_IF(p(158, s), SEQAN_PP_FOR_158, SEQAN_PP_TUPLE_EAT_4)(o(158, s), p, o, m) -# define SEQAN_PP_FOR_158(s, p, o, m) SEQAN_PP_IF(p(159, s), m, SEQAN_PP_TUPLE_EAT_2)(159, s) SEQAN_PP_IF(p(159, s), SEQAN_PP_FOR_159, SEQAN_PP_TUPLE_EAT_4)(o(159, s), p, o, m) -# define SEQAN_PP_FOR_159(s, p, o, m) SEQAN_PP_IF(p(160, s), m, SEQAN_PP_TUPLE_EAT_2)(160, s) SEQAN_PP_IF(p(160, s), SEQAN_PP_FOR_160, SEQAN_PP_TUPLE_EAT_4)(o(160, s), p, o, m) -# define SEQAN_PP_FOR_160(s, p, o, m) SEQAN_PP_IF(p(161, s), m, SEQAN_PP_TUPLE_EAT_2)(161, s) SEQAN_PP_IF(p(161, s), SEQAN_PP_FOR_161, SEQAN_PP_TUPLE_EAT_4)(o(161, s), p, o, m) -# define SEQAN_PP_FOR_161(s, p, o, m) SEQAN_PP_IF(p(162, s), m, SEQAN_PP_TUPLE_EAT_2)(162, s) SEQAN_PP_IF(p(162, s), SEQAN_PP_FOR_162, SEQAN_PP_TUPLE_EAT_4)(o(162, s), p, o, m) -# define SEQAN_PP_FOR_162(s, p, o, m) SEQAN_PP_IF(p(163, s), m, SEQAN_PP_TUPLE_EAT_2)(163, s) SEQAN_PP_IF(p(163, s), SEQAN_PP_FOR_163, SEQAN_PP_TUPLE_EAT_4)(o(163, s), p, o, m) -# define SEQAN_PP_FOR_163(s, p, o, m) SEQAN_PP_IF(p(164, s), m, SEQAN_PP_TUPLE_EAT_2)(164, s) SEQAN_PP_IF(p(164, s), SEQAN_PP_FOR_164, SEQAN_PP_TUPLE_EAT_4)(o(164, s), p, o, m) -# define SEQAN_PP_FOR_164(s, p, o, m) SEQAN_PP_IF(p(165, s), m, SEQAN_PP_TUPLE_EAT_2)(165, s) SEQAN_PP_IF(p(165, s), SEQAN_PP_FOR_165, SEQAN_PP_TUPLE_EAT_4)(o(165, s), p, o, m) -# define SEQAN_PP_FOR_165(s, p, o, m) SEQAN_PP_IF(p(166, s), m, SEQAN_PP_TUPLE_EAT_2)(166, s) SEQAN_PP_IF(p(166, s), SEQAN_PP_FOR_166, SEQAN_PP_TUPLE_EAT_4)(o(166, s), p, o, m) -# define SEQAN_PP_FOR_166(s, p, o, m) SEQAN_PP_IF(p(167, s), m, SEQAN_PP_TUPLE_EAT_2)(167, s) SEQAN_PP_IF(p(167, s), SEQAN_PP_FOR_167, SEQAN_PP_TUPLE_EAT_4)(o(167, s), p, o, m) -# define SEQAN_PP_FOR_167(s, p, o, m) SEQAN_PP_IF(p(168, s), m, SEQAN_PP_TUPLE_EAT_2)(168, s) SEQAN_PP_IF(p(168, s), SEQAN_PP_FOR_168, SEQAN_PP_TUPLE_EAT_4)(o(168, s), p, o, m) -# define SEQAN_PP_FOR_168(s, p, o, m) SEQAN_PP_IF(p(169, s), m, SEQAN_PP_TUPLE_EAT_2)(169, s) SEQAN_PP_IF(p(169, s), SEQAN_PP_FOR_169, SEQAN_PP_TUPLE_EAT_4)(o(169, s), p, o, m) -# define SEQAN_PP_FOR_169(s, p, o, m) SEQAN_PP_IF(p(170, s), m, SEQAN_PP_TUPLE_EAT_2)(170, s) SEQAN_PP_IF(p(170, s), SEQAN_PP_FOR_170, SEQAN_PP_TUPLE_EAT_4)(o(170, s), p, o, m) -# define SEQAN_PP_FOR_170(s, p, o, m) SEQAN_PP_IF(p(171, s), m, SEQAN_PP_TUPLE_EAT_2)(171, s) SEQAN_PP_IF(p(171, s), SEQAN_PP_FOR_171, SEQAN_PP_TUPLE_EAT_4)(o(171, s), p, o, m) -# define SEQAN_PP_FOR_171(s, p, o, m) SEQAN_PP_IF(p(172, s), m, SEQAN_PP_TUPLE_EAT_2)(172, s) SEQAN_PP_IF(p(172, s), SEQAN_PP_FOR_172, SEQAN_PP_TUPLE_EAT_4)(o(172, s), p, o, m) -# define SEQAN_PP_FOR_172(s, p, o, m) SEQAN_PP_IF(p(173, s), m, SEQAN_PP_TUPLE_EAT_2)(173, s) SEQAN_PP_IF(p(173, s), SEQAN_PP_FOR_173, SEQAN_PP_TUPLE_EAT_4)(o(173, s), p, o, m) -# define SEQAN_PP_FOR_173(s, p, o, m) SEQAN_PP_IF(p(174, s), m, SEQAN_PP_TUPLE_EAT_2)(174, s) SEQAN_PP_IF(p(174, s), SEQAN_PP_FOR_174, SEQAN_PP_TUPLE_EAT_4)(o(174, s), p, o, m) -# define SEQAN_PP_FOR_174(s, p, o, m) SEQAN_PP_IF(p(175, s), m, SEQAN_PP_TUPLE_EAT_2)(175, s) SEQAN_PP_IF(p(175, s), SEQAN_PP_FOR_175, SEQAN_PP_TUPLE_EAT_4)(o(175, s), p, o, m) -# define SEQAN_PP_FOR_175(s, p, o, m) SEQAN_PP_IF(p(176, s), m, SEQAN_PP_TUPLE_EAT_2)(176, s) SEQAN_PP_IF(p(176, s), SEQAN_PP_FOR_176, SEQAN_PP_TUPLE_EAT_4)(o(176, s), p, o, m) -# define SEQAN_PP_FOR_176(s, p, o, m) SEQAN_PP_IF(p(177, s), m, SEQAN_PP_TUPLE_EAT_2)(177, s) SEQAN_PP_IF(p(177, s), SEQAN_PP_FOR_177, SEQAN_PP_TUPLE_EAT_4)(o(177, s), p, o, m) -# define SEQAN_PP_FOR_177(s, p, o, m) SEQAN_PP_IF(p(178, s), m, SEQAN_PP_TUPLE_EAT_2)(178, s) SEQAN_PP_IF(p(178, s), SEQAN_PP_FOR_178, SEQAN_PP_TUPLE_EAT_4)(o(178, s), p, o, m) -# define SEQAN_PP_FOR_178(s, p, o, m) SEQAN_PP_IF(p(179, s), m, SEQAN_PP_TUPLE_EAT_2)(179, s) SEQAN_PP_IF(p(179, s), SEQAN_PP_FOR_179, SEQAN_PP_TUPLE_EAT_4)(o(179, s), p, o, m) -# define SEQAN_PP_FOR_179(s, p, o, m) SEQAN_PP_IF(p(180, s), m, SEQAN_PP_TUPLE_EAT_2)(180, s) SEQAN_PP_IF(p(180, s), SEQAN_PP_FOR_180, SEQAN_PP_TUPLE_EAT_4)(o(180, s), p, o, m) -# define SEQAN_PP_FOR_180(s, p, o, m) SEQAN_PP_IF(p(181, s), m, SEQAN_PP_TUPLE_EAT_2)(181, s) SEQAN_PP_IF(p(181, s), SEQAN_PP_FOR_181, SEQAN_PP_TUPLE_EAT_4)(o(181, s), p, o, m) -# define SEQAN_PP_FOR_181(s, p, o, m) SEQAN_PP_IF(p(182, s), m, SEQAN_PP_TUPLE_EAT_2)(182, s) SEQAN_PP_IF(p(182, s), SEQAN_PP_FOR_182, SEQAN_PP_TUPLE_EAT_4)(o(182, s), p, o, m) -# define SEQAN_PP_FOR_182(s, p, o, m) SEQAN_PP_IF(p(183, s), m, SEQAN_PP_TUPLE_EAT_2)(183, s) SEQAN_PP_IF(p(183, s), SEQAN_PP_FOR_183, SEQAN_PP_TUPLE_EAT_4)(o(183, s), p, o, m) -# define SEQAN_PP_FOR_183(s, p, o, m) SEQAN_PP_IF(p(184, s), m, SEQAN_PP_TUPLE_EAT_2)(184, s) SEQAN_PP_IF(p(184, s), SEQAN_PP_FOR_184, SEQAN_PP_TUPLE_EAT_4)(o(184, s), p, o, m) -# define SEQAN_PP_FOR_184(s, p, o, m) SEQAN_PP_IF(p(185, s), m, SEQAN_PP_TUPLE_EAT_2)(185, s) SEQAN_PP_IF(p(185, s), SEQAN_PP_FOR_185, SEQAN_PP_TUPLE_EAT_4)(o(185, s), p, o, m) -# define SEQAN_PP_FOR_185(s, p, o, m) SEQAN_PP_IF(p(186, s), m, SEQAN_PP_TUPLE_EAT_2)(186, s) SEQAN_PP_IF(p(186, s), SEQAN_PP_FOR_186, SEQAN_PP_TUPLE_EAT_4)(o(186, s), p, o, m) -# define SEQAN_PP_FOR_186(s, p, o, m) SEQAN_PP_IF(p(187, s), m, SEQAN_PP_TUPLE_EAT_2)(187, s) SEQAN_PP_IF(p(187, s), SEQAN_PP_FOR_187, SEQAN_PP_TUPLE_EAT_4)(o(187, s), p, o, m) -# define SEQAN_PP_FOR_187(s, p, o, m) SEQAN_PP_IF(p(188, s), m, SEQAN_PP_TUPLE_EAT_2)(188, s) SEQAN_PP_IF(p(188, s), SEQAN_PP_FOR_188, SEQAN_PP_TUPLE_EAT_4)(o(188, s), p, o, m) -# define SEQAN_PP_FOR_188(s, p, o, m) SEQAN_PP_IF(p(189, s), m, SEQAN_PP_TUPLE_EAT_2)(189, s) SEQAN_PP_IF(p(189, s), SEQAN_PP_FOR_189, SEQAN_PP_TUPLE_EAT_4)(o(189, s), p, o, m) -# define SEQAN_PP_FOR_189(s, p, o, m) SEQAN_PP_IF(p(190, s), m, SEQAN_PP_TUPLE_EAT_2)(190, s) SEQAN_PP_IF(p(190, s), SEQAN_PP_FOR_190, SEQAN_PP_TUPLE_EAT_4)(o(190, s), p, o, m) -# define SEQAN_PP_FOR_190(s, p, o, m) SEQAN_PP_IF(p(191, s), m, SEQAN_PP_TUPLE_EAT_2)(191, s) SEQAN_PP_IF(p(191, s), SEQAN_PP_FOR_191, SEQAN_PP_TUPLE_EAT_4)(o(191, s), p, o, m) -# define SEQAN_PP_FOR_191(s, p, o, m) SEQAN_PP_IF(p(192, s), m, SEQAN_PP_TUPLE_EAT_2)(192, s) SEQAN_PP_IF(p(192, s), SEQAN_PP_FOR_192, SEQAN_PP_TUPLE_EAT_4)(o(192, s), p, o, m) -# define SEQAN_PP_FOR_192(s, p, o, m) SEQAN_PP_IF(p(193, s), m, SEQAN_PP_TUPLE_EAT_2)(193, s) SEQAN_PP_IF(p(193, s), SEQAN_PP_FOR_193, SEQAN_PP_TUPLE_EAT_4)(o(193, s), p, o, m) -# define SEQAN_PP_FOR_193(s, p, o, m) SEQAN_PP_IF(p(194, s), m, SEQAN_PP_TUPLE_EAT_2)(194, s) SEQAN_PP_IF(p(194, s), SEQAN_PP_FOR_194, SEQAN_PP_TUPLE_EAT_4)(o(194, s), p, o, m) -# define SEQAN_PP_FOR_194(s, p, o, m) SEQAN_PP_IF(p(195, s), m, SEQAN_PP_TUPLE_EAT_2)(195, s) SEQAN_PP_IF(p(195, s), SEQAN_PP_FOR_195, SEQAN_PP_TUPLE_EAT_4)(o(195, s), p, o, m) -# define SEQAN_PP_FOR_195(s, p, o, m) SEQAN_PP_IF(p(196, s), m, SEQAN_PP_TUPLE_EAT_2)(196, s) SEQAN_PP_IF(p(196, s), SEQAN_PP_FOR_196, SEQAN_PP_TUPLE_EAT_4)(o(196, s), p, o, m) -# define SEQAN_PP_FOR_196(s, p, o, m) SEQAN_PP_IF(p(197, s), m, SEQAN_PP_TUPLE_EAT_2)(197, s) SEQAN_PP_IF(p(197, s), SEQAN_PP_FOR_197, SEQAN_PP_TUPLE_EAT_4)(o(197, s), p, o, m) -# define SEQAN_PP_FOR_197(s, p, o, m) SEQAN_PP_IF(p(198, s), m, SEQAN_PP_TUPLE_EAT_2)(198, s) SEQAN_PP_IF(p(198, s), SEQAN_PP_FOR_198, SEQAN_PP_TUPLE_EAT_4)(o(198, s), p, o, m) -# define SEQAN_PP_FOR_198(s, p, o, m) SEQAN_PP_IF(p(199, s), m, SEQAN_PP_TUPLE_EAT_2)(199, s) SEQAN_PP_IF(p(199, s), SEQAN_PP_FOR_199, SEQAN_PP_TUPLE_EAT_4)(o(199, s), p, o, m) -# define SEQAN_PP_FOR_199(s, p, o, m) SEQAN_PP_IF(p(200, s), m, SEQAN_PP_TUPLE_EAT_2)(200, s) SEQAN_PP_IF(p(200, s), SEQAN_PP_FOR_200, SEQAN_PP_TUPLE_EAT_4)(o(200, s), p, o, m) -# define SEQAN_PP_FOR_200(s, p, o, m) SEQAN_PP_IF(p(201, s), m, SEQAN_PP_TUPLE_EAT_2)(201, s) SEQAN_PP_IF(p(201, s), SEQAN_PP_FOR_201, SEQAN_PP_TUPLE_EAT_4)(o(201, s), p, o, m) -# define SEQAN_PP_FOR_201(s, p, o, m) SEQAN_PP_IF(p(202, s), m, SEQAN_PP_TUPLE_EAT_2)(202, s) SEQAN_PP_IF(p(202, s), SEQAN_PP_FOR_202, SEQAN_PP_TUPLE_EAT_4)(o(202, s), p, o, m) -# define SEQAN_PP_FOR_202(s, p, o, m) SEQAN_PP_IF(p(203, s), m, SEQAN_PP_TUPLE_EAT_2)(203, s) SEQAN_PP_IF(p(203, s), SEQAN_PP_FOR_203, SEQAN_PP_TUPLE_EAT_4)(o(203, s), p, o, m) -# define SEQAN_PP_FOR_203(s, p, o, m) SEQAN_PP_IF(p(204, s), m, SEQAN_PP_TUPLE_EAT_2)(204, s) SEQAN_PP_IF(p(204, s), SEQAN_PP_FOR_204, SEQAN_PP_TUPLE_EAT_4)(o(204, s), p, o, m) -# define SEQAN_PP_FOR_204(s, p, o, m) SEQAN_PP_IF(p(205, s), m, SEQAN_PP_TUPLE_EAT_2)(205, s) SEQAN_PP_IF(p(205, s), SEQAN_PP_FOR_205, SEQAN_PP_TUPLE_EAT_4)(o(205, s), p, o, m) -# define SEQAN_PP_FOR_205(s, p, o, m) SEQAN_PP_IF(p(206, s), m, SEQAN_PP_TUPLE_EAT_2)(206, s) SEQAN_PP_IF(p(206, s), SEQAN_PP_FOR_206, SEQAN_PP_TUPLE_EAT_4)(o(206, s), p, o, m) -# define SEQAN_PP_FOR_206(s, p, o, m) SEQAN_PP_IF(p(207, s), m, SEQAN_PP_TUPLE_EAT_2)(207, s) SEQAN_PP_IF(p(207, s), SEQAN_PP_FOR_207, SEQAN_PP_TUPLE_EAT_4)(o(207, s), p, o, m) -# define SEQAN_PP_FOR_207(s, p, o, m) SEQAN_PP_IF(p(208, s), m, SEQAN_PP_TUPLE_EAT_2)(208, s) SEQAN_PP_IF(p(208, s), SEQAN_PP_FOR_208, SEQAN_PP_TUPLE_EAT_4)(o(208, s), p, o, m) -# define SEQAN_PP_FOR_208(s, p, o, m) SEQAN_PP_IF(p(209, s), m, SEQAN_PP_TUPLE_EAT_2)(209, s) SEQAN_PP_IF(p(209, s), SEQAN_PP_FOR_209, SEQAN_PP_TUPLE_EAT_4)(o(209, s), p, o, m) -# define SEQAN_PP_FOR_209(s, p, o, m) SEQAN_PP_IF(p(210, s), m, SEQAN_PP_TUPLE_EAT_2)(210, s) SEQAN_PP_IF(p(210, s), SEQAN_PP_FOR_210, SEQAN_PP_TUPLE_EAT_4)(o(210, s), p, o, m) -# define SEQAN_PP_FOR_210(s, p, o, m) SEQAN_PP_IF(p(211, s), m, SEQAN_PP_TUPLE_EAT_2)(211, s) SEQAN_PP_IF(p(211, s), SEQAN_PP_FOR_211, SEQAN_PP_TUPLE_EAT_4)(o(211, s), p, o, m) -# define SEQAN_PP_FOR_211(s, p, o, m) SEQAN_PP_IF(p(212, s), m, SEQAN_PP_TUPLE_EAT_2)(212, s) SEQAN_PP_IF(p(212, s), SEQAN_PP_FOR_212, SEQAN_PP_TUPLE_EAT_4)(o(212, s), p, o, m) -# define SEQAN_PP_FOR_212(s, p, o, m) SEQAN_PP_IF(p(213, s), m, SEQAN_PP_TUPLE_EAT_2)(213, s) SEQAN_PP_IF(p(213, s), SEQAN_PP_FOR_213, SEQAN_PP_TUPLE_EAT_4)(o(213, s), p, o, m) -# define SEQAN_PP_FOR_213(s, p, o, m) SEQAN_PP_IF(p(214, s), m, SEQAN_PP_TUPLE_EAT_2)(214, s) SEQAN_PP_IF(p(214, s), SEQAN_PP_FOR_214, SEQAN_PP_TUPLE_EAT_4)(o(214, s), p, o, m) -# define SEQAN_PP_FOR_214(s, p, o, m) SEQAN_PP_IF(p(215, s), m, SEQAN_PP_TUPLE_EAT_2)(215, s) SEQAN_PP_IF(p(215, s), SEQAN_PP_FOR_215, SEQAN_PP_TUPLE_EAT_4)(o(215, s), p, o, m) -# define SEQAN_PP_FOR_215(s, p, o, m) SEQAN_PP_IF(p(216, s), m, SEQAN_PP_TUPLE_EAT_2)(216, s) SEQAN_PP_IF(p(216, s), SEQAN_PP_FOR_216, SEQAN_PP_TUPLE_EAT_4)(o(216, s), p, o, m) -# define SEQAN_PP_FOR_216(s, p, o, m) SEQAN_PP_IF(p(217, s), m, SEQAN_PP_TUPLE_EAT_2)(217, s) SEQAN_PP_IF(p(217, s), SEQAN_PP_FOR_217, SEQAN_PP_TUPLE_EAT_4)(o(217, s), p, o, m) -# define SEQAN_PP_FOR_217(s, p, o, m) SEQAN_PP_IF(p(218, s), m, SEQAN_PP_TUPLE_EAT_2)(218, s) SEQAN_PP_IF(p(218, s), SEQAN_PP_FOR_218, SEQAN_PP_TUPLE_EAT_4)(o(218, s), p, o, m) -# define SEQAN_PP_FOR_218(s, p, o, m) SEQAN_PP_IF(p(219, s), m, SEQAN_PP_TUPLE_EAT_2)(219, s) SEQAN_PP_IF(p(219, s), SEQAN_PP_FOR_219, SEQAN_PP_TUPLE_EAT_4)(o(219, s), p, o, m) -# define SEQAN_PP_FOR_219(s, p, o, m) SEQAN_PP_IF(p(220, s), m, SEQAN_PP_TUPLE_EAT_2)(220, s) SEQAN_PP_IF(p(220, s), SEQAN_PP_FOR_220, SEQAN_PP_TUPLE_EAT_4)(o(220, s), p, o, m) -# define SEQAN_PP_FOR_220(s, p, o, m) SEQAN_PP_IF(p(221, s), m, SEQAN_PP_TUPLE_EAT_2)(221, s) SEQAN_PP_IF(p(221, s), SEQAN_PP_FOR_221, SEQAN_PP_TUPLE_EAT_4)(o(221, s), p, o, m) -# define SEQAN_PP_FOR_221(s, p, o, m) SEQAN_PP_IF(p(222, s), m, SEQAN_PP_TUPLE_EAT_2)(222, s) SEQAN_PP_IF(p(222, s), SEQAN_PP_FOR_222, SEQAN_PP_TUPLE_EAT_4)(o(222, s), p, o, m) -# define SEQAN_PP_FOR_222(s, p, o, m) SEQAN_PP_IF(p(223, s), m, SEQAN_PP_TUPLE_EAT_2)(223, s) SEQAN_PP_IF(p(223, s), SEQAN_PP_FOR_223, SEQAN_PP_TUPLE_EAT_4)(o(223, s), p, o, m) -# define SEQAN_PP_FOR_223(s, p, o, m) SEQAN_PP_IF(p(224, s), m, SEQAN_PP_TUPLE_EAT_2)(224, s) SEQAN_PP_IF(p(224, s), SEQAN_PP_FOR_224, SEQAN_PP_TUPLE_EAT_4)(o(224, s), p, o, m) -# define SEQAN_PP_FOR_224(s, p, o, m) SEQAN_PP_IF(p(225, s), m, SEQAN_PP_TUPLE_EAT_2)(225, s) SEQAN_PP_IF(p(225, s), SEQAN_PP_FOR_225, SEQAN_PP_TUPLE_EAT_4)(o(225, s), p, o, m) -# define SEQAN_PP_FOR_225(s, p, o, m) SEQAN_PP_IF(p(226, s), m, SEQAN_PP_TUPLE_EAT_2)(226, s) SEQAN_PP_IF(p(226, s), SEQAN_PP_FOR_226, SEQAN_PP_TUPLE_EAT_4)(o(226, s), p, o, m) -# define SEQAN_PP_FOR_226(s, p, o, m) SEQAN_PP_IF(p(227, s), m, SEQAN_PP_TUPLE_EAT_2)(227, s) SEQAN_PP_IF(p(227, s), SEQAN_PP_FOR_227, SEQAN_PP_TUPLE_EAT_4)(o(227, s), p, o, m) -# define SEQAN_PP_FOR_227(s, p, o, m) SEQAN_PP_IF(p(228, s), m, SEQAN_PP_TUPLE_EAT_2)(228, s) SEQAN_PP_IF(p(228, s), SEQAN_PP_FOR_228, SEQAN_PP_TUPLE_EAT_4)(o(228, s), p, o, m) -# define SEQAN_PP_FOR_228(s, p, o, m) SEQAN_PP_IF(p(229, s), m, SEQAN_PP_TUPLE_EAT_2)(229, s) SEQAN_PP_IF(p(229, s), SEQAN_PP_FOR_229, SEQAN_PP_TUPLE_EAT_4)(o(229, s), p, o, m) -# define SEQAN_PP_FOR_229(s, p, o, m) SEQAN_PP_IF(p(230, s), m, SEQAN_PP_TUPLE_EAT_2)(230, s) SEQAN_PP_IF(p(230, s), SEQAN_PP_FOR_230, SEQAN_PP_TUPLE_EAT_4)(o(230, s), p, o, m) -# define SEQAN_PP_FOR_230(s, p, o, m) SEQAN_PP_IF(p(231, s), m, SEQAN_PP_TUPLE_EAT_2)(231, s) SEQAN_PP_IF(p(231, s), SEQAN_PP_FOR_231, SEQAN_PP_TUPLE_EAT_4)(o(231, s), p, o, m) -# define SEQAN_PP_FOR_231(s, p, o, m) SEQAN_PP_IF(p(232, s), m, SEQAN_PP_TUPLE_EAT_2)(232, s) SEQAN_PP_IF(p(232, s), SEQAN_PP_FOR_232, SEQAN_PP_TUPLE_EAT_4)(o(232, s), p, o, m) -# define SEQAN_PP_FOR_232(s, p, o, m) SEQAN_PP_IF(p(233, s), m, SEQAN_PP_TUPLE_EAT_2)(233, s) SEQAN_PP_IF(p(233, s), SEQAN_PP_FOR_233, SEQAN_PP_TUPLE_EAT_4)(o(233, s), p, o, m) -# define SEQAN_PP_FOR_233(s, p, o, m) SEQAN_PP_IF(p(234, s), m, SEQAN_PP_TUPLE_EAT_2)(234, s) SEQAN_PP_IF(p(234, s), SEQAN_PP_FOR_234, SEQAN_PP_TUPLE_EAT_4)(o(234, s), p, o, m) -# define SEQAN_PP_FOR_234(s, p, o, m) SEQAN_PP_IF(p(235, s), m, SEQAN_PP_TUPLE_EAT_2)(235, s) SEQAN_PP_IF(p(235, s), SEQAN_PP_FOR_235, SEQAN_PP_TUPLE_EAT_4)(o(235, s), p, o, m) -# define SEQAN_PP_FOR_235(s, p, o, m) SEQAN_PP_IF(p(236, s), m, SEQAN_PP_TUPLE_EAT_2)(236, s) SEQAN_PP_IF(p(236, s), SEQAN_PP_FOR_236, SEQAN_PP_TUPLE_EAT_4)(o(236, s), p, o, m) -# define SEQAN_PP_FOR_236(s, p, o, m) SEQAN_PP_IF(p(237, s), m, SEQAN_PP_TUPLE_EAT_2)(237, s) SEQAN_PP_IF(p(237, s), SEQAN_PP_FOR_237, SEQAN_PP_TUPLE_EAT_4)(o(237, s), p, o, m) -# define SEQAN_PP_FOR_237(s, p, o, m) SEQAN_PP_IF(p(238, s), m, SEQAN_PP_TUPLE_EAT_2)(238, s) SEQAN_PP_IF(p(238, s), SEQAN_PP_FOR_238, SEQAN_PP_TUPLE_EAT_4)(o(238, s), p, o, m) -# define SEQAN_PP_FOR_238(s, p, o, m) SEQAN_PP_IF(p(239, s), m, SEQAN_PP_TUPLE_EAT_2)(239, s) SEQAN_PP_IF(p(239, s), SEQAN_PP_FOR_239, SEQAN_PP_TUPLE_EAT_4)(o(239, s), p, o, m) -# define SEQAN_PP_FOR_239(s, p, o, m) SEQAN_PP_IF(p(240, s), m, SEQAN_PP_TUPLE_EAT_2)(240, s) SEQAN_PP_IF(p(240, s), SEQAN_PP_FOR_240, SEQAN_PP_TUPLE_EAT_4)(o(240, s), p, o, m) -# define SEQAN_PP_FOR_240(s, p, o, m) SEQAN_PP_IF(p(241, s), m, SEQAN_PP_TUPLE_EAT_2)(241, s) SEQAN_PP_IF(p(241, s), SEQAN_PP_FOR_241, SEQAN_PP_TUPLE_EAT_4)(o(241, s), p, o, m) -# define SEQAN_PP_FOR_241(s, p, o, m) SEQAN_PP_IF(p(242, s), m, SEQAN_PP_TUPLE_EAT_2)(242, s) SEQAN_PP_IF(p(242, s), SEQAN_PP_FOR_242, SEQAN_PP_TUPLE_EAT_4)(o(242, s), p, o, m) -# define SEQAN_PP_FOR_242(s, p, o, m) SEQAN_PP_IF(p(243, s), m, SEQAN_PP_TUPLE_EAT_2)(243, s) SEQAN_PP_IF(p(243, s), SEQAN_PP_FOR_243, SEQAN_PP_TUPLE_EAT_4)(o(243, s), p, o, m) -# define SEQAN_PP_FOR_243(s, p, o, m) SEQAN_PP_IF(p(244, s), m, SEQAN_PP_TUPLE_EAT_2)(244, s) SEQAN_PP_IF(p(244, s), SEQAN_PP_FOR_244, SEQAN_PP_TUPLE_EAT_4)(o(244, s), p, o, m) -# define SEQAN_PP_FOR_244(s, p, o, m) SEQAN_PP_IF(p(245, s), m, SEQAN_PP_TUPLE_EAT_2)(245, s) SEQAN_PP_IF(p(245, s), SEQAN_PP_FOR_245, SEQAN_PP_TUPLE_EAT_4)(o(245, s), p, o, m) -# define SEQAN_PP_FOR_245(s, p, o, m) SEQAN_PP_IF(p(246, s), m, SEQAN_PP_TUPLE_EAT_2)(246, s) SEQAN_PP_IF(p(246, s), SEQAN_PP_FOR_246, SEQAN_PP_TUPLE_EAT_4)(o(246, s), p, o, m) -# define SEQAN_PP_FOR_246(s, p, o, m) SEQAN_PP_IF(p(247, s), m, SEQAN_PP_TUPLE_EAT_2)(247, s) SEQAN_PP_IF(p(247, s), SEQAN_PP_FOR_247, SEQAN_PP_TUPLE_EAT_4)(o(247, s), p, o, m) -# define SEQAN_PP_FOR_247(s, p, o, m) SEQAN_PP_IF(p(248, s), m, SEQAN_PP_TUPLE_EAT_2)(248, s) SEQAN_PP_IF(p(248, s), SEQAN_PP_FOR_248, SEQAN_PP_TUPLE_EAT_4)(o(248, s), p, o, m) -# define SEQAN_PP_FOR_248(s, p, o, m) SEQAN_PP_IF(p(249, s), m, SEQAN_PP_TUPLE_EAT_2)(249, s) SEQAN_PP_IF(p(249, s), SEQAN_PP_FOR_249, SEQAN_PP_TUPLE_EAT_4)(o(249, s), p, o, m) -# define SEQAN_PP_FOR_249(s, p, o, m) SEQAN_PP_IF(p(250, s), m, SEQAN_PP_TUPLE_EAT_2)(250, s) SEQAN_PP_IF(p(250, s), SEQAN_PP_FOR_250, SEQAN_PP_TUPLE_EAT_4)(o(250, s), p, o, m) -# define SEQAN_PP_FOR_250(s, p, o, m) SEQAN_PP_IF(p(251, s), m, SEQAN_PP_TUPLE_EAT_2)(251, s) SEQAN_PP_IF(p(251, s), SEQAN_PP_FOR_251, SEQAN_PP_TUPLE_EAT_4)(o(251, s), p, o, m) -# define SEQAN_PP_FOR_251(s, p, o, m) SEQAN_PP_IF(p(252, s), m, SEQAN_PP_TUPLE_EAT_2)(252, s) SEQAN_PP_IF(p(252, s), SEQAN_PP_FOR_252, SEQAN_PP_TUPLE_EAT_4)(o(252, s), p, o, m) -# define SEQAN_PP_FOR_252(s, p, o, m) SEQAN_PP_IF(p(253, s), m, SEQAN_PP_TUPLE_EAT_2)(253, s) SEQAN_PP_IF(p(253, s), SEQAN_PP_FOR_253, SEQAN_PP_TUPLE_EAT_4)(o(253, s), p, o, m) -# define SEQAN_PP_FOR_253(s, p, o, m) SEQAN_PP_IF(p(254, s), m, SEQAN_PP_TUPLE_EAT_2)(254, s) SEQAN_PP_IF(p(254, s), SEQAN_PP_FOR_254, SEQAN_PP_TUPLE_EAT_4)(o(254, s), p, o, m) -# define SEQAN_PP_FOR_254(s, p, o, m) SEQAN_PP_IF(p(255, s), m, SEQAN_PP_TUPLE_EAT_2)(255, s) SEQAN_PP_IF(p(255, s), SEQAN_PP_FOR_255, SEQAN_PP_TUPLE_EAT_4)(o(255, s), p, o, m) -# define SEQAN_PP_FOR_255(s, p, o, m) SEQAN_PP_IF(p(256, s), m, SEQAN_PP_TUPLE_EAT_2)(256, s) SEQAN_PP_IF(p(256, s), SEQAN_PP_FOR_256, SEQAN_PP_TUPLE_EAT_4)(o(256, s), p, o, m) -# define SEQAN_PP_FOR_256(s, p, o, m) SEQAN_PP_IF(p(257, s), m, SEQAN_PP_TUPLE_EAT_2)(257, s) SEQAN_PP_IF(p(257, s), SEQAN_PP_FOR_257, SEQAN_PP_TUPLE_EAT_4)(o(257, s), p, o, m) -# -// # endif - -#else // #ifdef SEQAN_PLATFORM_WINDOWS_VS - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/repetition/detail/for.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_REPETITION_DETAIL_FOR_HPP -// # define SEQAN_PREPROCESSOR_REPETITION_DETAIL_FOR_HPP -// # -// # include -// # include -// # include -// # include -# -# define SEQAN_PP_FOR_1(s, p, o, m) SEQAN_PP_FOR_1_C(SEQAN_PP_BOOL(p(2, s)), s, p, o, m) -# define SEQAN_PP_FOR_2(s, p, o, m) SEQAN_PP_FOR_2_C(SEQAN_PP_BOOL(p(3, s)), s, p, o, m) -# define SEQAN_PP_FOR_3(s, p, o, m) SEQAN_PP_FOR_3_C(SEQAN_PP_BOOL(p(4, s)), s, p, o, m) -# define SEQAN_PP_FOR_4(s, p, o, m) SEQAN_PP_FOR_4_C(SEQAN_PP_BOOL(p(5, s)), s, p, o, m) -# define SEQAN_PP_FOR_5(s, p, o, m) SEQAN_PP_FOR_5_C(SEQAN_PP_BOOL(p(6, s)), s, p, o, m) -# define SEQAN_PP_FOR_6(s, p, o, m) SEQAN_PP_FOR_6_C(SEQAN_PP_BOOL(p(7, s)), s, p, o, m) -# define SEQAN_PP_FOR_7(s, p, o, m) SEQAN_PP_FOR_7_C(SEQAN_PP_BOOL(p(8, s)), s, p, o, m) -# define SEQAN_PP_FOR_8(s, p, o, m) SEQAN_PP_FOR_8_C(SEQAN_PP_BOOL(p(9, s)), s, p, o, m) -# define SEQAN_PP_FOR_9(s, p, o, m) SEQAN_PP_FOR_9_C(SEQAN_PP_BOOL(p(10, s)), s, p, o, m) -# define SEQAN_PP_FOR_10(s, p, o, m) SEQAN_PP_FOR_10_C(SEQAN_PP_BOOL(p(11, s)), s, p, o, m) -# define SEQAN_PP_FOR_11(s, p, o, m) SEQAN_PP_FOR_11_C(SEQAN_PP_BOOL(p(12, s)), s, p, o, m) -# define SEQAN_PP_FOR_12(s, p, o, m) SEQAN_PP_FOR_12_C(SEQAN_PP_BOOL(p(13, s)), s, p, o, m) -# define SEQAN_PP_FOR_13(s, p, o, m) SEQAN_PP_FOR_13_C(SEQAN_PP_BOOL(p(14, s)), s, p, o, m) -# define SEQAN_PP_FOR_14(s, p, o, m) SEQAN_PP_FOR_14_C(SEQAN_PP_BOOL(p(15, s)), s, p, o, m) -# define SEQAN_PP_FOR_15(s, p, o, m) SEQAN_PP_FOR_15_C(SEQAN_PP_BOOL(p(16, s)), s, p, o, m) -# define SEQAN_PP_FOR_16(s, p, o, m) SEQAN_PP_FOR_16_C(SEQAN_PP_BOOL(p(17, s)), s, p, o, m) -# define SEQAN_PP_FOR_17(s, p, o, m) SEQAN_PP_FOR_17_C(SEQAN_PP_BOOL(p(18, s)), s, p, o, m) -# define SEQAN_PP_FOR_18(s, p, o, m) SEQAN_PP_FOR_18_C(SEQAN_PP_BOOL(p(19, s)), s, p, o, m) -# define SEQAN_PP_FOR_19(s, p, o, m) SEQAN_PP_FOR_19_C(SEQAN_PP_BOOL(p(20, s)), s, p, o, m) -# define SEQAN_PP_FOR_20(s, p, o, m) SEQAN_PP_FOR_20_C(SEQAN_PP_BOOL(p(21, s)), s, p, o, m) -# define SEQAN_PP_FOR_21(s, p, o, m) SEQAN_PP_FOR_21_C(SEQAN_PP_BOOL(p(22, s)), s, p, o, m) -# define SEQAN_PP_FOR_22(s, p, o, m) SEQAN_PP_FOR_22_C(SEQAN_PP_BOOL(p(23, s)), s, p, o, m) -# define SEQAN_PP_FOR_23(s, p, o, m) SEQAN_PP_FOR_23_C(SEQAN_PP_BOOL(p(24, s)), s, p, o, m) -# define SEQAN_PP_FOR_24(s, p, o, m) SEQAN_PP_FOR_24_C(SEQAN_PP_BOOL(p(25, s)), s, p, o, m) -# define SEQAN_PP_FOR_25(s, p, o, m) SEQAN_PP_FOR_25_C(SEQAN_PP_BOOL(p(26, s)), s, p, o, m) -# define SEQAN_PP_FOR_26(s, p, o, m) SEQAN_PP_FOR_26_C(SEQAN_PP_BOOL(p(27, s)), s, p, o, m) -# define SEQAN_PP_FOR_27(s, p, o, m) SEQAN_PP_FOR_27_C(SEQAN_PP_BOOL(p(28, s)), s, p, o, m) -# define SEQAN_PP_FOR_28(s, p, o, m) SEQAN_PP_FOR_28_C(SEQAN_PP_BOOL(p(29, s)), s, p, o, m) -# define SEQAN_PP_FOR_29(s, p, o, m) SEQAN_PP_FOR_29_C(SEQAN_PP_BOOL(p(30, s)), s, p, o, m) -# define SEQAN_PP_FOR_30(s, p, o, m) SEQAN_PP_FOR_30_C(SEQAN_PP_BOOL(p(31, s)), s, p, o, m) -# define SEQAN_PP_FOR_31(s, p, o, m) SEQAN_PP_FOR_31_C(SEQAN_PP_BOOL(p(32, s)), s, p, o, m) -# define SEQAN_PP_FOR_32(s, p, o, m) SEQAN_PP_FOR_32_C(SEQAN_PP_BOOL(p(33, s)), s, p, o, m) -# define SEQAN_PP_FOR_33(s, p, o, m) SEQAN_PP_FOR_33_C(SEQAN_PP_BOOL(p(34, s)), s, p, o, m) -# define SEQAN_PP_FOR_34(s, p, o, m) SEQAN_PP_FOR_34_C(SEQAN_PP_BOOL(p(35, s)), s, p, o, m) -# define SEQAN_PP_FOR_35(s, p, o, m) SEQAN_PP_FOR_35_C(SEQAN_PP_BOOL(p(36, s)), s, p, o, m) -# define SEQAN_PP_FOR_36(s, p, o, m) SEQAN_PP_FOR_36_C(SEQAN_PP_BOOL(p(37, s)), s, p, o, m) -# define SEQAN_PP_FOR_37(s, p, o, m) SEQAN_PP_FOR_37_C(SEQAN_PP_BOOL(p(38, s)), s, p, o, m) -# define SEQAN_PP_FOR_38(s, p, o, m) SEQAN_PP_FOR_38_C(SEQAN_PP_BOOL(p(39, s)), s, p, o, m) -# define SEQAN_PP_FOR_39(s, p, o, m) SEQAN_PP_FOR_39_C(SEQAN_PP_BOOL(p(40, s)), s, p, o, m) -# define SEQAN_PP_FOR_40(s, p, o, m) SEQAN_PP_FOR_40_C(SEQAN_PP_BOOL(p(41, s)), s, p, o, m) -# define SEQAN_PP_FOR_41(s, p, o, m) SEQAN_PP_FOR_41_C(SEQAN_PP_BOOL(p(42, s)), s, p, o, m) -# define SEQAN_PP_FOR_42(s, p, o, m) SEQAN_PP_FOR_42_C(SEQAN_PP_BOOL(p(43, s)), s, p, o, m) -# define SEQAN_PP_FOR_43(s, p, o, m) SEQAN_PP_FOR_43_C(SEQAN_PP_BOOL(p(44, s)), s, p, o, m) -# define SEQAN_PP_FOR_44(s, p, o, m) SEQAN_PP_FOR_44_C(SEQAN_PP_BOOL(p(45, s)), s, p, o, m) -# define SEQAN_PP_FOR_45(s, p, o, m) SEQAN_PP_FOR_45_C(SEQAN_PP_BOOL(p(46, s)), s, p, o, m) -# define SEQAN_PP_FOR_46(s, p, o, m) SEQAN_PP_FOR_46_C(SEQAN_PP_BOOL(p(47, s)), s, p, o, m) -# define SEQAN_PP_FOR_47(s, p, o, m) SEQAN_PP_FOR_47_C(SEQAN_PP_BOOL(p(48, s)), s, p, o, m) -# define SEQAN_PP_FOR_48(s, p, o, m) SEQAN_PP_FOR_48_C(SEQAN_PP_BOOL(p(49, s)), s, p, o, m) -# define SEQAN_PP_FOR_49(s, p, o, m) SEQAN_PP_FOR_49_C(SEQAN_PP_BOOL(p(50, s)), s, p, o, m) -# define SEQAN_PP_FOR_50(s, p, o, m) SEQAN_PP_FOR_50_C(SEQAN_PP_BOOL(p(51, s)), s, p, o, m) -# define SEQAN_PP_FOR_51(s, p, o, m) SEQAN_PP_FOR_51_C(SEQAN_PP_BOOL(p(52, s)), s, p, o, m) -# define SEQAN_PP_FOR_52(s, p, o, m) SEQAN_PP_FOR_52_C(SEQAN_PP_BOOL(p(53, s)), s, p, o, m) -# define SEQAN_PP_FOR_53(s, p, o, m) SEQAN_PP_FOR_53_C(SEQAN_PP_BOOL(p(54, s)), s, p, o, m) -# define SEQAN_PP_FOR_54(s, p, o, m) SEQAN_PP_FOR_54_C(SEQAN_PP_BOOL(p(55, s)), s, p, o, m) -# define SEQAN_PP_FOR_55(s, p, o, m) SEQAN_PP_FOR_55_C(SEQAN_PP_BOOL(p(56, s)), s, p, o, m) -# define SEQAN_PP_FOR_56(s, p, o, m) SEQAN_PP_FOR_56_C(SEQAN_PP_BOOL(p(57, s)), s, p, o, m) -# define SEQAN_PP_FOR_57(s, p, o, m) SEQAN_PP_FOR_57_C(SEQAN_PP_BOOL(p(58, s)), s, p, o, m) -# define SEQAN_PP_FOR_58(s, p, o, m) SEQAN_PP_FOR_58_C(SEQAN_PP_BOOL(p(59, s)), s, p, o, m) -# define SEQAN_PP_FOR_59(s, p, o, m) SEQAN_PP_FOR_59_C(SEQAN_PP_BOOL(p(60, s)), s, p, o, m) -# define SEQAN_PP_FOR_60(s, p, o, m) SEQAN_PP_FOR_60_C(SEQAN_PP_BOOL(p(61, s)), s, p, o, m) -# define SEQAN_PP_FOR_61(s, p, o, m) SEQAN_PP_FOR_61_C(SEQAN_PP_BOOL(p(62, s)), s, p, o, m) -# define SEQAN_PP_FOR_62(s, p, o, m) SEQAN_PP_FOR_62_C(SEQAN_PP_BOOL(p(63, s)), s, p, o, m) -# define SEQAN_PP_FOR_63(s, p, o, m) SEQAN_PP_FOR_63_C(SEQAN_PP_BOOL(p(64, s)), s, p, o, m) -# define SEQAN_PP_FOR_64(s, p, o, m) SEQAN_PP_FOR_64_C(SEQAN_PP_BOOL(p(65, s)), s, p, o, m) -# define SEQAN_PP_FOR_65(s, p, o, m) SEQAN_PP_FOR_65_C(SEQAN_PP_BOOL(p(66, s)), s, p, o, m) -# define SEQAN_PP_FOR_66(s, p, o, m) SEQAN_PP_FOR_66_C(SEQAN_PP_BOOL(p(67, s)), s, p, o, m) -# define SEQAN_PP_FOR_67(s, p, o, m) SEQAN_PP_FOR_67_C(SEQAN_PP_BOOL(p(68, s)), s, p, o, m) -# define SEQAN_PP_FOR_68(s, p, o, m) SEQAN_PP_FOR_68_C(SEQAN_PP_BOOL(p(69, s)), s, p, o, m) -# define SEQAN_PP_FOR_69(s, p, o, m) SEQAN_PP_FOR_69_C(SEQAN_PP_BOOL(p(70, s)), s, p, o, m) -# define SEQAN_PP_FOR_70(s, p, o, m) SEQAN_PP_FOR_70_C(SEQAN_PP_BOOL(p(71, s)), s, p, o, m) -# define SEQAN_PP_FOR_71(s, p, o, m) SEQAN_PP_FOR_71_C(SEQAN_PP_BOOL(p(72, s)), s, p, o, m) -# define SEQAN_PP_FOR_72(s, p, o, m) SEQAN_PP_FOR_72_C(SEQAN_PP_BOOL(p(73, s)), s, p, o, m) -# define SEQAN_PP_FOR_73(s, p, o, m) SEQAN_PP_FOR_73_C(SEQAN_PP_BOOL(p(74, s)), s, p, o, m) -# define SEQAN_PP_FOR_74(s, p, o, m) SEQAN_PP_FOR_74_C(SEQAN_PP_BOOL(p(75, s)), s, p, o, m) -# define SEQAN_PP_FOR_75(s, p, o, m) SEQAN_PP_FOR_75_C(SEQAN_PP_BOOL(p(76, s)), s, p, o, m) -# define SEQAN_PP_FOR_76(s, p, o, m) SEQAN_PP_FOR_76_C(SEQAN_PP_BOOL(p(77, s)), s, p, o, m) -# define SEQAN_PP_FOR_77(s, p, o, m) SEQAN_PP_FOR_77_C(SEQAN_PP_BOOL(p(78, s)), s, p, o, m) -# define SEQAN_PP_FOR_78(s, p, o, m) SEQAN_PP_FOR_78_C(SEQAN_PP_BOOL(p(79, s)), s, p, o, m) -# define SEQAN_PP_FOR_79(s, p, o, m) SEQAN_PP_FOR_79_C(SEQAN_PP_BOOL(p(80, s)), s, p, o, m) -# define SEQAN_PP_FOR_80(s, p, o, m) SEQAN_PP_FOR_80_C(SEQAN_PP_BOOL(p(81, s)), s, p, o, m) -# define SEQAN_PP_FOR_81(s, p, o, m) SEQAN_PP_FOR_81_C(SEQAN_PP_BOOL(p(82, s)), s, p, o, m) -# define SEQAN_PP_FOR_82(s, p, o, m) SEQAN_PP_FOR_82_C(SEQAN_PP_BOOL(p(83, s)), s, p, o, m) -# define SEQAN_PP_FOR_83(s, p, o, m) SEQAN_PP_FOR_83_C(SEQAN_PP_BOOL(p(84, s)), s, p, o, m) -# define SEQAN_PP_FOR_84(s, p, o, m) SEQAN_PP_FOR_84_C(SEQAN_PP_BOOL(p(85, s)), s, p, o, m) -# define SEQAN_PP_FOR_85(s, p, o, m) SEQAN_PP_FOR_85_C(SEQAN_PP_BOOL(p(86, s)), s, p, o, m) -# define SEQAN_PP_FOR_86(s, p, o, m) SEQAN_PP_FOR_86_C(SEQAN_PP_BOOL(p(87, s)), s, p, o, m) -# define SEQAN_PP_FOR_87(s, p, o, m) SEQAN_PP_FOR_87_C(SEQAN_PP_BOOL(p(88, s)), s, p, o, m) -# define SEQAN_PP_FOR_88(s, p, o, m) SEQAN_PP_FOR_88_C(SEQAN_PP_BOOL(p(89, s)), s, p, o, m) -# define SEQAN_PP_FOR_89(s, p, o, m) SEQAN_PP_FOR_89_C(SEQAN_PP_BOOL(p(90, s)), s, p, o, m) -# define SEQAN_PP_FOR_90(s, p, o, m) SEQAN_PP_FOR_90_C(SEQAN_PP_BOOL(p(91, s)), s, p, o, m) -# define SEQAN_PP_FOR_91(s, p, o, m) SEQAN_PP_FOR_91_C(SEQAN_PP_BOOL(p(92, s)), s, p, o, m) -# define SEQAN_PP_FOR_92(s, p, o, m) SEQAN_PP_FOR_92_C(SEQAN_PP_BOOL(p(93, s)), s, p, o, m) -# define SEQAN_PP_FOR_93(s, p, o, m) SEQAN_PP_FOR_93_C(SEQAN_PP_BOOL(p(94, s)), s, p, o, m) -# define SEQAN_PP_FOR_94(s, p, o, m) SEQAN_PP_FOR_94_C(SEQAN_PP_BOOL(p(95, s)), s, p, o, m) -# define SEQAN_PP_FOR_95(s, p, o, m) SEQAN_PP_FOR_95_C(SEQAN_PP_BOOL(p(96, s)), s, p, o, m) -# define SEQAN_PP_FOR_96(s, p, o, m) SEQAN_PP_FOR_96_C(SEQAN_PP_BOOL(p(97, s)), s, p, o, m) -# define SEQAN_PP_FOR_97(s, p, o, m) SEQAN_PP_FOR_97_C(SEQAN_PP_BOOL(p(98, s)), s, p, o, m) -# define SEQAN_PP_FOR_98(s, p, o, m) SEQAN_PP_FOR_98_C(SEQAN_PP_BOOL(p(99, s)), s, p, o, m) -# define SEQAN_PP_FOR_99(s, p, o, m) SEQAN_PP_FOR_99_C(SEQAN_PP_BOOL(p(100, s)), s, p, o, m) -# define SEQAN_PP_FOR_100(s, p, o, m) SEQAN_PP_FOR_100_C(SEQAN_PP_BOOL(p(101, s)), s, p, o, m) -# define SEQAN_PP_FOR_101(s, p, o, m) SEQAN_PP_FOR_101_C(SEQAN_PP_BOOL(p(102, s)), s, p, o, m) -# define SEQAN_PP_FOR_102(s, p, o, m) SEQAN_PP_FOR_102_C(SEQAN_PP_BOOL(p(103, s)), s, p, o, m) -# define SEQAN_PP_FOR_103(s, p, o, m) SEQAN_PP_FOR_103_C(SEQAN_PP_BOOL(p(104, s)), s, p, o, m) -# define SEQAN_PP_FOR_104(s, p, o, m) SEQAN_PP_FOR_104_C(SEQAN_PP_BOOL(p(105, s)), s, p, o, m) -# define SEQAN_PP_FOR_105(s, p, o, m) SEQAN_PP_FOR_105_C(SEQAN_PP_BOOL(p(106, s)), s, p, o, m) -# define SEQAN_PP_FOR_106(s, p, o, m) SEQAN_PP_FOR_106_C(SEQAN_PP_BOOL(p(107, s)), s, p, o, m) -# define SEQAN_PP_FOR_107(s, p, o, m) SEQAN_PP_FOR_107_C(SEQAN_PP_BOOL(p(108, s)), s, p, o, m) -# define SEQAN_PP_FOR_108(s, p, o, m) SEQAN_PP_FOR_108_C(SEQAN_PP_BOOL(p(109, s)), s, p, o, m) -# define SEQAN_PP_FOR_109(s, p, o, m) SEQAN_PP_FOR_109_C(SEQAN_PP_BOOL(p(110, s)), s, p, o, m) -# define SEQAN_PP_FOR_110(s, p, o, m) SEQAN_PP_FOR_110_C(SEQAN_PP_BOOL(p(111, s)), s, p, o, m) -# define SEQAN_PP_FOR_111(s, p, o, m) SEQAN_PP_FOR_111_C(SEQAN_PP_BOOL(p(112, s)), s, p, o, m) -# define SEQAN_PP_FOR_112(s, p, o, m) SEQAN_PP_FOR_112_C(SEQAN_PP_BOOL(p(113, s)), s, p, o, m) -# define SEQAN_PP_FOR_113(s, p, o, m) SEQAN_PP_FOR_113_C(SEQAN_PP_BOOL(p(114, s)), s, p, o, m) -# define SEQAN_PP_FOR_114(s, p, o, m) SEQAN_PP_FOR_114_C(SEQAN_PP_BOOL(p(115, s)), s, p, o, m) -# define SEQAN_PP_FOR_115(s, p, o, m) SEQAN_PP_FOR_115_C(SEQAN_PP_BOOL(p(116, s)), s, p, o, m) -# define SEQAN_PP_FOR_116(s, p, o, m) SEQAN_PP_FOR_116_C(SEQAN_PP_BOOL(p(117, s)), s, p, o, m) -# define SEQAN_PP_FOR_117(s, p, o, m) SEQAN_PP_FOR_117_C(SEQAN_PP_BOOL(p(118, s)), s, p, o, m) -# define SEQAN_PP_FOR_118(s, p, o, m) SEQAN_PP_FOR_118_C(SEQAN_PP_BOOL(p(119, s)), s, p, o, m) -# define SEQAN_PP_FOR_119(s, p, o, m) SEQAN_PP_FOR_119_C(SEQAN_PP_BOOL(p(120, s)), s, p, o, m) -# define SEQAN_PP_FOR_120(s, p, o, m) SEQAN_PP_FOR_120_C(SEQAN_PP_BOOL(p(121, s)), s, p, o, m) -# define SEQAN_PP_FOR_121(s, p, o, m) SEQAN_PP_FOR_121_C(SEQAN_PP_BOOL(p(122, s)), s, p, o, m) -# define SEQAN_PP_FOR_122(s, p, o, m) SEQAN_PP_FOR_122_C(SEQAN_PP_BOOL(p(123, s)), s, p, o, m) -# define SEQAN_PP_FOR_123(s, p, o, m) SEQAN_PP_FOR_123_C(SEQAN_PP_BOOL(p(124, s)), s, p, o, m) -# define SEQAN_PP_FOR_124(s, p, o, m) SEQAN_PP_FOR_124_C(SEQAN_PP_BOOL(p(125, s)), s, p, o, m) -# define SEQAN_PP_FOR_125(s, p, o, m) SEQAN_PP_FOR_125_C(SEQAN_PP_BOOL(p(126, s)), s, p, o, m) -# define SEQAN_PP_FOR_126(s, p, o, m) SEQAN_PP_FOR_126_C(SEQAN_PP_BOOL(p(127, s)), s, p, o, m) -# define SEQAN_PP_FOR_127(s, p, o, m) SEQAN_PP_FOR_127_C(SEQAN_PP_BOOL(p(128, s)), s, p, o, m) -# define SEQAN_PP_FOR_128(s, p, o, m) SEQAN_PP_FOR_128_C(SEQAN_PP_BOOL(p(129, s)), s, p, o, m) -# define SEQAN_PP_FOR_129(s, p, o, m) SEQAN_PP_FOR_129_C(SEQAN_PP_BOOL(p(130, s)), s, p, o, m) -# define SEQAN_PP_FOR_130(s, p, o, m) SEQAN_PP_FOR_130_C(SEQAN_PP_BOOL(p(131, s)), s, p, o, m) -# define SEQAN_PP_FOR_131(s, p, o, m) SEQAN_PP_FOR_131_C(SEQAN_PP_BOOL(p(132, s)), s, p, o, m) -# define SEQAN_PP_FOR_132(s, p, o, m) SEQAN_PP_FOR_132_C(SEQAN_PP_BOOL(p(133, s)), s, p, o, m) -# define SEQAN_PP_FOR_133(s, p, o, m) SEQAN_PP_FOR_133_C(SEQAN_PP_BOOL(p(134, s)), s, p, o, m) -# define SEQAN_PP_FOR_134(s, p, o, m) SEQAN_PP_FOR_134_C(SEQAN_PP_BOOL(p(135, s)), s, p, o, m) -# define SEQAN_PP_FOR_135(s, p, o, m) SEQAN_PP_FOR_135_C(SEQAN_PP_BOOL(p(136, s)), s, p, o, m) -# define SEQAN_PP_FOR_136(s, p, o, m) SEQAN_PP_FOR_136_C(SEQAN_PP_BOOL(p(137, s)), s, p, o, m) -# define SEQAN_PP_FOR_137(s, p, o, m) SEQAN_PP_FOR_137_C(SEQAN_PP_BOOL(p(138, s)), s, p, o, m) -# define SEQAN_PP_FOR_138(s, p, o, m) SEQAN_PP_FOR_138_C(SEQAN_PP_BOOL(p(139, s)), s, p, o, m) -# define SEQAN_PP_FOR_139(s, p, o, m) SEQAN_PP_FOR_139_C(SEQAN_PP_BOOL(p(140, s)), s, p, o, m) -# define SEQAN_PP_FOR_140(s, p, o, m) SEQAN_PP_FOR_140_C(SEQAN_PP_BOOL(p(141, s)), s, p, o, m) -# define SEQAN_PP_FOR_141(s, p, o, m) SEQAN_PP_FOR_141_C(SEQAN_PP_BOOL(p(142, s)), s, p, o, m) -# define SEQAN_PP_FOR_142(s, p, o, m) SEQAN_PP_FOR_142_C(SEQAN_PP_BOOL(p(143, s)), s, p, o, m) -# define SEQAN_PP_FOR_143(s, p, o, m) SEQAN_PP_FOR_143_C(SEQAN_PP_BOOL(p(144, s)), s, p, o, m) -# define SEQAN_PP_FOR_144(s, p, o, m) SEQAN_PP_FOR_144_C(SEQAN_PP_BOOL(p(145, s)), s, p, o, m) -# define SEQAN_PP_FOR_145(s, p, o, m) SEQAN_PP_FOR_145_C(SEQAN_PP_BOOL(p(146, s)), s, p, o, m) -# define SEQAN_PP_FOR_146(s, p, o, m) SEQAN_PP_FOR_146_C(SEQAN_PP_BOOL(p(147, s)), s, p, o, m) -# define SEQAN_PP_FOR_147(s, p, o, m) SEQAN_PP_FOR_147_C(SEQAN_PP_BOOL(p(148, s)), s, p, o, m) -# define SEQAN_PP_FOR_148(s, p, o, m) SEQAN_PP_FOR_148_C(SEQAN_PP_BOOL(p(149, s)), s, p, o, m) -# define SEQAN_PP_FOR_149(s, p, o, m) SEQAN_PP_FOR_149_C(SEQAN_PP_BOOL(p(150, s)), s, p, o, m) -# define SEQAN_PP_FOR_150(s, p, o, m) SEQAN_PP_FOR_150_C(SEQAN_PP_BOOL(p(151, s)), s, p, o, m) -# define SEQAN_PP_FOR_151(s, p, o, m) SEQAN_PP_FOR_151_C(SEQAN_PP_BOOL(p(152, s)), s, p, o, m) -# define SEQAN_PP_FOR_152(s, p, o, m) SEQAN_PP_FOR_152_C(SEQAN_PP_BOOL(p(153, s)), s, p, o, m) -# define SEQAN_PP_FOR_153(s, p, o, m) SEQAN_PP_FOR_153_C(SEQAN_PP_BOOL(p(154, s)), s, p, o, m) -# define SEQAN_PP_FOR_154(s, p, o, m) SEQAN_PP_FOR_154_C(SEQAN_PP_BOOL(p(155, s)), s, p, o, m) -# define SEQAN_PP_FOR_155(s, p, o, m) SEQAN_PP_FOR_155_C(SEQAN_PP_BOOL(p(156, s)), s, p, o, m) -# define SEQAN_PP_FOR_156(s, p, o, m) SEQAN_PP_FOR_156_C(SEQAN_PP_BOOL(p(157, s)), s, p, o, m) -# define SEQAN_PP_FOR_157(s, p, o, m) SEQAN_PP_FOR_157_C(SEQAN_PP_BOOL(p(158, s)), s, p, o, m) -# define SEQAN_PP_FOR_158(s, p, o, m) SEQAN_PP_FOR_158_C(SEQAN_PP_BOOL(p(159, s)), s, p, o, m) -# define SEQAN_PP_FOR_159(s, p, o, m) SEQAN_PP_FOR_159_C(SEQAN_PP_BOOL(p(160, s)), s, p, o, m) -# define SEQAN_PP_FOR_160(s, p, o, m) SEQAN_PP_FOR_160_C(SEQAN_PP_BOOL(p(161, s)), s, p, o, m) -# define SEQAN_PP_FOR_161(s, p, o, m) SEQAN_PP_FOR_161_C(SEQAN_PP_BOOL(p(162, s)), s, p, o, m) -# define SEQAN_PP_FOR_162(s, p, o, m) SEQAN_PP_FOR_162_C(SEQAN_PP_BOOL(p(163, s)), s, p, o, m) -# define SEQAN_PP_FOR_163(s, p, o, m) SEQAN_PP_FOR_163_C(SEQAN_PP_BOOL(p(164, s)), s, p, o, m) -# define SEQAN_PP_FOR_164(s, p, o, m) SEQAN_PP_FOR_164_C(SEQAN_PP_BOOL(p(165, s)), s, p, o, m) -# define SEQAN_PP_FOR_165(s, p, o, m) SEQAN_PP_FOR_165_C(SEQAN_PP_BOOL(p(166, s)), s, p, o, m) -# define SEQAN_PP_FOR_166(s, p, o, m) SEQAN_PP_FOR_166_C(SEQAN_PP_BOOL(p(167, s)), s, p, o, m) -# define SEQAN_PP_FOR_167(s, p, o, m) SEQAN_PP_FOR_167_C(SEQAN_PP_BOOL(p(168, s)), s, p, o, m) -# define SEQAN_PP_FOR_168(s, p, o, m) SEQAN_PP_FOR_168_C(SEQAN_PP_BOOL(p(169, s)), s, p, o, m) -# define SEQAN_PP_FOR_169(s, p, o, m) SEQAN_PP_FOR_169_C(SEQAN_PP_BOOL(p(170, s)), s, p, o, m) -# define SEQAN_PP_FOR_170(s, p, o, m) SEQAN_PP_FOR_170_C(SEQAN_PP_BOOL(p(171, s)), s, p, o, m) -# define SEQAN_PP_FOR_171(s, p, o, m) SEQAN_PP_FOR_171_C(SEQAN_PP_BOOL(p(172, s)), s, p, o, m) -# define SEQAN_PP_FOR_172(s, p, o, m) SEQAN_PP_FOR_172_C(SEQAN_PP_BOOL(p(173, s)), s, p, o, m) -# define SEQAN_PP_FOR_173(s, p, o, m) SEQAN_PP_FOR_173_C(SEQAN_PP_BOOL(p(174, s)), s, p, o, m) -# define SEQAN_PP_FOR_174(s, p, o, m) SEQAN_PP_FOR_174_C(SEQAN_PP_BOOL(p(175, s)), s, p, o, m) -# define SEQAN_PP_FOR_175(s, p, o, m) SEQAN_PP_FOR_175_C(SEQAN_PP_BOOL(p(176, s)), s, p, o, m) -# define SEQAN_PP_FOR_176(s, p, o, m) SEQAN_PP_FOR_176_C(SEQAN_PP_BOOL(p(177, s)), s, p, o, m) -# define SEQAN_PP_FOR_177(s, p, o, m) SEQAN_PP_FOR_177_C(SEQAN_PP_BOOL(p(178, s)), s, p, o, m) -# define SEQAN_PP_FOR_178(s, p, o, m) SEQAN_PP_FOR_178_C(SEQAN_PP_BOOL(p(179, s)), s, p, o, m) -# define SEQAN_PP_FOR_179(s, p, o, m) SEQAN_PP_FOR_179_C(SEQAN_PP_BOOL(p(180, s)), s, p, o, m) -# define SEQAN_PP_FOR_180(s, p, o, m) SEQAN_PP_FOR_180_C(SEQAN_PP_BOOL(p(181, s)), s, p, o, m) -# define SEQAN_PP_FOR_181(s, p, o, m) SEQAN_PP_FOR_181_C(SEQAN_PP_BOOL(p(182, s)), s, p, o, m) -# define SEQAN_PP_FOR_182(s, p, o, m) SEQAN_PP_FOR_182_C(SEQAN_PP_BOOL(p(183, s)), s, p, o, m) -# define SEQAN_PP_FOR_183(s, p, o, m) SEQAN_PP_FOR_183_C(SEQAN_PP_BOOL(p(184, s)), s, p, o, m) -# define SEQAN_PP_FOR_184(s, p, o, m) SEQAN_PP_FOR_184_C(SEQAN_PP_BOOL(p(185, s)), s, p, o, m) -# define SEQAN_PP_FOR_185(s, p, o, m) SEQAN_PP_FOR_185_C(SEQAN_PP_BOOL(p(186, s)), s, p, o, m) -# define SEQAN_PP_FOR_186(s, p, o, m) SEQAN_PP_FOR_186_C(SEQAN_PP_BOOL(p(187, s)), s, p, o, m) -# define SEQAN_PP_FOR_187(s, p, o, m) SEQAN_PP_FOR_187_C(SEQAN_PP_BOOL(p(188, s)), s, p, o, m) -# define SEQAN_PP_FOR_188(s, p, o, m) SEQAN_PP_FOR_188_C(SEQAN_PP_BOOL(p(189, s)), s, p, o, m) -# define SEQAN_PP_FOR_189(s, p, o, m) SEQAN_PP_FOR_189_C(SEQAN_PP_BOOL(p(190, s)), s, p, o, m) -# define SEQAN_PP_FOR_190(s, p, o, m) SEQAN_PP_FOR_190_C(SEQAN_PP_BOOL(p(191, s)), s, p, o, m) -# define SEQAN_PP_FOR_191(s, p, o, m) SEQAN_PP_FOR_191_C(SEQAN_PP_BOOL(p(192, s)), s, p, o, m) -# define SEQAN_PP_FOR_192(s, p, o, m) SEQAN_PP_FOR_192_C(SEQAN_PP_BOOL(p(193, s)), s, p, o, m) -# define SEQAN_PP_FOR_193(s, p, o, m) SEQAN_PP_FOR_193_C(SEQAN_PP_BOOL(p(194, s)), s, p, o, m) -# define SEQAN_PP_FOR_194(s, p, o, m) SEQAN_PP_FOR_194_C(SEQAN_PP_BOOL(p(195, s)), s, p, o, m) -# define SEQAN_PP_FOR_195(s, p, o, m) SEQAN_PP_FOR_195_C(SEQAN_PP_BOOL(p(196, s)), s, p, o, m) -# define SEQAN_PP_FOR_196(s, p, o, m) SEQAN_PP_FOR_196_C(SEQAN_PP_BOOL(p(197, s)), s, p, o, m) -# define SEQAN_PP_FOR_197(s, p, o, m) SEQAN_PP_FOR_197_C(SEQAN_PP_BOOL(p(198, s)), s, p, o, m) -# define SEQAN_PP_FOR_198(s, p, o, m) SEQAN_PP_FOR_198_C(SEQAN_PP_BOOL(p(199, s)), s, p, o, m) -# define SEQAN_PP_FOR_199(s, p, o, m) SEQAN_PP_FOR_199_C(SEQAN_PP_BOOL(p(200, s)), s, p, o, m) -# define SEQAN_PP_FOR_200(s, p, o, m) SEQAN_PP_FOR_200_C(SEQAN_PP_BOOL(p(201, s)), s, p, o, m) -# define SEQAN_PP_FOR_201(s, p, o, m) SEQAN_PP_FOR_201_C(SEQAN_PP_BOOL(p(202, s)), s, p, o, m) -# define SEQAN_PP_FOR_202(s, p, o, m) SEQAN_PP_FOR_202_C(SEQAN_PP_BOOL(p(203, s)), s, p, o, m) -# define SEQAN_PP_FOR_203(s, p, o, m) SEQAN_PP_FOR_203_C(SEQAN_PP_BOOL(p(204, s)), s, p, o, m) -# define SEQAN_PP_FOR_204(s, p, o, m) SEQAN_PP_FOR_204_C(SEQAN_PP_BOOL(p(205, s)), s, p, o, m) -# define SEQAN_PP_FOR_205(s, p, o, m) SEQAN_PP_FOR_205_C(SEQAN_PP_BOOL(p(206, s)), s, p, o, m) -# define SEQAN_PP_FOR_206(s, p, o, m) SEQAN_PP_FOR_206_C(SEQAN_PP_BOOL(p(207, s)), s, p, o, m) -# define SEQAN_PP_FOR_207(s, p, o, m) SEQAN_PP_FOR_207_C(SEQAN_PP_BOOL(p(208, s)), s, p, o, m) -# define SEQAN_PP_FOR_208(s, p, o, m) SEQAN_PP_FOR_208_C(SEQAN_PP_BOOL(p(209, s)), s, p, o, m) -# define SEQAN_PP_FOR_209(s, p, o, m) SEQAN_PP_FOR_209_C(SEQAN_PP_BOOL(p(210, s)), s, p, o, m) -# define SEQAN_PP_FOR_210(s, p, o, m) SEQAN_PP_FOR_210_C(SEQAN_PP_BOOL(p(211, s)), s, p, o, m) -# define SEQAN_PP_FOR_211(s, p, o, m) SEQAN_PP_FOR_211_C(SEQAN_PP_BOOL(p(212, s)), s, p, o, m) -# define SEQAN_PP_FOR_212(s, p, o, m) SEQAN_PP_FOR_212_C(SEQAN_PP_BOOL(p(213, s)), s, p, o, m) -# define SEQAN_PP_FOR_213(s, p, o, m) SEQAN_PP_FOR_213_C(SEQAN_PP_BOOL(p(214, s)), s, p, o, m) -# define SEQAN_PP_FOR_214(s, p, o, m) SEQAN_PP_FOR_214_C(SEQAN_PP_BOOL(p(215, s)), s, p, o, m) -# define SEQAN_PP_FOR_215(s, p, o, m) SEQAN_PP_FOR_215_C(SEQAN_PP_BOOL(p(216, s)), s, p, o, m) -# define SEQAN_PP_FOR_216(s, p, o, m) SEQAN_PP_FOR_216_C(SEQAN_PP_BOOL(p(217, s)), s, p, o, m) -# define SEQAN_PP_FOR_217(s, p, o, m) SEQAN_PP_FOR_217_C(SEQAN_PP_BOOL(p(218, s)), s, p, o, m) -# define SEQAN_PP_FOR_218(s, p, o, m) SEQAN_PP_FOR_218_C(SEQAN_PP_BOOL(p(219, s)), s, p, o, m) -# define SEQAN_PP_FOR_219(s, p, o, m) SEQAN_PP_FOR_219_C(SEQAN_PP_BOOL(p(220, s)), s, p, o, m) -# define SEQAN_PP_FOR_220(s, p, o, m) SEQAN_PP_FOR_220_C(SEQAN_PP_BOOL(p(221, s)), s, p, o, m) -# define SEQAN_PP_FOR_221(s, p, o, m) SEQAN_PP_FOR_221_C(SEQAN_PP_BOOL(p(222, s)), s, p, o, m) -# define SEQAN_PP_FOR_222(s, p, o, m) SEQAN_PP_FOR_222_C(SEQAN_PP_BOOL(p(223, s)), s, p, o, m) -# define SEQAN_PP_FOR_223(s, p, o, m) SEQAN_PP_FOR_223_C(SEQAN_PP_BOOL(p(224, s)), s, p, o, m) -# define SEQAN_PP_FOR_224(s, p, o, m) SEQAN_PP_FOR_224_C(SEQAN_PP_BOOL(p(225, s)), s, p, o, m) -# define SEQAN_PP_FOR_225(s, p, o, m) SEQAN_PP_FOR_225_C(SEQAN_PP_BOOL(p(226, s)), s, p, o, m) -# define SEQAN_PP_FOR_226(s, p, o, m) SEQAN_PP_FOR_226_C(SEQAN_PP_BOOL(p(227, s)), s, p, o, m) -# define SEQAN_PP_FOR_227(s, p, o, m) SEQAN_PP_FOR_227_C(SEQAN_PP_BOOL(p(228, s)), s, p, o, m) -# define SEQAN_PP_FOR_228(s, p, o, m) SEQAN_PP_FOR_228_C(SEQAN_PP_BOOL(p(229, s)), s, p, o, m) -# define SEQAN_PP_FOR_229(s, p, o, m) SEQAN_PP_FOR_229_C(SEQAN_PP_BOOL(p(230, s)), s, p, o, m) -# define SEQAN_PP_FOR_230(s, p, o, m) SEQAN_PP_FOR_230_C(SEQAN_PP_BOOL(p(231, s)), s, p, o, m) -# define SEQAN_PP_FOR_231(s, p, o, m) SEQAN_PP_FOR_231_C(SEQAN_PP_BOOL(p(232, s)), s, p, o, m) -# define SEQAN_PP_FOR_232(s, p, o, m) SEQAN_PP_FOR_232_C(SEQAN_PP_BOOL(p(233, s)), s, p, o, m) -# define SEQAN_PP_FOR_233(s, p, o, m) SEQAN_PP_FOR_233_C(SEQAN_PP_BOOL(p(234, s)), s, p, o, m) -# define SEQAN_PP_FOR_234(s, p, o, m) SEQAN_PP_FOR_234_C(SEQAN_PP_BOOL(p(235, s)), s, p, o, m) -# define SEQAN_PP_FOR_235(s, p, o, m) SEQAN_PP_FOR_235_C(SEQAN_PP_BOOL(p(236, s)), s, p, o, m) -# define SEQAN_PP_FOR_236(s, p, o, m) SEQAN_PP_FOR_236_C(SEQAN_PP_BOOL(p(237, s)), s, p, o, m) -# define SEQAN_PP_FOR_237(s, p, o, m) SEQAN_PP_FOR_237_C(SEQAN_PP_BOOL(p(238, s)), s, p, o, m) -# define SEQAN_PP_FOR_238(s, p, o, m) SEQAN_PP_FOR_238_C(SEQAN_PP_BOOL(p(239, s)), s, p, o, m) -# define SEQAN_PP_FOR_239(s, p, o, m) SEQAN_PP_FOR_239_C(SEQAN_PP_BOOL(p(240, s)), s, p, o, m) -# define SEQAN_PP_FOR_240(s, p, o, m) SEQAN_PP_FOR_240_C(SEQAN_PP_BOOL(p(241, s)), s, p, o, m) -# define SEQAN_PP_FOR_241(s, p, o, m) SEQAN_PP_FOR_241_C(SEQAN_PP_BOOL(p(242, s)), s, p, o, m) -# define SEQAN_PP_FOR_242(s, p, o, m) SEQAN_PP_FOR_242_C(SEQAN_PP_BOOL(p(243, s)), s, p, o, m) -# define SEQAN_PP_FOR_243(s, p, o, m) SEQAN_PP_FOR_243_C(SEQAN_PP_BOOL(p(244, s)), s, p, o, m) -# define SEQAN_PP_FOR_244(s, p, o, m) SEQAN_PP_FOR_244_C(SEQAN_PP_BOOL(p(245, s)), s, p, o, m) -# define SEQAN_PP_FOR_245(s, p, o, m) SEQAN_PP_FOR_245_C(SEQAN_PP_BOOL(p(246, s)), s, p, o, m) -# define SEQAN_PP_FOR_246(s, p, o, m) SEQAN_PP_FOR_246_C(SEQAN_PP_BOOL(p(247, s)), s, p, o, m) -# define SEQAN_PP_FOR_247(s, p, o, m) SEQAN_PP_FOR_247_C(SEQAN_PP_BOOL(p(248, s)), s, p, o, m) -# define SEQAN_PP_FOR_248(s, p, o, m) SEQAN_PP_FOR_248_C(SEQAN_PP_BOOL(p(249, s)), s, p, o, m) -# define SEQAN_PP_FOR_249(s, p, o, m) SEQAN_PP_FOR_249_C(SEQAN_PP_BOOL(p(250, s)), s, p, o, m) -# define SEQAN_PP_FOR_250(s, p, o, m) SEQAN_PP_FOR_250_C(SEQAN_PP_BOOL(p(251, s)), s, p, o, m) -# define SEQAN_PP_FOR_251(s, p, o, m) SEQAN_PP_FOR_251_C(SEQAN_PP_BOOL(p(252, s)), s, p, o, m) -# define SEQAN_PP_FOR_252(s, p, o, m) SEQAN_PP_FOR_252_C(SEQAN_PP_BOOL(p(253, s)), s, p, o, m) -# define SEQAN_PP_FOR_253(s, p, o, m) SEQAN_PP_FOR_253_C(SEQAN_PP_BOOL(p(254, s)), s, p, o, m) -# define SEQAN_PP_FOR_254(s, p, o, m) SEQAN_PP_FOR_254_C(SEQAN_PP_BOOL(p(255, s)), s, p, o, m) -# define SEQAN_PP_FOR_255(s, p, o, m) SEQAN_PP_FOR_255_C(SEQAN_PP_BOOL(p(256, s)), s, p, o, m) -# define SEQAN_PP_FOR_256(s, p, o, m) SEQAN_PP_FOR_256_C(SEQAN_PP_BOOL(p(257, s)), s, p, o, m) -# -# define SEQAN_PP_FOR_1_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(2, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_2, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(2, s), p, o, m) -# define SEQAN_PP_FOR_2_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(3, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_3, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(3, s), p, o, m) -# define SEQAN_PP_FOR_3_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(4, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_4, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(4, s), p, o, m) -# define SEQAN_PP_FOR_4_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(5, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_5, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(5, s), p, o, m) -# define SEQAN_PP_FOR_5_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(6, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_6, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(6, s), p, o, m) -# define SEQAN_PP_FOR_6_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(7, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_7, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(7, s), p, o, m) -# define SEQAN_PP_FOR_7_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(8, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_8, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(8, s), p, o, m) -# define SEQAN_PP_FOR_8_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(9, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_9, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(9, s), p, o, m) -# define SEQAN_PP_FOR_9_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(10, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_10, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(10, s), p, o, m) -# define SEQAN_PP_FOR_10_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(11, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_11, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(11, s), p, o, m) -# define SEQAN_PP_FOR_11_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(12, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_12, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(12, s), p, o, m) -# define SEQAN_PP_FOR_12_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(13, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_13, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(13, s), p, o, m) -# define SEQAN_PP_FOR_13_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(14, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_14, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(14, s), p, o, m) -# define SEQAN_PP_FOR_14_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(15, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_15, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(15, s), p, o, m) -# define SEQAN_PP_FOR_15_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(16, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_16, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(16, s), p, o, m) -# define SEQAN_PP_FOR_16_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(17, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_17, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(17, s), p, o, m) -# define SEQAN_PP_FOR_17_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(18, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_18, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(18, s), p, o, m) -# define SEQAN_PP_FOR_18_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(19, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_19, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(19, s), p, o, m) -# define SEQAN_PP_FOR_19_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(20, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_20, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(20, s), p, o, m) -# define SEQAN_PP_FOR_20_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(21, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_21, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(21, s), p, o, m) -# define SEQAN_PP_FOR_21_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(22, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_22, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(22, s), p, o, m) -# define SEQAN_PP_FOR_22_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(23, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_23, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(23, s), p, o, m) -# define SEQAN_PP_FOR_23_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(24, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_24, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(24, s), p, o, m) -# define SEQAN_PP_FOR_24_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(25, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_25, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(25, s), p, o, m) -# define SEQAN_PP_FOR_25_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(26, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_26, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(26, s), p, o, m) -# define SEQAN_PP_FOR_26_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(27, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_27, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(27, s), p, o, m) -# define SEQAN_PP_FOR_27_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(28, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_28, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(28, s), p, o, m) -# define SEQAN_PP_FOR_28_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(29, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_29, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(29, s), p, o, m) -# define SEQAN_PP_FOR_29_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(30, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_30, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(30, s), p, o, m) -# define SEQAN_PP_FOR_30_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(31, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_31, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(31, s), p, o, m) -# define SEQAN_PP_FOR_31_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(32, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_32, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(32, s), p, o, m) -# define SEQAN_PP_FOR_32_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(33, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_33, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(33, s), p, o, m) -# define SEQAN_PP_FOR_33_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(34, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_34, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(34, s), p, o, m) -# define SEQAN_PP_FOR_34_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(35, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_35, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(35, s), p, o, m) -# define SEQAN_PP_FOR_35_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(36, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_36, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(36, s), p, o, m) -# define SEQAN_PP_FOR_36_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(37, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_37, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(37, s), p, o, m) -# define SEQAN_PP_FOR_37_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(38, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_38, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(38, s), p, o, m) -# define SEQAN_PP_FOR_38_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(39, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_39, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(39, s), p, o, m) -# define SEQAN_PP_FOR_39_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(40, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_40, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(40, s), p, o, m) -# define SEQAN_PP_FOR_40_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(41, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_41, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(41, s), p, o, m) -# define SEQAN_PP_FOR_41_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(42, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_42, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(42, s), p, o, m) -# define SEQAN_PP_FOR_42_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(43, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_43, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(43, s), p, o, m) -# define SEQAN_PP_FOR_43_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(44, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_44, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(44, s), p, o, m) -# define SEQAN_PP_FOR_44_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(45, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_45, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(45, s), p, o, m) -# define SEQAN_PP_FOR_45_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(46, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_46, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(46, s), p, o, m) -# define SEQAN_PP_FOR_46_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(47, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_47, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(47, s), p, o, m) -# define SEQAN_PP_FOR_47_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(48, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_48, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(48, s), p, o, m) -# define SEQAN_PP_FOR_48_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(49, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_49, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(49, s), p, o, m) -# define SEQAN_PP_FOR_49_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(50, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_50, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(50, s), p, o, m) -# define SEQAN_PP_FOR_50_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(51, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_51, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(51, s), p, o, m) -# define SEQAN_PP_FOR_51_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(52, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_52, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(52, s), p, o, m) -# define SEQAN_PP_FOR_52_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(53, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_53, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(53, s), p, o, m) -# define SEQAN_PP_FOR_53_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(54, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_54, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(54, s), p, o, m) -# define SEQAN_PP_FOR_54_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(55, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_55, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(55, s), p, o, m) -# define SEQAN_PP_FOR_55_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(56, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_56, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(56, s), p, o, m) -# define SEQAN_PP_FOR_56_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(57, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_57, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(57, s), p, o, m) -# define SEQAN_PP_FOR_57_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(58, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_58, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(58, s), p, o, m) -# define SEQAN_PP_FOR_58_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(59, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_59, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(59, s), p, o, m) -# define SEQAN_PP_FOR_59_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(60, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_60, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(60, s), p, o, m) -# define SEQAN_PP_FOR_60_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(61, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_61, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(61, s), p, o, m) -# define SEQAN_PP_FOR_61_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(62, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_62, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(62, s), p, o, m) -# define SEQAN_PP_FOR_62_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(63, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_63, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(63, s), p, o, m) -# define SEQAN_PP_FOR_63_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(64, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_64, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(64, s), p, o, m) -# define SEQAN_PP_FOR_64_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(65, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_65, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(65, s), p, o, m) -# define SEQAN_PP_FOR_65_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(66, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_66, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(66, s), p, o, m) -# define SEQAN_PP_FOR_66_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(67, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_67, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(67, s), p, o, m) -# define SEQAN_PP_FOR_67_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(68, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_68, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(68, s), p, o, m) -# define SEQAN_PP_FOR_68_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(69, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_69, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(69, s), p, o, m) -# define SEQAN_PP_FOR_69_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(70, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_70, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(70, s), p, o, m) -# define SEQAN_PP_FOR_70_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(71, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_71, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(71, s), p, o, m) -# define SEQAN_PP_FOR_71_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(72, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_72, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(72, s), p, o, m) -# define SEQAN_PP_FOR_72_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(73, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_73, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(73, s), p, o, m) -# define SEQAN_PP_FOR_73_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(74, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_74, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(74, s), p, o, m) -# define SEQAN_PP_FOR_74_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(75, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_75, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(75, s), p, o, m) -# define SEQAN_PP_FOR_75_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(76, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_76, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(76, s), p, o, m) -# define SEQAN_PP_FOR_76_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(77, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_77, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(77, s), p, o, m) -# define SEQAN_PP_FOR_77_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(78, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_78, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(78, s), p, o, m) -# define SEQAN_PP_FOR_78_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(79, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_79, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(79, s), p, o, m) -# define SEQAN_PP_FOR_79_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(80, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_80, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(80, s), p, o, m) -# define SEQAN_PP_FOR_80_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(81, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_81, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(81, s), p, o, m) -# define SEQAN_PP_FOR_81_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(82, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_82, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(82, s), p, o, m) -# define SEQAN_PP_FOR_82_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(83, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_83, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(83, s), p, o, m) -# define SEQAN_PP_FOR_83_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(84, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_84, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(84, s), p, o, m) -# define SEQAN_PP_FOR_84_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(85, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_85, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(85, s), p, o, m) -# define SEQAN_PP_FOR_85_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(86, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_86, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(86, s), p, o, m) -# define SEQAN_PP_FOR_86_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(87, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_87, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(87, s), p, o, m) -# define SEQAN_PP_FOR_87_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(88, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_88, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(88, s), p, o, m) -# define SEQAN_PP_FOR_88_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(89, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_89, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(89, s), p, o, m) -# define SEQAN_PP_FOR_89_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(90, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_90, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(90, s), p, o, m) -# define SEQAN_PP_FOR_90_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(91, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_91, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(91, s), p, o, m) -# define SEQAN_PP_FOR_91_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(92, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_92, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(92, s), p, o, m) -# define SEQAN_PP_FOR_92_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(93, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_93, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(93, s), p, o, m) -# define SEQAN_PP_FOR_93_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(94, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_94, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(94, s), p, o, m) -# define SEQAN_PP_FOR_94_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(95, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_95, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(95, s), p, o, m) -# define SEQAN_PP_FOR_95_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(96, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_96, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(96, s), p, o, m) -# define SEQAN_PP_FOR_96_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(97, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_97, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(97, s), p, o, m) -# define SEQAN_PP_FOR_97_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(98, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_98, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(98, s), p, o, m) -# define SEQAN_PP_FOR_98_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(99, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_99, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(99, s), p, o, m) -# define SEQAN_PP_FOR_99_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(100, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_100, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(100, s), p, o, m) -# define SEQAN_PP_FOR_100_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(101, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_101, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(101, s), p, o, m) -# define SEQAN_PP_FOR_101_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(102, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_102, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(102, s), p, o, m) -# define SEQAN_PP_FOR_102_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(103, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_103, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(103, s), p, o, m) -# define SEQAN_PP_FOR_103_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(104, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_104, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(104, s), p, o, m) -# define SEQAN_PP_FOR_104_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(105, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_105, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(105, s), p, o, m) -# define SEQAN_PP_FOR_105_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(106, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_106, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(106, s), p, o, m) -# define SEQAN_PP_FOR_106_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(107, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_107, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(107, s), p, o, m) -# define SEQAN_PP_FOR_107_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(108, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_108, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(108, s), p, o, m) -# define SEQAN_PP_FOR_108_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(109, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_109, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(109, s), p, o, m) -# define SEQAN_PP_FOR_109_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(110, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_110, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(110, s), p, o, m) -# define SEQAN_PP_FOR_110_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(111, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_111, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(111, s), p, o, m) -# define SEQAN_PP_FOR_111_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(112, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_112, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(112, s), p, o, m) -# define SEQAN_PP_FOR_112_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(113, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_113, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(113, s), p, o, m) -# define SEQAN_PP_FOR_113_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(114, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_114, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(114, s), p, o, m) -# define SEQAN_PP_FOR_114_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(115, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_115, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(115, s), p, o, m) -# define SEQAN_PP_FOR_115_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(116, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_116, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(116, s), p, o, m) -# define SEQAN_PP_FOR_116_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(117, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_117, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(117, s), p, o, m) -# define SEQAN_PP_FOR_117_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(118, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_118, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(118, s), p, o, m) -# define SEQAN_PP_FOR_118_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(119, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_119, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(119, s), p, o, m) -# define SEQAN_PP_FOR_119_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(120, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_120, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(120, s), p, o, m) -# define SEQAN_PP_FOR_120_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(121, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_121, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(121, s), p, o, m) -# define SEQAN_PP_FOR_121_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(122, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_122, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(122, s), p, o, m) -# define SEQAN_PP_FOR_122_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(123, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_123, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(123, s), p, o, m) -# define SEQAN_PP_FOR_123_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(124, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_124, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(124, s), p, o, m) -# define SEQAN_PP_FOR_124_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(125, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_125, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(125, s), p, o, m) -# define SEQAN_PP_FOR_125_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(126, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_126, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(126, s), p, o, m) -# define SEQAN_PP_FOR_126_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(127, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_127, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(127, s), p, o, m) -# define SEQAN_PP_FOR_127_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(128, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_128, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(128, s), p, o, m) -# define SEQAN_PP_FOR_128_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(129, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_129, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(129, s), p, o, m) -# define SEQAN_PP_FOR_129_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(130, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_130, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(130, s), p, o, m) -# define SEQAN_PP_FOR_130_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(131, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_131, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(131, s), p, o, m) -# define SEQAN_PP_FOR_131_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(132, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_132, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(132, s), p, o, m) -# define SEQAN_PP_FOR_132_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(133, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_133, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(133, s), p, o, m) -# define SEQAN_PP_FOR_133_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(134, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_134, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(134, s), p, o, m) -# define SEQAN_PP_FOR_134_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(135, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_135, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(135, s), p, o, m) -# define SEQAN_PP_FOR_135_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(136, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_136, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(136, s), p, o, m) -# define SEQAN_PP_FOR_136_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(137, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_137, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(137, s), p, o, m) -# define SEQAN_PP_FOR_137_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(138, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_138, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(138, s), p, o, m) -# define SEQAN_PP_FOR_138_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(139, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_139, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(139, s), p, o, m) -# define SEQAN_PP_FOR_139_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(140, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_140, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(140, s), p, o, m) -# define SEQAN_PP_FOR_140_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(141, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_141, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(141, s), p, o, m) -# define SEQAN_PP_FOR_141_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(142, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_142, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(142, s), p, o, m) -# define SEQAN_PP_FOR_142_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(143, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_143, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(143, s), p, o, m) -# define SEQAN_PP_FOR_143_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(144, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_144, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(144, s), p, o, m) -# define SEQAN_PP_FOR_144_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(145, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_145, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(145, s), p, o, m) -# define SEQAN_PP_FOR_145_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(146, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_146, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(146, s), p, o, m) -# define SEQAN_PP_FOR_146_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(147, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_147, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(147, s), p, o, m) -# define SEQAN_PP_FOR_147_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(148, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_148, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(148, s), p, o, m) -# define SEQAN_PP_FOR_148_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(149, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_149, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(149, s), p, o, m) -# define SEQAN_PP_FOR_149_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(150, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_150, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(150, s), p, o, m) -# define SEQAN_PP_FOR_150_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(151, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_151, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(151, s), p, o, m) -# define SEQAN_PP_FOR_151_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(152, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_152, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(152, s), p, o, m) -# define SEQAN_PP_FOR_152_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(153, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_153, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(153, s), p, o, m) -# define SEQAN_PP_FOR_153_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(154, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_154, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(154, s), p, o, m) -# define SEQAN_PP_FOR_154_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(155, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_155, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(155, s), p, o, m) -# define SEQAN_PP_FOR_155_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(156, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_156, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(156, s), p, o, m) -# define SEQAN_PP_FOR_156_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(157, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_157, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(157, s), p, o, m) -# define SEQAN_PP_FOR_157_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(158, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_158, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(158, s), p, o, m) -# define SEQAN_PP_FOR_158_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(159, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_159, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(159, s), p, o, m) -# define SEQAN_PP_FOR_159_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(160, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_160, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(160, s), p, o, m) -# define SEQAN_PP_FOR_160_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(161, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_161, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(161, s), p, o, m) -# define SEQAN_PP_FOR_161_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(162, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_162, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(162, s), p, o, m) -# define SEQAN_PP_FOR_162_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(163, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_163, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(163, s), p, o, m) -# define SEQAN_PP_FOR_163_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(164, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_164, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(164, s), p, o, m) -# define SEQAN_PP_FOR_164_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(165, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_165, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(165, s), p, o, m) -# define SEQAN_PP_FOR_165_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(166, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_166, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(166, s), p, o, m) -# define SEQAN_PP_FOR_166_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(167, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_167, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(167, s), p, o, m) -# define SEQAN_PP_FOR_167_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(168, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_168, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(168, s), p, o, m) -# define SEQAN_PP_FOR_168_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(169, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_169, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(169, s), p, o, m) -# define SEQAN_PP_FOR_169_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(170, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_170, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(170, s), p, o, m) -# define SEQAN_PP_FOR_170_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(171, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_171, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(171, s), p, o, m) -# define SEQAN_PP_FOR_171_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(172, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_172, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(172, s), p, o, m) -# define SEQAN_PP_FOR_172_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(173, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_173, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(173, s), p, o, m) -# define SEQAN_PP_FOR_173_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(174, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_174, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(174, s), p, o, m) -# define SEQAN_PP_FOR_174_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(175, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_175, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(175, s), p, o, m) -# define SEQAN_PP_FOR_175_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(176, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_176, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(176, s), p, o, m) -# define SEQAN_PP_FOR_176_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(177, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_177, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(177, s), p, o, m) -# define SEQAN_PP_FOR_177_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(178, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_178, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(178, s), p, o, m) -# define SEQAN_PP_FOR_178_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(179, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_179, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(179, s), p, o, m) -# define SEQAN_PP_FOR_179_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(180, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_180, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(180, s), p, o, m) -# define SEQAN_PP_FOR_180_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(181, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_181, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(181, s), p, o, m) -# define SEQAN_PP_FOR_181_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(182, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_182, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(182, s), p, o, m) -# define SEQAN_PP_FOR_182_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(183, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_183, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(183, s), p, o, m) -# define SEQAN_PP_FOR_183_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(184, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_184, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(184, s), p, o, m) -# define SEQAN_PP_FOR_184_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(185, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_185, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(185, s), p, o, m) -# define SEQAN_PP_FOR_185_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(186, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_186, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(186, s), p, o, m) -# define SEQAN_PP_FOR_186_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(187, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_187, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(187, s), p, o, m) -# define SEQAN_PP_FOR_187_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(188, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_188, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(188, s), p, o, m) -# define SEQAN_PP_FOR_188_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(189, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_189, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(189, s), p, o, m) -# define SEQAN_PP_FOR_189_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(190, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_190, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(190, s), p, o, m) -# define SEQAN_PP_FOR_190_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(191, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_191, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(191, s), p, o, m) -# define SEQAN_PP_FOR_191_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(192, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_192, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(192, s), p, o, m) -# define SEQAN_PP_FOR_192_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(193, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_193, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(193, s), p, o, m) -# define SEQAN_PP_FOR_193_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(194, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_194, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(194, s), p, o, m) -# define SEQAN_PP_FOR_194_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(195, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_195, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(195, s), p, o, m) -# define SEQAN_PP_FOR_195_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(196, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_196, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(196, s), p, o, m) -# define SEQAN_PP_FOR_196_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(197, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_197, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(197, s), p, o, m) -# define SEQAN_PP_FOR_197_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(198, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_198, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(198, s), p, o, m) -# define SEQAN_PP_FOR_198_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(199, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_199, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(199, s), p, o, m) -# define SEQAN_PP_FOR_199_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(200, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_200, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(200, s), p, o, m) -# define SEQAN_PP_FOR_200_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(201, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_201, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(201, s), p, o, m) -# define SEQAN_PP_FOR_201_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(202, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_202, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(202, s), p, o, m) -# define SEQAN_PP_FOR_202_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(203, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_203, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(203, s), p, o, m) -# define SEQAN_PP_FOR_203_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(204, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_204, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(204, s), p, o, m) -# define SEQAN_PP_FOR_204_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(205, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_205, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(205, s), p, o, m) -# define SEQAN_PP_FOR_205_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(206, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_206, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(206, s), p, o, m) -# define SEQAN_PP_FOR_206_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(207, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_207, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(207, s), p, o, m) -# define SEQAN_PP_FOR_207_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(208, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_208, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(208, s), p, o, m) -# define SEQAN_PP_FOR_208_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(209, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_209, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(209, s), p, o, m) -# define SEQAN_PP_FOR_209_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(210, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_210, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(210, s), p, o, m) -# define SEQAN_PP_FOR_210_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(211, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_211, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(211, s), p, o, m) -# define SEQAN_PP_FOR_211_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(212, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_212, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(212, s), p, o, m) -# define SEQAN_PP_FOR_212_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(213, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_213, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(213, s), p, o, m) -# define SEQAN_PP_FOR_213_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(214, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_214, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(214, s), p, o, m) -# define SEQAN_PP_FOR_214_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(215, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_215, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(215, s), p, o, m) -# define SEQAN_PP_FOR_215_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(216, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_216, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(216, s), p, o, m) -# define SEQAN_PP_FOR_216_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(217, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_217, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(217, s), p, o, m) -# define SEQAN_PP_FOR_217_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(218, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_218, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(218, s), p, o, m) -# define SEQAN_PP_FOR_218_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(219, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_219, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(219, s), p, o, m) -# define SEQAN_PP_FOR_219_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(220, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_220, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(220, s), p, o, m) -# define SEQAN_PP_FOR_220_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(221, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_221, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(221, s), p, o, m) -# define SEQAN_PP_FOR_221_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(222, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_222, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(222, s), p, o, m) -# define SEQAN_PP_FOR_222_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(223, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_223, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(223, s), p, o, m) -# define SEQAN_PP_FOR_223_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(224, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_224, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(224, s), p, o, m) -# define SEQAN_PP_FOR_224_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(225, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_225, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(225, s), p, o, m) -# define SEQAN_PP_FOR_225_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(226, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_226, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(226, s), p, o, m) -# define SEQAN_PP_FOR_226_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(227, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_227, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(227, s), p, o, m) -# define SEQAN_PP_FOR_227_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(228, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_228, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(228, s), p, o, m) -# define SEQAN_PP_FOR_228_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(229, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_229, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(229, s), p, o, m) -# define SEQAN_PP_FOR_229_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(230, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_230, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(230, s), p, o, m) -# define SEQAN_PP_FOR_230_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(231, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_231, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(231, s), p, o, m) -# define SEQAN_PP_FOR_231_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(232, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_232, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(232, s), p, o, m) -# define SEQAN_PP_FOR_232_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(233, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_233, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(233, s), p, o, m) -# define SEQAN_PP_FOR_233_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(234, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_234, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(234, s), p, o, m) -# define SEQAN_PP_FOR_234_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(235, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_235, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(235, s), p, o, m) -# define SEQAN_PP_FOR_235_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(236, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_236, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(236, s), p, o, m) -# define SEQAN_PP_FOR_236_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(237, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_237, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(237, s), p, o, m) -# define SEQAN_PP_FOR_237_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(238, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_238, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(238, s), p, o, m) -# define SEQAN_PP_FOR_238_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(239, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_239, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(239, s), p, o, m) -# define SEQAN_PP_FOR_239_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(240, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_240, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(240, s), p, o, m) -# define SEQAN_PP_FOR_240_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(241, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_241, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(241, s), p, o, m) -# define SEQAN_PP_FOR_241_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(242, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_242, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(242, s), p, o, m) -# define SEQAN_PP_FOR_242_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(243, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_243, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(243, s), p, o, m) -# define SEQAN_PP_FOR_243_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(244, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_244, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(244, s), p, o, m) -# define SEQAN_PP_FOR_244_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(245, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_245, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(245, s), p, o, m) -# define SEQAN_PP_FOR_245_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(246, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_246, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(246, s), p, o, m) -# define SEQAN_PP_FOR_246_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(247, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_247, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(247, s), p, o, m) -# define SEQAN_PP_FOR_247_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(248, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_248, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(248, s), p, o, m) -# define SEQAN_PP_FOR_248_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(249, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_249, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(249, s), p, o, m) -# define SEQAN_PP_FOR_249_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(250, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_250, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(250, s), p, o, m) -# define SEQAN_PP_FOR_250_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(251, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_251, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(251, s), p, o, m) -# define SEQAN_PP_FOR_251_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(252, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_252, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(252, s), p, o, m) -# define SEQAN_PP_FOR_252_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(253, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_253, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(253, s), p, o, m) -# define SEQAN_PP_FOR_253_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(254, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_254, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(254, s), p, o, m) -# define SEQAN_PP_FOR_254_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(255, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_255, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(255, s), p, o, m) -# define SEQAN_PP_FOR_255_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(256, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_256, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(256, s), p, o, m) -# define SEQAN_PP_FOR_256_C(c, s, p, o, m) SEQAN_PP_IIF(c, m, SEQAN_PP_TUPLE_EAT_2)(257, s) SEQAN_PP_IIF(c, SEQAN_PP_FOR_257, SEQAN_PP_TUPLE_EAT_4)(SEQAN_PP_EXPR_IIF(c, o)(257, s), p, o, m) - -#endif // #ifdef SEQAN_PLATFORM_WINDOWS_VS - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/detail/auto_rec.hpp <== -// -------------------------------------------------------------------------- - -# /* ************************************************************************** -# * * -# * (C) Copyright Paul Mensonides 2002. -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# * * -# ************************************************************************** */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # include -# -// # if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_DMC() -// # include -// # else -# -// # ifndef SEQAN_PREPROCESSOR_DETAIL_AUTO_REC_HPP -// # define SEQAN_PREPROCESSOR_DETAIL_AUTO_REC_HPP -# -// # include -# -# /* SEQAN_PP_AUTO_REC */ -# -# define SEQAN_PP_AUTO_REC(pred, n) SEQAN_PP_NODE_ENTRY_ ## n(pred) -# -# define SEQAN_PP_NODE_ENTRY_256(p) SEQAN_PP_NODE_128(p)(p)(p)(p)(p)(p)(p)(p) -# define SEQAN_PP_NODE_ENTRY_128(p) SEQAN_PP_NODE_64(p)(p)(p)(p)(p)(p)(p) -# define SEQAN_PP_NODE_ENTRY_64(p) SEQAN_PP_NODE_32(p)(p)(p)(p)(p)(p) -# define SEQAN_PP_NODE_ENTRY_32(p) SEQAN_PP_NODE_16(p)(p)(p)(p)(p) -# define SEQAN_PP_NODE_ENTRY_16(p) SEQAN_PP_NODE_8(p)(p)(p)(p) -# define SEQAN_PP_NODE_ENTRY_8(p) SEQAN_PP_NODE_4(p)(p)(p) -# define SEQAN_PP_NODE_ENTRY_4(p) SEQAN_PP_NODE_2(p)(p) -# define SEQAN_PP_NODE_ENTRY_2(p) SEQAN_PP_NODE_1(p) -# -# define SEQAN_PP_NODE_128(p) SEQAN_PP_IIF(p(128), SEQAN_PP_NODE_64, SEQAN_PP_NODE_192) -# define SEQAN_PP_NODE_64(p) SEQAN_PP_IIF(p(64), SEQAN_PP_NODE_32, SEQAN_PP_NODE_96) -# define SEQAN_PP_NODE_32(p) SEQAN_PP_IIF(p(32), SEQAN_PP_NODE_16, SEQAN_PP_NODE_48) -# define SEQAN_PP_NODE_16(p) SEQAN_PP_IIF(p(16), SEQAN_PP_NODE_8, SEQAN_PP_NODE_24) -# define SEQAN_PP_NODE_8(p) SEQAN_PP_IIF(p(8), SEQAN_PP_NODE_4, SEQAN_PP_NODE_12) -# define SEQAN_PP_NODE_4(p) SEQAN_PP_IIF(p(4), SEQAN_PP_NODE_2, SEQAN_PP_NODE_6) -# define SEQAN_PP_NODE_2(p) SEQAN_PP_IIF(p(2), SEQAN_PP_NODE_1, SEQAN_PP_NODE_3) -# define SEQAN_PP_NODE_1(p) SEQAN_PP_IIF(p(1), 1, 2) -# define SEQAN_PP_NODE_3(p) SEQAN_PP_IIF(p(3), 3, 4) -# define SEQAN_PP_NODE_6(p) SEQAN_PP_IIF(p(6), SEQAN_PP_NODE_5, SEQAN_PP_NODE_7) -# define SEQAN_PP_NODE_5(p) SEQAN_PP_IIF(p(5), 5, 6) -# define SEQAN_PP_NODE_7(p) SEQAN_PP_IIF(p(7), 7, 8) -# define SEQAN_PP_NODE_12(p) SEQAN_PP_IIF(p(12), SEQAN_PP_NODE_10, SEQAN_PP_NODE_14) -# define SEQAN_PP_NODE_10(p) SEQAN_PP_IIF(p(10), SEQAN_PP_NODE_9, SEQAN_PP_NODE_11) -# define SEQAN_PP_NODE_9(p) SEQAN_PP_IIF(p(9), 9, 10) -# define SEQAN_PP_NODE_11(p) SEQAN_PP_IIF(p(11), 11, 12) -# define SEQAN_PP_NODE_14(p) SEQAN_PP_IIF(p(14), SEQAN_PP_NODE_13, SEQAN_PP_NODE_15) -# define SEQAN_PP_NODE_13(p) SEQAN_PP_IIF(p(13), 13, 14) -# define SEQAN_PP_NODE_15(p) SEQAN_PP_IIF(p(15), 15, 16) -# define SEQAN_PP_NODE_24(p) SEQAN_PP_IIF(p(24), SEQAN_PP_NODE_20, SEQAN_PP_NODE_28) -# define SEQAN_PP_NODE_20(p) SEQAN_PP_IIF(p(20), SEQAN_PP_NODE_18, SEQAN_PP_NODE_22) -# define SEQAN_PP_NODE_18(p) SEQAN_PP_IIF(p(18), SEQAN_PP_NODE_17, SEQAN_PP_NODE_19) -# define SEQAN_PP_NODE_17(p) SEQAN_PP_IIF(p(17), 17, 18) -# define SEQAN_PP_NODE_19(p) SEQAN_PP_IIF(p(19), 19, 20) -# define SEQAN_PP_NODE_22(p) SEQAN_PP_IIF(p(22), SEQAN_PP_NODE_21, SEQAN_PP_NODE_23) -# define SEQAN_PP_NODE_21(p) SEQAN_PP_IIF(p(21), 21, 22) -# define SEQAN_PP_NODE_23(p) SEQAN_PP_IIF(p(23), 23, 24) -# define SEQAN_PP_NODE_28(p) SEQAN_PP_IIF(p(28), SEQAN_PP_NODE_26, SEQAN_PP_NODE_30) -# define SEQAN_PP_NODE_26(p) SEQAN_PP_IIF(p(26), SEQAN_PP_NODE_25, SEQAN_PP_NODE_27) -# define SEQAN_PP_NODE_25(p) SEQAN_PP_IIF(p(25), 25, 26) -# define SEQAN_PP_NODE_27(p) SEQAN_PP_IIF(p(27), 27, 28) -# define SEQAN_PP_NODE_30(p) SEQAN_PP_IIF(p(30), SEQAN_PP_NODE_29, SEQAN_PP_NODE_31) -# define SEQAN_PP_NODE_29(p) SEQAN_PP_IIF(p(29), 29, 30) -# define SEQAN_PP_NODE_31(p) SEQAN_PP_IIF(p(31), 31, 32) -# define SEQAN_PP_NODE_48(p) SEQAN_PP_IIF(p(48), SEQAN_PP_NODE_40, SEQAN_PP_NODE_56) -# define SEQAN_PP_NODE_40(p) SEQAN_PP_IIF(p(40), SEQAN_PP_NODE_36, SEQAN_PP_NODE_44) -# define SEQAN_PP_NODE_36(p) SEQAN_PP_IIF(p(36), SEQAN_PP_NODE_34, SEQAN_PP_NODE_38) -# define SEQAN_PP_NODE_34(p) SEQAN_PP_IIF(p(34), SEQAN_PP_NODE_33, SEQAN_PP_NODE_35) -# define SEQAN_PP_NODE_33(p) SEQAN_PP_IIF(p(33), 33, 34) -# define SEQAN_PP_NODE_35(p) SEQAN_PP_IIF(p(35), 35, 36) -# define SEQAN_PP_NODE_38(p) SEQAN_PP_IIF(p(38), SEQAN_PP_NODE_37, SEQAN_PP_NODE_39) -# define SEQAN_PP_NODE_37(p) SEQAN_PP_IIF(p(37), 37, 38) -# define SEQAN_PP_NODE_39(p) SEQAN_PP_IIF(p(39), 39, 40) -# define SEQAN_PP_NODE_44(p) SEQAN_PP_IIF(p(44), SEQAN_PP_NODE_42, SEQAN_PP_NODE_46) -# define SEQAN_PP_NODE_42(p) SEQAN_PP_IIF(p(42), SEQAN_PP_NODE_41, SEQAN_PP_NODE_43) -# define SEQAN_PP_NODE_41(p) SEQAN_PP_IIF(p(41), 41, 42) -# define SEQAN_PP_NODE_43(p) SEQAN_PP_IIF(p(43), 43, 44) -# define SEQAN_PP_NODE_46(p) SEQAN_PP_IIF(p(46), SEQAN_PP_NODE_45, SEQAN_PP_NODE_47) -# define SEQAN_PP_NODE_45(p) SEQAN_PP_IIF(p(45), 45, 46) -# define SEQAN_PP_NODE_47(p) SEQAN_PP_IIF(p(47), 47, 48) -# define SEQAN_PP_NODE_56(p) SEQAN_PP_IIF(p(56), SEQAN_PP_NODE_52, SEQAN_PP_NODE_60) -# define SEQAN_PP_NODE_52(p) SEQAN_PP_IIF(p(52), SEQAN_PP_NODE_50, SEQAN_PP_NODE_54) -# define SEQAN_PP_NODE_50(p) SEQAN_PP_IIF(p(50), SEQAN_PP_NODE_49, SEQAN_PP_NODE_51) -# define SEQAN_PP_NODE_49(p) SEQAN_PP_IIF(p(49), 49, 50) -# define SEQAN_PP_NODE_51(p) SEQAN_PP_IIF(p(51), 51, 52) -# define SEQAN_PP_NODE_54(p) SEQAN_PP_IIF(p(54), SEQAN_PP_NODE_53, SEQAN_PP_NODE_55) -# define SEQAN_PP_NODE_53(p) SEQAN_PP_IIF(p(53), 53, 54) -# define SEQAN_PP_NODE_55(p) SEQAN_PP_IIF(p(55), 55, 56) -# define SEQAN_PP_NODE_60(p) SEQAN_PP_IIF(p(60), SEQAN_PP_NODE_58, SEQAN_PP_NODE_62) -# define SEQAN_PP_NODE_58(p) SEQAN_PP_IIF(p(58), SEQAN_PP_NODE_57, SEQAN_PP_NODE_59) -# define SEQAN_PP_NODE_57(p) SEQAN_PP_IIF(p(57), 57, 58) -# define SEQAN_PP_NODE_59(p) SEQAN_PP_IIF(p(59), 59, 60) -# define SEQAN_PP_NODE_62(p) SEQAN_PP_IIF(p(62), SEQAN_PP_NODE_61, SEQAN_PP_NODE_63) -# define SEQAN_PP_NODE_61(p) SEQAN_PP_IIF(p(61), 61, 62) -# define SEQAN_PP_NODE_63(p) SEQAN_PP_IIF(p(63), 63, 64) -# define SEQAN_PP_NODE_96(p) SEQAN_PP_IIF(p(96), SEQAN_PP_NODE_80, SEQAN_PP_NODE_112) -# define SEQAN_PP_NODE_80(p) SEQAN_PP_IIF(p(80), SEQAN_PP_NODE_72, SEQAN_PP_NODE_88) -# define SEQAN_PP_NODE_72(p) SEQAN_PP_IIF(p(72), SEQAN_PP_NODE_68, SEQAN_PP_NODE_76) -# define SEQAN_PP_NODE_68(p) SEQAN_PP_IIF(p(68), SEQAN_PP_NODE_66, SEQAN_PP_NODE_70) -# define SEQAN_PP_NODE_66(p) SEQAN_PP_IIF(p(66), SEQAN_PP_NODE_65, SEQAN_PP_NODE_67) -# define SEQAN_PP_NODE_65(p) SEQAN_PP_IIF(p(65), 65, 66) -# define SEQAN_PP_NODE_67(p) SEQAN_PP_IIF(p(67), 67, 68) -# define SEQAN_PP_NODE_70(p) SEQAN_PP_IIF(p(70), SEQAN_PP_NODE_69, SEQAN_PP_NODE_71) -# define SEQAN_PP_NODE_69(p) SEQAN_PP_IIF(p(69), 69, 70) -# define SEQAN_PP_NODE_71(p) SEQAN_PP_IIF(p(71), 71, 72) -# define SEQAN_PP_NODE_76(p) SEQAN_PP_IIF(p(76), SEQAN_PP_NODE_74, SEQAN_PP_NODE_78) -# define SEQAN_PP_NODE_74(p) SEQAN_PP_IIF(p(74), SEQAN_PP_NODE_73, SEQAN_PP_NODE_75) -# define SEQAN_PP_NODE_73(p) SEQAN_PP_IIF(p(73), 73, 74) -# define SEQAN_PP_NODE_75(p) SEQAN_PP_IIF(p(75), 75, 76) -# define SEQAN_PP_NODE_78(p) SEQAN_PP_IIF(p(78), SEQAN_PP_NODE_77, SEQAN_PP_NODE_79) -# define SEQAN_PP_NODE_77(p) SEQAN_PP_IIF(p(77), 77, 78) -# define SEQAN_PP_NODE_79(p) SEQAN_PP_IIF(p(79), 79, 80) -# define SEQAN_PP_NODE_88(p) SEQAN_PP_IIF(p(88), SEQAN_PP_NODE_84, SEQAN_PP_NODE_92) -# define SEQAN_PP_NODE_84(p) SEQAN_PP_IIF(p(84), SEQAN_PP_NODE_82, SEQAN_PP_NODE_86) -# define SEQAN_PP_NODE_82(p) SEQAN_PP_IIF(p(82), SEQAN_PP_NODE_81, SEQAN_PP_NODE_83) -# define SEQAN_PP_NODE_81(p) SEQAN_PP_IIF(p(81), 81, 82) -# define SEQAN_PP_NODE_83(p) SEQAN_PP_IIF(p(83), 83, 84) -# define SEQAN_PP_NODE_86(p) SEQAN_PP_IIF(p(86), SEQAN_PP_NODE_85, SEQAN_PP_NODE_87) -# define SEQAN_PP_NODE_85(p) SEQAN_PP_IIF(p(85), 85, 86) -# define SEQAN_PP_NODE_87(p) SEQAN_PP_IIF(p(87), 87, 88) -# define SEQAN_PP_NODE_92(p) SEQAN_PP_IIF(p(92), SEQAN_PP_NODE_90, SEQAN_PP_NODE_94) -# define SEQAN_PP_NODE_90(p) SEQAN_PP_IIF(p(90), SEQAN_PP_NODE_89, SEQAN_PP_NODE_91) -# define SEQAN_PP_NODE_89(p) SEQAN_PP_IIF(p(89), 89, 90) -# define SEQAN_PP_NODE_91(p) SEQAN_PP_IIF(p(91), 91, 92) -# define SEQAN_PP_NODE_94(p) SEQAN_PP_IIF(p(94), SEQAN_PP_NODE_93, SEQAN_PP_NODE_95) -# define SEQAN_PP_NODE_93(p) SEQAN_PP_IIF(p(93), 93, 94) -# define SEQAN_PP_NODE_95(p) SEQAN_PP_IIF(p(95), 95, 96) -# define SEQAN_PP_NODE_112(p) SEQAN_PP_IIF(p(112), SEQAN_PP_NODE_104, SEQAN_PP_NODE_120) -# define SEQAN_PP_NODE_104(p) SEQAN_PP_IIF(p(104), SEQAN_PP_NODE_100, SEQAN_PP_NODE_108) -# define SEQAN_PP_NODE_100(p) SEQAN_PP_IIF(p(100), SEQAN_PP_NODE_98, SEQAN_PP_NODE_102) -# define SEQAN_PP_NODE_98(p) SEQAN_PP_IIF(p(98), SEQAN_PP_NODE_97, SEQAN_PP_NODE_99) -# define SEQAN_PP_NODE_97(p) SEQAN_PP_IIF(p(97), 97, 98) -# define SEQAN_PP_NODE_99(p) SEQAN_PP_IIF(p(99), 99, 100) -# define SEQAN_PP_NODE_102(p) SEQAN_PP_IIF(p(102), SEQAN_PP_NODE_101, SEQAN_PP_NODE_103) -# define SEQAN_PP_NODE_101(p) SEQAN_PP_IIF(p(101), 101, 102) -# define SEQAN_PP_NODE_103(p) SEQAN_PP_IIF(p(103), 103, 104) -# define SEQAN_PP_NODE_108(p) SEQAN_PP_IIF(p(108), SEQAN_PP_NODE_106, SEQAN_PP_NODE_110) -# define SEQAN_PP_NODE_106(p) SEQAN_PP_IIF(p(106), SEQAN_PP_NODE_105, SEQAN_PP_NODE_107) -# define SEQAN_PP_NODE_105(p) SEQAN_PP_IIF(p(105), 105, 106) -# define SEQAN_PP_NODE_107(p) SEQAN_PP_IIF(p(107), 107, 108) -# define SEQAN_PP_NODE_110(p) SEQAN_PP_IIF(p(110), SEQAN_PP_NODE_109, SEQAN_PP_NODE_111) -# define SEQAN_PP_NODE_109(p) SEQAN_PP_IIF(p(109), 109, 110) -# define SEQAN_PP_NODE_111(p) SEQAN_PP_IIF(p(111), 111, 112) -# define SEQAN_PP_NODE_120(p) SEQAN_PP_IIF(p(120), SEQAN_PP_NODE_116, SEQAN_PP_NODE_124) -# define SEQAN_PP_NODE_116(p) SEQAN_PP_IIF(p(116), SEQAN_PP_NODE_114, SEQAN_PP_NODE_118) -# define SEQAN_PP_NODE_114(p) SEQAN_PP_IIF(p(114), SEQAN_PP_NODE_113, SEQAN_PP_NODE_115) -# define SEQAN_PP_NODE_113(p) SEQAN_PP_IIF(p(113), 113, 114) -# define SEQAN_PP_NODE_115(p) SEQAN_PP_IIF(p(115), 115, 116) -# define SEQAN_PP_NODE_118(p) SEQAN_PP_IIF(p(118), SEQAN_PP_NODE_117, SEQAN_PP_NODE_119) -# define SEQAN_PP_NODE_117(p) SEQAN_PP_IIF(p(117), 117, 118) -# define SEQAN_PP_NODE_119(p) SEQAN_PP_IIF(p(119), 119, 120) -# define SEQAN_PP_NODE_124(p) SEQAN_PP_IIF(p(124), SEQAN_PP_NODE_122, SEQAN_PP_NODE_126) -# define SEQAN_PP_NODE_122(p) SEQAN_PP_IIF(p(122), SEQAN_PP_NODE_121, SEQAN_PP_NODE_123) -# define SEQAN_PP_NODE_121(p) SEQAN_PP_IIF(p(121), 121, 122) -# define SEQAN_PP_NODE_123(p) SEQAN_PP_IIF(p(123), 123, 124) -# define SEQAN_PP_NODE_126(p) SEQAN_PP_IIF(p(126), SEQAN_PP_NODE_125, SEQAN_PP_NODE_127) -# define SEQAN_PP_NODE_125(p) SEQAN_PP_IIF(p(125), 125, 126) -# define SEQAN_PP_NODE_127(p) SEQAN_PP_IIF(p(127), 127, 128) -# define SEQAN_PP_NODE_192(p) SEQAN_PP_IIF(p(192), SEQAN_PP_NODE_160, SEQAN_PP_NODE_224) -# define SEQAN_PP_NODE_160(p) SEQAN_PP_IIF(p(160), SEQAN_PP_NODE_144, SEQAN_PP_NODE_176) -# define SEQAN_PP_NODE_144(p) SEQAN_PP_IIF(p(144), SEQAN_PP_NODE_136, SEQAN_PP_NODE_152) -# define SEQAN_PP_NODE_136(p) SEQAN_PP_IIF(p(136), SEQAN_PP_NODE_132, SEQAN_PP_NODE_140) -# define SEQAN_PP_NODE_132(p) SEQAN_PP_IIF(p(132), SEQAN_PP_NODE_130, SEQAN_PP_NODE_134) -# define SEQAN_PP_NODE_130(p) SEQAN_PP_IIF(p(130), SEQAN_PP_NODE_129, SEQAN_PP_NODE_131) -# define SEQAN_PP_NODE_129(p) SEQAN_PP_IIF(p(129), 129, 130) -# define SEQAN_PP_NODE_131(p) SEQAN_PP_IIF(p(131), 131, 132) -# define SEQAN_PP_NODE_134(p) SEQAN_PP_IIF(p(134), SEQAN_PP_NODE_133, SEQAN_PP_NODE_135) -# define SEQAN_PP_NODE_133(p) SEQAN_PP_IIF(p(133), 133, 134) -# define SEQAN_PP_NODE_135(p) SEQAN_PP_IIF(p(135), 135, 136) -# define SEQAN_PP_NODE_140(p) SEQAN_PP_IIF(p(140), SEQAN_PP_NODE_138, SEQAN_PP_NODE_142) -# define SEQAN_PP_NODE_138(p) SEQAN_PP_IIF(p(138), SEQAN_PP_NODE_137, SEQAN_PP_NODE_139) -# define SEQAN_PP_NODE_137(p) SEQAN_PP_IIF(p(137), 137, 138) -# define SEQAN_PP_NODE_139(p) SEQAN_PP_IIF(p(139), 139, 140) -# define SEQAN_PP_NODE_142(p) SEQAN_PP_IIF(p(142), SEQAN_PP_NODE_141, SEQAN_PP_NODE_143) -# define SEQAN_PP_NODE_141(p) SEQAN_PP_IIF(p(141), 141, 142) -# define SEQAN_PP_NODE_143(p) SEQAN_PP_IIF(p(143), 143, 144) -# define SEQAN_PP_NODE_152(p) SEQAN_PP_IIF(p(152), SEQAN_PP_NODE_148, SEQAN_PP_NODE_156) -# define SEQAN_PP_NODE_148(p) SEQAN_PP_IIF(p(148), SEQAN_PP_NODE_146, SEQAN_PP_NODE_150) -# define SEQAN_PP_NODE_146(p) SEQAN_PP_IIF(p(146), SEQAN_PP_NODE_145, SEQAN_PP_NODE_147) -# define SEQAN_PP_NODE_145(p) SEQAN_PP_IIF(p(145), 145, 146) -# define SEQAN_PP_NODE_147(p) SEQAN_PP_IIF(p(147), 147, 148) -# define SEQAN_PP_NODE_150(p) SEQAN_PP_IIF(p(150), SEQAN_PP_NODE_149, SEQAN_PP_NODE_151) -# define SEQAN_PP_NODE_149(p) SEQAN_PP_IIF(p(149), 149, 150) -# define SEQAN_PP_NODE_151(p) SEQAN_PP_IIF(p(151), 151, 152) -# define SEQAN_PP_NODE_156(p) SEQAN_PP_IIF(p(156), SEQAN_PP_NODE_154, SEQAN_PP_NODE_158) -# define SEQAN_PP_NODE_154(p) SEQAN_PP_IIF(p(154), SEQAN_PP_NODE_153, SEQAN_PP_NODE_155) -# define SEQAN_PP_NODE_153(p) SEQAN_PP_IIF(p(153), 153, 154) -# define SEQAN_PP_NODE_155(p) SEQAN_PP_IIF(p(155), 155, 156) -# define SEQAN_PP_NODE_158(p) SEQAN_PP_IIF(p(158), SEQAN_PP_NODE_157, SEQAN_PP_NODE_159) -# define SEQAN_PP_NODE_157(p) SEQAN_PP_IIF(p(157), 157, 158) -# define SEQAN_PP_NODE_159(p) SEQAN_PP_IIF(p(159), 159, 160) -# define SEQAN_PP_NODE_176(p) SEQAN_PP_IIF(p(176), SEQAN_PP_NODE_168, SEQAN_PP_NODE_184) -# define SEQAN_PP_NODE_168(p) SEQAN_PP_IIF(p(168), SEQAN_PP_NODE_164, SEQAN_PP_NODE_172) -# define SEQAN_PP_NODE_164(p) SEQAN_PP_IIF(p(164), SEQAN_PP_NODE_162, SEQAN_PP_NODE_166) -# define SEQAN_PP_NODE_162(p) SEQAN_PP_IIF(p(162), SEQAN_PP_NODE_161, SEQAN_PP_NODE_163) -# define SEQAN_PP_NODE_161(p) SEQAN_PP_IIF(p(161), 161, 162) -# define SEQAN_PP_NODE_163(p) SEQAN_PP_IIF(p(163), 163, 164) -# define SEQAN_PP_NODE_166(p) SEQAN_PP_IIF(p(166), SEQAN_PP_NODE_165, SEQAN_PP_NODE_167) -# define SEQAN_PP_NODE_165(p) SEQAN_PP_IIF(p(165), 165, 166) -# define SEQAN_PP_NODE_167(p) SEQAN_PP_IIF(p(167), 167, 168) -# define SEQAN_PP_NODE_172(p) SEQAN_PP_IIF(p(172), SEQAN_PP_NODE_170, SEQAN_PP_NODE_174) -# define SEQAN_PP_NODE_170(p) SEQAN_PP_IIF(p(170), SEQAN_PP_NODE_169, SEQAN_PP_NODE_171) -# define SEQAN_PP_NODE_169(p) SEQAN_PP_IIF(p(169), 169, 170) -# define SEQAN_PP_NODE_171(p) SEQAN_PP_IIF(p(171), 171, 172) -# define SEQAN_PP_NODE_174(p) SEQAN_PP_IIF(p(174), SEQAN_PP_NODE_173, SEQAN_PP_NODE_175) -# define SEQAN_PP_NODE_173(p) SEQAN_PP_IIF(p(173), 173, 174) -# define SEQAN_PP_NODE_175(p) SEQAN_PP_IIF(p(175), 175, 176) -# define SEQAN_PP_NODE_184(p) SEQAN_PP_IIF(p(184), SEQAN_PP_NODE_180, SEQAN_PP_NODE_188) -# define SEQAN_PP_NODE_180(p) SEQAN_PP_IIF(p(180), SEQAN_PP_NODE_178, SEQAN_PP_NODE_182) -# define SEQAN_PP_NODE_178(p) SEQAN_PP_IIF(p(178), SEQAN_PP_NODE_177, SEQAN_PP_NODE_179) -# define SEQAN_PP_NODE_177(p) SEQAN_PP_IIF(p(177), 177, 178) -# define SEQAN_PP_NODE_179(p) SEQAN_PP_IIF(p(179), 179, 180) -# define SEQAN_PP_NODE_182(p) SEQAN_PP_IIF(p(182), SEQAN_PP_NODE_181, SEQAN_PP_NODE_183) -# define SEQAN_PP_NODE_181(p) SEQAN_PP_IIF(p(181), 181, 182) -# define SEQAN_PP_NODE_183(p) SEQAN_PP_IIF(p(183), 183, 184) -# define SEQAN_PP_NODE_188(p) SEQAN_PP_IIF(p(188), SEQAN_PP_NODE_186, SEQAN_PP_NODE_190) -# define SEQAN_PP_NODE_186(p) SEQAN_PP_IIF(p(186), SEQAN_PP_NODE_185, SEQAN_PP_NODE_187) -# define SEQAN_PP_NODE_185(p) SEQAN_PP_IIF(p(185), 185, 186) -# define SEQAN_PP_NODE_187(p) SEQAN_PP_IIF(p(187), 187, 188) -# define SEQAN_PP_NODE_190(p) SEQAN_PP_IIF(p(190), SEQAN_PP_NODE_189, SEQAN_PP_NODE_191) -# define SEQAN_PP_NODE_189(p) SEQAN_PP_IIF(p(189), 189, 190) -# define SEQAN_PP_NODE_191(p) SEQAN_PP_IIF(p(191), 191, 192) -# define SEQAN_PP_NODE_224(p) SEQAN_PP_IIF(p(224), SEQAN_PP_NODE_208, SEQAN_PP_NODE_240) -# define SEQAN_PP_NODE_208(p) SEQAN_PP_IIF(p(208), SEQAN_PP_NODE_200, SEQAN_PP_NODE_216) -# define SEQAN_PP_NODE_200(p) SEQAN_PP_IIF(p(200), SEQAN_PP_NODE_196, SEQAN_PP_NODE_204) -# define SEQAN_PP_NODE_196(p) SEQAN_PP_IIF(p(196), SEQAN_PP_NODE_194, SEQAN_PP_NODE_198) -# define SEQAN_PP_NODE_194(p) SEQAN_PP_IIF(p(194), SEQAN_PP_NODE_193, SEQAN_PP_NODE_195) -# define SEQAN_PP_NODE_193(p) SEQAN_PP_IIF(p(193), 193, 194) -# define SEQAN_PP_NODE_195(p) SEQAN_PP_IIF(p(195), 195, 196) -# define SEQAN_PP_NODE_198(p) SEQAN_PP_IIF(p(198), SEQAN_PP_NODE_197, SEQAN_PP_NODE_199) -# define SEQAN_PP_NODE_197(p) SEQAN_PP_IIF(p(197), 197, 198) -# define SEQAN_PP_NODE_199(p) SEQAN_PP_IIF(p(199), 199, 200) -# define SEQAN_PP_NODE_204(p) SEQAN_PP_IIF(p(204), SEQAN_PP_NODE_202, SEQAN_PP_NODE_206) -# define SEQAN_PP_NODE_202(p) SEQAN_PP_IIF(p(202), SEQAN_PP_NODE_201, SEQAN_PP_NODE_203) -# define SEQAN_PP_NODE_201(p) SEQAN_PP_IIF(p(201), 201, 202) -# define SEQAN_PP_NODE_203(p) SEQAN_PP_IIF(p(203), 203, 204) -# define SEQAN_PP_NODE_206(p) SEQAN_PP_IIF(p(206), SEQAN_PP_NODE_205, SEQAN_PP_NODE_207) -# define SEQAN_PP_NODE_205(p) SEQAN_PP_IIF(p(205), 205, 206) -# define SEQAN_PP_NODE_207(p) SEQAN_PP_IIF(p(207), 207, 208) -# define SEQAN_PP_NODE_216(p) SEQAN_PP_IIF(p(216), SEQAN_PP_NODE_212, SEQAN_PP_NODE_220) -# define SEQAN_PP_NODE_212(p) SEQAN_PP_IIF(p(212), SEQAN_PP_NODE_210, SEQAN_PP_NODE_214) -# define SEQAN_PP_NODE_210(p) SEQAN_PP_IIF(p(210), SEQAN_PP_NODE_209, SEQAN_PP_NODE_211) -# define SEQAN_PP_NODE_209(p) SEQAN_PP_IIF(p(209), 209, 210) -# define SEQAN_PP_NODE_211(p) SEQAN_PP_IIF(p(211), 211, 212) -# define SEQAN_PP_NODE_214(p) SEQAN_PP_IIF(p(214), SEQAN_PP_NODE_213, SEQAN_PP_NODE_215) -# define SEQAN_PP_NODE_213(p) SEQAN_PP_IIF(p(213), 213, 214) -# define SEQAN_PP_NODE_215(p) SEQAN_PP_IIF(p(215), 215, 216) -# define SEQAN_PP_NODE_220(p) SEQAN_PP_IIF(p(220), SEQAN_PP_NODE_218, SEQAN_PP_NODE_222) -# define SEQAN_PP_NODE_218(p) SEQAN_PP_IIF(p(218), SEQAN_PP_NODE_217, SEQAN_PP_NODE_219) -# define SEQAN_PP_NODE_217(p) SEQAN_PP_IIF(p(217), 217, 218) -# define SEQAN_PP_NODE_219(p) SEQAN_PP_IIF(p(219), 219, 220) -# define SEQAN_PP_NODE_222(p) SEQAN_PP_IIF(p(222), SEQAN_PP_NODE_221, SEQAN_PP_NODE_223) -# define SEQAN_PP_NODE_221(p) SEQAN_PP_IIF(p(221), 221, 222) -# define SEQAN_PP_NODE_223(p) SEQAN_PP_IIF(p(223), 223, 224) -# define SEQAN_PP_NODE_240(p) SEQAN_PP_IIF(p(240), SEQAN_PP_NODE_232, SEQAN_PP_NODE_248) -# define SEQAN_PP_NODE_232(p) SEQAN_PP_IIF(p(232), SEQAN_PP_NODE_228, SEQAN_PP_NODE_236) -# define SEQAN_PP_NODE_228(p) SEQAN_PP_IIF(p(228), SEQAN_PP_NODE_226, SEQAN_PP_NODE_230) -# define SEQAN_PP_NODE_226(p) SEQAN_PP_IIF(p(226), SEQAN_PP_NODE_225, SEQAN_PP_NODE_227) -# define SEQAN_PP_NODE_225(p) SEQAN_PP_IIF(p(225), 225, 226) -# define SEQAN_PP_NODE_227(p) SEQAN_PP_IIF(p(227), 227, 228) -# define SEQAN_PP_NODE_230(p) SEQAN_PP_IIF(p(230), SEQAN_PP_NODE_229, SEQAN_PP_NODE_231) -# define SEQAN_PP_NODE_229(p) SEQAN_PP_IIF(p(229), 229, 230) -# define SEQAN_PP_NODE_231(p) SEQAN_PP_IIF(p(231), 231, 232) -# define SEQAN_PP_NODE_236(p) SEQAN_PP_IIF(p(236), SEQAN_PP_NODE_234, SEQAN_PP_NODE_238) -# define SEQAN_PP_NODE_234(p) SEQAN_PP_IIF(p(234), SEQAN_PP_NODE_233, SEQAN_PP_NODE_235) -# define SEQAN_PP_NODE_233(p) SEQAN_PP_IIF(p(233), 233, 234) -# define SEQAN_PP_NODE_235(p) SEQAN_PP_IIF(p(235), 235, 236) -# define SEQAN_PP_NODE_238(p) SEQAN_PP_IIF(p(238), SEQAN_PP_NODE_237, SEQAN_PP_NODE_239) -# define SEQAN_PP_NODE_237(p) SEQAN_PP_IIF(p(237), 237, 238) -# define SEQAN_PP_NODE_239(p) SEQAN_PP_IIF(p(239), 239, 240) -# define SEQAN_PP_NODE_248(p) SEQAN_PP_IIF(p(248), SEQAN_PP_NODE_244, SEQAN_PP_NODE_252) -# define SEQAN_PP_NODE_244(p) SEQAN_PP_IIF(p(244), SEQAN_PP_NODE_242, SEQAN_PP_NODE_246) -# define SEQAN_PP_NODE_242(p) SEQAN_PP_IIF(p(242), SEQAN_PP_NODE_241, SEQAN_PP_NODE_243) -# define SEQAN_PP_NODE_241(p) SEQAN_PP_IIF(p(241), 241, 242) -# define SEQAN_PP_NODE_243(p) SEQAN_PP_IIF(p(243), 243, 244) -# define SEQAN_PP_NODE_246(p) SEQAN_PP_IIF(p(246), SEQAN_PP_NODE_245, SEQAN_PP_NODE_247) -# define SEQAN_PP_NODE_245(p) SEQAN_PP_IIF(p(245), 245, 246) -# define SEQAN_PP_NODE_247(p) SEQAN_PP_IIF(p(247), 247, 248) -# define SEQAN_PP_NODE_252(p) SEQAN_PP_IIF(p(252), SEQAN_PP_NODE_250, SEQAN_PP_NODE_254) -# define SEQAN_PP_NODE_250(p) SEQAN_PP_IIF(p(250), SEQAN_PP_NODE_249, SEQAN_PP_NODE_251) -# define SEQAN_PP_NODE_249(p) SEQAN_PP_IIF(p(249), 249, 250) -# define SEQAN_PP_NODE_251(p) SEQAN_PP_IIF(p(251), 251, 252) -# define SEQAN_PP_NODE_254(p) SEQAN_PP_IIF(p(254), SEQAN_PP_NODE_253, SEQAN_PP_NODE_255) -# define SEQAN_PP_NODE_253(p) SEQAN_PP_IIF(p(253), 253, 254) -# define SEQAN_PP_NODE_255(p) SEQAN_PP_IIF(p(255), 255, 256) - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/logical/bool.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_LOGICAL_BOOL_HPP -// # define SEQAN_PREPROCESSOR_LOGICAL_BOOL_HPP -# -// # include -# -# /* SEQAN_PP_BOOL */ -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_BOOL(x) SEQAN_PP_BOOL_I(x) -// # else -// # define SEQAN_PP_BOOL(x) SEQAN_PP_BOOL_OO((x)) -// # define SEQAN_PP_BOOL_OO(par) SEQAN_PP_BOOL_I ## par -// # endif -# -# define SEQAN_PP_BOOL_I(x) SEQAN_PP_BOOL_ ## x -# -# define SEQAN_PP_BOOL_0 0 -# define SEQAN_PP_BOOL_1 1 -# define SEQAN_PP_BOOL_2 1 -# define SEQAN_PP_BOOL_3 1 -# define SEQAN_PP_BOOL_4 1 -# define SEQAN_PP_BOOL_5 1 -# define SEQAN_PP_BOOL_6 1 -# define SEQAN_PP_BOOL_7 1 -# define SEQAN_PP_BOOL_8 1 -# define SEQAN_PP_BOOL_9 1 -# define SEQAN_PP_BOOL_10 1 -# define SEQAN_PP_BOOL_11 1 -# define SEQAN_PP_BOOL_12 1 -# define SEQAN_PP_BOOL_13 1 -# define SEQAN_PP_BOOL_14 1 -# define SEQAN_PP_BOOL_15 1 -# define SEQAN_PP_BOOL_16 1 -# define SEQAN_PP_BOOL_17 1 -# define SEQAN_PP_BOOL_18 1 -# define SEQAN_PP_BOOL_19 1 -# define SEQAN_PP_BOOL_20 1 -# define SEQAN_PP_BOOL_21 1 -# define SEQAN_PP_BOOL_22 1 -# define SEQAN_PP_BOOL_23 1 -# define SEQAN_PP_BOOL_24 1 -# define SEQAN_PP_BOOL_25 1 -# define SEQAN_PP_BOOL_26 1 -# define SEQAN_PP_BOOL_27 1 -# define SEQAN_PP_BOOL_28 1 -# define SEQAN_PP_BOOL_29 1 -# define SEQAN_PP_BOOL_30 1 -# define SEQAN_PP_BOOL_31 1 -# define SEQAN_PP_BOOL_32 1 -# define SEQAN_PP_BOOL_33 1 -# define SEQAN_PP_BOOL_34 1 -# define SEQAN_PP_BOOL_35 1 -# define SEQAN_PP_BOOL_36 1 -# define SEQAN_PP_BOOL_37 1 -# define SEQAN_PP_BOOL_38 1 -# define SEQAN_PP_BOOL_39 1 -# define SEQAN_PP_BOOL_40 1 -# define SEQAN_PP_BOOL_41 1 -# define SEQAN_PP_BOOL_42 1 -# define SEQAN_PP_BOOL_43 1 -# define SEQAN_PP_BOOL_44 1 -# define SEQAN_PP_BOOL_45 1 -# define SEQAN_PP_BOOL_46 1 -# define SEQAN_PP_BOOL_47 1 -# define SEQAN_PP_BOOL_48 1 -# define SEQAN_PP_BOOL_49 1 -# define SEQAN_PP_BOOL_50 1 -# define SEQAN_PP_BOOL_51 1 -# define SEQAN_PP_BOOL_52 1 -# define SEQAN_PP_BOOL_53 1 -# define SEQAN_PP_BOOL_54 1 -# define SEQAN_PP_BOOL_55 1 -# define SEQAN_PP_BOOL_56 1 -# define SEQAN_PP_BOOL_57 1 -# define SEQAN_PP_BOOL_58 1 -# define SEQAN_PP_BOOL_59 1 -# define SEQAN_PP_BOOL_60 1 -# define SEQAN_PP_BOOL_61 1 -# define SEQAN_PP_BOOL_62 1 -# define SEQAN_PP_BOOL_63 1 -# define SEQAN_PP_BOOL_64 1 -# define SEQAN_PP_BOOL_65 1 -# define SEQAN_PP_BOOL_66 1 -# define SEQAN_PP_BOOL_67 1 -# define SEQAN_PP_BOOL_68 1 -# define SEQAN_PP_BOOL_69 1 -# define SEQAN_PP_BOOL_70 1 -# define SEQAN_PP_BOOL_71 1 -# define SEQAN_PP_BOOL_72 1 -# define SEQAN_PP_BOOL_73 1 -# define SEQAN_PP_BOOL_74 1 -# define SEQAN_PP_BOOL_75 1 -# define SEQAN_PP_BOOL_76 1 -# define SEQAN_PP_BOOL_77 1 -# define SEQAN_PP_BOOL_78 1 -# define SEQAN_PP_BOOL_79 1 -# define SEQAN_PP_BOOL_80 1 -# define SEQAN_PP_BOOL_81 1 -# define SEQAN_PP_BOOL_82 1 -# define SEQAN_PP_BOOL_83 1 -# define SEQAN_PP_BOOL_84 1 -# define SEQAN_PP_BOOL_85 1 -# define SEQAN_PP_BOOL_86 1 -# define SEQAN_PP_BOOL_87 1 -# define SEQAN_PP_BOOL_88 1 -# define SEQAN_PP_BOOL_89 1 -# define SEQAN_PP_BOOL_90 1 -# define SEQAN_PP_BOOL_91 1 -# define SEQAN_PP_BOOL_92 1 -# define SEQAN_PP_BOOL_93 1 -# define SEQAN_PP_BOOL_94 1 -# define SEQAN_PP_BOOL_95 1 -# define SEQAN_PP_BOOL_96 1 -# define SEQAN_PP_BOOL_97 1 -# define SEQAN_PP_BOOL_98 1 -# define SEQAN_PP_BOOL_99 1 -# define SEQAN_PP_BOOL_100 1 -# define SEQAN_PP_BOOL_101 1 -# define SEQAN_PP_BOOL_102 1 -# define SEQAN_PP_BOOL_103 1 -# define SEQAN_PP_BOOL_104 1 -# define SEQAN_PP_BOOL_105 1 -# define SEQAN_PP_BOOL_106 1 -# define SEQAN_PP_BOOL_107 1 -# define SEQAN_PP_BOOL_108 1 -# define SEQAN_PP_BOOL_109 1 -# define SEQAN_PP_BOOL_110 1 -# define SEQAN_PP_BOOL_111 1 -# define SEQAN_PP_BOOL_112 1 -# define SEQAN_PP_BOOL_113 1 -# define SEQAN_PP_BOOL_114 1 -# define SEQAN_PP_BOOL_115 1 -# define SEQAN_PP_BOOL_116 1 -# define SEQAN_PP_BOOL_117 1 -# define SEQAN_PP_BOOL_118 1 -# define SEQAN_PP_BOOL_119 1 -# define SEQAN_PP_BOOL_120 1 -# define SEQAN_PP_BOOL_121 1 -# define SEQAN_PP_BOOL_122 1 -# define SEQAN_PP_BOOL_123 1 -# define SEQAN_PP_BOOL_124 1 -# define SEQAN_PP_BOOL_125 1 -# define SEQAN_PP_BOOL_126 1 -# define SEQAN_PP_BOOL_127 1 -# define SEQAN_PP_BOOL_128 1 -# define SEQAN_PP_BOOL_129 1 -# define SEQAN_PP_BOOL_130 1 -# define SEQAN_PP_BOOL_131 1 -# define SEQAN_PP_BOOL_132 1 -# define SEQAN_PP_BOOL_133 1 -# define SEQAN_PP_BOOL_134 1 -# define SEQAN_PP_BOOL_135 1 -# define SEQAN_PP_BOOL_136 1 -# define SEQAN_PP_BOOL_137 1 -# define SEQAN_PP_BOOL_138 1 -# define SEQAN_PP_BOOL_139 1 -# define SEQAN_PP_BOOL_140 1 -# define SEQAN_PP_BOOL_141 1 -# define SEQAN_PP_BOOL_142 1 -# define SEQAN_PP_BOOL_143 1 -# define SEQAN_PP_BOOL_144 1 -# define SEQAN_PP_BOOL_145 1 -# define SEQAN_PP_BOOL_146 1 -# define SEQAN_PP_BOOL_147 1 -# define SEQAN_PP_BOOL_148 1 -# define SEQAN_PP_BOOL_149 1 -# define SEQAN_PP_BOOL_150 1 -# define SEQAN_PP_BOOL_151 1 -# define SEQAN_PP_BOOL_152 1 -# define SEQAN_PP_BOOL_153 1 -# define SEQAN_PP_BOOL_154 1 -# define SEQAN_PP_BOOL_155 1 -# define SEQAN_PP_BOOL_156 1 -# define SEQAN_PP_BOOL_157 1 -# define SEQAN_PP_BOOL_158 1 -# define SEQAN_PP_BOOL_159 1 -# define SEQAN_PP_BOOL_160 1 -# define SEQAN_PP_BOOL_161 1 -# define SEQAN_PP_BOOL_162 1 -# define SEQAN_PP_BOOL_163 1 -# define SEQAN_PP_BOOL_164 1 -# define SEQAN_PP_BOOL_165 1 -# define SEQAN_PP_BOOL_166 1 -# define SEQAN_PP_BOOL_167 1 -# define SEQAN_PP_BOOL_168 1 -# define SEQAN_PP_BOOL_169 1 -# define SEQAN_PP_BOOL_170 1 -# define SEQAN_PP_BOOL_171 1 -# define SEQAN_PP_BOOL_172 1 -# define SEQAN_PP_BOOL_173 1 -# define SEQAN_PP_BOOL_174 1 -# define SEQAN_PP_BOOL_175 1 -# define SEQAN_PP_BOOL_176 1 -# define SEQAN_PP_BOOL_177 1 -# define SEQAN_PP_BOOL_178 1 -# define SEQAN_PP_BOOL_179 1 -# define SEQAN_PP_BOOL_180 1 -# define SEQAN_PP_BOOL_181 1 -# define SEQAN_PP_BOOL_182 1 -# define SEQAN_PP_BOOL_183 1 -# define SEQAN_PP_BOOL_184 1 -# define SEQAN_PP_BOOL_185 1 -# define SEQAN_PP_BOOL_186 1 -# define SEQAN_PP_BOOL_187 1 -# define SEQAN_PP_BOOL_188 1 -# define SEQAN_PP_BOOL_189 1 -# define SEQAN_PP_BOOL_190 1 -# define SEQAN_PP_BOOL_191 1 -# define SEQAN_PP_BOOL_192 1 -# define SEQAN_PP_BOOL_193 1 -# define SEQAN_PP_BOOL_194 1 -# define SEQAN_PP_BOOL_195 1 -# define SEQAN_PP_BOOL_196 1 -# define SEQAN_PP_BOOL_197 1 -# define SEQAN_PP_BOOL_198 1 -# define SEQAN_PP_BOOL_199 1 -# define SEQAN_PP_BOOL_200 1 -# define SEQAN_PP_BOOL_201 1 -# define SEQAN_PP_BOOL_202 1 -# define SEQAN_PP_BOOL_203 1 -# define SEQAN_PP_BOOL_204 1 -# define SEQAN_PP_BOOL_205 1 -# define SEQAN_PP_BOOL_206 1 -# define SEQAN_PP_BOOL_207 1 -# define SEQAN_PP_BOOL_208 1 -# define SEQAN_PP_BOOL_209 1 -# define SEQAN_PP_BOOL_210 1 -# define SEQAN_PP_BOOL_211 1 -# define SEQAN_PP_BOOL_212 1 -# define SEQAN_PP_BOOL_213 1 -# define SEQAN_PP_BOOL_214 1 -# define SEQAN_PP_BOOL_215 1 -# define SEQAN_PP_BOOL_216 1 -# define SEQAN_PP_BOOL_217 1 -# define SEQAN_PP_BOOL_218 1 -# define SEQAN_PP_BOOL_219 1 -# define SEQAN_PP_BOOL_220 1 -# define SEQAN_PP_BOOL_221 1 -# define SEQAN_PP_BOOL_222 1 -# define SEQAN_PP_BOOL_223 1 -# define SEQAN_PP_BOOL_224 1 -# define SEQAN_PP_BOOL_225 1 -# define SEQAN_PP_BOOL_226 1 -# define SEQAN_PP_BOOL_227 1 -# define SEQAN_PP_BOOL_228 1 -# define SEQAN_PP_BOOL_229 1 -# define SEQAN_PP_BOOL_230 1 -# define SEQAN_PP_BOOL_231 1 -# define SEQAN_PP_BOOL_232 1 -# define SEQAN_PP_BOOL_233 1 -# define SEQAN_PP_BOOL_234 1 -# define SEQAN_PP_BOOL_235 1 -# define SEQAN_PP_BOOL_236 1 -# define SEQAN_PP_BOOL_237 1 -# define SEQAN_PP_BOOL_238 1 -# define SEQAN_PP_BOOL_239 1 -# define SEQAN_PP_BOOL_240 1 -# define SEQAN_PP_BOOL_241 1 -# define SEQAN_PP_BOOL_242 1 -# define SEQAN_PP_BOOL_243 1 -# define SEQAN_PP_BOOL_244 1 -# define SEQAN_PP_BOOL_245 1 -# define SEQAN_PP_BOOL_246 1 -# define SEQAN_PP_BOOL_247 1 -# define SEQAN_PP_BOOL_248 1 -# define SEQAN_PP_BOOL_249 1 -# define SEQAN_PP_BOOL_250 1 -# define SEQAN_PP_BOOL_251 1 -# define SEQAN_PP_BOOL_252 1 -# define SEQAN_PP_BOOL_253 1 -# define SEQAN_PP_BOOL_254 1 -# define SEQAN_PP_BOOL_255 1 -# define SEQAN_PP_BOOL_256 1 - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/control/expr_iif.hpp <== -// -------------------------------------------------------------------------- - -# /* ************************************************************************** -# * * -# * (C) Copyright Paul Mensonides 2002. -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# * * -# ************************************************************************** */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_CONTROL_EXPR_IIF_HPP -// # define SEQAN_PREPROCESSOR_CONTROL_EXPR_IIF_HPP -# -// # include -# -# /* SEQAN_PP_EXPR_IIF */ -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_EXPR_IIF(bit, expr) SEQAN_PP_EXPR_IIF_I(bit, expr) -// # else -// # define SEQAN_PP_EXPR_IIF(bit, expr) SEQAN_PP_EXPR_IIF_OO((bit, expr)) -// # define SEQAN_PP_EXPR_IIF_OO(par) SEQAN_PP_EXPR_IIF_I ## par -// # endif -# -# define SEQAN_PP_EXPR_IIF_I(bit, expr) SEQAN_PP_EXPR_IIF_ ## bit(expr) -# -# define SEQAN_PP_EXPR_IIF_0(expr) -# define SEQAN_PP_EXPR_IIF_1(expr) expr -# -// # endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/control/iif.hpp <== -// -------------------------------------------------------------------------- - -# /* ************************************************************************** -# * * -# * (C) Copyright Paul Mensonides 2002. -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# * * -# ************************************************************************** */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_CONTROL_IIF_HPP -// # define SEQAN_PREPROCESSOR_CONTROL_IIF_HPP -# -// # include -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_IIF(bit, t, f) SEQAN_PP_IIF_I(bit, t, f) -// # else -// # define SEQAN_PP_IIF(bit, t, f) SEQAN_PP_IIF_OO((bit, t, f)) -// # define SEQAN_PP_IIF_OO(par) SEQAN_PP_IIF_I ## par -// # endif -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MSVC() -#ifndef PLATFORM_WINDOWS_VS -# define SEQAN_PP_IIF_I(bit, t, f) SEQAN_PP_IIF_ ## bit(t, f) -# else // #ifndef PLATFORM_WINDOWS_VS -# define SEQAN_PP_IIF_I(bit, t, f) SEQAN_PP_IIF_II(SEQAN_PP_IIF_ ## bit(t, f)) -# define SEQAN_PP_IIF_II(id) id -# endif // #ifndef PLATFORM_WINDOWS_VS -# -# define SEQAN_PP_IIF_0(t, f) f -# define SEQAN_PP_IIF_1(t, f) t -# -// # endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/control/if.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -//# ifndef SEQAN_PREPROCESSOR_CONTROL_IF_HPP -//# define SEQAN_PREPROCESSOR_CONTROL_IF_HPP -# -//# include -//# include -//# include -# -# /* SEQAN_PP_IF */ -# -//# if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() -# define SEQAN_PP_IF(cond, t, f) SEQAN_PP_IIF(SEQAN_PP_BOOL(cond), t, f) -//# else -//# define SEQAN_PP_IF(cond, t, f) SEQAN_PP_IF_I(cond, t, f) -//# define SEQAN_PP_IF_I(cond, t, f) SEQAN_PP_IIF(SEQAN_PP_BOOL(cond), t, f) -//# endif -# -//# endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/facilities/empty.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -//# ifndef SEQAN_PREPROCESSOR_FACILITIES_EMPTY_HPP -//# define SEQAN_PREPROCESSOR_FACILITIES_EMPTY_HPP -# -# /* SEQAN_PP_EMPTY */ -# -# define SEQAN_PP_EMPTY() -# -//# endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/punctuation/comma.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -//# ifndef SEQAN_PREPROCESSOR_PUNCTUATION_COMMA_HPP -//# define SEQAN_PREPROCESSOR_PUNCTUATION_COMMA_HPP -# -# /* SEQAN_PP_COMMA */ -# -# define SEQAN_PP_COMMA() , -# -//# endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/punctuation/comma_if.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -//# ifndef SEQAN_PREPROCESSOR_PUNCTUATION_COMMA_IF_HPP -//# define SEQAN_PREPROCESSOR_PUNCTUATION_COMMA_IF_HPP -# -//# include -//# include -//# include -//# include -# -# /* SEQAN_PP_COMMA_IF */ -# -//# if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() -# define SEQAN_PP_COMMA_IF(cond) SEQAN_PP_IF(cond, SEQAN_PP_COMMA, SEQAN_PP_EMPTY)() -//# else -//# define SEQAN_PP_COMMA_IF(cond) SEQAN_PP_COMMA_IF_I(cond) -//# define SEQAN_PP_COMMA_IF_I(cond) SEQAN_PP_IF(cond, SEQAN_PP_COMMA, SEQAN_PP_EMPTY)() -//# endif -# -//# endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/repetition/repeat.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -//# ifndef SEQAN_PREPROCESSOR_REPETITION_REPEAT_HPP -//# define SEQAN_PREPROCESSOR_REPETITION_REPEAT_HPP -# -//# include -//# include -//# include -//# include -//# include -# -# /* SEQAN_PP_REPEAT */ -# -# if 0 -# define SEQAN_PP_REPEAT(count, macro, data) -# endif -# -# define SEQAN_PP_REPEAT SEQAN_PP_CAT(SEQAN_PP_REPEAT_, SEQAN_PP_AUTO_REC(SEQAN_PP_REPEAT_P, 4)) -# -# define SEQAN_PP_REPEAT_P(n) SEQAN_PP_CAT(SEQAN_PP_REPEAT_CHECK_, SEQAN_PP_REPEAT_ ## n(1, SEQAN_PP_NIL SEQAN_PP_TUPLE_EAT_3, SEQAN_PP_NIL)) -# -# define SEQAN_PP_REPEAT_CHECK_SEQAN_PP_NIL 1 -# define SEQAN_PP_REPEAT_CHECK_SEQAN_PP_REPEAT_1(c, m, d) 0 -# define SEQAN_PP_REPEAT_CHECK_SEQAN_PP_REPEAT_2(c, m, d) 0 -# define SEQAN_PP_REPEAT_CHECK_SEQAN_PP_REPEAT_3(c, m, d) 0 -# -# define SEQAN_PP_REPEAT_1(c, m, d) SEQAN_PP_REPEAT_1_I(c, m, d) -# define SEQAN_PP_REPEAT_2(c, m, d) SEQAN_PP_REPEAT_2_I(c, m, d) -# define SEQAN_PP_REPEAT_3(c, m, d) SEQAN_PP_REPEAT_3_I(c, m, d) -# define SEQAN_PP_REPEAT_4(c, m, d) SEQAN_PP_ERROR(0x0003) -# -# define SEQAN_PP_REPEAT_1_I(c, m, d) SEQAN_PP_REPEAT_1_ ## c(m, d) -# define SEQAN_PP_REPEAT_2_I(c, m, d) SEQAN_PP_REPEAT_2_ ## c(m, d) -# define SEQAN_PP_REPEAT_3_I(c, m, d) SEQAN_PP_REPEAT_3_ ## c(m, d) -# -# define SEQAN_PP_REPEAT_1ST SEQAN_PP_REPEAT_1 -# define SEQAN_PP_REPEAT_2ND SEQAN_PP_REPEAT_2 -# define SEQAN_PP_REPEAT_3RD SEQAN_PP_REPEAT_3 -# -# define SEQAN_PP_REPEAT_1_0(m, d) -# define SEQAN_PP_REPEAT_1_1(m, d) m(2, 0, d) -# define SEQAN_PP_REPEAT_1_2(m, d) SEQAN_PP_REPEAT_1_1(m, d) m(2, 1, d) -# define SEQAN_PP_REPEAT_1_3(m, d) SEQAN_PP_REPEAT_1_2(m, d) m(2, 2, d) -# define SEQAN_PP_REPEAT_1_4(m, d) SEQAN_PP_REPEAT_1_3(m, d) m(2, 3, d) -# define SEQAN_PP_REPEAT_1_5(m, d) SEQAN_PP_REPEAT_1_4(m, d) m(2, 4, d) -# define SEQAN_PP_REPEAT_1_6(m, d) SEQAN_PP_REPEAT_1_5(m, d) m(2, 5, d) -# define SEQAN_PP_REPEAT_1_7(m, d) SEQAN_PP_REPEAT_1_6(m, d) m(2, 6, d) -# define SEQAN_PP_REPEAT_1_8(m, d) SEQAN_PP_REPEAT_1_7(m, d) m(2, 7, d) -# define SEQAN_PP_REPEAT_1_9(m, d) SEQAN_PP_REPEAT_1_8(m, d) m(2, 8, d) -# define SEQAN_PP_REPEAT_1_10(m, d) SEQAN_PP_REPEAT_1_9(m, d) m(2, 9, d) -# define SEQAN_PP_REPEAT_1_11(m, d) SEQAN_PP_REPEAT_1_10(m, d) m(2, 10, d) -# define SEQAN_PP_REPEAT_1_12(m, d) SEQAN_PP_REPEAT_1_11(m, d) m(2, 11, d) -# define SEQAN_PP_REPEAT_1_13(m, d) SEQAN_PP_REPEAT_1_12(m, d) m(2, 12, d) -# define SEQAN_PP_REPEAT_1_14(m, d) SEQAN_PP_REPEAT_1_13(m, d) m(2, 13, d) -# define SEQAN_PP_REPEAT_1_15(m, d) SEQAN_PP_REPEAT_1_14(m, d) m(2, 14, d) -# define SEQAN_PP_REPEAT_1_16(m, d) SEQAN_PP_REPEAT_1_15(m, d) m(2, 15, d) -# define SEQAN_PP_REPEAT_1_17(m, d) SEQAN_PP_REPEAT_1_16(m, d) m(2, 16, d) -# define SEQAN_PP_REPEAT_1_18(m, d) SEQAN_PP_REPEAT_1_17(m, d) m(2, 17, d) -# define SEQAN_PP_REPEAT_1_19(m, d) SEQAN_PP_REPEAT_1_18(m, d) m(2, 18, d) -# define SEQAN_PP_REPEAT_1_20(m, d) SEQAN_PP_REPEAT_1_19(m, d) m(2, 19, d) -# define SEQAN_PP_REPEAT_1_21(m, d) SEQAN_PP_REPEAT_1_20(m, d) m(2, 20, d) -# define SEQAN_PP_REPEAT_1_22(m, d) SEQAN_PP_REPEAT_1_21(m, d) m(2, 21, d) -# define SEQAN_PP_REPEAT_1_23(m, d) SEQAN_PP_REPEAT_1_22(m, d) m(2, 22, d) -# define SEQAN_PP_REPEAT_1_24(m, d) SEQAN_PP_REPEAT_1_23(m, d) m(2, 23, d) -# define SEQAN_PP_REPEAT_1_25(m, d) SEQAN_PP_REPEAT_1_24(m, d) m(2, 24, d) -# define SEQAN_PP_REPEAT_1_26(m, d) SEQAN_PP_REPEAT_1_25(m, d) m(2, 25, d) -# define SEQAN_PP_REPEAT_1_27(m, d) SEQAN_PP_REPEAT_1_26(m, d) m(2, 26, d) -# define SEQAN_PP_REPEAT_1_28(m, d) SEQAN_PP_REPEAT_1_27(m, d) m(2, 27, d) -# define SEQAN_PP_REPEAT_1_29(m, d) SEQAN_PP_REPEAT_1_28(m, d) m(2, 28, d) -# define SEQAN_PP_REPEAT_1_30(m, d) SEQAN_PP_REPEAT_1_29(m, d) m(2, 29, d) -# define SEQAN_PP_REPEAT_1_31(m, d) SEQAN_PP_REPEAT_1_30(m, d) m(2, 30, d) -# define SEQAN_PP_REPEAT_1_32(m, d) SEQAN_PP_REPEAT_1_31(m, d) m(2, 31, d) -# define SEQAN_PP_REPEAT_1_33(m, d) SEQAN_PP_REPEAT_1_32(m, d) m(2, 32, d) -# define SEQAN_PP_REPEAT_1_34(m, d) SEQAN_PP_REPEAT_1_33(m, d) m(2, 33, d) -# define SEQAN_PP_REPEAT_1_35(m, d) SEQAN_PP_REPEAT_1_34(m, d) m(2, 34, d) -# define SEQAN_PP_REPEAT_1_36(m, d) SEQAN_PP_REPEAT_1_35(m, d) m(2, 35, d) -# define SEQAN_PP_REPEAT_1_37(m, d) SEQAN_PP_REPEAT_1_36(m, d) m(2, 36, d) -# define SEQAN_PP_REPEAT_1_38(m, d) SEQAN_PP_REPEAT_1_37(m, d) m(2, 37, d) -# define SEQAN_PP_REPEAT_1_39(m, d) SEQAN_PP_REPEAT_1_38(m, d) m(2, 38, d) -# define SEQAN_PP_REPEAT_1_40(m, d) SEQAN_PP_REPEAT_1_39(m, d) m(2, 39, d) -# define SEQAN_PP_REPEAT_1_41(m, d) SEQAN_PP_REPEAT_1_40(m, d) m(2, 40, d) -# define SEQAN_PP_REPEAT_1_42(m, d) SEQAN_PP_REPEAT_1_41(m, d) m(2, 41, d) -# define SEQAN_PP_REPEAT_1_43(m, d) SEQAN_PP_REPEAT_1_42(m, d) m(2, 42, d) -# define SEQAN_PP_REPEAT_1_44(m, d) SEQAN_PP_REPEAT_1_43(m, d) m(2, 43, d) -# define SEQAN_PP_REPEAT_1_45(m, d) SEQAN_PP_REPEAT_1_44(m, d) m(2, 44, d) -# define SEQAN_PP_REPEAT_1_46(m, d) SEQAN_PP_REPEAT_1_45(m, d) m(2, 45, d) -# define SEQAN_PP_REPEAT_1_47(m, d) SEQAN_PP_REPEAT_1_46(m, d) m(2, 46, d) -# define SEQAN_PP_REPEAT_1_48(m, d) SEQAN_PP_REPEAT_1_47(m, d) m(2, 47, d) -# define SEQAN_PP_REPEAT_1_49(m, d) SEQAN_PP_REPEAT_1_48(m, d) m(2, 48, d) -# define SEQAN_PP_REPEAT_1_50(m, d) SEQAN_PP_REPEAT_1_49(m, d) m(2, 49, d) -# define SEQAN_PP_REPEAT_1_51(m, d) SEQAN_PP_REPEAT_1_50(m, d) m(2, 50, d) -# define SEQAN_PP_REPEAT_1_52(m, d) SEQAN_PP_REPEAT_1_51(m, d) m(2, 51, d) -# define SEQAN_PP_REPEAT_1_53(m, d) SEQAN_PP_REPEAT_1_52(m, d) m(2, 52, d) -# define SEQAN_PP_REPEAT_1_54(m, d) SEQAN_PP_REPEAT_1_53(m, d) m(2, 53, d) -# define SEQAN_PP_REPEAT_1_55(m, d) SEQAN_PP_REPEAT_1_54(m, d) m(2, 54, d) -# define SEQAN_PP_REPEAT_1_56(m, d) SEQAN_PP_REPEAT_1_55(m, d) m(2, 55, d) -# define SEQAN_PP_REPEAT_1_57(m, d) SEQAN_PP_REPEAT_1_56(m, d) m(2, 56, d) -# define SEQAN_PP_REPEAT_1_58(m, d) SEQAN_PP_REPEAT_1_57(m, d) m(2, 57, d) -# define SEQAN_PP_REPEAT_1_59(m, d) SEQAN_PP_REPEAT_1_58(m, d) m(2, 58, d) -# define SEQAN_PP_REPEAT_1_60(m, d) SEQAN_PP_REPEAT_1_59(m, d) m(2, 59, d) -# define SEQAN_PP_REPEAT_1_61(m, d) SEQAN_PP_REPEAT_1_60(m, d) m(2, 60, d) -# define SEQAN_PP_REPEAT_1_62(m, d) SEQAN_PP_REPEAT_1_61(m, d) m(2, 61, d) -# define SEQAN_PP_REPEAT_1_63(m, d) SEQAN_PP_REPEAT_1_62(m, d) m(2, 62, d) -# define SEQAN_PP_REPEAT_1_64(m, d) SEQAN_PP_REPEAT_1_63(m, d) m(2, 63, d) -# define SEQAN_PP_REPEAT_1_65(m, d) SEQAN_PP_REPEAT_1_64(m, d) m(2, 64, d) -# define SEQAN_PP_REPEAT_1_66(m, d) SEQAN_PP_REPEAT_1_65(m, d) m(2, 65, d) -# define SEQAN_PP_REPEAT_1_67(m, d) SEQAN_PP_REPEAT_1_66(m, d) m(2, 66, d) -# define SEQAN_PP_REPEAT_1_68(m, d) SEQAN_PP_REPEAT_1_67(m, d) m(2, 67, d) -# define SEQAN_PP_REPEAT_1_69(m, d) SEQAN_PP_REPEAT_1_68(m, d) m(2, 68, d) -# define SEQAN_PP_REPEAT_1_70(m, d) SEQAN_PP_REPEAT_1_69(m, d) m(2, 69, d) -# define SEQAN_PP_REPEAT_1_71(m, d) SEQAN_PP_REPEAT_1_70(m, d) m(2, 70, d) -# define SEQAN_PP_REPEAT_1_72(m, d) SEQAN_PP_REPEAT_1_71(m, d) m(2, 71, d) -# define SEQAN_PP_REPEAT_1_73(m, d) SEQAN_PP_REPEAT_1_72(m, d) m(2, 72, d) -# define SEQAN_PP_REPEAT_1_74(m, d) SEQAN_PP_REPEAT_1_73(m, d) m(2, 73, d) -# define SEQAN_PP_REPEAT_1_75(m, d) SEQAN_PP_REPEAT_1_74(m, d) m(2, 74, d) -# define SEQAN_PP_REPEAT_1_76(m, d) SEQAN_PP_REPEAT_1_75(m, d) m(2, 75, d) -# define SEQAN_PP_REPEAT_1_77(m, d) SEQAN_PP_REPEAT_1_76(m, d) m(2, 76, d) -# define SEQAN_PP_REPEAT_1_78(m, d) SEQAN_PP_REPEAT_1_77(m, d) m(2, 77, d) -# define SEQAN_PP_REPEAT_1_79(m, d) SEQAN_PP_REPEAT_1_78(m, d) m(2, 78, d) -# define SEQAN_PP_REPEAT_1_80(m, d) SEQAN_PP_REPEAT_1_79(m, d) m(2, 79, d) -# define SEQAN_PP_REPEAT_1_81(m, d) SEQAN_PP_REPEAT_1_80(m, d) m(2, 80, d) -# define SEQAN_PP_REPEAT_1_82(m, d) SEQAN_PP_REPEAT_1_81(m, d) m(2, 81, d) -# define SEQAN_PP_REPEAT_1_83(m, d) SEQAN_PP_REPEAT_1_82(m, d) m(2, 82, d) -# define SEQAN_PP_REPEAT_1_84(m, d) SEQAN_PP_REPEAT_1_83(m, d) m(2, 83, d) -# define SEQAN_PP_REPEAT_1_85(m, d) SEQAN_PP_REPEAT_1_84(m, d) m(2, 84, d) -# define SEQAN_PP_REPEAT_1_86(m, d) SEQAN_PP_REPEAT_1_85(m, d) m(2, 85, d) -# define SEQAN_PP_REPEAT_1_87(m, d) SEQAN_PP_REPEAT_1_86(m, d) m(2, 86, d) -# define SEQAN_PP_REPEAT_1_88(m, d) SEQAN_PP_REPEAT_1_87(m, d) m(2, 87, d) -# define SEQAN_PP_REPEAT_1_89(m, d) SEQAN_PP_REPEAT_1_88(m, d) m(2, 88, d) -# define SEQAN_PP_REPEAT_1_90(m, d) SEQAN_PP_REPEAT_1_89(m, d) m(2, 89, d) -# define SEQAN_PP_REPEAT_1_91(m, d) SEQAN_PP_REPEAT_1_90(m, d) m(2, 90, d) -# define SEQAN_PP_REPEAT_1_92(m, d) SEQAN_PP_REPEAT_1_91(m, d) m(2, 91, d) -# define SEQAN_PP_REPEAT_1_93(m, d) SEQAN_PP_REPEAT_1_92(m, d) m(2, 92, d) -# define SEQAN_PP_REPEAT_1_94(m, d) SEQAN_PP_REPEAT_1_93(m, d) m(2, 93, d) -# define SEQAN_PP_REPEAT_1_95(m, d) SEQAN_PP_REPEAT_1_94(m, d) m(2, 94, d) -# define SEQAN_PP_REPEAT_1_96(m, d) SEQAN_PP_REPEAT_1_95(m, d) m(2, 95, d) -# define SEQAN_PP_REPEAT_1_97(m, d) SEQAN_PP_REPEAT_1_96(m, d) m(2, 96, d) -# define SEQAN_PP_REPEAT_1_98(m, d) SEQAN_PP_REPEAT_1_97(m, d) m(2, 97, d) -# define SEQAN_PP_REPEAT_1_99(m, d) SEQAN_PP_REPEAT_1_98(m, d) m(2, 98, d) -# define SEQAN_PP_REPEAT_1_100(m, d) SEQAN_PP_REPEAT_1_99(m, d) m(2, 99, d) -# define SEQAN_PP_REPEAT_1_101(m, d) SEQAN_PP_REPEAT_1_100(m, d) m(2, 100, d) -# define SEQAN_PP_REPEAT_1_102(m, d) SEQAN_PP_REPEAT_1_101(m, d) m(2, 101, d) -# define SEQAN_PP_REPEAT_1_103(m, d) SEQAN_PP_REPEAT_1_102(m, d) m(2, 102, d) -# define SEQAN_PP_REPEAT_1_104(m, d) SEQAN_PP_REPEAT_1_103(m, d) m(2, 103, d) -# define SEQAN_PP_REPEAT_1_105(m, d) SEQAN_PP_REPEAT_1_104(m, d) m(2, 104, d) -# define SEQAN_PP_REPEAT_1_106(m, d) SEQAN_PP_REPEAT_1_105(m, d) m(2, 105, d) -# define SEQAN_PP_REPEAT_1_107(m, d) SEQAN_PP_REPEAT_1_106(m, d) m(2, 106, d) -# define SEQAN_PP_REPEAT_1_108(m, d) SEQAN_PP_REPEAT_1_107(m, d) m(2, 107, d) -# define SEQAN_PP_REPEAT_1_109(m, d) SEQAN_PP_REPEAT_1_108(m, d) m(2, 108, d) -# define SEQAN_PP_REPEAT_1_110(m, d) SEQAN_PP_REPEAT_1_109(m, d) m(2, 109, d) -# define SEQAN_PP_REPEAT_1_111(m, d) SEQAN_PP_REPEAT_1_110(m, d) m(2, 110, d) -# define SEQAN_PP_REPEAT_1_112(m, d) SEQAN_PP_REPEAT_1_111(m, d) m(2, 111, d) -# define SEQAN_PP_REPEAT_1_113(m, d) SEQAN_PP_REPEAT_1_112(m, d) m(2, 112, d) -# define SEQAN_PP_REPEAT_1_114(m, d) SEQAN_PP_REPEAT_1_113(m, d) m(2, 113, d) -# define SEQAN_PP_REPEAT_1_115(m, d) SEQAN_PP_REPEAT_1_114(m, d) m(2, 114, d) -# define SEQAN_PP_REPEAT_1_116(m, d) SEQAN_PP_REPEAT_1_115(m, d) m(2, 115, d) -# define SEQAN_PP_REPEAT_1_117(m, d) SEQAN_PP_REPEAT_1_116(m, d) m(2, 116, d) -# define SEQAN_PP_REPEAT_1_118(m, d) SEQAN_PP_REPEAT_1_117(m, d) m(2, 117, d) -# define SEQAN_PP_REPEAT_1_119(m, d) SEQAN_PP_REPEAT_1_118(m, d) m(2, 118, d) -# define SEQAN_PP_REPEAT_1_120(m, d) SEQAN_PP_REPEAT_1_119(m, d) m(2, 119, d) -# define SEQAN_PP_REPEAT_1_121(m, d) SEQAN_PP_REPEAT_1_120(m, d) m(2, 120, d) -# define SEQAN_PP_REPEAT_1_122(m, d) SEQAN_PP_REPEAT_1_121(m, d) m(2, 121, d) -# define SEQAN_PP_REPEAT_1_123(m, d) SEQAN_PP_REPEAT_1_122(m, d) m(2, 122, d) -# define SEQAN_PP_REPEAT_1_124(m, d) SEQAN_PP_REPEAT_1_123(m, d) m(2, 123, d) -# define SEQAN_PP_REPEAT_1_125(m, d) SEQAN_PP_REPEAT_1_124(m, d) m(2, 124, d) -# define SEQAN_PP_REPEAT_1_126(m, d) SEQAN_PP_REPEAT_1_125(m, d) m(2, 125, d) -# define SEQAN_PP_REPEAT_1_127(m, d) SEQAN_PP_REPEAT_1_126(m, d) m(2, 126, d) -# define SEQAN_PP_REPEAT_1_128(m, d) SEQAN_PP_REPEAT_1_127(m, d) m(2, 127, d) -# define SEQAN_PP_REPEAT_1_129(m, d) SEQAN_PP_REPEAT_1_128(m, d) m(2, 128, d) -# define SEQAN_PP_REPEAT_1_130(m, d) SEQAN_PP_REPEAT_1_129(m, d) m(2, 129, d) -# define SEQAN_PP_REPEAT_1_131(m, d) SEQAN_PP_REPEAT_1_130(m, d) m(2, 130, d) -# define SEQAN_PP_REPEAT_1_132(m, d) SEQAN_PP_REPEAT_1_131(m, d) m(2, 131, d) -# define SEQAN_PP_REPEAT_1_133(m, d) SEQAN_PP_REPEAT_1_132(m, d) m(2, 132, d) -# define SEQAN_PP_REPEAT_1_134(m, d) SEQAN_PP_REPEAT_1_133(m, d) m(2, 133, d) -# define SEQAN_PP_REPEAT_1_135(m, d) SEQAN_PP_REPEAT_1_134(m, d) m(2, 134, d) -# define SEQAN_PP_REPEAT_1_136(m, d) SEQAN_PP_REPEAT_1_135(m, d) m(2, 135, d) -# define SEQAN_PP_REPEAT_1_137(m, d) SEQAN_PP_REPEAT_1_136(m, d) m(2, 136, d) -# define SEQAN_PP_REPEAT_1_138(m, d) SEQAN_PP_REPEAT_1_137(m, d) m(2, 137, d) -# define SEQAN_PP_REPEAT_1_139(m, d) SEQAN_PP_REPEAT_1_138(m, d) m(2, 138, d) -# define SEQAN_PP_REPEAT_1_140(m, d) SEQAN_PP_REPEAT_1_139(m, d) m(2, 139, d) -# define SEQAN_PP_REPEAT_1_141(m, d) SEQAN_PP_REPEAT_1_140(m, d) m(2, 140, d) -# define SEQAN_PP_REPEAT_1_142(m, d) SEQAN_PP_REPEAT_1_141(m, d) m(2, 141, d) -# define SEQAN_PP_REPEAT_1_143(m, d) SEQAN_PP_REPEAT_1_142(m, d) m(2, 142, d) -# define SEQAN_PP_REPEAT_1_144(m, d) SEQAN_PP_REPEAT_1_143(m, d) m(2, 143, d) -# define SEQAN_PP_REPEAT_1_145(m, d) SEQAN_PP_REPEAT_1_144(m, d) m(2, 144, d) -# define SEQAN_PP_REPEAT_1_146(m, d) SEQAN_PP_REPEAT_1_145(m, d) m(2, 145, d) -# define SEQAN_PP_REPEAT_1_147(m, d) SEQAN_PP_REPEAT_1_146(m, d) m(2, 146, d) -# define SEQAN_PP_REPEAT_1_148(m, d) SEQAN_PP_REPEAT_1_147(m, d) m(2, 147, d) -# define SEQAN_PP_REPEAT_1_149(m, d) SEQAN_PP_REPEAT_1_148(m, d) m(2, 148, d) -# define SEQAN_PP_REPEAT_1_150(m, d) SEQAN_PP_REPEAT_1_149(m, d) m(2, 149, d) -# define SEQAN_PP_REPEAT_1_151(m, d) SEQAN_PP_REPEAT_1_150(m, d) m(2, 150, d) -# define SEQAN_PP_REPEAT_1_152(m, d) SEQAN_PP_REPEAT_1_151(m, d) m(2, 151, d) -# define SEQAN_PP_REPEAT_1_153(m, d) SEQAN_PP_REPEAT_1_152(m, d) m(2, 152, d) -# define SEQAN_PP_REPEAT_1_154(m, d) SEQAN_PP_REPEAT_1_153(m, d) m(2, 153, d) -# define SEQAN_PP_REPEAT_1_155(m, d) SEQAN_PP_REPEAT_1_154(m, d) m(2, 154, d) -# define SEQAN_PP_REPEAT_1_156(m, d) SEQAN_PP_REPEAT_1_155(m, d) m(2, 155, d) -# define SEQAN_PP_REPEAT_1_157(m, d) SEQAN_PP_REPEAT_1_156(m, d) m(2, 156, d) -# define SEQAN_PP_REPEAT_1_158(m, d) SEQAN_PP_REPEAT_1_157(m, d) m(2, 157, d) -# define SEQAN_PP_REPEAT_1_159(m, d) SEQAN_PP_REPEAT_1_158(m, d) m(2, 158, d) -# define SEQAN_PP_REPEAT_1_160(m, d) SEQAN_PP_REPEAT_1_159(m, d) m(2, 159, d) -# define SEQAN_PP_REPEAT_1_161(m, d) SEQAN_PP_REPEAT_1_160(m, d) m(2, 160, d) -# define SEQAN_PP_REPEAT_1_162(m, d) SEQAN_PP_REPEAT_1_161(m, d) m(2, 161, d) -# define SEQAN_PP_REPEAT_1_163(m, d) SEQAN_PP_REPEAT_1_162(m, d) m(2, 162, d) -# define SEQAN_PP_REPEAT_1_164(m, d) SEQAN_PP_REPEAT_1_163(m, d) m(2, 163, d) -# define SEQAN_PP_REPEAT_1_165(m, d) SEQAN_PP_REPEAT_1_164(m, d) m(2, 164, d) -# define SEQAN_PP_REPEAT_1_166(m, d) SEQAN_PP_REPEAT_1_165(m, d) m(2, 165, d) -# define SEQAN_PP_REPEAT_1_167(m, d) SEQAN_PP_REPEAT_1_166(m, d) m(2, 166, d) -# define SEQAN_PP_REPEAT_1_168(m, d) SEQAN_PP_REPEAT_1_167(m, d) m(2, 167, d) -# define SEQAN_PP_REPEAT_1_169(m, d) SEQAN_PP_REPEAT_1_168(m, d) m(2, 168, d) -# define SEQAN_PP_REPEAT_1_170(m, d) SEQAN_PP_REPEAT_1_169(m, d) m(2, 169, d) -# define SEQAN_PP_REPEAT_1_171(m, d) SEQAN_PP_REPEAT_1_170(m, d) m(2, 170, d) -# define SEQAN_PP_REPEAT_1_172(m, d) SEQAN_PP_REPEAT_1_171(m, d) m(2, 171, d) -# define SEQAN_PP_REPEAT_1_173(m, d) SEQAN_PP_REPEAT_1_172(m, d) m(2, 172, d) -# define SEQAN_PP_REPEAT_1_174(m, d) SEQAN_PP_REPEAT_1_173(m, d) m(2, 173, d) -# define SEQAN_PP_REPEAT_1_175(m, d) SEQAN_PP_REPEAT_1_174(m, d) m(2, 174, d) -# define SEQAN_PP_REPEAT_1_176(m, d) SEQAN_PP_REPEAT_1_175(m, d) m(2, 175, d) -# define SEQAN_PP_REPEAT_1_177(m, d) SEQAN_PP_REPEAT_1_176(m, d) m(2, 176, d) -# define SEQAN_PP_REPEAT_1_178(m, d) SEQAN_PP_REPEAT_1_177(m, d) m(2, 177, d) -# define SEQAN_PP_REPEAT_1_179(m, d) SEQAN_PP_REPEAT_1_178(m, d) m(2, 178, d) -# define SEQAN_PP_REPEAT_1_180(m, d) SEQAN_PP_REPEAT_1_179(m, d) m(2, 179, d) -# define SEQAN_PP_REPEAT_1_181(m, d) SEQAN_PP_REPEAT_1_180(m, d) m(2, 180, d) -# define SEQAN_PP_REPEAT_1_182(m, d) SEQAN_PP_REPEAT_1_181(m, d) m(2, 181, d) -# define SEQAN_PP_REPEAT_1_183(m, d) SEQAN_PP_REPEAT_1_182(m, d) m(2, 182, d) -# define SEQAN_PP_REPEAT_1_184(m, d) SEQAN_PP_REPEAT_1_183(m, d) m(2, 183, d) -# define SEQAN_PP_REPEAT_1_185(m, d) SEQAN_PP_REPEAT_1_184(m, d) m(2, 184, d) -# define SEQAN_PP_REPEAT_1_186(m, d) SEQAN_PP_REPEAT_1_185(m, d) m(2, 185, d) -# define SEQAN_PP_REPEAT_1_187(m, d) SEQAN_PP_REPEAT_1_186(m, d) m(2, 186, d) -# define SEQAN_PP_REPEAT_1_188(m, d) SEQAN_PP_REPEAT_1_187(m, d) m(2, 187, d) -# define SEQAN_PP_REPEAT_1_189(m, d) SEQAN_PP_REPEAT_1_188(m, d) m(2, 188, d) -# define SEQAN_PP_REPEAT_1_190(m, d) SEQAN_PP_REPEAT_1_189(m, d) m(2, 189, d) -# define SEQAN_PP_REPEAT_1_191(m, d) SEQAN_PP_REPEAT_1_190(m, d) m(2, 190, d) -# define SEQAN_PP_REPEAT_1_192(m, d) SEQAN_PP_REPEAT_1_191(m, d) m(2, 191, d) -# define SEQAN_PP_REPEAT_1_193(m, d) SEQAN_PP_REPEAT_1_192(m, d) m(2, 192, d) -# define SEQAN_PP_REPEAT_1_194(m, d) SEQAN_PP_REPEAT_1_193(m, d) m(2, 193, d) -# define SEQAN_PP_REPEAT_1_195(m, d) SEQAN_PP_REPEAT_1_194(m, d) m(2, 194, d) -# define SEQAN_PP_REPEAT_1_196(m, d) SEQAN_PP_REPEAT_1_195(m, d) m(2, 195, d) -# define SEQAN_PP_REPEAT_1_197(m, d) SEQAN_PP_REPEAT_1_196(m, d) m(2, 196, d) -# define SEQAN_PP_REPEAT_1_198(m, d) SEQAN_PP_REPEAT_1_197(m, d) m(2, 197, d) -# define SEQAN_PP_REPEAT_1_199(m, d) SEQAN_PP_REPEAT_1_198(m, d) m(2, 198, d) -# define SEQAN_PP_REPEAT_1_200(m, d) SEQAN_PP_REPEAT_1_199(m, d) m(2, 199, d) -# define SEQAN_PP_REPEAT_1_201(m, d) SEQAN_PP_REPEAT_1_200(m, d) m(2, 200, d) -# define SEQAN_PP_REPEAT_1_202(m, d) SEQAN_PP_REPEAT_1_201(m, d) m(2, 201, d) -# define SEQAN_PP_REPEAT_1_203(m, d) SEQAN_PP_REPEAT_1_202(m, d) m(2, 202, d) -# define SEQAN_PP_REPEAT_1_204(m, d) SEQAN_PP_REPEAT_1_203(m, d) m(2, 203, d) -# define SEQAN_PP_REPEAT_1_205(m, d) SEQAN_PP_REPEAT_1_204(m, d) m(2, 204, d) -# define SEQAN_PP_REPEAT_1_206(m, d) SEQAN_PP_REPEAT_1_205(m, d) m(2, 205, d) -# define SEQAN_PP_REPEAT_1_207(m, d) SEQAN_PP_REPEAT_1_206(m, d) m(2, 206, d) -# define SEQAN_PP_REPEAT_1_208(m, d) SEQAN_PP_REPEAT_1_207(m, d) m(2, 207, d) -# define SEQAN_PP_REPEAT_1_209(m, d) SEQAN_PP_REPEAT_1_208(m, d) m(2, 208, d) -# define SEQAN_PP_REPEAT_1_210(m, d) SEQAN_PP_REPEAT_1_209(m, d) m(2, 209, d) -# define SEQAN_PP_REPEAT_1_211(m, d) SEQAN_PP_REPEAT_1_210(m, d) m(2, 210, d) -# define SEQAN_PP_REPEAT_1_212(m, d) SEQAN_PP_REPEAT_1_211(m, d) m(2, 211, d) -# define SEQAN_PP_REPEAT_1_213(m, d) SEQAN_PP_REPEAT_1_212(m, d) m(2, 212, d) -# define SEQAN_PP_REPEAT_1_214(m, d) SEQAN_PP_REPEAT_1_213(m, d) m(2, 213, d) -# define SEQAN_PP_REPEAT_1_215(m, d) SEQAN_PP_REPEAT_1_214(m, d) m(2, 214, d) -# define SEQAN_PP_REPEAT_1_216(m, d) SEQAN_PP_REPEAT_1_215(m, d) m(2, 215, d) -# define SEQAN_PP_REPEAT_1_217(m, d) SEQAN_PP_REPEAT_1_216(m, d) m(2, 216, d) -# define SEQAN_PP_REPEAT_1_218(m, d) SEQAN_PP_REPEAT_1_217(m, d) m(2, 217, d) -# define SEQAN_PP_REPEAT_1_219(m, d) SEQAN_PP_REPEAT_1_218(m, d) m(2, 218, d) -# define SEQAN_PP_REPEAT_1_220(m, d) SEQAN_PP_REPEAT_1_219(m, d) m(2, 219, d) -# define SEQAN_PP_REPEAT_1_221(m, d) SEQAN_PP_REPEAT_1_220(m, d) m(2, 220, d) -# define SEQAN_PP_REPEAT_1_222(m, d) SEQAN_PP_REPEAT_1_221(m, d) m(2, 221, d) -# define SEQAN_PP_REPEAT_1_223(m, d) SEQAN_PP_REPEAT_1_222(m, d) m(2, 222, d) -# define SEQAN_PP_REPEAT_1_224(m, d) SEQAN_PP_REPEAT_1_223(m, d) m(2, 223, d) -# define SEQAN_PP_REPEAT_1_225(m, d) SEQAN_PP_REPEAT_1_224(m, d) m(2, 224, d) -# define SEQAN_PP_REPEAT_1_226(m, d) SEQAN_PP_REPEAT_1_225(m, d) m(2, 225, d) -# define SEQAN_PP_REPEAT_1_227(m, d) SEQAN_PP_REPEAT_1_226(m, d) m(2, 226, d) -# define SEQAN_PP_REPEAT_1_228(m, d) SEQAN_PP_REPEAT_1_227(m, d) m(2, 227, d) -# define SEQAN_PP_REPEAT_1_229(m, d) SEQAN_PP_REPEAT_1_228(m, d) m(2, 228, d) -# define SEQAN_PP_REPEAT_1_230(m, d) SEQAN_PP_REPEAT_1_229(m, d) m(2, 229, d) -# define SEQAN_PP_REPEAT_1_231(m, d) SEQAN_PP_REPEAT_1_230(m, d) m(2, 230, d) -# define SEQAN_PP_REPEAT_1_232(m, d) SEQAN_PP_REPEAT_1_231(m, d) m(2, 231, d) -# define SEQAN_PP_REPEAT_1_233(m, d) SEQAN_PP_REPEAT_1_232(m, d) m(2, 232, d) -# define SEQAN_PP_REPEAT_1_234(m, d) SEQAN_PP_REPEAT_1_233(m, d) m(2, 233, d) -# define SEQAN_PP_REPEAT_1_235(m, d) SEQAN_PP_REPEAT_1_234(m, d) m(2, 234, d) -# define SEQAN_PP_REPEAT_1_236(m, d) SEQAN_PP_REPEAT_1_235(m, d) m(2, 235, d) -# define SEQAN_PP_REPEAT_1_237(m, d) SEQAN_PP_REPEAT_1_236(m, d) m(2, 236, d) -# define SEQAN_PP_REPEAT_1_238(m, d) SEQAN_PP_REPEAT_1_237(m, d) m(2, 237, d) -# define SEQAN_PP_REPEAT_1_239(m, d) SEQAN_PP_REPEAT_1_238(m, d) m(2, 238, d) -# define SEQAN_PP_REPEAT_1_240(m, d) SEQAN_PP_REPEAT_1_239(m, d) m(2, 239, d) -# define SEQAN_PP_REPEAT_1_241(m, d) SEQAN_PP_REPEAT_1_240(m, d) m(2, 240, d) -# define SEQAN_PP_REPEAT_1_242(m, d) SEQAN_PP_REPEAT_1_241(m, d) m(2, 241, d) -# define SEQAN_PP_REPEAT_1_243(m, d) SEQAN_PP_REPEAT_1_242(m, d) m(2, 242, d) -# define SEQAN_PP_REPEAT_1_244(m, d) SEQAN_PP_REPEAT_1_243(m, d) m(2, 243, d) -# define SEQAN_PP_REPEAT_1_245(m, d) SEQAN_PP_REPEAT_1_244(m, d) m(2, 244, d) -# define SEQAN_PP_REPEAT_1_246(m, d) SEQAN_PP_REPEAT_1_245(m, d) m(2, 245, d) -# define SEQAN_PP_REPEAT_1_247(m, d) SEQAN_PP_REPEAT_1_246(m, d) m(2, 246, d) -# define SEQAN_PP_REPEAT_1_248(m, d) SEQAN_PP_REPEAT_1_247(m, d) m(2, 247, d) -# define SEQAN_PP_REPEAT_1_249(m, d) SEQAN_PP_REPEAT_1_248(m, d) m(2, 248, d) -# define SEQAN_PP_REPEAT_1_250(m, d) SEQAN_PP_REPEAT_1_249(m, d) m(2, 249, d) -# define SEQAN_PP_REPEAT_1_251(m, d) SEQAN_PP_REPEAT_1_250(m, d) m(2, 250, d) -# define SEQAN_PP_REPEAT_1_252(m, d) SEQAN_PP_REPEAT_1_251(m, d) m(2, 251, d) -# define SEQAN_PP_REPEAT_1_253(m, d) SEQAN_PP_REPEAT_1_252(m, d) m(2, 252, d) -# define SEQAN_PP_REPEAT_1_254(m, d) SEQAN_PP_REPEAT_1_253(m, d) m(2, 253, d) -# define SEQAN_PP_REPEAT_1_255(m, d) SEQAN_PP_REPEAT_1_254(m, d) m(2, 254, d) -# define SEQAN_PP_REPEAT_1_256(m, d) SEQAN_PP_REPEAT_1_255(m, d) m(2, 255, d) -# -# define SEQAN_PP_REPEAT_2_0(m, d) -# define SEQAN_PP_REPEAT_2_1(m, d) m(3, 0, d) -# define SEQAN_PP_REPEAT_2_2(m, d) SEQAN_PP_REPEAT_2_1(m, d) m(3, 1, d) -# define SEQAN_PP_REPEAT_2_3(m, d) SEQAN_PP_REPEAT_2_2(m, d) m(3, 2, d) -# define SEQAN_PP_REPEAT_2_4(m, d) SEQAN_PP_REPEAT_2_3(m, d) m(3, 3, d) -# define SEQAN_PP_REPEAT_2_5(m, d) SEQAN_PP_REPEAT_2_4(m, d) m(3, 4, d) -# define SEQAN_PP_REPEAT_2_6(m, d) SEQAN_PP_REPEAT_2_5(m, d) m(3, 5, d) -# define SEQAN_PP_REPEAT_2_7(m, d) SEQAN_PP_REPEAT_2_6(m, d) m(3, 6, d) -# define SEQAN_PP_REPEAT_2_8(m, d) SEQAN_PP_REPEAT_2_7(m, d) m(3, 7, d) -# define SEQAN_PP_REPEAT_2_9(m, d) SEQAN_PP_REPEAT_2_8(m, d) m(3, 8, d) -# define SEQAN_PP_REPEAT_2_10(m, d) SEQAN_PP_REPEAT_2_9(m, d) m(3, 9, d) -# define SEQAN_PP_REPEAT_2_11(m, d) SEQAN_PP_REPEAT_2_10(m, d) m(3, 10, d) -# define SEQAN_PP_REPEAT_2_12(m, d) SEQAN_PP_REPEAT_2_11(m, d) m(3, 11, d) -# define SEQAN_PP_REPEAT_2_13(m, d) SEQAN_PP_REPEAT_2_12(m, d) m(3, 12, d) -# define SEQAN_PP_REPEAT_2_14(m, d) SEQAN_PP_REPEAT_2_13(m, d) m(3, 13, d) -# define SEQAN_PP_REPEAT_2_15(m, d) SEQAN_PP_REPEAT_2_14(m, d) m(3, 14, d) -# define SEQAN_PP_REPEAT_2_16(m, d) SEQAN_PP_REPEAT_2_15(m, d) m(3, 15, d) -# define SEQAN_PP_REPEAT_2_17(m, d) SEQAN_PP_REPEAT_2_16(m, d) m(3, 16, d) -# define SEQAN_PP_REPEAT_2_18(m, d) SEQAN_PP_REPEAT_2_17(m, d) m(3, 17, d) -# define SEQAN_PP_REPEAT_2_19(m, d) SEQAN_PP_REPEAT_2_18(m, d) m(3, 18, d) -# define SEQAN_PP_REPEAT_2_20(m, d) SEQAN_PP_REPEAT_2_19(m, d) m(3, 19, d) -# define SEQAN_PP_REPEAT_2_21(m, d) SEQAN_PP_REPEAT_2_20(m, d) m(3, 20, d) -# define SEQAN_PP_REPEAT_2_22(m, d) SEQAN_PP_REPEAT_2_21(m, d) m(3, 21, d) -# define SEQAN_PP_REPEAT_2_23(m, d) SEQAN_PP_REPEAT_2_22(m, d) m(3, 22, d) -# define SEQAN_PP_REPEAT_2_24(m, d) SEQAN_PP_REPEAT_2_23(m, d) m(3, 23, d) -# define SEQAN_PP_REPEAT_2_25(m, d) SEQAN_PP_REPEAT_2_24(m, d) m(3, 24, d) -# define SEQAN_PP_REPEAT_2_26(m, d) SEQAN_PP_REPEAT_2_25(m, d) m(3, 25, d) -# define SEQAN_PP_REPEAT_2_27(m, d) SEQAN_PP_REPEAT_2_26(m, d) m(3, 26, d) -# define SEQAN_PP_REPEAT_2_28(m, d) SEQAN_PP_REPEAT_2_27(m, d) m(3, 27, d) -# define SEQAN_PP_REPEAT_2_29(m, d) SEQAN_PP_REPEAT_2_28(m, d) m(3, 28, d) -# define SEQAN_PP_REPEAT_2_30(m, d) SEQAN_PP_REPEAT_2_29(m, d) m(3, 29, d) -# define SEQAN_PP_REPEAT_2_31(m, d) SEQAN_PP_REPEAT_2_30(m, d) m(3, 30, d) -# define SEQAN_PP_REPEAT_2_32(m, d) SEQAN_PP_REPEAT_2_31(m, d) m(3, 31, d) -# define SEQAN_PP_REPEAT_2_33(m, d) SEQAN_PP_REPEAT_2_32(m, d) m(3, 32, d) -# define SEQAN_PP_REPEAT_2_34(m, d) SEQAN_PP_REPEAT_2_33(m, d) m(3, 33, d) -# define SEQAN_PP_REPEAT_2_35(m, d) SEQAN_PP_REPEAT_2_34(m, d) m(3, 34, d) -# define SEQAN_PP_REPEAT_2_36(m, d) SEQAN_PP_REPEAT_2_35(m, d) m(3, 35, d) -# define SEQAN_PP_REPEAT_2_37(m, d) SEQAN_PP_REPEAT_2_36(m, d) m(3, 36, d) -# define SEQAN_PP_REPEAT_2_38(m, d) SEQAN_PP_REPEAT_2_37(m, d) m(3, 37, d) -# define SEQAN_PP_REPEAT_2_39(m, d) SEQAN_PP_REPEAT_2_38(m, d) m(3, 38, d) -# define SEQAN_PP_REPEAT_2_40(m, d) SEQAN_PP_REPEAT_2_39(m, d) m(3, 39, d) -# define SEQAN_PP_REPEAT_2_41(m, d) SEQAN_PP_REPEAT_2_40(m, d) m(3, 40, d) -# define SEQAN_PP_REPEAT_2_42(m, d) SEQAN_PP_REPEAT_2_41(m, d) m(3, 41, d) -# define SEQAN_PP_REPEAT_2_43(m, d) SEQAN_PP_REPEAT_2_42(m, d) m(3, 42, d) -# define SEQAN_PP_REPEAT_2_44(m, d) SEQAN_PP_REPEAT_2_43(m, d) m(3, 43, d) -# define SEQAN_PP_REPEAT_2_45(m, d) SEQAN_PP_REPEAT_2_44(m, d) m(3, 44, d) -# define SEQAN_PP_REPEAT_2_46(m, d) SEQAN_PP_REPEAT_2_45(m, d) m(3, 45, d) -# define SEQAN_PP_REPEAT_2_47(m, d) SEQAN_PP_REPEAT_2_46(m, d) m(3, 46, d) -# define SEQAN_PP_REPEAT_2_48(m, d) SEQAN_PP_REPEAT_2_47(m, d) m(3, 47, d) -# define SEQAN_PP_REPEAT_2_49(m, d) SEQAN_PP_REPEAT_2_48(m, d) m(3, 48, d) -# define SEQAN_PP_REPEAT_2_50(m, d) SEQAN_PP_REPEAT_2_49(m, d) m(3, 49, d) -# define SEQAN_PP_REPEAT_2_51(m, d) SEQAN_PP_REPEAT_2_50(m, d) m(3, 50, d) -# define SEQAN_PP_REPEAT_2_52(m, d) SEQAN_PP_REPEAT_2_51(m, d) m(3, 51, d) -# define SEQAN_PP_REPEAT_2_53(m, d) SEQAN_PP_REPEAT_2_52(m, d) m(3, 52, d) -# define SEQAN_PP_REPEAT_2_54(m, d) SEQAN_PP_REPEAT_2_53(m, d) m(3, 53, d) -# define SEQAN_PP_REPEAT_2_55(m, d) SEQAN_PP_REPEAT_2_54(m, d) m(3, 54, d) -# define SEQAN_PP_REPEAT_2_56(m, d) SEQAN_PP_REPEAT_2_55(m, d) m(3, 55, d) -# define SEQAN_PP_REPEAT_2_57(m, d) SEQAN_PP_REPEAT_2_56(m, d) m(3, 56, d) -# define SEQAN_PP_REPEAT_2_58(m, d) SEQAN_PP_REPEAT_2_57(m, d) m(3, 57, d) -# define SEQAN_PP_REPEAT_2_59(m, d) SEQAN_PP_REPEAT_2_58(m, d) m(3, 58, d) -# define SEQAN_PP_REPEAT_2_60(m, d) SEQAN_PP_REPEAT_2_59(m, d) m(3, 59, d) -# define SEQAN_PP_REPEAT_2_61(m, d) SEQAN_PP_REPEAT_2_60(m, d) m(3, 60, d) -# define SEQAN_PP_REPEAT_2_62(m, d) SEQAN_PP_REPEAT_2_61(m, d) m(3, 61, d) -# define SEQAN_PP_REPEAT_2_63(m, d) SEQAN_PP_REPEAT_2_62(m, d) m(3, 62, d) -# define SEQAN_PP_REPEAT_2_64(m, d) SEQAN_PP_REPEAT_2_63(m, d) m(3, 63, d) -# define SEQAN_PP_REPEAT_2_65(m, d) SEQAN_PP_REPEAT_2_64(m, d) m(3, 64, d) -# define SEQAN_PP_REPEAT_2_66(m, d) SEQAN_PP_REPEAT_2_65(m, d) m(3, 65, d) -# define SEQAN_PP_REPEAT_2_67(m, d) SEQAN_PP_REPEAT_2_66(m, d) m(3, 66, d) -# define SEQAN_PP_REPEAT_2_68(m, d) SEQAN_PP_REPEAT_2_67(m, d) m(3, 67, d) -# define SEQAN_PP_REPEAT_2_69(m, d) SEQAN_PP_REPEAT_2_68(m, d) m(3, 68, d) -# define SEQAN_PP_REPEAT_2_70(m, d) SEQAN_PP_REPEAT_2_69(m, d) m(3, 69, d) -# define SEQAN_PP_REPEAT_2_71(m, d) SEQAN_PP_REPEAT_2_70(m, d) m(3, 70, d) -# define SEQAN_PP_REPEAT_2_72(m, d) SEQAN_PP_REPEAT_2_71(m, d) m(3, 71, d) -# define SEQAN_PP_REPEAT_2_73(m, d) SEQAN_PP_REPEAT_2_72(m, d) m(3, 72, d) -# define SEQAN_PP_REPEAT_2_74(m, d) SEQAN_PP_REPEAT_2_73(m, d) m(3, 73, d) -# define SEQAN_PP_REPEAT_2_75(m, d) SEQAN_PP_REPEAT_2_74(m, d) m(3, 74, d) -# define SEQAN_PP_REPEAT_2_76(m, d) SEQAN_PP_REPEAT_2_75(m, d) m(3, 75, d) -# define SEQAN_PP_REPEAT_2_77(m, d) SEQAN_PP_REPEAT_2_76(m, d) m(3, 76, d) -# define SEQAN_PP_REPEAT_2_78(m, d) SEQAN_PP_REPEAT_2_77(m, d) m(3, 77, d) -# define SEQAN_PP_REPEAT_2_79(m, d) SEQAN_PP_REPEAT_2_78(m, d) m(3, 78, d) -# define SEQAN_PP_REPEAT_2_80(m, d) SEQAN_PP_REPEAT_2_79(m, d) m(3, 79, d) -# define SEQAN_PP_REPEAT_2_81(m, d) SEQAN_PP_REPEAT_2_80(m, d) m(3, 80, d) -# define SEQAN_PP_REPEAT_2_82(m, d) SEQAN_PP_REPEAT_2_81(m, d) m(3, 81, d) -# define SEQAN_PP_REPEAT_2_83(m, d) SEQAN_PP_REPEAT_2_82(m, d) m(3, 82, d) -# define SEQAN_PP_REPEAT_2_84(m, d) SEQAN_PP_REPEAT_2_83(m, d) m(3, 83, d) -# define SEQAN_PP_REPEAT_2_85(m, d) SEQAN_PP_REPEAT_2_84(m, d) m(3, 84, d) -# define SEQAN_PP_REPEAT_2_86(m, d) SEQAN_PP_REPEAT_2_85(m, d) m(3, 85, d) -# define SEQAN_PP_REPEAT_2_87(m, d) SEQAN_PP_REPEAT_2_86(m, d) m(3, 86, d) -# define SEQAN_PP_REPEAT_2_88(m, d) SEQAN_PP_REPEAT_2_87(m, d) m(3, 87, d) -# define SEQAN_PP_REPEAT_2_89(m, d) SEQAN_PP_REPEAT_2_88(m, d) m(3, 88, d) -# define SEQAN_PP_REPEAT_2_90(m, d) SEQAN_PP_REPEAT_2_89(m, d) m(3, 89, d) -# define SEQAN_PP_REPEAT_2_91(m, d) SEQAN_PP_REPEAT_2_90(m, d) m(3, 90, d) -# define SEQAN_PP_REPEAT_2_92(m, d) SEQAN_PP_REPEAT_2_91(m, d) m(3, 91, d) -# define SEQAN_PP_REPEAT_2_93(m, d) SEQAN_PP_REPEAT_2_92(m, d) m(3, 92, d) -# define SEQAN_PP_REPEAT_2_94(m, d) SEQAN_PP_REPEAT_2_93(m, d) m(3, 93, d) -# define SEQAN_PP_REPEAT_2_95(m, d) SEQAN_PP_REPEAT_2_94(m, d) m(3, 94, d) -# define SEQAN_PP_REPEAT_2_96(m, d) SEQAN_PP_REPEAT_2_95(m, d) m(3, 95, d) -# define SEQAN_PP_REPEAT_2_97(m, d) SEQAN_PP_REPEAT_2_96(m, d) m(3, 96, d) -# define SEQAN_PP_REPEAT_2_98(m, d) SEQAN_PP_REPEAT_2_97(m, d) m(3, 97, d) -# define SEQAN_PP_REPEAT_2_99(m, d) SEQAN_PP_REPEAT_2_98(m, d) m(3, 98, d) -# define SEQAN_PP_REPEAT_2_100(m, d) SEQAN_PP_REPEAT_2_99(m, d) m(3, 99, d) -# define SEQAN_PP_REPEAT_2_101(m, d) SEQAN_PP_REPEAT_2_100(m, d) m(3, 100, d) -# define SEQAN_PP_REPEAT_2_102(m, d) SEQAN_PP_REPEAT_2_101(m, d) m(3, 101, d) -# define SEQAN_PP_REPEAT_2_103(m, d) SEQAN_PP_REPEAT_2_102(m, d) m(3, 102, d) -# define SEQAN_PP_REPEAT_2_104(m, d) SEQAN_PP_REPEAT_2_103(m, d) m(3, 103, d) -# define SEQAN_PP_REPEAT_2_105(m, d) SEQAN_PP_REPEAT_2_104(m, d) m(3, 104, d) -# define SEQAN_PP_REPEAT_2_106(m, d) SEQAN_PP_REPEAT_2_105(m, d) m(3, 105, d) -# define SEQAN_PP_REPEAT_2_107(m, d) SEQAN_PP_REPEAT_2_106(m, d) m(3, 106, d) -# define SEQAN_PP_REPEAT_2_108(m, d) SEQAN_PP_REPEAT_2_107(m, d) m(3, 107, d) -# define SEQAN_PP_REPEAT_2_109(m, d) SEQAN_PP_REPEAT_2_108(m, d) m(3, 108, d) -# define SEQAN_PP_REPEAT_2_110(m, d) SEQAN_PP_REPEAT_2_109(m, d) m(3, 109, d) -# define SEQAN_PP_REPEAT_2_111(m, d) SEQAN_PP_REPEAT_2_110(m, d) m(3, 110, d) -# define SEQAN_PP_REPEAT_2_112(m, d) SEQAN_PP_REPEAT_2_111(m, d) m(3, 111, d) -# define SEQAN_PP_REPEAT_2_113(m, d) SEQAN_PP_REPEAT_2_112(m, d) m(3, 112, d) -# define SEQAN_PP_REPEAT_2_114(m, d) SEQAN_PP_REPEAT_2_113(m, d) m(3, 113, d) -# define SEQAN_PP_REPEAT_2_115(m, d) SEQAN_PP_REPEAT_2_114(m, d) m(3, 114, d) -# define SEQAN_PP_REPEAT_2_116(m, d) SEQAN_PP_REPEAT_2_115(m, d) m(3, 115, d) -# define SEQAN_PP_REPEAT_2_117(m, d) SEQAN_PP_REPEAT_2_116(m, d) m(3, 116, d) -# define SEQAN_PP_REPEAT_2_118(m, d) SEQAN_PP_REPEAT_2_117(m, d) m(3, 117, d) -# define SEQAN_PP_REPEAT_2_119(m, d) SEQAN_PP_REPEAT_2_118(m, d) m(3, 118, d) -# define SEQAN_PP_REPEAT_2_120(m, d) SEQAN_PP_REPEAT_2_119(m, d) m(3, 119, d) -# define SEQAN_PP_REPEAT_2_121(m, d) SEQAN_PP_REPEAT_2_120(m, d) m(3, 120, d) -# define SEQAN_PP_REPEAT_2_122(m, d) SEQAN_PP_REPEAT_2_121(m, d) m(3, 121, d) -# define SEQAN_PP_REPEAT_2_123(m, d) SEQAN_PP_REPEAT_2_122(m, d) m(3, 122, d) -# define SEQAN_PP_REPEAT_2_124(m, d) SEQAN_PP_REPEAT_2_123(m, d) m(3, 123, d) -# define SEQAN_PP_REPEAT_2_125(m, d) SEQAN_PP_REPEAT_2_124(m, d) m(3, 124, d) -# define SEQAN_PP_REPEAT_2_126(m, d) SEQAN_PP_REPEAT_2_125(m, d) m(3, 125, d) -# define SEQAN_PP_REPEAT_2_127(m, d) SEQAN_PP_REPEAT_2_126(m, d) m(3, 126, d) -# define SEQAN_PP_REPEAT_2_128(m, d) SEQAN_PP_REPEAT_2_127(m, d) m(3, 127, d) -# define SEQAN_PP_REPEAT_2_129(m, d) SEQAN_PP_REPEAT_2_128(m, d) m(3, 128, d) -# define SEQAN_PP_REPEAT_2_130(m, d) SEQAN_PP_REPEAT_2_129(m, d) m(3, 129, d) -# define SEQAN_PP_REPEAT_2_131(m, d) SEQAN_PP_REPEAT_2_130(m, d) m(3, 130, d) -# define SEQAN_PP_REPEAT_2_132(m, d) SEQAN_PP_REPEAT_2_131(m, d) m(3, 131, d) -# define SEQAN_PP_REPEAT_2_133(m, d) SEQAN_PP_REPEAT_2_132(m, d) m(3, 132, d) -# define SEQAN_PP_REPEAT_2_134(m, d) SEQAN_PP_REPEAT_2_133(m, d) m(3, 133, d) -# define SEQAN_PP_REPEAT_2_135(m, d) SEQAN_PP_REPEAT_2_134(m, d) m(3, 134, d) -# define SEQAN_PP_REPEAT_2_136(m, d) SEQAN_PP_REPEAT_2_135(m, d) m(3, 135, d) -# define SEQAN_PP_REPEAT_2_137(m, d) SEQAN_PP_REPEAT_2_136(m, d) m(3, 136, d) -# define SEQAN_PP_REPEAT_2_138(m, d) SEQAN_PP_REPEAT_2_137(m, d) m(3, 137, d) -# define SEQAN_PP_REPEAT_2_139(m, d) SEQAN_PP_REPEAT_2_138(m, d) m(3, 138, d) -# define SEQAN_PP_REPEAT_2_140(m, d) SEQAN_PP_REPEAT_2_139(m, d) m(3, 139, d) -# define SEQAN_PP_REPEAT_2_141(m, d) SEQAN_PP_REPEAT_2_140(m, d) m(3, 140, d) -# define SEQAN_PP_REPEAT_2_142(m, d) SEQAN_PP_REPEAT_2_141(m, d) m(3, 141, d) -# define SEQAN_PP_REPEAT_2_143(m, d) SEQAN_PP_REPEAT_2_142(m, d) m(3, 142, d) -# define SEQAN_PP_REPEAT_2_144(m, d) SEQAN_PP_REPEAT_2_143(m, d) m(3, 143, d) -# define SEQAN_PP_REPEAT_2_145(m, d) SEQAN_PP_REPEAT_2_144(m, d) m(3, 144, d) -# define SEQAN_PP_REPEAT_2_146(m, d) SEQAN_PP_REPEAT_2_145(m, d) m(3, 145, d) -# define SEQAN_PP_REPEAT_2_147(m, d) SEQAN_PP_REPEAT_2_146(m, d) m(3, 146, d) -# define SEQAN_PP_REPEAT_2_148(m, d) SEQAN_PP_REPEAT_2_147(m, d) m(3, 147, d) -# define SEQAN_PP_REPEAT_2_149(m, d) SEQAN_PP_REPEAT_2_148(m, d) m(3, 148, d) -# define SEQAN_PP_REPEAT_2_150(m, d) SEQAN_PP_REPEAT_2_149(m, d) m(3, 149, d) -# define SEQAN_PP_REPEAT_2_151(m, d) SEQAN_PP_REPEAT_2_150(m, d) m(3, 150, d) -# define SEQAN_PP_REPEAT_2_152(m, d) SEQAN_PP_REPEAT_2_151(m, d) m(3, 151, d) -# define SEQAN_PP_REPEAT_2_153(m, d) SEQAN_PP_REPEAT_2_152(m, d) m(3, 152, d) -# define SEQAN_PP_REPEAT_2_154(m, d) SEQAN_PP_REPEAT_2_153(m, d) m(3, 153, d) -# define SEQAN_PP_REPEAT_2_155(m, d) SEQAN_PP_REPEAT_2_154(m, d) m(3, 154, d) -# define SEQAN_PP_REPEAT_2_156(m, d) SEQAN_PP_REPEAT_2_155(m, d) m(3, 155, d) -# define SEQAN_PP_REPEAT_2_157(m, d) SEQAN_PP_REPEAT_2_156(m, d) m(3, 156, d) -# define SEQAN_PP_REPEAT_2_158(m, d) SEQAN_PP_REPEAT_2_157(m, d) m(3, 157, d) -# define SEQAN_PP_REPEAT_2_159(m, d) SEQAN_PP_REPEAT_2_158(m, d) m(3, 158, d) -# define SEQAN_PP_REPEAT_2_160(m, d) SEQAN_PP_REPEAT_2_159(m, d) m(3, 159, d) -# define SEQAN_PP_REPEAT_2_161(m, d) SEQAN_PP_REPEAT_2_160(m, d) m(3, 160, d) -# define SEQAN_PP_REPEAT_2_162(m, d) SEQAN_PP_REPEAT_2_161(m, d) m(3, 161, d) -# define SEQAN_PP_REPEAT_2_163(m, d) SEQAN_PP_REPEAT_2_162(m, d) m(3, 162, d) -# define SEQAN_PP_REPEAT_2_164(m, d) SEQAN_PP_REPEAT_2_163(m, d) m(3, 163, d) -# define SEQAN_PP_REPEAT_2_165(m, d) SEQAN_PP_REPEAT_2_164(m, d) m(3, 164, d) -# define SEQAN_PP_REPEAT_2_166(m, d) SEQAN_PP_REPEAT_2_165(m, d) m(3, 165, d) -# define SEQAN_PP_REPEAT_2_167(m, d) SEQAN_PP_REPEAT_2_166(m, d) m(3, 166, d) -# define SEQAN_PP_REPEAT_2_168(m, d) SEQAN_PP_REPEAT_2_167(m, d) m(3, 167, d) -# define SEQAN_PP_REPEAT_2_169(m, d) SEQAN_PP_REPEAT_2_168(m, d) m(3, 168, d) -# define SEQAN_PP_REPEAT_2_170(m, d) SEQAN_PP_REPEAT_2_169(m, d) m(3, 169, d) -# define SEQAN_PP_REPEAT_2_171(m, d) SEQAN_PP_REPEAT_2_170(m, d) m(3, 170, d) -# define SEQAN_PP_REPEAT_2_172(m, d) SEQAN_PP_REPEAT_2_171(m, d) m(3, 171, d) -# define SEQAN_PP_REPEAT_2_173(m, d) SEQAN_PP_REPEAT_2_172(m, d) m(3, 172, d) -# define SEQAN_PP_REPEAT_2_174(m, d) SEQAN_PP_REPEAT_2_173(m, d) m(3, 173, d) -# define SEQAN_PP_REPEAT_2_175(m, d) SEQAN_PP_REPEAT_2_174(m, d) m(3, 174, d) -# define SEQAN_PP_REPEAT_2_176(m, d) SEQAN_PP_REPEAT_2_175(m, d) m(3, 175, d) -# define SEQAN_PP_REPEAT_2_177(m, d) SEQAN_PP_REPEAT_2_176(m, d) m(3, 176, d) -# define SEQAN_PP_REPEAT_2_178(m, d) SEQAN_PP_REPEAT_2_177(m, d) m(3, 177, d) -# define SEQAN_PP_REPEAT_2_179(m, d) SEQAN_PP_REPEAT_2_178(m, d) m(3, 178, d) -# define SEQAN_PP_REPEAT_2_180(m, d) SEQAN_PP_REPEAT_2_179(m, d) m(3, 179, d) -# define SEQAN_PP_REPEAT_2_181(m, d) SEQAN_PP_REPEAT_2_180(m, d) m(3, 180, d) -# define SEQAN_PP_REPEAT_2_182(m, d) SEQAN_PP_REPEAT_2_181(m, d) m(3, 181, d) -# define SEQAN_PP_REPEAT_2_183(m, d) SEQAN_PP_REPEAT_2_182(m, d) m(3, 182, d) -# define SEQAN_PP_REPEAT_2_184(m, d) SEQAN_PP_REPEAT_2_183(m, d) m(3, 183, d) -# define SEQAN_PP_REPEAT_2_185(m, d) SEQAN_PP_REPEAT_2_184(m, d) m(3, 184, d) -# define SEQAN_PP_REPEAT_2_186(m, d) SEQAN_PP_REPEAT_2_185(m, d) m(3, 185, d) -# define SEQAN_PP_REPEAT_2_187(m, d) SEQAN_PP_REPEAT_2_186(m, d) m(3, 186, d) -# define SEQAN_PP_REPEAT_2_188(m, d) SEQAN_PP_REPEAT_2_187(m, d) m(3, 187, d) -# define SEQAN_PP_REPEAT_2_189(m, d) SEQAN_PP_REPEAT_2_188(m, d) m(3, 188, d) -# define SEQAN_PP_REPEAT_2_190(m, d) SEQAN_PP_REPEAT_2_189(m, d) m(3, 189, d) -# define SEQAN_PP_REPEAT_2_191(m, d) SEQAN_PP_REPEAT_2_190(m, d) m(3, 190, d) -# define SEQAN_PP_REPEAT_2_192(m, d) SEQAN_PP_REPEAT_2_191(m, d) m(3, 191, d) -# define SEQAN_PP_REPEAT_2_193(m, d) SEQAN_PP_REPEAT_2_192(m, d) m(3, 192, d) -# define SEQAN_PP_REPEAT_2_194(m, d) SEQAN_PP_REPEAT_2_193(m, d) m(3, 193, d) -# define SEQAN_PP_REPEAT_2_195(m, d) SEQAN_PP_REPEAT_2_194(m, d) m(3, 194, d) -# define SEQAN_PP_REPEAT_2_196(m, d) SEQAN_PP_REPEAT_2_195(m, d) m(3, 195, d) -# define SEQAN_PP_REPEAT_2_197(m, d) SEQAN_PP_REPEAT_2_196(m, d) m(3, 196, d) -# define SEQAN_PP_REPEAT_2_198(m, d) SEQAN_PP_REPEAT_2_197(m, d) m(3, 197, d) -# define SEQAN_PP_REPEAT_2_199(m, d) SEQAN_PP_REPEAT_2_198(m, d) m(3, 198, d) -# define SEQAN_PP_REPEAT_2_200(m, d) SEQAN_PP_REPEAT_2_199(m, d) m(3, 199, d) -# define SEQAN_PP_REPEAT_2_201(m, d) SEQAN_PP_REPEAT_2_200(m, d) m(3, 200, d) -# define SEQAN_PP_REPEAT_2_202(m, d) SEQAN_PP_REPEAT_2_201(m, d) m(3, 201, d) -# define SEQAN_PP_REPEAT_2_203(m, d) SEQAN_PP_REPEAT_2_202(m, d) m(3, 202, d) -# define SEQAN_PP_REPEAT_2_204(m, d) SEQAN_PP_REPEAT_2_203(m, d) m(3, 203, d) -# define SEQAN_PP_REPEAT_2_205(m, d) SEQAN_PP_REPEAT_2_204(m, d) m(3, 204, d) -# define SEQAN_PP_REPEAT_2_206(m, d) SEQAN_PP_REPEAT_2_205(m, d) m(3, 205, d) -# define SEQAN_PP_REPEAT_2_207(m, d) SEQAN_PP_REPEAT_2_206(m, d) m(3, 206, d) -# define SEQAN_PP_REPEAT_2_208(m, d) SEQAN_PP_REPEAT_2_207(m, d) m(3, 207, d) -# define SEQAN_PP_REPEAT_2_209(m, d) SEQAN_PP_REPEAT_2_208(m, d) m(3, 208, d) -# define SEQAN_PP_REPEAT_2_210(m, d) SEQAN_PP_REPEAT_2_209(m, d) m(3, 209, d) -# define SEQAN_PP_REPEAT_2_211(m, d) SEQAN_PP_REPEAT_2_210(m, d) m(3, 210, d) -# define SEQAN_PP_REPEAT_2_212(m, d) SEQAN_PP_REPEAT_2_211(m, d) m(3, 211, d) -# define SEQAN_PP_REPEAT_2_213(m, d) SEQAN_PP_REPEAT_2_212(m, d) m(3, 212, d) -# define SEQAN_PP_REPEAT_2_214(m, d) SEQAN_PP_REPEAT_2_213(m, d) m(3, 213, d) -# define SEQAN_PP_REPEAT_2_215(m, d) SEQAN_PP_REPEAT_2_214(m, d) m(3, 214, d) -# define SEQAN_PP_REPEAT_2_216(m, d) SEQAN_PP_REPEAT_2_215(m, d) m(3, 215, d) -# define SEQAN_PP_REPEAT_2_217(m, d) SEQAN_PP_REPEAT_2_216(m, d) m(3, 216, d) -# define SEQAN_PP_REPEAT_2_218(m, d) SEQAN_PP_REPEAT_2_217(m, d) m(3, 217, d) -# define SEQAN_PP_REPEAT_2_219(m, d) SEQAN_PP_REPEAT_2_218(m, d) m(3, 218, d) -# define SEQAN_PP_REPEAT_2_220(m, d) SEQAN_PP_REPEAT_2_219(m, d) m(3, 219, d) -# define SEQAN_PP_REPEAT_2_221(m, d) SEQAN_PP_REPEAT_2_220(m, d) m(3, 220, d) -# define SEQAN_PP_REPEAT_2_222(m, d) SEQAN_PP_REPEAT_2_221(m, d) m(3, 221, d) -# define SEQAN_PP_REPEAT_2_223(m, d) SEQAN_PP_REPEAT_2_222(m, d) m(3, 222, d) -# define SEQAN_PP_REPEAT_2_224(m, d) SEQAN_PP_REPEAT_2_223(m, d) m(3, 223, d) -# define SEQAN_PP_REPEAT_2_225(m, d) SEQAN_PP_REPEAT_2_224(m, d) m(3, 224, d) -# define SEQAN_PP_REPEAT_2_226(m, d) SEQAN_PP_REPEAT_2_225(m, d) m(3, 225, d) -# define SEQAN_PP_REPEAT_2_227(m, d) SEQAN_PP_REPEAT_2_226(m, d) m(3, 226, d) -# define SEQAN_PP_REPEAT_2_228(m, d) SEQAN_PP_REPEAT_2_227(m, d) m(3, 227, d) -# define SEQAN_PP_REPEAT_2_229(m, d) SEQAN_PP_REPEAT_2_228(m, d) m(3, 228, d) -# define SEQAN_PP_REPEAT_2_230(m, d) SEQAN_PP_REPEAT_2_229(m, d) m(3, 229, d) -# define SEQAN_PP_REPEAT_2_231(m, d) SEQAN_PP_REPEAT_2_230(m, d) m(3, 230, d) -# define SEQAN_PP_REPEAT_2_232(m, d) SEQAN_PP_REPEAT_2_231(m, d) m(3, 231, d) -# define SEQAN_PP_REPEAT_2_233(m, d) SEQAN_PP_REPEAT_2_232(m, d) m(3, 232, d) -# define SEQAN_PP_REPEAT_2_234(m, d) SEQAN_PP_REPEAT_2_233(m, d) m(3, 233, d) -# define SEQAN_PP_REPEAT_2_235(m, d) SEQAN_PP_REPEAT_2_234(m, d) m(3, 234, d) -# define SEQAN_PP_REPEAT_2_236(m, d) SEQAN_PP_REPEAT_2_235(m, d) m(3, 235, d) -# define SEQAN_PP_REPEAT_2_237(m, d) SEQAN_PP_REPEAT_2_236(m, d) m(3, 236, d) -# define SEQAN_PP_REPEAT_2_238(m, d) SEQAN_PP_REPEAT_2_237(m, d) m(3, 237, d) -# define SEQAN_PP_REPEAT_2_239(m, d) SEQAN_PP_REPEAT_2_238(m, d) m(3, 238, d) -# define SEQAN_PP_REPEAT_2_240(m, d) SEQAN_PP_REPEAT_2_239(m, d) m(3, 239, d) -# define SEQAN_PP_REPEAT_2_241(m, d) SEQAN_PP_REPEAT_2_240(m, d) m(3, 240, d) -# define SEQAN_PP_REPEAT_2_242(m, d) SEQAN_PP_REPEAT_2_241(m, d) m(3, 241, d) -# define SEQAN_PP_REPEAT_2_243(m, d) SEQAN_PP_REPEAT_2_242(m, d) m(3, 242, d) -# define SEQAN_PP_REPEAT_2_244(m, d) SEQAN_PP_REPEAT_2_243(m, d) m(3, 243, d) -# define SEQAN_PP_REPEAT_2_245(m, d) SEQAN_PP_REPEAT_2_244(m, d) m(3, 244, d) -# define SEQAN_PP_REPEAT_2_246(m, d) SEQAN_PP_REPEAT_2_245(m, d) m(3, 245, d) -# define SEQAN_PP_REPEAT_2_247(m, d) SEQAN_PP_REPEAT_2_246(m, d) m(3, 246, d) -# define SEQAN_PP_REPEAT_2_248(m, d) SEQAN_PP_REPEAT_2_247(m, d) m(3, 247, d) -# define SEQAN_PP_REPEAT_2_249(m, d) SEQAN_PP_REPEAT_2_248(m, d) m(3, 248, d) -# define SEQAN_PP_REPEAT_2_250(m, d) SEQAN_PP_REPEAT_2_249(m, d) m(3, 249, d) -# define SEQAN_PP_REPEAT_2_251(m, d) SEQAN_PP_REPEAT_2_250(m, d) m(3, 250, d) -# define SEQAN_PP_REPEAT_2_252(m, d) SEQAN_PP_REPEAT_2_251(m, d) m(3, 251, d) -# define SEQAN_PP_REPEAT_2_253(m, d) SEQAN_PP_REPEAT_2_252(m, d) m(3, 252, d) -# define SEQAN_PP_REPEAT_2_254(m, d) SEQAN_PP_REPEAT_2_253(m, d) m(3, 253, d) -# define SEQAN_PP_REPEAT_2_255(m, d) SEQAN_PP_REPEAT_2_254(m, d) m(3, 254, d) -# define SEQAN_PP_REPEAT_2_256(m, d) SEQAN_PP_REPEAT_2_255(m, d) m(3, 255, d) -# -# define SEQAN_PP_REPEAT_3_0(m, d) -# define SEQAN_PP_REPEAT_3_1(m, d) m(4, 0, d) -# define SEQAN_PP_REPEAT_3_2(m, d) SEQAN_PP_REPEAT_3_1(m, d) m(4, 1, d) -# define SEQAN_PP_REPEAT_3_3(m, d) SEQAN_PP_REPEAT_3_2(m, d) m(4, 2, d) -# define SEQAN_PP_REPEAT_3_4(m, d) SEQAN_PP_REPEAT_3_3(m, d) m(4, 3, d) -# define SEQAN_PP_REPEAT_3_5(m, d) SEQAN_PP_REPEAT_3_4(m, d) m(4, 4, d) -# define SEQAN_PP_REPEAT_3_6(m, d) SEQAN_PP_REPEAT_3_5(m, d) m(4, 5, d) -# define SEQAN_PP_REPEAT_3_7(m, d) SEQAN_PP_REPEAT_3_6(m, d) m(4, 6, d) -# define SEQAN_PP_REPEAT_3_8(m, d) SEQAN_PP_REPEAT_3_7(m, d) m(4, 7, d) -# define SEQAN_PP_REPEAT_3_9(m, d) SEQAN_PP_REPEAT_3_8(m, d) m(4, 8, d) -# define SEQAN_PP_REPEAT_3_10(m, d) SEQAN_PP_REPEAT_3_9(m, d) m(4, 9, d) -# define SEQAN_PP_REPEAT_3_11(m, d) SEQAN_PP_REPEAT_3_10(m, d) m(4, 10, d) -# define SEQAN_PP_REPEAT_3_12(m, d) SEQAN_PP_REPEAT_3_11(m, d) m(4, 11, d) -# define SEQAN_PP_REPEAT_3_13(m, d) SEQAN_PP_REPEAT_3_12(m, d) m(4, 12, d) -# define SEQAN_PP_REPEAT_3_14(m, d) SEQAN_PP_REPEAT_3_13(m, d) m(4, 13, d) -# define SEQAN_PP_REPEAT_3_15(m, d) SEQAN_PP_REPEAT_3_14(m, d) m(4, 14, d) -# define SEQAN_PP_REPEAT_3_16(m, d) SEQAN_PP_REPEAT_3_15(m, d) m(4, 15, d) -# define SEQAN_PP_REPEAT_3_17(m, d) SEQAN_PP_REPEAT_3_16(m, d) m(4, 16, d) -# define SEQAN_PP_REPEAT_3_18(m, d) SEQAN_PP_REPEAT_3_17(m, d) m(4, 17, d) -# define SEQAN_PP_REPEAT_3_19(m, d) SEQAN_PP_REPEAT_3_18(m, d) m(4, 18, d) -# define SEQAN_PP_REPEAT_3_20(m, d) SEQAN_PP_REPEAT_3_19(m, d) m(4, 19, d) -# define SEQAN_PP_REPEAT_3_21(m, d) SEQAN_PP_REPEAT_3_20(m, d) m(4, 20, d) -# define SEQAN_PP_REPEAT_3_22(m, d) SEQAN_PP_REPEAT_3_21(m, d) m(4, 21, d) -# define SEQAN_PP_REPEAT_3_23(m, d) SEQAN_PP_REPEAT_3_22(m, d) m(4, 22, d) -# define SEQAN_PP_REPEAT_3_24(m, d) SEQAN_PP_REPEAT_3_23(m, d) m(4, 23, d) -# define SEQAN_PP_REPEAT_3_25(m, d) SEQAN_PP_REPEAT_3_24(m, d) m(4, 24, d) -# define SEQAN_PP_REPEAT_3_26(m, d) SEQAN_PP_REPEAT_3_25(m, d) m(4, 25, d) -# define SEQAN_PP_REPEAT_3_27(m, d) SEQAN_PP_REPEAT_3_26(m, d) m(4, 26, d) -# define SEQAN_PP_REPEAT_3_28(m, d) SEQAN_PP_REPEAT_3_27(m, d) m(4, 27, d) -# define SEQAN_PP_REPEAT_3_29(m, d) SEQAN_PP_REPEAT_3_28(m, d) m(4, 28, d) -# define SEQAN_PP_REPEAT_3_30(m, d) SEQAN_PP_REPEAT_3_29(m, d) m(4, 29, d) -# define SEQAN_PP_REPEAT_3_31(m, d) SEQAN_PP_REPEAT_3_30(m, d) m(4, 30, d) -# define SEQAN_PP_REPEAT_3_32(m, d) SEQAN_PP_REPEAT_3_31(m, d) m(4, 31, d) -# define SEQAN_PP_REPEAT_3_33(m, d) SEQAN_PP_REPEAT_3_32(m, d) m(4, 32, d) -# define SEQAN_PP_REPEAT_3_34(m, d) SEQAN_PP_REPEAT_3_33(m, d) m(4, 33, d) -# define SEQAN_PP_REPEAT_3_35(m, d) SEQAN_PP_REPEAT_3_34(m, d) m(4, 34, d) -# define SEQAN_PP_REPEAT_3_36(m, d) SEQAN_PP_REPEAT_3_35(m, d) m(4, 35, d) -# define SEQAN_PP_REPEAT_3_37(m, d) SEQAN_PP_REPEAT_3_36(m, d) m(4, 36, d) -# define SEQAN_PP_REPEAT_3_38(m, d) SEQAN_PP_REPEAT_3_37(m, d) m(4, 37, d) -# define SEQAN_PP_REPEAT_3_39(m, d) SEQAN_PP_REPEAT_3_38(m, d) m(4, 38, d) -# define SEQAN_PP_REPEAT_3_40(m, d) SEQAN_PP_REPEAT_3_39(m, d) m(4, 39, d) -# define SEQAN_PP_REPEAT_3_41(m, d) SEQAN_PP_REPEAT_3_40(m, d) m(4, 40, d) -# define SEQAN_PP_REPEAT_3_42(m, d) SEQAN_PP_REPEAT_3_41(m, d) m(4, 41, d) -# define SEQAN_PP_REPEAT_3_43(m, d) SEQAN_PP_REPEAT_3_42(m, d) m(4, 42, d) -# define SEQAN_PP_REPEAT_3_44(m, d) SEQAN_PP_REPEAT_3_43(m, d) m(4, 43, d) -# define SEQAN_PP_REPEAT_3_45(m, d) SEQAN_PP_REPEAT_3_44(m, d) m(4, 44, d) -# define SEQAN_PP_REPEAT_3_46(m, d) SEQAN_PP_REPEAT_3_45(m, d) m(4, 45, d) -# define SEQAN_PP_REPEAT_3_47(m, d) SEQAN_PP_REPEAT_3_46(m, d) m(4, 46, d) -# define SEQAN_PP_REPEAT_3_48(m, d) SEQAN_PP_REPEAT_3_47(m, d) m(4, 47, d) -# define SEQAN_PP_REPEAT_3_49(m, d) SEQAN_PP_REPEAT_3_48(m, d) m(4, 48, d) -# define SEQAN_PP_REPEAT_3_50(m, d) SEQAN_PP_REPEAT_3_49(m, d) m(4, 49, d) -# define SEQAN_PP_REPEAT_3_51(m, d) SEQAN_PP_REPEAT_3_50(m, d) m(4, 50, d) -# define SEQAN_PP_REPEAT_3_52(m, d) SEQAN_PP_REPEAT_3_51(m, d) m(4, 51, d) -# define SEQAN_PP_REPEAT_3_53(m, d) SEQAN_PP_REPEAT_3_52(m, d) m(4, 52, d) -# define SEQAN_PP_REPEAT_3_54(m, d) SEQAN_PP_REPEAT_3_53(m, d) m(4, 53, d) -# define SEQAN_PP_REPEAT_3_55(m, d) SEQAN_PP_REPEAT_3_54(m, d) m(4, 54, d) -# define SEQAN_PP_REPEAT_3_56(m, d) SEQAN_PP_REPEAT_3_55(m, d) m(4, 55, d) -# define SEQAN_PP_REPEAT_3_57(m, d) SEQAN_PP_REPEAT_3_56(m, d) m(4, 56, d) -# define SEQAN_PP_REPEAT_3_58(m, d) SEQAN_PP_REPEAT_3_57(m, d) m(4, 57, d) -# define SEQAN_PP_REPEAT_3_59(m, d) SEQAN_PP_REPEAT_3_58(m, d) m(4, 58, d) -# define SEQAN_PP_REPEAT_3_60(m, d) SEQAN_PP_REPEAT_3_59(m, d) m(4, 59, d) -# define SEQAN_PP_REPEAT_3_61(m, d) SEQAN_PP_REPEAT_3_60(m, d) m(4, 60, d) -# define SEQAN_PP_REPEAT_3_62(m, d) SEQAN_PP_REPEAT_3_61(m, d) m(4, 61, d) -# define SEQAN_PP_REPEAT_3_63(m, d) SEQAN_PP_REPEAT_3_62(m, d) m(4, 62, d) -# define SEQAN_PP_REPEAT_3_64(m, d) SEQAN_PP_REPEAT_3_63(m, d) m(4, 63, d) -# define SEQAN_PP_REPEAT_3_65(m, d) SEQAN_PP_REPEAT_3_64(m, d) m(4, 64, d) -# define SEQAN_PP_REPEAT_3_66(m, d) SEQAN_PP_REPEAT_3_65(m, d) m(4, 65, d) -# define SEQAN_PP_REPEAT_3_67(m, d) SEQAN_PP_REPEAT_3_66(m, d) m(4, 66, d) -# define SEQAN_PP_REPEAT_3_68(m, d) SEQAN_PP_REPEAT_3_67(m, d) m(4, 67, d) -# define SEQAN_PP_REPEAT_3_69(m, d) SEQAN_PP_REPEAT_3_68(m, d) m(4, 68, d) -# define SEQAN_PP_REPEAT_3_70(m, d) SEQAN_PP_REPEAT_3_69(m, d) m(4, 69, d) -# define SEQAN_PP_REPEAT_3_71(m, d) SEQAN_PP_REPEAT_3_70(m, d) m(4, 70, d) -# define SEQAN_PP_REPEAT_3_72(m, d) SEQAN_PP_REPEAT_3_71(m, d) m(4, 71, d) -# define SEQAN_PP_REPEAT_3_73(m, d) SEQAN_PP_REPEAT_3_72(m, d) m(4, 72, d) -# define SEQAN_PP_REPEAT_3_74(m, d) SEQAN_PP_REPEAT_3_73(m, d) m(4, 73, d) -# define SEQAN_PP_REPEAT_3_75(m, d) SEQAN_PP_REPEAT_3_74(m, d) m(4, 74, d) -# define SEQAN_PP_REPEAT_3_76(m, d) SEQAN_PP_REPEAT_3_75(m, d) m(4, 75, d) -# define SEQAN_PP_REPEAT_3_77(m, d) SEQAN_PP_REPEAT_3_76(m, d) m(4, 76, d) -# define SEQAN_PP_REPEAT_3_78(m, d) SEQAN_PP_REPEAT_3_77(m, d) m(4, 77, d) -# define SEQAN_PP_REPEAT_3_79(m, d) SEQAN_PP_REPEAT_3_78(m, d) m(4, 78, d) -# define SEQAN_PP_REPEAT_3_80(m, d) SEQAN_PP_REPEAT_3_79(m, d) m(4, 79, d) -# define SEQAN_PP_REPEAT_3_81(m, d) SEQAN_PP_REPEAT_3_80(m, d) m(4, 80, d) -# define SEQAN_PP_REPEAT_3_82(m, d) SEQAN_PP_REPEAT_3_81(m, d) m(4, 81, d) -# define SEQAN_PP_REPEAT_3_83(m, d) SEQAN_PP_REPEAT_3_82(m, d) m(4, 82, d) -# define SEQAN_PP_REPEAT_3_84(m, d) SEQAN_PP_REPEAT_3_83(m, d) m(4, 83, d) -# define SEQAN_PP_REPEAT_3_85(m, d) SEQAN_PP_REPEAT_3_84(m, d) m(4, 84, d) -# define SEQAN_PP_REPEAT_3_86(m, d) SEQAN_PP_REPEAT_3_85(m, d) m(4, 85, d) -# define SEQAN_PP_REPEAT_3_87(m, d) SEQAN_PP_REPEAT_3_86(m, d) m(4, 86, d) -# define SEQAN_PP_REPEAT_3_88(m, d) SEQAN_PP_REPEAT_3_87(m, d) m(4, 87, d) -# define SEQAN_PP_REPEAT_3_89(m, d) SEQAN_PP_REPEAT_3_88(m, d) m(4, 88, d) -# define SEQAN_PP_REPEAT_3_90(m, d) SEQAN_PP_REPEAT_3_89(m, d) m(4, 89, d) -# define SEQAN_PP_REPEAT_3_91(m, d) SEQAN_PP_REPEAT_3_90(m, d) m(4, 90, d) -# define SEQAN_PP_REPEAT_3_92(m, d) SEQAN_PP_REPEAT_3_91(m, d) m(4, 91, d) -# define SEQAN_PP_REPEAT_3_93(m, d) SEQAN_PP_REPEAT_3_92(m, d) m(4, 92, d) -# define SEQAN_PP_REPEAT_3_94(m, d) SEQAN_PP_REPEAT_3_93(m, d) m(4, 93, d) -# define SEQAN_PP_REPEAT_3_95(m, d) SEQAN_PP_REPEAT_3_94(m, d) m(4, 94, d) -# define SEQAN_PP_REPEAT_3_96(m, d) SEQAN_PP_REPEAT_3_95(m, d) m(4, 95, d) -# define SEQAN_PP_REPEAT_3_97(m, d) SEQAN_PP_REPEAT_3_96(m, d) m(4, 96, d) -# define SEQAN_PP_REPEAT_3_98(m, d) SEQAN_PP_REPEAT_3_97(m, d) m(4, 97, d) -# define SEQAN_PP_REPEAT_3_99(m, d) SEQAN_PP_REPEAT_3_98(m, d) m(4, 98, d) -# define SEQAN_PP_REPEAT_3_100(m, d) SEQAN_PP_REPEAT_3_99(m, d) m(4, 99, d) -# define SEQAN_PP_REPEAT_3_101(m, d) SEQAN_PP_REPEAT_3_100(m, d) m(4, 100, d) -# define SEQAN_PP_REPEAT_3_102(m, d) SEQAN_PP_REPEAT_3_101(m, d) m(4, 101, d) -# define SEQAN_PP_REPEAT_3_103(m, d) SEQAN_PP_REPEAT_3_102(m, d) m(4, 102, d) -# define SEQAN_PP_REPEAT_3_104(m, d) SEQAN_PP_REPEAT_3_103(m, d) m(4, 103, d) -# define SEQAN_PP_REPEAT_3_105(m, d) SEQAN_PP_REPEAT_3_104(m, d) m(4, 104, d) -# define SEQAN_PP_REPEAT_3_106(m, d) SEQAN_PP_REPEAT_3_105(m, d) m(4, 105, d) -# define SEQAN_PP_REPEAT_3_107(m, d) SEQAN_PP_REPEAT_3_106(m, d) m(4, 106, d) -# define SEQAN_PP_REPEAT_3_108(m, d) SEQAN_PP_REPEAT_3_107(m, d) m(4, 107, d) -# define SEQAN_PP_REPEAT_3_109(m, d) SEQAN_PP_REPEAT_3_108(m, d) m(4, 108, d) -# define SEQAN_PP_REPEAT_3_110(m, d) SEQAN_PP_REPEAT_3_109(m, d) m(4, 109, d) -# define SEQAN_PP_REPEAT_3_111(m, d) SEQAN_PP_REPEAT_3_110(m, d) m(4, 110, d) -# define SEQAN_PP_REPEAT_3_112(m, d) SEQAN_PP_REPEAT_3_111(m, d) m(4, 111, d) -# define SEQAN_PP_REPEAT_3_113(m, d) SEQAN_PP_REPEAT_3_112(m, d) m(4, 112, d) -# define SEQAN_PP_REPEAT_3_114(m, d) SEQAN_PP_REPEAT_3_113(m, d) m(4, 113, d) -# define SEQAN_PP_REPEAT_3_115(m, d) SEQAN_PP_REPEAT_3_114(m, d) m(4, 114, d) -# define SEQAN_PP_REPEAT_3_116(m, d) SEQAN_PP_REPEAT_3_115(m, d) m(4, 115, d) -# define SEQAN_PP_REPEAT_3_117(m, d) SEQAN_PP_REPEAT_3_116(m, d) m(4, 116, d) -# define SEQAN_PP_REPEAT_3_118(m, d) SEQAN_PP_REPEAT_3_117(m, d) m(4, 117, d) -# define SEQAN_PP_REPEAT_3_119(m, d) SEQAN_PP_REPEAT_3_118(m, d) m(4, 118, d) -# define SEQAN_PP_REPEAT_3_120(m, d) SEQAN_PP_REPEAT_3_119(m, d) m(4, 119, d) -# define SEQAN_PP_REPEAT_3_121(m, d) SEQAN_PP_REPEAT_3_120(m, d) m(4, 120, d) -# define SEQAN_PP_REPEAT_3_122(m, d) SEQAN_PP_REPEAT_3_121(m, d) m(4, 121, d) -# define SEQAN_PP_REPEAT_3_123(m, d) SEQAN_PP_REPEAT_3_122(m, d) m(4, 122, d) -# define SEQAN_PP_REPEAT_3_124(m, d) SEQAN_PP_REPEAT_3_123(m, d) m(4, 123, d) -# define SEQAN_PP_REPEAT_3_125(m, d) SEQAN_PP_REPEAT_3_124(m, d) m(4, 124, d) -# define SEQAN_PP_REPEAT_3_126(m, d) SEQAN_PP_REPEAT_3_125(m, d) m(4, 125, d) -# define SEQAN_PP_REPEAT_3_127(m, d) SEQAN_PP_REPEAT_3_126(m, d) m(4, 126, d) -# define SEQAN_PP_REPEAT_3_128(m, d) SEQAN_PP_REPEAT_3_127(m, d) m(4, 127, d) -# define SEQAN_PP_REPEAT_3_129(m, d) SEQAN_PP_REPEAT_3_128(m, d) m(4, 128, d) -# define SEQAN_PP_REPEAT_3_130(m, d) SEQAN_PP_REPEAT_3_129(m, d) m(4, 129, d) -# define SEQAN_PP_REPEAT_3_131(m, d) SEQAN_PP_REPEAT_3_130(m, d) m(4, 130, d) -# define SEQAN_PP_REPEAT_3_132(m, d) SEQAN_PP_REPEAT_3_131(m, d) m(4, 131, d) -# define SEQAN_PP_REPEAT_3_133(m, d) SEQAN_PP_REPEAT_3_132(m, d) m(4, 132, d) -# define SEQAN_PP_REPEAT_3_134(m, d) SEQAN_PP_REPEAT_3_133(m, d) m(4, 133, d) -# define SEQAN_PP_REPEAT_3_135(m, d) SEQAN_PP_REPEAT_3_134(m, d) m(4, 134, d) -# define SEQAN_PP_REPEAT_3_136(m, d) SEQAN_PP_REPEAT_3_135(m, d) m(4, 135, d) -# define SEQAN_PP_REPEAT_3_137(m, d) SEQAN_PP_REPEAT_3_136(m, d) m(4, 136, d) -# define SEQAN_PP_REPEAT_3_138(m, d) SEQAN_PP_REPEAT_3_137(m, d) m(4, 137, d) -# define SEQAN_PP_REPEAT_3_139(m, d) SEQAN_PP_REPEAT_3_138(m, d) m(4, 138, d) -# define SEQAN_PP_REPEAT_3_140(m, d) SEQAN_PP_REPEAT_3_139(m, d) m(4, 139, d) -# define SEQAN_PP_REPEAT_3_141(m, d) SEQAN_PP_REPEAT_3_140(m, d) m(4, 140, d) -# define SEQAN_PP_REPEAT_3_142(m, d) SEQAN_PP_REPEAT_3_141(m, d) m(4, 141, d) -# define SEQAN_PP_REPEAT_3_143(m, d) SEQAN_PP_REPEAT_3_142(m, d) m(4, 142, d) -# define SEQAN_PP_REPEAT_3_144(m, d) SEQAN_PP_REPEAT_3_143(m, d) m(4, 143, d) -# define SEQAN_PP_REPEAT_3_145(m, d) SEQAN_PP_REPEAT_3_144(m, d) m(4, 144, d) -# define SEQAN_PP_REPEAT_3_146(m, d) SEQAN_PP_REPEAT_3_145(m, d) m(4, 145, d) -# define SEQAN_PP_REPEAT_3_147(m, d) SEQAN_PP_REPEAT_3_146(m, d) m(4, 146, d) -# define SEQAN_PP_REPEAT_3_148(m, d) SEQAN_PP_REPEAT_3_147(m, d) m(4, 147, d) -# define SEQAN_PP_REPEAT_3_149(m, d) SEQAN_PP_REPEAT_3_148(m, d) m(4, 148, d) -# define SEQAN_PP_REPEAT_3_150(m, d) SEQAN_PP_REPEAT_3_149(m, d) m(4, 149, d) -# define SEQAN_PP_REPEAT_3_151(m, d) SEQAN_PP_REPEAT_3_150(m, d) m(4, 150, d) -# define SEQAN_PP_REPEAT_3_152(m, d) SEQAN_PP_REPEAT_3_151(m, d) m(4, 151, d) -# define SEQAN_PP_REPEAT_3_153(m, d) SEQAN_PP_REPEAT_3_152(m, d) m(4, 152, d) -# define SEQAN_PP_REPEAT_3_154(m, d) SEQAN_PP_REPEAT_3_153(m, d) m(4, 153, d) -# define SEQAN_PP_REPEAT_3_155(m, d) SEQAN_PP_REPEAT_3_154(m, d) m(4, 154, d) -# define SEQAN_PP_REPEAT_3_156(m, d) SEQAN_PP_REPEAT_3_155(m, d) m(4, 155, d) -# define SEQAN_PP_REPEAT_3_157(m, d) SEQAN_PP_REPEAT_3_156(m, d) m(4, 156, d) -# define SEQAN_PP_REPEAT_3_158(m, d) SEQAN_PP_REPEAT_3_157(m, d) m(4, 157, d) -# define SEQAN_PP_REPEAT_3_159(m, d) SEQAN_PP_REPEAT_3_158(m, d) m(4, 158, d) -# define SEQAN_PP_REPEAT_3_160(m, d) SEQAN_PP_REPEAT_3_159(m, d) m(4, 159, d) -# define SEQAN_PP_REPEAT_3_161(m, d) SEQAN_PP_REPEAT_3_160(m, d) m(4, 160, d) -# define SEQAN_PP_REPEAT_3_162(m, d) SEQAN_PP_REPEAT_3_161(m, d) m(4, 161, d) -# define SEQAN_PP_REPEAT_3_163(m, d) SEQAN_PP_REPEAT_3_162(m, d) m(4, 162, d) -# define SEQAN_PP_REPEAT_3_164(m, d) SEQAN_PP_REPEAT_3_163(m, d) m(4, 163, d) -# define SEQAN_PP_REPEAT_3_165(m, d) SEQAN_PP_REPEAT_3_164(m, d) m(4, 164, d) -# define SEQAN_PP_REPEAT_3_166(m, d) SEQAN_PP_REPEAT_3_165(m, d) m(4, 165, d) -# define SEQAN_PP_REPEAT_3_167(m, d) SEQAN_PP_REPEAT_3_166(m, d) m(4, 166, d) -# define SEQAN_PP_REPEAT_3_168(m, d) SEQAN_PP_REPEAT_3_167(m, d) m(4, 167, d) -# define SEQAN_PP_REPEAT_3_169(m, d) SEQAN_PP_REPEAT_3_168(m, d) m(4, 168, d) -# define SEQAN_PP_REPEAT_3_170(m, d) SEQAN_PP_REPEAT_3_169(m, d) m(4, 169, d) -# define SEQAN_PP_REPEAT_3_171(m, d) SEQAN_PP_REPEAT_3_170(m, d) m(4, 170, d) -# define SEQAN_PP_REPEAT_3_172(m, d) SEQAN_PP_REPEAT_3_171(m, d) m(4, 171, d) -# define SEQAN_PP_REPEAT_3_173(m, d) SEQAN_PP_REPEAT_3_172(m, d) m(4, 172, d) -# define SEQAN_PP_REPEAT_3_174(m, d) SEQAN_PP_REPEAT_3_173(m, d) m(4, 173, d) -# define SEQAN_PP_REPEAT_3_175(m, d) SEQAN_PP_REPEAT_3_174(m, d) m(4, 174, d) -# define SEQAN_PP_REPEAT_3_176(m, d) SEQAN_PP_REPEAT_3_175(m, d) m(4, 175, d) -# define SEQAN_PP_REPEAT_3_177(m, d) SEQAN_PP_REPEAT_3_176(m, d) m(4, 176, d) -# define SEQAN_PP_REPEAT_3_178(m, d) SEQAN_PP_REPEAT_3_177(m, d) m(4, 177, d) -# define SEQAN_PP_REPEAT_3_179(m, d) SEQAN_PP_REPEAT_3_178(m, d) m(4, 178, d) -# define SEQAN_PP_REPEAT_3_180(m, d) SEQAN_PP_REPEAT_3_179(m, d) m(4, 179, d) -# define SEQAN_PP_REPEAT_3_181(m, d) SEQAN_PP_REPEAT_3_180(m, d) m(4, 180, d) -# define SEQAN_PP_REPEAT_3_182(m, d) SEQAN_PP_REPEAT_3_181(m, d) m(4, 181, d) -# define SEQAN_PP_REPEAT_3_183(m, d) SEQAN_PP_REPEAT_3_182(m, d) m(4, 182, d) -# define SEQAN_PP_REPEAT_3_184(m, d) SEQAN_PP_REPEAT_3_183(m, d) m(4, 183, d) -# define SEQAN_PP_REPEAT_3_185(m, d) SEQAN_PP_REPEAT_3_184(m, d) m(4, 184, d) -# define SEQAN_PP_REPEAT_3_186(m, d) SEQAN_PP_REPEAT_3_185(m, d) m(4, 185, d) -# define SEQAN_PP_REPEAT_3_187(m, d) SEQAN_PP_REPEAT_3_186(m, d) m(4, 186, d) -# define SEQAN_PP_REPEAT_3_188(m, d) SEQAN_PP_REPEAT_3_187(m, d) m(4, 187, d) -# define SEQAN_PP_REPEAT_3_189(m, d) SEQAN_PP_REPEAT_3_188(m, d) m(4, 188, d) -# define SEQAN_PP_REPEAT_3_190(m, d) SEQAN_PP_REPEAT_3_189(m, d) m(4, 189, d) -# define SEQAN_PP_REPEAT_3_191(m, d) SEQAN_PP_REPEAT_3_190(m, d) m(4, 190, d) -# define SEQAN_PP_REPEAT_3_192(m, d) SEQAN_PP_REPEAT_3_191(m, d) m(4, 191, d) -# define SEQAN_PP_REPEAT_3_193(m, d) SEQAN_PP_REPEAT_3_192(m, d) m(4, 192, d) -# define SEQAN_PP_REPEAT_3_194(m, d) SEQAN_PP_REPEAT_3_193(m, d) m(4, 193, d) -# define SEQAN_PP_REPEAT_3_195(m, d) SEQAN_PP_REPEAT_3_194(m, d) m(4, 194, d) -# define SEQAN_PP_REPEAT_3_196(m, d) SEQAN_PP_REPEAT_3_195(m, d) m(4, 195, d) -# define SEQAN_PP_REPEAT_3_197(m, d) SEQAN_PP_REPEAT_3_196(m, d) m(4, 196, d) -# define SEQAN_PP_REPEAT_3_198(m, d) SEQAN_PP_REPEAT_3_197(m, d) m(4, 197, d) -# define SEQAN_PP_REPEAT_3_199(m, d) SEQAN_PP_REPEAT_3_198(m, d) m(4, 198, d) -# define SEQAN_PP_REPEAT_3_200(m, d) SEQAN_PP_REPEAT_3_199(m, d) m(4, 199, d) -# define SEQAN_PP_REPEAT_3_201(m, d) SEQAN_PP_REPEAT_3_200(m, d) m(4, 200, d) -# define SEQAN_PP_REPEAT_3_202(m, d) SEQAN_PP_REPEAT_3_201(m, d) m(4, 201, d) -# define SEQAN_PP_REPEAT_3_203(m, d) SEQAN_PP_REPEAT_3_202(m, d) m(4, 202, d) -# define SEQAN_PP_REPEAT_3_204(m, d) SEQAN_PP_REPEAT_3_203(m, d) m(4, 203, d) -# define SEQAN_PP_REPEAT_3_205(m, d) SEQAN_PP_REPEAT_3_204(m, d) m(4, 204, d) -# define SEQAN_PP_REPEAT_3_206(m, d) SEQAN_PP_REPEAT_3_205(m, d) m(4, 205, d) -# define SEQAN_PP_REPEAT_3_207(m, d) SEQAN_PP_REPEAT_3_206(m, d) m(4, 206, d) -# define SEQAN_PP_REPEAT_3_208(m, d) SEQAN_PP_REPEAT_3_207(m, d) m(4, 207, d) -# define SEQAN_PP_REPEAT_3_209(m, d) SEQAN_PP_REPEAT_3_208(m, d) m(4, 208, d) -# define SEQAN_PP_REPEAT_3_210(m, d) SEQAN_PP_REPEAT_3_209(m, d) m(4, 209, d) -# define SEQAN_PP_REPEAT_3_211(m, d) SEQAN_PP_REPEAT_3_210(m, d) m(4, 210, d) -# define SEQAN_PP_REPEAT_3_212(m, d) SEQAN_PP_REPEAT_3_211(m, d) m(4, 211, d) -# define SEQAN_PP_REPEAT_3_213(m, d) SEQAN_PP_REPEAT_3_212(m, d) m(4, 212, d) -# define SEQAN_PP_REPEAT_3_214(m, d) SEQAN_PP_REPEAT_3_213(m, d) m(4, 213, d) -# define SEQAN_PP_REPEAT_3_215(m, d) SEQAN_PP_REPEAT_3_214(m, d) m(4, 214, d) -# define SEQAN_PP_REPEAT_3_216(m, d) SEQAN_PP_REPEAT_3_215(m, d) m(4, 215, d) -# define SEQAN_PP_REPEAT_3_217(m, d) SEQAN_PP_REPEAT_3_216(m, d) m(4, 216, d) -# define SEQAN_PP_REPEAT_3_218(m, d) SEQAN_PP_REPEAT_3_217(m, d) m(4, 217, d) -# define SEQAN_PP_REPEAT_3_219(m, d) SEQAN_PP_REPEAT_3_218(m, d) m(4, 218, d) -# define SEQAN_PP_REPEAT_3_220(m, d) SEQAN_PP_REPEAT_3_219(m, d) m(4, 219, d) -# define SEQAN_PP_REPEAT_3_221(m, d) SEQAN_PP_REPEAT_3_220(m, d) m(4, 220, d) -# define SEQAN_PP_REPEAT_3_222(m, d) SEQAN_PP_REPEAT_3_221(m, d) m(4, 221, d) -# define SEQAN_PP_REPEAT_3_223(m, d) SEQAN_PP_REPEAT_3_222(m, d) m(4, 222, d) -# define SEQAN_PP_REPEAT_3_224(m, d) SEQAN_PP_REPEAT_3_223(m, d) m(4, 223, d) -# define SEQAN_PP_REPEAT_3_225(m, d) SEQAN_PP_REPEAT_3_224(m, d) m(4, 224, d) -# define SEQAN_PP_REPEAT_3_226(m, d) SEQAN_PP_REPEAT_3_225(m, d) m(4, 225, d) -# define SEQAN_PP_REPEAT_3_227(m, d) SEQAN_PP_REPEAT_3_226(m, d) m(4, 226, d) -# define SEQAN_PP_REPEAT_3_228(m, d) SEQAN_PP_REPEAT_3_227(m, d) m(4, 227, d) -# define SEQAN_PP_REPEAT_3_229(m, d) SEQAN_PP_REPEAT_3_228(m, d) m(4, 228, d) -# define SEQAN_PP_REPEAT_3_230(m, d) SEQAN_PP_REPEAT_3_229(m, d) m(4, 229, d) -# define SEQAN_PP_REPEAT_3_231(m, d) SEQAN_PP_REPEAT_3_230(m, d) m(4, 230, d) -# define SEQAN_PP_REPEAT_3_232(m, d) SEQAN_PP_REPEAT_3_231(m, d) m(4, 231, d) -# define SEQAN_PP_REPEAT_3_233(m, d) SEQAN_PP_REPEAT_3_232(m, d) m(4, 232, d) -# define SEQAN_PP_REPEAT_3_234(m, d) SEQAN_PP_REPEAT_3_233(m, d) m(4, 233, d) -# define SEQAN_PP_REPEAT_3_235(m, d) SEQAN_PP_REPEAT_3_234(m, d) m(4, 234, d) -# define SEQAN_PP_REPEAT_3_236(m, d) SEQAN_PP_REPEAT_3_235(m, d) m(4, 235, d) -# define SEQAN_PP_REPEAT_3_237(m, d) SEQAN_PP_REPEAT_3_236(m, d) m(4, 236, d) -# define SEQAN_PP_REPEAT_3_238(m, d) SEQAN_PP_REPEAT_3_237(m, d) m(4, 237, d) -# define SEQAN_PP_REPEAT_3_239(m, d) SEQAN_PP_REPEAT_3_238(m, d) m(4, 238, d) -# define SEQAN_PP_REPEAT_3_240(m, d) SEQAN_PP_REPEAT_3_239(m, d) m(4, 239, d) -# define SEQAN_PP_REPEAT_3_241(m, d) SEQAN_PP_REPEAT_3_240(m, d) m(4, 240, d) -# define SEQAN_PP_REPEAT_3_242(m, d) SEQAN_PP_REPEAT_3_241(m, d) m(4, 241, d) -# define SEQAN_PP_REPEAT_3_243(m, d) SEQAN_PP_REPEAT_3_242(m, d) m(4, 242, d) -# define SEQAN_PP_REPEAT_3_244(m, d) SEQAN_PP_REPEAT_3_243(m, d) m(4, 243, d) -# define SEQAN_PP_REPEAT_3_245(m, d) SEQAN_PP_REPEAT_3_244(m, d) m(4, 244, d) -# define SEQAN_PP_REPEAT_3_246(m, d) SEQAN_PP_REPEAT_3_245(m, d) m(4, 245, d) -# define SEQAN_PP_REPEAT_3_247(m, d) SEQAN_PP_REPEAT_3_246(m, d) m(4, 246, d) -# define SEQAN_PP_REPEAT_3_248(m, d) SEQAN_PP_REPEAT_3_247(m, d) m(4, 247, d) -# define SEQAN_PP_REPEAT_3_249(m, d) SEQAN_PP_REPEAT_3_248(m, d) m(4, 248, d) -# define SEQAN_PP_REPEAT_3_250(m, d) SEQAN_PP_REPEAT_3_249(m, d) m(4, 249, d) -# define SEQAN_PP_REPEAT_3_251(m, d) SEQAN_PP_REPEAT_3_250(m, d) m(4, 250, d) -# define SEQAN_PP_REPEAT_3_252(m, d) SEQAN_PP_REPEAT_3_251(m, d) m(4, 251, d) -# define SEQAN_PP_REPEAT_3_253(m, d) SEQAN_PP_REPEAT_3_252(m, d) m(4, 252, d) -# define SEQAN_PP_REPEAT_3_254(m, d) SEQAN_PP_REPEAT_3_253(m, d) m(4, 253, d) -# define SEQAN_PP_REPEAT_3_255(m, d) SEQAN_PP_REPEAT_3_254(m, d) m(4, 254, d) -# define SEQAN_PP_REPEAT_3_256(m, d) SEQAN_PP_REPEAT_3_255(m, d) m(4, 255, d) -# -//# endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/repetition/for.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_REPETITION_FOR_HPP -// # define SEQAN_PREPROCESSOR_REPETITION_FOR_HPP -# -// # include -// # include -// # include -# -# /* SEQAN_PP_FOR */ -# -// # if 0 -// # define SEQAN_PP_FOR(state, pred, op, macro) -// # endif -# -# define SEQAN_PP_FOR SEQAN_PP_CAT(SEQAN_PP_FOR_, SEQAN_PP_AUTO_REC(SEQAN_PP_FOR_P, 256)) -# -# define SEQAN_PP_FOR_P(n) SEQAN_PP_CAT(SEQAN_PP_FOR_CHECK_, SEQAN_PP_FOR_ ## n(1, SEQAN_PP_FOR_SR_P, SEQAN_PP_FOR_SR_O, SEQAN_PP_FOR_SR_M)) -# -# define SEQAN_PP_FOR_SR_P(r, s) s -# define SEQAN_PP_FOR_SR_O(r, s) 0 -# define SEQAN_PP_FOR_SR_M(r, s) SEQAN_PP_NIL -# -// # if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() -// # include -// # elif SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MSVC() -// # include -// # elif SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_DMC() -// # include -// # else -// # include -// # endif -# -# define SEQAN_PP_FOR_257(s, p, o, m) SEQAN_PP_ERROR(0x0002) -# -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_NIL 1 -# -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_1(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_2(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_3(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_4(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_5(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_6(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_7(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_8(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_9(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_10(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_11(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_12(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_13(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_14(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_15(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_16(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_17(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_18(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_19(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_20(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_21(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_22(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_23(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_24(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_25(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_26(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_27(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_28(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_29(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_30(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_31(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_32(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_33(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_34(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_35(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_36(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_37(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_38(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_39(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_40(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_41(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_42(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_43(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_44(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_45(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_46(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_47(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_48(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_49(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_50(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_51(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_52(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_53(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_54(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_55(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_56(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_57(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_58(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_59(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_60(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_61(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_62(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_63(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_64(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_65(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_66(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_67(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_68(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_69(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_70(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_71(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_72(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_73(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_74(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_75(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_76(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_77(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_78(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_79(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_80(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_81(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_82(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_83(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_84(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_85(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_86(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_87(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_88(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_89(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_90(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_91(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_92(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_93(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_94(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_95(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_96(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_97(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_98(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_99(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_100(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_101(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_102(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_103(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_104(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_105(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_106(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_107(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_108(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_109(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_110(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_111(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_112(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_113(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_114(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_115(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_116(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_117(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_118(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_119(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_120(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_121(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_122(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_123(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_124(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_125(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_126(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_127(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_128(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_129(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_130(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_131(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_132(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_133(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_134(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_135(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_136(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_137(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_138(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_139(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_140(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_141(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_142(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_143(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_144(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_145(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_146(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_147(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_148(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_149(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_150(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_151(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_152(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_153(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_154(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_155(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_156(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_157(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_158(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_159(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_160(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_161(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_162(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_163(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_164(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_165(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_166(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_167(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_168(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_169(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_170(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_171(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_172(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_173(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_174(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_175(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_176(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_177(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_178(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_179(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_180(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_181(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_182(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_183(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_184(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_185(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_186(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_187(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_188(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_189(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_190(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_191(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_192(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_193(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_194(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_195(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_196(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_197(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_198(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_199(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_200(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_201(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_202(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_203(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_204(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_205(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_206(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_207(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_208(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_209(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_210(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_211(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_212(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_213(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_214(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_215(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_216(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_217(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_218(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_219(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_220(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_221(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_222(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_223(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_224(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_225(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_226(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_227(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_228(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_229(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_230(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_231(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_232(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_233(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_234(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_235(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_236(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_237(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_238(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_239(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_240(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_241(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_242(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_243(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_244(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_245(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_246(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_247(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_248(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_249(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_250(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_251(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_252(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_253(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_254(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_255(s, p, o, m) 0 -# define SEQAN_PP_FOR_CHECK_SEQAN_PP_FOR_256(s, p, o, m) 0 - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/facilities/empty.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_FACILITIES_EMPTY_HPP -// # define SEQAN_PREPROCESSOR_FACILITIES_EMPTY_HPP -# -# /* SEQAN_PP_EMPTY */ -# -# define SEQAN_PP_EMPTY() -# -// # endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/seq/elem.hpp <== -// -------------------------------------------------------------------------- - -# /* ************************************************************************** -# * * -# * (C) Copyright Paul Mensonides 2002. -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# * * -# ************************************************************************** */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_SEQ_ELEM_HPP -// # define SEQAN_PREPROCESSOR_SEQ_ELEM_HPP -# -// # include -// # include -// # include -# -# /* SEQAN_PP_SEQ_ELEM */ -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_SEQ_ELEM(i, seq) SEQAN_PP_SEQ_ELEM_I(i, seq) -// # else -// # define SEQAN_PP_SEQ_ELEM(i, seq) SEQAN_PP_SEQ_ELEM_I((i, seq)) -// # endif -# -// # if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MSVC() -#ifdef PLATFORM_WINDOWS_VS -# define SEQAN_PP_SEQ_ELEM_I(i, seq) SEQAN_PP_SEQ_ELEM_II((SEQAN_PP_SEQ_ELEM_ ## i seq)) -# define SEQAN_PP_SEQ_ELEM_II(res) SEQAN_PP_SEQ_ELEM_IV(SEQAN_PP_SEQ_ELEM_III res) -# define SEQAN_PP_SEQ_ELEM_III(x, _) x SEQAN_PP_EMPTY() -# define SEQAN_PP_SEQ_ELEM_IV(x) x -// # elif SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -// # define SEQAN_PP_SEQ_ELEM_I(par) SEQAN_PP_SEQ_ELEM_II ## par -// # define SEQAN_PP_SEQ_ELEM_II(i, seq) SEQAN_PP_SEQ_ELEM_III(SEQAN_PP_SEQ_ELEM_ ## i ## seq) -// # define SEQAN_PP_SEQ_ELEM_III(im) SEQAN_PP_SEQ_ELEM_IV(im) -// # define SEQAN_PP_SEQ_ELEM_IV(x, _) x -# else // #ifdef PLATFORM_WINDOWS_VS -// # if defined(__IBMC__) || defined(__IBMCPP__) -// # define SEQAN_PP_SEQ_ELEM_I(i, seq) SEQAN_PP_SEQ_ELEM_II(SEQAN_PP_CAT(SEQAN_PP_SEQ_ELEM_ ## i, seq)) -// # else -# define SEQAN_PP_SEQ_ELEM_I(i, seq) SEQAN_PP_SEQ_ELEM_II(SEQAN_PP_SEQ_ELEM_ ## i seq) -// # endif -# define SEQAN_PP_SEQ_ELEM_II(im) SEQAN_PP_SEQ_ELEM_III(im) -# define SEQAN_PP_SEQ_ELEM_III(x, _) x -# endif // #ifdef PLATFORM_WINDOWS_VS -# -# define SEQAN_PP_SEQ_ELEM_0(x) x, SEQAN_PP_NIL -# define SEQAN_PP_SEQ_ELEM_1(_) SEQAN_PP_SEQ_ELEM_0 -# define SEQAN_PP_SEQ_ELEM_2(_) SEQAN_PP_SEQ_ELEM_1 -# define SEQAN_PP_SEQ_ELEM_3(_) SEQAN_PP_SEQ_ELEM_2 -# define SEQAN_PP_SEQ_ELEM_4(_) SEQAN_PP_SEQ_ELEM_3 -# define SEQAN_PP_SEQ_ELEM_5(_) SEQAN_PP_SEQ_ELEM_4 -# define SEQAN_PP_SEQ_ELEM_6(_) SEQAN_PP_SEQ_ELEM_5 -# define SEQAN_PP_SEQ_ELEM_7(_) SEQAN_PP_SEQ_ELEM_6 -# define SEQAN_PP_SEQ_ELEM_8(_) SEQAN_PP_SEQ_ELEM_7 -# define SEQAN_PP_SEQ_ELEM_9(_) SEQAN_PP_SEQ_ELEM_8 -# define SEQAN_PP_SEQ_ELEM_10(_) SEQAN_PP_SEQ_ELEM_9 -# define SEQAN_PP_SEQ_ELEM_11(_) SEQAN_PP_SEQ_ELEM_10 -# define SEQAN_PP_SEQ_ELEM_12(_) SEQAN_PP_SEQ_ELEM_11 -# define SEQAN_PP_SEQ_ELEM_13(_) SEQAN_PP_SEQ_ELEM_12 -# define SEQAN_PP_SEQ_ELEM_14(_) SEQAN_PP_SEQ_ELEM_13 -# define SEQAN_PP_SEQ_ELEM_15(_) SEQAN_PP_SEQ_ELEM_14 -# define SEQAN_PP_SEQ_ELEM_16(_) SEQAN_PP_SEQ_ELEM_15 -# define SEQAN_PP_SEQ_ELEM_17(_) SEQAN_PP_SEQ_ELEM_16 -# define SEQAN_PP_SEQ_ELEM_18(_) SEQAN_PP_SEQ_ELEM_17 -# define SEQAN_PP_SEQ_ELEM_19(_) SEQAN_PP_SEQ_ELEM_18 -# define SEQAN_PP_SEQ_ELEM_20(_) SEQAN_PP_SEQ_ELEM_19 -# define SEQAN_PP_SEQ_ELEM_21(_) SEQAN_PP_SEQ_ELEM_20 -# define SEQAN_PP_SEQ_ELEM_22(_) SEQAN_PP_SEQ_ELEM_21 -# define SEQAN_PP_SEQ_ELEM_23(_) SEQAN_PP_SEQ_ELEM_22 -# define SEQAN_PP_SEQ_ELEM_24(_) SEQAN_PP_SEQ_ELEM_23 -# define SEQAN_PP_SEQ_ELEM_25(_) SEQAN_PP_SEQ_ELEM_24 -# define SEQAN_PP_SEQ_ELEM_26(_) SEQAN_PP_SEQ_ELEM_25 -# define SEQAN_PP_SEQ_ELEM_27(_) SEQAN_PP_SEQ_ELEM_26 -# define SEQAN_PP_SEQ_ELEM_28(_) SEQAN_PP_SEQ_ELEM_27 -# define SEQAN_PP_SEQ_ELEM_29(_) SEQAN_PP_SEQ_ELEM_28 -# define SEQAN_PP_SEQ_ELEM_30(_) SEQAN_PP_SEQ_ELEM_29 -# define SEQAN_PP_SEQ_ELEM_31(_) SEQAN_PP_SEQ_ELEM_30 -# define SEQAN_PP_SEQ_ELEM_32(_) SEQAN_PP_SEQ_ELEM_31 -# define SEQAN_PP_SEQ_ELEM_33(_) SEQAN_PP_SEQ_ELEM_32 -# define SEQAN_PP_SEQ_ELEM_34(_) SEQAN_PP_SEQ_ELEM_33 -# define SEQAN_PP_SEQ_ELEM_35(_) SEQAN_PP_SEQ_ELEM_34 -# define SEQAN_PP_SEQ_ELEM_36(_) SEQAN_PP_SEQ_ELEM_35 -# define SEQAN_PP_SEQ_ELEM_37(_) SEQAN_PP_SEQ_ELEM_36 -# define SEQAN_PP_SEQ_ELEM_38(_) SEQAN_PP_SEQ_ELEM_37 -# define SEQAN_PP_SEQ_ELEM_39(_) SEQAN_PP_SEQ_ELEM_38 -# define SEQAN_PP_SEQ_ELEM_40(_) SEQAN_PP_SEQ_ELEM_39 -# define SEQAN_PP_SEQ_ELEM_41(_) SEQAN_PP_SEQ_ELEM_40 -# define SEQAN_PP_SEQ_ELEM_42(_) SEQAN_PP_SEQ_ELEM_41 -# define SEQAN_PP_SEQ_ELEM_43(_) SEQAN_PP_SEQ_ELEM_42 -# define SEQAN_PP_SEQ_ELEM_44(_) SEQAN_PP_SEQ_ELEM_43 -# define SEQAN_PP_SEQ_ELEM_45(_) SEQAN_PP_SEQ_ELEM_44 -# define SEQAN_PP_SEQ_ELEM_46(_) SEQAN_PP_SEQ_ELEM_45 -# define SEQAN_PP_SEQ_ELEM_47(_) SEQAN_PP_SEQ_ELEM_46 -# define SEQAN_PP_SEQ_ELEM_48(_) SEQAN_PP_SEQ_ELEM_47 -# define SEQAN_PP_SEQ_ELEM_49(_) SEQAN_PP_SEQ_ELEM_48 -# define SEQAN_PP_SEQ_ELEM_50(_) SEQAN_PP_SEQ_ELEM_49 -# define SEQAN_PP_SEQ_ELEM_51(_) SEQAN_PP_SEQ_ELEM_50 -# define SEQAN_PP_SEQ_ELEM_52(_) SEQAN_PP_SEQ_ELEM_51 -# define SEQAN_PP_SEQ_ELEM_53(_) SEQAN_PP_SEQ_ELEM_52 - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/seq/seq.hpp <== -// -------------------------------------------------------------------------- - -# /* ************************************************************************** -# * * -# * (C) Copyright Paul Mensonides 2002. -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# * * -# ************************************************************************** */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_SEQ_SEQ_HPP -// # define SEQAN_PREPROCESSOR_SEQ_SEQ_HPP -# -// # include -// # include -# -# /* SEQAN_PP_SEQ_HEAD */ -# -# define SEQAN_PP_SEQ_HEAD(seq) SEQAN_PP_SEQ_ELEM(0, seq) -# -# /* SEQAN_PP_SEQ_TAIL */ -# -// # if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -// # define SEQAN_PP_SEQ_TAIL(seq) SEQAN_PP_SEQ_TAIL_1((seq)) -// # define SEQAN_PP_SEQ_TAIL_1(par) SEQAN_PP_SEQ_TAIL_2 ## par -// # define SEQAN_PP_SEQ_TAIL_2(seq) SEQAN_PP_SEQ_TAIL_I ## seq -// # elif SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MSVC() -#ifdef PLATFORM_WINDOWS_VS -# define SEQAN_PP_SEQ_TAIL(seq) SEQAN_PP_SEQ_TAIL_ID(SEQAN_PP_SEQ_TAIL_I seq) -# define SEQAN_PP_SEQ_TAIL_ID(id) id -// # elif SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() -// # define SEQAN_PP_SEQ_TAIL(seq) SEQAN_PP_SEQ_TAIL_D(seq) -// # define SEQAN_PP_SEQ_TAIL_D(seq) SEQAN_PP_SEQ_TAIL_I seq -# else // #ifdef PLATFORM_WINDOWS_VS -# define SEQAN_PP_SEQ_TAIL(seq) SEQAN_PP_SEQ_TAIL_I seq -# endif // #ifdef PLATFORM_WINDOWS_VS -# -# define SEQAN_PP_SEQ_TAIL_I(x) -# -# /* SEQAN_PP_SEQ_NIL */ -# -# define SEQAN_PP_SEQ_NIL(x) (x) -# -// # endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/arithmetic/inc.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -//# ifndef SEQAN_PREPROCESSOR_ARITHMETIC_INC_HPP -//# define SEQAN_PREPROCESSOR_ARITHMETIC_INC_HPP -# -//# include -# -# /* SEQAN_PP_INC */ -# -//# if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_INC(x) SEQAN_PP_INC_I(x) -//# else -//# define SEQAN_PP_INC(x) SEQAN_PP_INC_OO((x)) -//# define SEQAN_PP_INC_OO(par) SEQAN_PP_INC_I ## par -//# endif -# -# define SEQAN_PP_INC_I(x) SEQAN_PP_INC_ ## x -# -# define SEQAN_PP_INC_0 1 -# define SEQAN_PP_INC_1 2 -# define SEQAN_PP_INC_2 3 -# define SEQAN_PP_INC_3 4 -# define SEQAN_PP_INC_4 5 -# define SEQAN_PP_INC_5 6 -# define SEQAN_PP_INC_6 7 -# define SEQAN_PP_INC_7 8 -# define SEQAN_PP_INC_8 9 -# define SEQAN_PP_INC_9 10 -# define SEQAN_PP_INC_10 11 -# define SEQAN_PP_INC_11 12 -# define SEQAN_PP_INC_12 13 -# define SEQAN_PP_INC_13 14 -# define SEQAN_PP_INC_14 15 -# define SEQAN_PP_INC_15 16 -# define SEQAN_PP_INC_16 17 -# define SEQAN_PP_INC_17 18 -# define SEQAN_PP_INC_18 19 -# define SEQAN_PP_INC_19 20 -# define SEQAN_PP_INC_20 21 -# define SEQAN_PP_INC_21 22 -# define SEQAN_PP_INC_22 23 -# define SEQAN_PP_INC_23 24 -# define SEQAN_PP_INC_24 25 -# define SEQAN_PP_INC_25 26 -# define SEQAN_PP_INC_26 27 -# define SEQAN_PP_INC_27 28 -# define SEQAN_PP_INC_28 29 -# define SEQAN_PP_INC_29 30 -# define SEQAN_PP_INC_30 31 -# define SEQAN_PP_INC_31 32 -# define SEQAN_PP_INC_32 33 -# define SEQAN_PP_INC_33 34 -# define SEQAN_PP_INC_34 35 -# define SEQAN_PP_INC_35 36 -# define SEQAN_PP_INC_36 37 -# define SEQAN_PP_INC_37 38 -# define SEQAN_PP_INC_38 39 -# define SEQAN_PP_INC_39 40 -# define SEQAN_PP_INC_40 41 -# define SEQAN_PP_INC_41 42 -# define SEQAN_PP_INC_42 43 -# define SEQAN_PP_INC_43 44 -# define SEQAN_PP_INC_44 45 -# define SEQAN_PP_INC_45 46 -# define SEQAN_PP_INC_46 47 -# define SEQAN_PP_INC_47 48 -# define SEQAN_PP_INC_48 49 -# define SEQAN_PP_INC_49 50 -# define SEQAN_PP_INC_50 51 -# define SEQAN_PP_INC_51 52 -# define SEQAN_PP_INC_52 53 -# define SEQAN_PP_INC_53 54 -# define SEQAN_PP_INC_54 55 -# define SEQAN_PP_INC_55 56 -# define SEQAN_PP_INC_56 57 -# define SEQAN_PP_INC_57 58 -# define SEQAN_PP_INC_58 59 -# define SEQAN_PP_INC_59 60 -# define SEQAN_PP_INC_60 61 -# define SEQAN_PP_INC_61 62 -# define SEQAN_PP_INC_62 63 -# define SEQAN_PP_INC_63 64 -# define SEQAN_PP_INC_64 65 -# define SEQAN_PP_INC_65 66 -# define SEQAN_PP_INC_66 67 -# define SEQAN_PP_INC_67 68 -# define SEQAN_PP_INC_68 69 -# define SEQAN_PP_INC_69 70 -# define SEQAN_PP_INC_70 71 -# define SEQAN_PP_INC_71 72 -# define SEQAN_PP_INC_72 73 -# define SEQAN_PP_INC_73 74 -# define SEQAN_PP_INC_74 75 -# define SEQAN_PP_INC_75 76 -# define SEQAN_PP_INC_76 77 -# define SEQAN_PP_INC_77 78 -# define SEQAN_PP_INC_78 79 -# define SEQAN_PP_INC_79 80 -# define SEQAN_PP_INC_80 81 -# define SEQAN_PP_INC_81 82 -# define SEQAN_PP_INC_82 83 -# define SEQAN_PP_INC_83 84 -# define SEQAN_PP_INC_84 85 -# define SEQAN_PP_INC_85 86 -# define SEQAN_PP_INC_86 87 -# define SEQAN_PP_INC_87 88 -# define SEQAN_PP_INC_88 89 -# define SEQAN_PP_INC_89 90 -# define SEQAN_PP_INC_90 91 -# define SEQAN_PP_INC_91 92 -# define SEQAN_PP_INC_92 93 -# define SEQAN_PP_INC_93 94 -# define SEQAN_PP_INC_94 95 -# define SEQAN_PP_INC_95 96 -# define SEQAN_PP_INC_96 97 -# define SEQAN_PP_INC_97 98 -# define SEQAN_PP_INC_98 99 -# define SEQAN_PP_INC_99 100 -# define SEQAN_PP_INC_100 101 -# define SEQAN_PP_INC_101 102 -# define SEQAN_PP_INC_102 103 -# define SEQAN_PP_INC_103 104 -# define SEQAN_PP_INC_104 105 -# define SEQAN_PP_INC_105 106 -# define SEQAN_PP_INC_106 107 -# define SEQAN_PP_INC_107 108 -# define SEQAN_PP_INC_108 109 -# define SEQAN_PP_INC_109 110 -# define SEQAN_PP_INC_110 111 -# define SEQAN_PP_INC_111 112 -# define SEQAN_PP_INC_112 113 -# define SEQAN_PP_INC_113 114 -# define SEQAN_PP_INC_114 115 -# define SEQAN_PP_INC_115 116 -# define SEQAN_PP_INC_116 117 -# define SEQAN_PP_INC_117 118 -# define SEQAN_PP_INC_118 119 -# define SEQAN_PP_INC_119 120 -# define SEQAN_PP_INC_120 121 -# define SEQAN_PP_INC_121 122 -# define SEQAN_PP_INC_122 123 -# define SEQAN_PP_INC_123 124 -# define SEQAN_PP_INC_124 125 -# define SEQAN_PP_INC_125 126 -# define SEQAN_PP_INC_126 127 -# define SEQAN_PP_INC_127 128 -# define SEQAN_PP_INC_128 129 -# define SEQAN_PP_INC_129 130 -# define SEQAN_PP_INC_130 131 -# define SEQAN_PP_INC_131 132 -# define SEQAN_PP_INC_132 133 -# define SEQAN_PP_INC_133 134 -# define SEQAN_PP_INC_134 135 -# define SEQAN_PP_INC_135 136 -# define SEQAN_PP_INC_136 137 -# define SEQAN_PP_INC_137 138 -# define SEQAN_PP_INC_138 139 -# define SEQAN_PP_INC_139 140 -# define SEQAN_PP_INC_140 141 -# define SEQAN_PP_INC_141 142 -# define SEQAN_PP_INC_142 143 -# define SEQAN_PP_INC_143 144 -# define SEQAN_PP_INC_144 145 -# define SEQAN_PP_INC_145 146 -# define SEQAN_PP_INC_146 147 -# define SEQAN_PP_INC_147 148 -# define SEQAN_PP_INC_148 149 -# define SEQAN_PP_INC_149 150 -# define SEQAN_PP_INC_150 151 -# define SEQAN_PP_INC_151 152 -# define SEQAN_PP_INC_152 153 -# define SEQAN_PP_INC_153 154 -# define SEQAN_PP_INC_154 155 -# define SEQAN_PP_INC_155 156 -# define SEQAN_PP_INC_156 157 -# define SEQAN_PP_INC_157 158 -# define SEQAN_PP_INC_158 159 -# define SEQAN_PP_INC_159 160 -# define SEQAN_PP_INC_160 161 -# define SEQAN_PP_INC_161 162 -# define SEQAN_PP_INC_162 163 -# define SEQAN_PP_INC_163 164 -# define SEQAN_PP_INC_164 165 -# define SEQAN_PP_INC_165 166 -# define SEQAN_PP_INC_166 167 -# define SEQAN_PP_INC_167 168 -# define SEQAN_PP_INC_168 169 -# define SEQAN_PP_INC_169 170 -# define SEQAN_PP_INC_170 171 -# define SEQAN_PP_INC_171 172 -# define SEQAN_PP_INC_172 173 -# define SEQAN_PP_INC_173 174 -# define SEQAN_PP_INC_174 175 -# define SEQAN_PP_INC_175 176 -# define SEQAN_PP_INC_176 177 -# define SEQAN_PP_INC_177 178 -# define SEQAN_PP_INC_178 179 -# define SEQAN_PP_INC_179 180 -# define SEQAN_PP_INC_180 181 -# define SEQAN_PP_INC_181 182 -# define SEQAN_PP_INC_182 183 -# define SEQAN_PP_INC_183 184 -# define SEQAN_PP_INC_184 185 -# define SEQAN_PP_INC_185 186 -# define SEQAN_PP_INC_186 187 -# define SEQAN_PP_INC_187 188 -# define SEQAN_PP_INC_188 189 -# define SEQAN_PP_INC_189 190 -# define SEQAN_PP_INC_190 191 -# define SEQAN_PP_INC_191 192 -# define SEQAN_PP_INC_192 193 -# define SEQAN_PP_INC_193 194 -# define SEQAN_PP_INC_194 195 -# define SEQAN_PP_INC_195 196 -# define SEQAN_PP_INC_196 197 -# define SEQAN_PP_INC_197 198 -# define SEQAN_PP_INC_198 199 -# define SEQAN_PP_INC_199 200 -# define SEQAN_PP_INC_200 201 -# define SEQAN_PP_INC_201 202 -# define SEQAN_PP_INC_202 203 -# define SEQAN_PP_INC_203 204 -# define SEQAN_PP_INC_204 205 -# define SEQAN_PP_INC_205 206 -# define SEQAN_PP_INC_206 207 -# define SEQAN_PP_INC_207 208 -# define SEQAN_PP_INC_208 209 -# define SEQAN_PP_INC_209 210 -# define SEQAN_PP_INC_210 211 -# define SEQAN_PP_INC_211 212 -# define SEQAN_PP_INC_212 213 -# define SEQAN_PP_INC_213 214 -# define SEQAN_PP_INC_214 215 -# define SEQAN_PP_INC_215 216 -# define SEQAN_PP_INC_216 217 -# define SEQAN_PP_INC_217 218 -# define SEQAN_PP_INC_218 219 -# define SEQAN_PP_INC_219 220 -# define SEQAN_PP_INC_220 221 -# define SEQAN_PP_INC_221 222 -# define SEQAN_PP_INC_222 223 -# define SEQAN_PP_INC_223 224 -# define SEQAN_PP_INC_224 225 -# define SEQAN_PP_INC_225 226 -# define SEQAN_PP_INC_226 227 -# define SEQAN_PP_INC_227 228 -# define SEQAN_PP_INC_228 229 -# define SEQAN_PP_INC_229 230 -# define SEQAN_PP_INC_230 231 -# define SEQAN_PP_INC_231 232 -# define SEQAN_PP_INC_232 233 -# define SEQAN_PP_INC_233 234 -# define SEQAN_PP_INC_234 235 -# define SEQAN_PP_INC_235 236 -# define SEQAN_PP_INC_236 237 -# define SEQAN_PP_INC_237 238 -# define SEQAN_PP_INC_238 239 -# define SEQAN_PP_INC_239 240 -# define SEQAN_PP_INC_240 241 -# define SEQAN_PP_INC_241 242 -# define SEQAN_PP_INC_242 243 -# define SEQAN_PP_INC_243 244 -# define SEQAN_PP_INC_244 245 -# define SEQAN_PP_INC_245 246 -# define SEQAN_PP_INC_246 247 -# define SEQAN_PP_INC_247 248 -# define SEQAN_PP_INC_248 249 -# define SEQAN_PP_INC_249 250 -# define SEQAN_PP_INC_250 251 -# define SEQAN_PP_INC_251 252 -# define SEQAN_PP_INC_252 253 -# define SEQAN_PP_INC_253 254 -# define SEQAN_PP_INC_254 255 -# define SEQAN_PP_INC_255 256 -# define SEQAN_PP_INC_256 256 -# -//# endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/arithmetic/dec.hpp <== -// -------------------------------------------------------------------------- - -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.com -# * -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_ARITHMETIC_DEC_HPP -// # define SEQAN_PREPROCESSOR_ARITHMETIC_DEC_HPP -# -// # include -# -# /* SEQAN_PP_DEC */ -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_MWCC() -# define SEQAN_PP_DEC(x) SEQAN_PP_DEC_I(x) -// # else -// # define SEQAN_PP_DEC(x) SEQAN_PP_DEC_OO((x)) -// # define SEQAN_PP_DEC_OO(par) SEQAN_PP_DEC_I ## par -// # endif -# -# define SEQAN_PP_DEC_I(x) SEQAN_PP_DEC_ ## x -# -# define SEQAN_PP_DEC_0 0 -# define SEQAN_PP_DEC_1 0 -# define SEQAN_PP_DEC_2 1 -# define SEQAN_PP_DEC_3 2 -# define SEQAN_PP_DEC_4 3 -# define SEQAN_PP_DEC_5 4 -# define SEQAN_PP_DEC_6 5 -# define SEQAN_PP_DEC_7 6 -# define SEQAN_PP_DEC_8 7 -# define SEQAN_PP_DEC_9 8 -# define SEQAN_PP_DEC_10 9 -# define SEQAN_PP_DEC_11 10 -# define SEQAN_PP_DEC_12 11 -# define SEQAN_PP_DEC_13 12 -# define SEQAN_PP_DEC_14 13 -# define SEQAN_PP_DEC_15 14 -# define SEQAN_PP_DEC_16 15 -# define SEQAN_PP_DEC_17 16 -# define SEQAN_PP_DEC_18 17 -# define SEQAN_PP_DEC_19 18 -# define SEQAN_PP_DEC_20 19 -# define SEQAN_PP_DEC_21 20 -# define SEQAN_PP_DEC_22 21 -# define SEQAN_PP_DEC_23 22 -# define SEQAN_PP_DEC_24 23 -# define SEQAN_PP_DEC_25 24 -# define SEQAN_PP_DEC_26 25 -# define SEQAN_PP_DEC_27 26 -# define SEQAN_PP_DEC_28 27 -# define SEQAN_PP_DEC_29 28 -# define SEQAN_PP_DEC_30 29 -# define SEQAN_PP_DEC_31 30 -# define SEQAN_PP_DEC_32 31 -# define SEQAN_PP_DEC_33 32 -# define SEQAN_PP_DEC_34 33 -# define SEQAN_PP_DEC_35 34 -# define SEQAN_PP_DEC_36 35 -# define SEQAN_PP_DEC_37 36 -# define SEQAN_PP_DEC_38 37 -# define SEQAN_PP_DEC_39 38 -# define SEQAN_PP_DEC_40 39 -# define SEQAN_PP_DEC_41 40 -# define SEQAN_PP_DEC_42 41 -# define SEQAN_PP_DEC_43 42 -# define SEQAN_PP_DEC_44 43 -# define SEQAN_PP_DEC_45 44 -# define SEQAN_PP_DEC_46 45 -# define SEQAN_PP_DEC_47 46 -# define SEQAN_PP_DEC_48 47 -# define SEQAN_PP_DEC_49 48 -# define SEQAN_PP_DEC_50 49 -# define SEQAN_PP_DEC_51 50 -# define SEQAN_PP_DEC_52 51 -# define SEQAN_PP_DEC_53 52 -# define SEQAN_PP_DEC_54 53 -# define SEQAN_PP_DEC_55 54 -# define SEQAN_PP_DEC_56 55 -# define SEQAN_PP_DEC_57 56 -# define SEQAN_PP_DEC_58 57 -# define SEQAN_PP_DEC_59 58 -# define SEQAN_PP_DEC_60 59 -# define SEQAN_PP_DEC_61 60 -# define SEQAN_PP_DEC_62 61 -# define SEQAN_PP_DEC_63 62 -# define SEQAN_PP_DEC_64 63 -# define SEQAN_PP_DEC_65 64 -# define SEQAN_PP_DEC_66 65 -# define SEQAN_PP_DEC_67 66 -# define SEQAN_PP_DEC_68 67 -# define SEQAN_PP_DEC_69 68 -# define SEQAN_PP_DEC_70 69 -# define SEQAN_PP_DEC_71 70 -# define SEQAN_PP_DEC_72 71 -# define SEQAN_PP_DEC_73 72 -# define SEQAN_PP_DEC_74 73 -# define SEQAN_PP_DEC_75 74 -# define SEQAN_PP_DEC_76 75 -# define SEQAN_PP_DEC_77 76 -# define SEQAN_PP_DEC_78 77 -# define SEQAN_PP_DEC_79 78 -# define SEQAN_PP_DEC_80 79 -# define SEQAN_PP_DEC_81 80 -# define SEQAN_PP_DEC_82 81 -# define SEQAN_PP_DEC_83 82 -# define SEQAN_PP_DEC_84 83 -# define SEQAN_PP_DEC_85 84 -# define SEQAN_PP_DEC_86 85 -# define SEQAN_PP_DEC_87 86 -# define SEQAN_PP_DEC_88 87 -# define SEQAN_PP_DEC_89 88 -# define SEQAN_PP_DEC_90 89 -# define SEQAN_PP_DEC_91 90 -# define SEQAN_PP_DEC_92 91 -# define SEQAN_PP_DEC_93 92 -# define SEQAN_PP_DEC_94 93 -# define SEQAN_PP_DEC_95 94 -# define SEQAN_PP_DEC_96 95 -# define SEQAN_PP_DEC_97 96 -# define SEQAN_PP_DEC_98 97 -# define SEQAN_PP_DEC_99 98 -# define SEQAN_PP_DEC_100 99 -# define SEQAN_PP_DEC_101 100 -# define SEQAN_PP_DEC_102 101 -# define SEQAN_PP_DEC_103 102 -# define SEQAN_PP_DEC_104 103 -# define SEQAN_PP_DEC_105 104 -# define SEQAN_PP_DEC_106 105 -# define SEQAN_PP_DEC_107 106 -# define SEQAN_PP_DEC_108 107 -# define SEQAN_PP_DEC_109 108 -# define SEQAN_PP_DEC_110 109 -# define SEQAN_PP_DEC_111 110 -# define SEQAN_PP_DEC_112 111 -# define SEQAN_PP_DEC_113 112 -# define SEQAN_PP_DEC_114 113 -# define SEQAN_PP_DEC_115 114 -# define SEQAN_PP_DEC_116 115 -# define SEQAN_PP_DEC_117 116 -# define SEQAN_PP_DEC_118 117 -# define SEQAN_PP_DEC_119 118 -# define SEQAN_PP_DEC_120 119 -# define SEQAN_PP_DEC_121 120 -# define SEQAN_PP_DEC_122 121 -# define SEQAN_PP_DEC_123 122 -# define SEQAN_PP_DEC_124 123 -# define SEQAN_PP_DEC_125 124 -# define SEQAN_PP_DEC_126 125 -# define SEQAN_PP_DEC_127 126 -# define SEQAN_PP_DEC_128 127 -# define SEQAN_PP_DEC_129 128 -# define SEQAN_PP_DEC_130 129 -# define SEQAN_PP_DEC_131 130 -# define SEQAN_PP_DEC_132 131 -# define SEQAN_PP_DEC_133 132 -# define SEQAN_PP_DEC_134 133 -# define SEQAN_PP_DEC_135 134 -# define SEQAN_PP_DEC_136 135 -# define SEQAN_PP_DEC_137 136 -# define SEQAN_PP_DEC_138 137 -# define SEQAN_PP_DEC_139 138 -# define SEQAN_PP_DEC_140 139 -# define SEQAN_PP_DEC_141 140 -# define SEQAN_PP_DEC_142 141 -# define SEQAN_PP_DEC_143 142 -# define SEQAN_PP_DEC_144 143 -# define SEQAN_PP_DEC_145 144 -# define SEQAN_PP_DEC_146 145 -# define SEQAN_PP_DEC_147 146 -# define SEQAN_PP_DEC_148 147 -# define SEQAN_PP_DEC_149 148 -# define SEQAN_PP_DEC_150 149 -# define SEQAN_PP_DEC_151 150 -# define SEQAN_PP_DEC_152 151 -# define SEQAN_PP_DEC_153 152 -# define SEQAN_PP_DEC_154 153 -# define SEQAN_PP_DEC_155 154 -# define SEQAN_PP_DEC_156 155 -# define SEQAN_PP_DEC_157 156 -# define SEQAN_PP_DEC_158 157 -# define SEQAN_PP_DEC_159 158 -# define SEQAN_PP_DEC_160 159 -# define SEQAN_PP_DEC_161 160 -# define SEQAN_PP_DEC_162 161 -# define SEQAN_PP_DEC_163 162 -# define SEQAN_PP_DEC_164 163 -# define SEQAN_PP_DEC_165 164 -# define SEQAN_PP_DEC_166 165 -# define SEQAN_PP_DEC_167 166 -# define SEQAN_PP_DEC_168 167 -# define SEQAN_PP_DEC_169 168 -# define SEQAN_PP_DEC_170 169 -# define SEQAN_PP_DEC_171 170 -# define SEQAN_PP_DEC_172 171 -# define SEQAN_PP_DEC_173 172 -# define SEQAN_PP_DEC_174 173 -# define SEQAN_PP_DEC_175 174 -# define SEQAN_PP_DEC_176 175 -# define SEQAN_PP_DEC_177 176 -# define SEQAN_PP_DEC_178 177 -# define SEQAN_PP_DEC_179 178 -# define SEQAN_PP_DEC_180 179 -# define SEQAN_PP_DEC_181 180 -# define SEQAN_PP_DEC_182 181 -# define SEQAN_PP_DEC_183 182 -# define SEQAN_PP_DEC_184 183 -# define SEQAN_PP_DEC_185 184 -# define SEQAN_PP_DEC_186 185 -# define SEQAN_PP_DEC_187 186 -# define SEQAN_PP_DEC_188 187 -# define SEQAN_PP_DEC_189 188 -# define SEQAN_PP_DEC_190 189 -# define SEQAN_PP_DEC_191 190 -# define SEQAN_PP_DEC_192 191 -# define SEQAN_PP_DEC_193 192 -# define SEQAN_PP_DEC_194 193 -# define SEQAN_PP_DEC_195 194 -# define SEQAN_PP_DEC_196 195 -# define SEQAN_PP_DEC_197 196 -# define SEQAN_PP_DEC_198 197 -# define SEQAN_PP_DEC_199 198 -# define SEQAN_PP_DEC_200 199 -# define SEQAN_PP_DEC_201 200 -# define SEQAN_PP_DEC_202 201 -# define SEQAN_PP_DEC_203 202 -# define SEQAN_PP_DEC_204 203 -# define SEQAN_PP_DEC_205 204 -# define SEQAN_PP_DEC_206 205 -# define SEQAN_PP_DEC_207 206 -# define SEQAN_PP_DEC_208 207 -# define SEQAN_PP_DEC_209 208 -# define SEQAN_PP_DEC_210 209 -# define SEQAN_PP_DEC_211 210 -# define SEQAN_PP_DEC_212 211 -# define SEQAN_PP_DEC_213 212 -# define SEQAN_PP_DEC_214 213 -# define SEQAN_PP_DEC_215 214 -# define SEQAN_PP_DEC_216 215 -# define SEQAN_PP_DEC_217 216 -# define SEQAN_PP_DEC_218 217 -# define SEQAN_PP_DEC_219 218 -# define SEQAN_PP_DEC_220 219 -# define SEQAN_PP_DEC_221 220 -# define SEQAN_PP_DEC_222 221 -# define SEQAN_PP_DEC_223 222 -# define SEQAN_PP_DEC_224 223 -# define SEQAN_PP_DEC_225 224 -# define SEQAN_PP_DEC_226 225 -# define SEQAN_PP_DEC_227 226 -# define SEQAN_PP_DEC_228 227 -# define SEQAN_PP_DEC_229 228 -# define SEQAN_PP_DEC_230 229 -# define SEQAN_PP_DEC_231 230 -# define SEQAN_PP_DEC_232 231 -# define SEQAN_PP_DEC_233 232 -# define SEQAN_PP_DEC_234 233 -# define SEQAN_PP_DEC_235 234 -# define SEQAN_PP_DEC_236 235 -# define SEQAN_PP_DEC_237 236 -# define SEQAN_PP_DEC_238 237 -# define SEQAN_PP_DEC_239 238 -# define SEQAN_PP_DEC_240 239 -# define SEQAN_PP_DEC_241 240 -# define SEQAN_PP_DEC_242 241 -# define SEQAN_PP_DEC_243 242 -# define SEQAN_PP_DEC_244 243 -# define SEQAN_PP_DEC_245 244 -# define SEQAN_PP_DEC_246 245 -# define SEQAN_PP_DEC_247 246 -# define SEQAN_PP_DEC_248 247 -# define SEQAN_PP_DEC_249 248 -# define SEQAN_PP_DEC_250 249 -# define SEQAN_PP_DEC_251 250 -# define SEQAN_PP_DEC_252 251 -# define SEQAN_PP_DEC_253 252 -# define SEQAN_PP_DEC_254 253 -# define SEQAN_PP_DEC_255 254 -# define SEQAN_PP_DEC_256 255 - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/seq/for_each.hpp <== -// -------------------------------------------------------------------------- - -# /* ************************************************************************** -# * * -# * (C) Copyright Paul Mensonides 2002. -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# * * -# ************************************************************************** */ -# -# /* See http://www.boost.org for most recent version. */ -# -// # ifndef SEQAN_PREPROCESSOR_SEQ_FOR_EACH_HPP -// # define SEQAN_PREPROCESSOR_SEQ_FOR_EACH_HPP -# -// # include -// # include -// # include -// # include -// # include -// # include -// # include -# -# /* SEQAN_PP_SEQ_FOR_EACH */ -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() -# define SEQAN_PP_SEQ_FOR_EACH(macro, data, seq) SEQAN_PP_FOR((macro, data, seq (nil)), SEQAN_PP_SEQ_FOR_EACH_P, SEQAN_PP_SEQ_FOR_EACH_O, SEQAN_PP_SEQ_FOR_EACH_M) -// # else -// # define SEQAN_PP_SEQ_FOR_EACH(macro, data, seq) SEQAN_PP_SEQ_FOR_EACH_D(macro, data, seq) -// # define SEQAN_PP_SEQ_FOR_EACH_D(macro, data, seq) SEQAN_PP_FOR((macro, data, seq (nil)), SEQAN_PP_SEQ_FOR_EACH_P, SEQAN_PP_SEQ_FOR_EACH_O, SEQAN_PP_SEQ_FOR_EACH_M) -// # endif -# -# define SEQAN_PP_SEQ_FOR_EACH_P(r, x) SEQAN_PP_DEC(SEQAN_PP_SEQ_SIZE(SEQAN_PP_TUPLE_ELEM(3, 2, x))) -# -// # if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_STRICT() -#ifndef PLATFORM_WINDOWS_VS -# define SEQAN_PP_SEQ_FOR_EACH_O(r, x) SEQAN_PP_SEQ_FOR_EACH_O_I x -# else // #ifndef PLATFORM_WINDOWS_VS -# define SEQAN_PP_SEQ_FOR_EACH_O(r, x) SEQAN_PP_SEQ_FOR_EACH_O_I(SEQAN_PP_TUPLE_ELEM(3, 0, x), SEQAN_PP_TUPLE_ELEM(3, 1, x), SEQAN_PP_TUPLE_ELEM(3, 2, x)) -# endif // #ifndef PLATFORM_WINDOWS_VS -# -# define SEQAN_PP_SEQ_FOR_EACH_O_I(macro, data, seq) (macro, data, SEQAN_PP_SEQ_TAIL(seq)) -# -// # if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_STRICT() -#ifndef PLATFORM_WINDOWS_VS -# define SEQAN_PP_SEQ_FOR_EACH_M(r, x) SEQAN_PP_SEQ_FOR_EACH_M_IM(r, SEQAN_PP_TUPLE_REM_3 x) -# define SEQAN_PP_SEQ_FOR_EACH_M_IM(r, im) SEQAN_PP_SEQ_FOR_EACH_M_I(r, im) -# else // #ifndef PLATFORM_WINDOWS_VS -# define SEQAN_PP_SEQ_FOR_EACH_M(r, x) SEQAN_PP_SEQ_FOR_EACH_M_I(r, SEQAN_PP_TUPLE_ELEM(3, 0, x), SEQAN_PP_TUPLE_ELEM(3, 1, x), SEQAN_PP_TUPLE_ELEM(3, 2, x)) -# endif // #ifndef PLATFORM_WINDOWS_VS -# -# define SEQAN_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq) macro(r, data, SEQAN_PP_SEQ_HEAD(seq)) -# -# /* SEQAN_PP_SEQ_FOR_EACH_R */ -# -// # if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() -# define SEQAN_PP_SEQ_FOR_EACH_R(r, macro, data, seq) SEQAN_PP_FOR_ ## r((macro, data, seq (nil)), SEQAN_PP_SEQ_FOR_EACH_P, SEQAN_PP_SEQ_FOR_EACH_O, SEQAN_PP_SEQ_FOR_EACH_M) -// # else -// # define SEQAN_PP_SEQ_FOR_EACH_R(r, macro, data, seq) SEQAN_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) -// # define SEQAN_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) SEQAN_PP_FOR_ ## r((macro, data, seq (nil)), SEQAN_PP_SEQ_FOR_EACH_P, SEQAN_PP_SEQ_FOR_EACH_O, SEQAN_PP_SEQ_FOR_EACH_M) -// # endif -# -// # endif - -// -------------------------------------------------------------------------- -// ==> boost/preprocessor/seq/for_each_i.hpp <== -// -------------------------------------------------------------------------- - -# /* ************************************************************************** -# * * -# * (C) Copyright Paul Mensonides 2002. -# * Distributed under the Boost Software License, Version 1.0. (See -# * accompanying file LICENSE_1_0.txt or copy at -# * http://www.boost.org/LICENSE_1_0.txt) -# * * -# ************************************************************************** */ -# -# /* See http://www.boost.org for most recent version. */ -# -//# ifndef SEQAN_PREPROCESSOR_SEQ_FOR_EACH_I_HPP -//# define SEQAN_PREPROCESSOR_SEQ_FOR_EACH_I_HPP -# -//# include -//# include -//# include -//# include -//# include -//# include -//# include -//# include -# -# /* SEQAN_PP_SEQ_FOR_EACH_I */ -# -//# if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() -# define SEQAN_PP_SEQ_FOR_EACH_I(macro, data, seq) SEQAN_PP_FOR((macro, data, seq (nil), 0), SEQAN_PP_SEQ_FOR_EACH_I_P, SEQAN_PP_SEQ_FOR_EACH_I_O, SEQAN_PP_SEQ_FOR_EACH_I_M) -//# else -//# define SEQAN_PP_SEQ_FOR_EACH_I(macro, data, seq) SEQAN_PP_SEQ_FOR_EACH_I_I(macro, data, seq) -//# define SEQAN_PP_SEQ_FOR_EACH_I_I(macro, data, seq) SEQAN_PP_FOR((macro, data, seq (nil), 0), SEQAN_PP_SEQ_FOR_EACH_I_P, SEQAN_PP_SEQ_FOR_EACH_I_O, SEQAN_PP_SEQ_FOR_EACH_I_M) -//# endif -# -# define SEQAN_PP_SEQ_FOR_EACH_I_P(r, x) SEQAN_PP_DEC(SEQAN_PP_SEQ_SIZE(SEQAN_PP_TUPLE_ELEM(4, 2, x))) -# -//# if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_STRICT() -# define SEQAN_PP_SEQ_FOR_EACH_I_O(r, x) SEQAN_PP_SEQ_FOR_EACH_I_O_I x -//# else -//# define SEQAN_PP_SEQ_FOR_EACH_I_O(r, x) SEQAN_PP_SEQ_FOR_EACH_I_O_I(SEQAN_PP_TUPLE_ELEM(4, 0, x), SEQAN_PP_TUPLE_ELEM(4, 1, x), SEQAN_PP_TUPLE_ELEM(4, 2, x), SEQAN_PP_TUPLE_ELEM(4, 3, x)) -//# endif -# -# define SEQAN_PP_SEQ_FOR_EACH_I_O_I(macro, data, seq, i) (macro, data, SEQAN_PP_SEQ_TAIL(seq), SEQAN_PP_INC(i)) -# -//# if SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_STRICT() -//# define SEQAN_PP_SEQ_FOR_EACH_I_M(r, x) SEQAN_PP_SEQ_FOR_EACH_I_M_IM(r, SEQAN_PP_TUPLE_REM_4 x) -//# define SEQAN_PP_SEQ_FOR_EACH_I_M_IM(r, im) SEQAN_PP_SEQ_FOR_EACH_I_M_I(r, im) -//# else -# define SEQAN_PP_SEQ_FOR_EACH_I_M(r, x) SEQAN_PP_SEQ_FOR_EACH_I_M_I(r, SEQAN_PP_TUPLE_ELEM(4, 0, x), SEQAN_PP_TUPLE_ELEM(4, 1, x), SEQAN_PP_TUPLE_ELEM(4, 2, x), SEQAN_PP_TUPLE_ELEM(4, 3, x)) -//# endif -# -# define SEQAN_PP_SEQ_FOR_EACH_I_M_I(r, macro, data, seq, i) macro(r, data, i, SEQAN_PP_SEQ_HEAD(seq)) -# -# /* SEQAN_PP_SEQ_FOR_EACH_I_R */ -# -//# if ~SEQAN_PP_CONFIG_FLAGS() & SEQAN_PP_CONFIG_EDG() -# define SEQAN_PP_SEQ_FOR_EACH_I_R(r, macro, data, seq) SEQAN_PP_FOR_ ## r((macro, data, seq (nil), 0), SEQAN_PP_SEQ_FOR_EACH_I_P, SEQAN_PP_SEQ_FOR_EACH_I_O, SEQAN_PP_SEQ_FOR_EACH_I_M) -//# else -//# define SEQAN_PP_SEQ_FOR_EACH_I_R(r, macro, data, seq) SEQAN_PP_SEQ_FOR_EACH_I_R_I(r, macro, data, seq) -//# define SEQAN_PP_SEQ_FOR_EACH_I_R_I(r, macro, data, seq) SEQAN_PP_FOR_ ## r((macro, data, seq (nil), 0), SEQAN_PP_SEQ_FOR_EACH_I_P, SEQAN_PP_SEQ_FOR_EACH_I_O, SEQAN_PP_SEQ_FOR_EACH_I_M) -//# endif -# -//# endif - -// -------------------------------------------------------------------------- -// ==> boost/config/suffix.hpp <== -// -------------------------------------------------------------------------- - -// Copyright (c) 2001-2003 John Maddock -// Copyright (c) 2001 Darin Adler -// Copyright (c) 2001 Peter Dimov -// Copyright (c) 2002 Bill Kempf -// Copyright (c) 2002 Jens Maurer -// Copyright (c) 2002-2003 David Abrahams -// Copyright (c) 2003 Gennaro Prota -// Copyright (c) 2003 Eric Friedman -// Copyright (c) 2010 Eric Jourdanneau, Joel Falcou -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// -// Helper macro SEQAN_JOIN: -// The following piece of macro magic joins the two -// arguments together, even when one of the arguments is -// itself a macro (see 16.3.1 in C++ standard). The key -// is that macro expansion of macro arguments does not -// occur in SEQAN_DO_JOIN2 but does in SEQAN_DO_JOIN. -// -#define SEQAN_JOIN( X, Y ) SEQAN_DO_JOIN( X, Y ) -#define SEQAN_DO_JOIN( X, Y ) SEQAN_DO_JOIN2(X,Y) -#define SEQAN_DO_JOIN2( X, Y ) X##Y - - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_SEQAN_PREPROCESSOR_SUBSET_H_ diff --git a/seqan/basic/builtin_functions.h b/seqan/basic/builtin_functions.h deleted file mode 100644 index 55f849f..0000000 --- a/seqan/basic/builtin_functions.h +++ /dev/null @@ -1,269 +0,0 @@ -// ========================================================================== -// builtin_functions.h -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// Documentation for built-in functions. -// -// This is used for documenting that certain global functions and operators -// are overridden for some classes. -// ========================================================================== - -#ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BUILTIN_FUNCTIONS_H_ -#define SEQAN_CORE_INCLUDE_SEQAN_BASIC_BUILTIN_FUNCTIONS_H_ - -namespace seqan { - -// ============================================================================ -// Forwards -// ============================================================================ - -// ============================================================================ -// Tags, Classes, Enums -// ============================================================================ - -// ============================================================================ -// Metafunctions -// ============================================================================ - -// ============================================================================ -// Functions -// ============================================================================ - -/** -.Function.operator= -..cat:C++ built-in -..summary:C++ built-in Assignment operator. - -.Function.operator+ -..cat:C++ built-in -..summary:C++ built-in addition operator. - -.Function.operator+ (unary) -..cat:C++ built-in -..summary:C++ built-in unary plus (integer promotion) operator. - -.Function.operator- -..cat:C++ built-in -..summary:C++ built-in subtraction operator. - -.Function.operator- (unary) -..cat:C++ built-in -..summary:C++ built-in unary minus (additive inverse) operator. - -.Function.operator* -..cat:C++ built-in -..summary:C++ built-in multiplication operator. - -.Function.operator/ -..cat:C++ built-in -..summary:C++ built-in division operator. - -.Function.operator% -..cat:C++ built-in -..summary:C++ built-in modulo operator. - -.Function.operator++ (prefix) -..cat:C++ built-in -..summary:C++ built-in prefix increment operator. - -.Function.operator++ (suffix) -..cat:C++ built-in -..summary:C++ built-in suffix increment operator. - -.Function.operator-- (prefix) -..cat:C++ built-in -..summary:C++ built-in prefix decrement operator. - -.Function.operator-- (suffix) -..cat:C++ built-in -..summary:C++ built-in suffix decrement operator. - -.Function.operator== -..cat:C++ built-in -..summary:C++ built-in equal comparison operator. - -.Function.operator!= -..cat:C++ built-in -..summary:C++ built-in inequal comparison operator. - -.Function.operator> -..cat:C++ built-in -..summary:C++ built-in greater-than comparison operator. - -.Function.operator< -..cat:C++ built-in -..summary:C++ built-in less-than comparison operator. - -.Function.operator>= -..cat:C++ built-in -..summary:C++ built-in greather-than-or-equal comparison operator. - -.Function.operator<= -..cat:C++ built-in -..summary:C++ built-in less-than-or-equal comparison operator. - -.Function.operator! -..cat:C++ built-in -..summary:C++ built-in logical negation operator. - -.Function.operator&& -..cat:C++ built-in -..summary:C++ built-in logical AND operator. - -.DISABLED.Function.operator\pipe\pipe|operator|| -..cat:C++ built-in -..summary:C++ built-in logical OR operator. - -.Function.operator~ -..cat:C++ built-in -..summary:C++ built-in bitwise NOT operator. - -.Function.operator& -..cat:C++ built-in -..summary:C++ built-in bitwise AND operator. - -.DISABLED.Function.operator\pipe|operator\pipe -..cat:C++ built-in -..summary:C++ built-in bitwise OR operator. - -.Function.operator^ -..cat:C++ built-in -..summary:C++ built-in bitwise XOR operator. - -.Function.operator<< -..cat:C++ built-in -..summary:C++ built-in bitwise left shift operator. - -.Function.operator<< (Stream) -..cat:C++ built-in -..summary:C++ built-in bitwise put-to/stream insertion operator. - -.Function.operator>> -..cat:C++ built-in -..summary:C++ built-in bitwise right shift operator. - -.Function.operator>> (Stream) -..cat:C++ built-in -..summary:C++ built-in bitwise get-from/stream extraction operator. - -.Function.operator+= -..cat:C++ built-in -..summary:C++ built-in addition assignment operator. - -.Function.operator-= -..cat:C++ built-in -..summary:C++ built-in subtraction assignment operator. - -.Function.operator*= -..cat:C++ built-in -..summary:C++ built-in multiplication assignment operator. - -.Function.operator/= -..cat:C++ built-in -..summary:C++ built-in division assignment operator. - -.Function.operator%= -..cat:C++ built-in -..summary:C++ built-in modulo assignment operator. - -.Function.operator&= -..cat:C++ built-in -..summary:C++ built-in bitwise AND assignment operator. - -.DISABLED.Function.operator\pipe=|operator|= -..cat:C++ built-in -..summary:C++ built-in bitwise OR assignment operator. - -.Function.operator^= -..cat:C++ built-in -..summary:C++ built-in bitwise XOR assignment operator. - -.Function.operator<<= -..cat:C++ built-in -..summary:C++ built-in bitwise left shift assignment operator. - -.Function.operator>>= -..cat:C++ built-in -..summary:C++ built-in bitwise right shift assignment operator. - -.Function.operator[] -..cat:C++ built-in -..summary:C++ built-in array subscript operator. - -.Function.operator* (indirection) -..cat:C++ built-in -..summary:C++ built-in indirection/object-pointed-to-by operator. - -.Function.operator& (reference) -..cat:C++ built-in -..summary:C++ built-in reference/address-of operator. - -.Function.operator-> -..cat:C++ built-in -..summary:C++ built-in structure dereference operator. - -.Function.operator->* -..cat:C++ built-in -..summary:C++ built-in member-pointed-to-by-b-of-object-pointed-to-by-a operator. - -.Function.operator() -..cat:C++ built-in -..summary:C++ built-in function call operator. - -.Function.operator, -..cat:C++ built-in -..summary:C++ built-in comma operator. - -.Function.cast operator -..cat:C++ built-in -..summary:C++ built-in cast operator. - -.Function.operator new -..cat:C++ built-in -..summary:C++ built-in allocation operator. - -.Function.operator new[] -..cat:C++ built-in -..summary:C++ built-in array allocation operator operator. - -.Function.operator delete -..cat:C++ built-in -..summary:C++ built-in deallocation operator. - -.Function.operator delete[] -..cat:C++ built-in -..summary:C++ built-in array deallocation operator. - */ - -} // namespace seqan - -#endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_BUILTIN_FUNCTIONS_H_ diff --git a/seqan/basic/concept_checking.h b/seqan/basic/concept_checking.h deleted file mode 100644 index 52c4c55..0000000 --- a/seqan/basic/concept_checking.h +++ /dev/null @@ -1,1007 +0,0 @@ -// ========================================================================== -// SeqAn - The Library for Sequence Analysis -// ========================================================================== -// Copyright (c) 2006-2013, Knut Reinert, FU Berlin -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of Knut Reinert or the FU Berlin nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -// DAMAGE. -// -// ========================================================================== -// Author: Manuel Holtgrewe -// ========================================================================== -// A minimal subset of the Boost Concept Checking Library. A lot of the code -// in the BCCL deals with support of non-conforming compilers and we cut this -// away. The code here has been adjusted to work with the compilers supported -// by SeqAn and be as simple as possible while still creating useful compiler -// errors. -// ========================================================================== - -// SEQAN_NO_GENERATED_FORWARDS - -#ifndef CORE_INCLUDE_SEQAN_BASIC_CONCEPT_CHECKING_H_ -#define CORE_INCLUDE_SEQAN_BASIC_CONCEPT_CHECKING_H_ - -namespace seqan { - -// --------------------------------------------------------------------------- -// ==> boost/static_assert.hpp <== -// --------------------------------------------------------------------------- - -// (C) Copyright John Maddock 2000. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/static_assert for documentation. - -#ifdef SEQAN_CXX11_STANDARD -# define SEQAN_STATIC_ASSERT_MSG( B, Msg ) static_assert(B, Msg) -#else -# define SEQAN_STATIC_ASSERT_MSG( B, Msg ) SEQAN_STATIC_ASSERT( B ) -#endif - -// -// If the compiler issues warnings about old C style casts, -// then enable this: -// -//#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))) -//# define BOOST_STATIC_ASSERT_BOOL_CAST( x ) ((x) == 0 ? false : true) -//#else -# define SEQAN_STATIC_ASSERT_BOOL_CAST(x) (bool)(x) -//#endif - -// -// If the compiler warns about unused typedefs then enable this: -// -#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))) -# define SEQAN_STATIC_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused)) -#else -# define SEQAN_STATIC_ASSERT_UNUSED_ATTRIBUTE -#endif - -#ifdef SEQAN_CXX11_STANDARD -# define SEQAN_STATIC_ASSERT( B ) static_assert(B, #B) -#else - -// HP aCC cannot deal with missing names for template value parameters -template struct STATIC_ASSERTION_FAILURE; - -template <> struct STATIC_ASSERTION_FAILURE { enum { value = 1 }; }; - -// HP aCC cannot deal with missing names for template value parameters -template struct static_assert_test{}; - -// -// Implicit instantiation requires that all member declarations be -// instantiated, but that the definitions are *not* instantiated. -// -// It's not particularly clear how this applies to enum's or typedefs; -// both are described as declarations [7.1.3] and [7.2] in the standard, -// however some compilers use "delayed evaluation" of one or more of -// these when implicitly instantiating templates. We use typedef declarations -// by default, but try defining SEQAN_USE_ENUM_STATIC_ASSERT if the enum -// version gets better results from your compiler... -// -// Implementation: -// Both of these versions rely on sizeof(incomplete_type) generating an error -// message containing the name of the incomplete type. We use -// "STATIC_ASSERTION_FAILURE" as the type name here to generate -// an eye catching error message. The result of the sizeof expression is either -// used as an enum initialiser, or as a template argument depending which version -// is in use... -// Note that the argument to the assert is explicitly cast to bool using old- -// style casts: too many compilers currently have problems with static_cast -// when used inside integral constant expressions. -// -//#if !defined(SEQAN_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS) -/* -#if defined(SEQAN_MSVC) && (SEQAN_MSVC < 1300) -// __LINE__ macro broken when -ZI is used see Q199057 -// fortunately MSVC ignores duplicate typedef's. -#define SEQAN_STATIC_ASSERT( B ) \ - typedef static_assert_test<\ - sizeof(STATIC_ASSERTION_FAILURE< (bool)( B ) >)\ - > seqan_static_assert_typedef_ -#elif defined(SEQAN_MSVC) -*/ -#if defined(PLATFORM_WINDOWS_VS) -#define SEQAN_STATIC_ASSERT( B ) \ - typedef static_assert_test<\ - sizeof(STATIC_ASSERTION_FAILURE< SEQAN_STATIC_ASSERT_BOOL_CAST ( B ) >)>\ - SEQAN_JOIN(seqan_static_assert_typedef_, __COUNTER__) -/* -#elif defined(SEQAN_INTEL_CXX_VERSION) || defined(SEQAN_SA_GCC_WORKAROUND) -// agurt 15/sep/02: a special care is needed to force Intel C++ issue an error -// instead of warning in case of failure -# define SEQAN_STATIC_ASSERT( B ) \ - typedef char SEQAN_JOIN(seqan_static_assert_typedef_, __LINE__) \ - [ STATIC_ASSERTION_FAILURE< SEQAN_STATIC_ASSERT_BOOL_CAST( B ) >::value ] -#elif defined(__sgi) -// special version for SGI MIPSpro compiler -#define SEQAN_STATIC_ASSERT( B ) \ - SEQAN_STATIC_CONSTANT(bool, \ - SEQAN_JOIN(boost_static_assert_test_, __LINE__) = ( B )); \ - typedef static_assert_test<\ - sizeof(STATIC_ASSERTION_FAILURE< \ - SEQAN_JOIN(boost_static_assert_test_, __LINE__) >)>\ - SEQAN_JOIN(seqan_static_assert_typedef_, __LINE__) -#elif SEQAN_WORKAROUND(__MWERKS__, <= 0x3003) -// special version for CodeWarrior <= 8.x -#define SEQAN_STATIC_ASSERT( B ) \ - SEQAN_STATIC_CONSTANT(int, \ - SEQAN_JOIN(boost_static_assert_test_, __LINE__) = \ - sizeof(STATIC_ASSERTION_FAILURE< SEQAN_STATIC_ASSERT_BOOL_CAST( B ) >) ) -*/ -#else -// generic version -#define SEQAN_STATIC_ASSERT( B ) \ - typedef static_assert_test<\ - sizeof(STATIC_ASSERTION_FAILURE< SEQAN_STATIC_ASSERT_BOOL_CAST( B ) >)>\ - SEQAN_JOIN(seqan_static_assert_typedef_, __LINE__) SEQAN_STATIC_ASSERT_UNUSED_ATTRIBUTE -#endif -/* -#else -// alternative enum based implementation: -#define SEQAN_STATIC_ASSERT( B ) \ - enum { SEQAN_JOIN(boost_static_assert_enum_, __LINE__) \ - = sizeof(STATIC_ASSERTION_FAILURE< (bool)( B ) >) } -#endif -*/ -#endif - -// --------------------------------------------------------------------------- -// ==> boost/parameter/aux_/paranthesized_type.hpp <== -// --------------------------------------------------------------------------- - -// Copyright David Abrahams 2006. Distributed under the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). - -template -struct unaryfunptr_arg_type; - -template -struct unaryfunptr_arg_type -{ - typedef Arg type; -}; - -template <> -struct unaryfunptr_arg_type -{ - typedef void type; -}; - -// --------------------------------------------------------------------------- -// ==> boost/concept_check/general.hpp <== -// --------------------------------------------------------------------------- - -// Copyright David Abrahams 2006. Distributed under the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). - -namespace concept_checking -{ -template struct instantiate {}; -} - -template struct concept_check_; - -template -void concept_check_failed() -{ - ((Model*)0)->~Model(); -} - -template -struct concept_check -{ - concept_checking::instantiate > x; - enum { instantiate = 1 }; -}; - -template -struct concept_check_ - : concept_check -{}; - -# define SEQAN_CONCEPT_ASSERT_FN( ModelFnPtr ) \ - typedef ::seqan::detail::instantiate< \ - &::seqan::requirement_::failed> \ - SEQAN_PP_CAT(seqan_concept_check,__LINE__) SEQAN_STATIC_ASSERT_UNUSED_ATTRIBUTE - -// --------------------------------------------------------------------------- -// ==> boost/concept/assert.hpp <== -// --------------------------------------------------------------------------- - -// Copyright David Abrahams 2006. Distributed under the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). - -/*! - * @macro SEQAN_CONCEPT_ASSERT - * @brief Perform a concept check. - * @headerfile - * - * @signature SEQAN_CONCEPT_ASSERT((concept)) - * - * @param concept Concept specialized with a the type that should be checked. - * - * @section Remarks - * - * This macro is a compile-time assertion and requires the concept specialized - * with the tested types to compile. The check neither consumes memory nor - * running time. The macro can be used at the beginning of a function or within - * a struct/class definition. The checked concepts should be as restrictive and - * generic as possible to on the one hand cover all used functionality and on - * the other hand not limit the applicability of a function/class. - * - * @section Examples - * - * @code{.cpp} - * typedef typename Value::Type TValue; - * typedef typename Position::Type TPosition; - * typedef typename Difference::Type TDifference; - * - * SEQAN_CONCEPT_ASSERT((AlphabetConcept)); - * SEQAN_CONCEPT_ASSERT((SignedIntegerConcept)); - * SEQAN_CONCEPT_ASSERT((UnsignedIntegerConcept)); - * @endcode - * @see Is - */ - -/** -.Macro.SEQAN_CONCEPT_ASSERT -..cat:Concepts -..summary:Perform a concept check. -..signature:SEQAN_CONCEPT_ASSERT((concept)) -..param.concept:Concept specialized with a the type that should be checked. -..remarks:This macro is a compile-time assertion and requires the concept specialized with the tested types to compile. -The check neither consumes memory nor running time. -The macro can be used at the beginning of a function or within a struct/class definition. -The checked concepts should be as restrictive and generic as possible to on the one hand -cover all used functionality and on the other hand not limit the applicability of a function/class. -..example.code: -typedef typename Value::Type TValue; -typedef typename Position::Type TPosition; -typedef typename Difference::Type TDifference; - -SEQAN_CONCEPT_ASSERT((AlphabetConcept)); -SEQAN_CONCEPT_ASSERT((SignedIntegerConcept)); -SEQAN_CONCEPT_ASSERT((UnsignedIntegerConcept)); -..include:seqan/basic.h - */ - -// Usage, in class or function context: -// SEQAN_CONCEPT_ASSERT((UnaryFunctionConcept)); -# define SEQAN_CONCEPT_ASSERT(ModelInParens) \ - SEQAN_CONCEPT_ASSERT_FN(void(*)ModelInParens) - -// usage.hpp - -template -struct usage_requirements -{ - ~usage_requirements() { ((Model*)0)->~Model(); } -}; - -/*! - * @macro SEQAN_CONCEPT_USAGE - * @headerfile - * @brief Defines valid expressions. - * - * @signature SEQAN_CONCEPT_USAGE(name) - * - * @param[in] name Identifier of the concept defined with @link SEQAN_CONCEPT @endlink or @link SEQAN_CONCEPT_REFINE - * @endlink. - * - * This macro should be used to introduce a block (enclosed with curly braces) of valid expressions within a newly - * defined concept. Valid expressions should test for available functions, operators and the correctness of return - * types. Use helper functions, e.g. @link ignoreUnusedVariableWarning @endlink, @link requireBooleanExpr @endlink and - * @link sameType @endlink. - * - * @section Examples - * - * @code{.cpp} - * SEQAN_CONCEPT(EqualityComparable,(T)) - * { - * SEQAN_CONCEPT_USAGE(EqualityComparable) - * { - * requireBooleanExpr(a == b); - * requireBooleanExpr(a != b); - * } - * private: - * T a, b; - * }; - * @endcode - * - * @see requireBooleanExpr - * @see SEQAN_CONCEPT - * @see SEQAN_CONCEPT_REFINE - */ - -/** -.Macro.SEQAN_CONCEPT_USAGE -..cat:Concepts -..summary:Define valid expressions. -..signature:SEQAN_CONCEPT_USAGE(name) -..param.name:Identifier of the concept defined with @Macro.SEQAN_CONCEPT@ or @Macro.SEQAN_CONCEPT_REFINE@. -..remarks:This macro should be used to introduce a block (enclosed with curly braces) of valid expressions within -a newly defined concept. -Valid expressions should test for available functions, operators and the correctness of return types. -Use helper functions, e.g. @Function.ignoreUnusedVariableWarning@, @Function.requireBooleanExpr@ and @Function.sameType@. -..example.code: -SEQAN_CONCEPT(EqualityComparable,(T)) -{ - SEQAN_CONCEPT_USAGE(EqualityComparable) - { - requireBooleanExpr(a == b); - requireBooleanExpr(a != b); - } -private: - T a, b; -}; -..see:Function.requireBooleanExpr -..see:Macro.SEQAN_CONCEPT -..see:Macro.SEQAN_CONCEPT_REFINE -..include:seqan/basic.h - */ -#define SEQAN_CONCEPT_USAGE(model) \ - SEQAN_CONCEPT_ASSERT((seqan::usage_requirements)); \ - ~model() - -// --------------------------------------------------------------------------- -// ==> boost/concept/detail/has_constraints.hpp <== -// --------------------------------------------------------------------------- - -// Copyright David Abrahams 2006. Distributed under the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). - -namespace detail { - typedef char yes; - typedef char (&no)[2]; - - template - struct wrap_constraints {}; - - template - inline yes has_constraints_(Model*, wrap_constraints* = 0); - inline no has_constraints_(...); -} - -// This would be called "detail::has_constraints," but it has a strong -// tendency to show up in error messages. -template -struct not_satisfied -{ - enum {value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) }; - typedef typename Eval::Type Type; -}; - -// --------------------------------------------------------------------------- -// ==> boost/concept_check/detail/general.hpp <== -// --------------------------------------------------------------------------- - -// Copyright David Abrahams 2006. Distributed under the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). - -template -struct requirement_; - -namespace detail -{ - template struct instantiate {}; -} - -template -struct requirement -{ - static void failed() { ((Model*)0)->~Model(); } -}; - -struct failed {}; - -template -struct requirement -{ - static void failed() { ((Model*)0)->~Model(); } -}; - -template -struct constraint -{ - static void failed() { ((Model*)0)->constraints(); } -}; - -template -struct requirement_ - : IfC::Type::VALUE, /* should be called "has_constraints", see above */ - constraint, - requirement - >::Type -{}; - -# define SEQAN_CONCEPT_ASSERT_FN( ModelFnPtr ) \ - typedef ::seqan::detail::instantiate< \ - &::seqan::requirement_::failed> \ - SEQAN_PP_CAT(seqan_concept_check,__LINE__) SEQAN_STATIC_ASSERT_UNUSED_ATTRIBUTE - -// --------------------------------------------------------------------------- -// ==> boost/concept_check/detail/requires.hpp <== -// --------------------------------------------------------------------------- - -// Copyright David Abrahams 2006. Distributed under the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). - -// Template for use in handwritten assertions -template -struct requires_ : More -{ - SEQAN_CONCEPT_ASSERT((Model)); -}; - -// Template for use by macros, where models must be wrapped in parens. -// This isn't in namespace detail to keep extra cruft out of resulting -// error messages. - -template -struct _requires_ -{ - enum { value = 0 }; - SEQAN_CONCEPT_ASSERT_FN(ModelFn); -}; - -template -struct Requires_ : unaryfunptr_arg_type -{}; - -# define SEQAN_CONCEPT_REQUIRES_(r,data,t) + (::seqan::_requires_::value) - -#if defined(NDEBUG) - -# define SEQAN_CONCEPT_REQUIRES(models, result) \ - typename unaryfunptr_arg_type::type - -#else // #if defined(NDEBUG) - -# define SEQAN_CONCEPT_REQUIRES(models, result) \ - typename ::seqan::Requires_< \ - (0 SEQAN_PP_SEQ_FOR_EACH(SEQAN_CONCEPT_REQUIRES_, ~, models)), \ - void(*)result \ - >::type - -#endif // #if defined(NDEBUG) - -// --------------------------------------------------------------------------- -// ==> boost/concept_check.hpp <== -// --------------------------------------------------------------------------- - -// -// (C) Copyright Jeremy Siek 2000. -// Copyright 2002 The Trustees of Indiana University. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) // -// Backward compatibility -// - -template -inline void functionRequires(Model* = 0) -{ - SEQAN_CONCEPT_ASSERT((Model)); -} - -/*! - * @fn ignoreUnusedVariableWarning - * @headefile - * @brief Removes unused variable warning. - * - * @signature void ignoreUnusedVariableWarning(x); - * - * @param[in] x Variable that causes the unused variable warning. - * - * It sometimes is necessary to define variables which are not further used, e.g. to check available assignment - * operators. Use this functions to remove a compile warning that otherwise would be raised in this case. - */ - -/** -.Function.ignoreUnusedVariableWarning -..summary:Removes unused variable warning. -..cat:Concepts -..signature:ignoreUnusedVariableWarning(x) -..param.x: Variable that causes the unused variable warning. -..remarks:It sometimes is necessary to define variables which are not further used, e.g. to check available assignment operators. -Use this functions to remove a compile warning that otherwise would be raised in this case. -..see:Macro.SEQAN_CONCEPT_USAGE -..include:seqan/basic.h - */ -template SEQAN_HOST_DEVICE inline void ignoreUnusedVariableWarning(T const&) {} - -// --------------------------------------------------------------------------- -// ==> boost/concept/detail/concept_def.hpp <== -// --------------------------------------------------------------------------- - -// Copyright David Abrahams 2006. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// SEQAN_CONCEPT_REFINE added by David Weese - -/*! - * @macro SEQAN_CONCEPT - * @brief Defines a new concept. - * @headerfile seqan/basic.h - * - * @signature SEQAN_CONCEPT(name, params) - * - * @param params Template paramter list in parantheses, e.g. (T) or (T1)(T2). - * Typically, template parameters are models, i.e. one or multiple - * classes that should be checked for fulfilling a concept.This is - * a sequence of the Boost Preprocessor Library, read more. - * @param name Concept identifier. Non-trivial concepts should have an - * identifier with a Concept-suffix. - * - * @section Remarks - * - * A concept is implemented as a template struct with name name and - * arguments params. The concept checking should be part of the struct - * definition. Associated types should be checked via @link SEQAN_CONCEPT_ASSERT - * @endlink and valid expressions in a function @link SEQAN_CONCEPT_USAGE - * @endlink, see below. Variables used in valid expressions should be (private) - * struct members instead of local variables in member functions (read more. - * - * @section Examples - * - * @code{.cpp} - * SEQAN_CONCEPT(Assignable,(T)) - * { - * SEQAN_CONCEPT_USAGE(Assignable) - * { - * a = b; // require assignment operator - * constConstraints(b); - * } - * private: - * void constConstraints(const T& x) - * { - * a = x; // const required for argument to assignment - * ignoreUnusedVariableWarning(x); - * } - * private: - * T a; - * T b; - * }; - * - * SEQAN_CONCEPT(EqualityComparable,(T)) - * { - * SEQAN_CONCEPT_USAGE(EqualityComparable) - * { - * requireBooleanExpr(a == b); - * requireBooleanExpr(a != b); - * } - * private: - * T a, b; - * }; - * @endcode - * - * @see SEQAN_CONCEPT_USAGE - */ - -/** -.Macro.SEQAN_CONCEPT -..cat:Concepts -..summary:Defines a new concept. -..signature:SEQAN_CONCEPT(name, params) -..param.name:Concept identifier. Non-trivial concepts should have an identifier with a "Concept"-suffix. -..param.params:Template paramter list in parantheses, e.g. (T) or (T1)(T2). -Typically, template parameters are models, i.e. one or multiple classes that should be checked for fulfilling a concept. -...remarks:This is a sequence of the Boost Preprocessor Library, read @http://www.boost.org/doc/libs/1_47_0/libs/preprocessor/doc/index.html|more@. -..remarks:A concept is implemented as a template struct with name $name$ and arguments $params$. -The concept checking should be part of the struct definition. -Associated types should be checked via @Macro.SEQAN_CONCEPT_ASSERT@ and valid expressions in a function @Macro.SEQAN_CONCEPT_USAGE@, see below. -Variables used in valid expressions should be (private) struct members instead of local variables in member functions (read @http://www.boost.org/doc/libs/1_47_0/libs/concept_check/creating_concepts.htm|more@). -..example.code: -SEQAN_CONCEPT(Assignable,(T)) -{ - SEQAN_CONCEPT_USAGE(Assignable) - { - a = b; // require assignment operator - constConstraints(b); - } -private: - void constConstraints(const T& x) - { - a = x; // const required for argument to assignment - ignoreUnusedVariableWarning(x); - } -private: - T a; - T b; -}; - -SEQAN_CONCEPT(EqualityComparable,(T)) -{ - SEQAN_CONCEPT_USAGE(EqualityComparable) - { - requireBooleanExpr(a == b); - requireBooleanExpr(a != b); - } -private: - T a, b; -}; -..include:seqan/basic.h - */ - -# define SEQAN_CONCEPT(name, params) \ - template < SEQAN_PP_SEQ_FOR_EACH_I(SEQAN_CONCEPT_typename,~,params) > \ - struct name - -/*! - * @macro SEQAN_CONCEPT_REFINE - * @brief Defines a new concept as a refinement of existing concepts. - * @headerfile seqan/basic.h - * - * @signature SEQAN_CONCEPT_REFINE(name, params, refinedConcepts) - * - * @param params Template paramter list in parantheses, e.g. (T) or (T1)(T2). - * Typically, template parameters are models, i.e. one or multiple - * classes that should be checked for fulfilling a concept.This is - * a sequence of the Boost Preprocessor Library, read more. - * @param name Concept identifier. Non-trivial concepts should have an - * identifier with a Concept-suffix. - * @param refinedConcepts Identifiers of concepts that are refined by the new - * concept.Refined concepts are implicitly integrated - * into the requirements of the new concept.This is a - * sequence of the Boost Preprocessor Library, read - * more - * - * @section Remarks - * - * A concept is implemented as a template struct with name name and - * arguments params. The struct inherits all refined concept structs. - * The concept checking should be part of the struct definition. For more - * information, see @link SEQAN_CONCEPT @endlink. - * - * @section Examples - * - * @code{.cpp} - * SEQAN_CONCEPT_REFINE(AlphabetConcept, (TValue), (Assignable)(DefaultConstructible)(CopyConstructible)) - * { - * TValue val, val2; - * - * SEQAN_CONCEPT_USAGE(AlphabetConcept) - * { - * assign(val, val2); - * } - * }; - * @endcode - * @see SEQAN_CONCEPT_USAGE - */ - -/** -.Macro.SEQAN_CONCEPT_REFINE -..cat:Concepts -..summary:Defines a new concept as a refinement of existing concepts. -..signature:SEQAN_CONCEPT_REFINE(name, params, refinedConcepts) -..param.name:Concept identifier. Non-trivial concepts should have an identifier with a "Concept"-suffix. -..param.params:Template paramter list in parantheses, e.g. (T) or (T1)(T2). -Typically, template parameters are models, i.e. one or multiple classes that should be checked for fulfilling a concept. -...remarks:This is a sequence of the Boost Preprocessor Library, read @http://www.boost.org/doc/libs/1_47_0/libs/preprocessor/doc/index.html|more@. -..param.refinedConcepts:Identifiers of concepts that are refined by the new concept. -...remarks:Refined concepts are implicitly integrated into the requirements of the new concept. -...remarks:This is a sequence of the Boost Preprocessor Library, read @http://www.boost.org/doc/libs/1_47_0/libs/preprocessor/doc/index.html|more@. -..remarks:A concept is implemented as a template struct with name $name$ and arguments $params$. -The struct inherits all refined concept structs. -The concept checking should be part of the struct definition. -For more information, see @Macro.SEQAN_CONCEPT@. -..example.code: -SEQAN_CONCEPT_REFINE(AlphabetConcept, (TValue), (Assignable)(DefaultConstructible)(CopyConstructible)) -{ - TValue val, val2; - - SEQAN_CONCEPT_USAGE(AlphabetConcept) - { - assign(val, val2); - } -}; -..include:seqan/basic.h - */ - -# define SEQAN_CONCEPT_REFINE(name, params, refinedConcepts) \ - template < SEQAN_PP_SEQ_FOR_EACH_I(SEQAN_CONCEPT_typename,~,params) > \ - struct name; \ - \ - template < SEQAN_PP_SEQ_FOR_EACH_I(SEQAN_CONCEPT_typename,~,params) > \ - struct Refines< name > \ - { \ - typedef \ - SEQAN_PP_SEQ_FOR_EACH_I(SEQAN_CONCEPT_LIST_prefix,params,refinedConcepts) \ - SEQAN_PP_REPEAT(SEQAN_PP_SEQ_SIZE(refinedConcepts),SEQAN_CONCEPT_LIST_suffix,~) Type; \ - }; \ - \ - template < SEQAN_PP_SEQ_FOR_EACH_I(SEQAN_CONCEPT_typename,~,params) > \ - struct name: \ - SEQAN_PP_SEQ_FOR_EACH_I(SEQAN_CONCEPT_REFINE_superclass,params,refinedConcepts) - -/*! - * @macro SEQAN_CONCEPT_IMPL - * @brief Defines which concepts a model fulfills. - * @headerfile seqan/basic.h - * - * - * @signature template<> SEQAN_CONCEPT_IMPL(name, implementedConcepts) - * template SEQAN_CONCEPT_IMPL(name, implementedConcepts) - * - * @param implementedConcepts Identifiers of concepts that are fulfilled by the model. This is a sequence of the - * Boost Preprocessor Library, read more. - * @param name Model type, i.e. an identifier or an identifier with template - * arguments. - * - * @section Remarks - * - * The metafunction @link Is @endlink can be used to determine whether a class - * models (fulfills) a concepts. A model of a concept must pass the concept - * check via @link SEQAN_CONCEPT_ASSERT @endlink. - * - * @section Examples - * - * @code{.cpp} - * template - * SEQAN_CONCEPT_IMPL(String, (StringConcept)); - * @endcode - */ - -/** -.Macro.SEQAN_CONCEPT_IMPL -..cat:Concepts -..summary:Defines which concepts a model fulfills. -..signature: -template<> -SEQAN_CONCEPT_IMPL(name, implementedConcepts) - -template -SEQAN_CONCEPT_IMPL(name, implementedConcepts) -..param.name:Model type, i.e. an identifier or an identifier with template arguments. -..param.implementedConcepts:Identifiers of concepts that are fulfilled by the model. -...remarks:This is a sequence of the Boost Preprocessor Library, read @http://www.boost.org/doc/libs/1_47_0/libs/preprocessor/doc/index.html|more@. -..remarks:The metafunction @Metafunction.Is@ can be used to determine whether a class models (fulfills) a concepts. -A model of a concept must pass the concept check via @Macro.SEQAN_CONCEPT_ASSERT@. -..example.code: -template -SEQAN_CONCEPT_IMPL(String, (StringConcept)); -..include:seqan/basic.h - */ - -# define SEQAN_CONCEPT_IMPL(model, implementedConcepts) \ - template <> \ - struct Implements \ - { \ - typedef \ - SEQAN_PP_SEQ_FOR_EACH_I(SEQAN_CONCEPT_LIST_prefix,(model),implementedConcepts) \ - SEQAN_PP_REPEAT(SEQAN_PP_SEQ_SIZE(implementedConcepts),SEQAN_CONCEPT_LIST_suffix,~) Type; \ - } - - -// helper for the SEQAN_CONCEPT, above. -# define SEQAN_CONCEPT_typename(r, ignored, index, t) \ - SEQAN_PP_COMMA_IF(index) typename t - -// helper for the SEQAN_CONCEPT, above. -# define SEQAN_CONCEPT_REFINE_superclass(r, params, index, t) \ - SEQAN_PP_COMMA_IF(index) t -# define SEQAN_CONCEPT_LIST_prefix(r, params, index, t) \ - SEQAN_PP_COMMA_IF(index) TagList -# define SEQAN_CONCEPT_LIST_suffix(z, n, text) > - -// ============================================================================ -// Functions -// ============================================================================ - -/*! - * @fn sameType - * @brief Tests for equality of types. - * - * @signature void sameType(x, y); - * - * @param[in] x Object of a certain type. - * @param[in] y Object that must be of the same type. - * - * This function can be used to test for the correctness of function return types or the type of an expression in - * concept tests. - * - * @see SEQAN_CONCEPT_USAGE - */ - -/** -.Function.sameType -..summary:Tests for equality of types. -..cat:Concepts -..signature:sameType(x, y) -..param.x: Object of a certain type. -..param.y: Object that must be of the same type. -..remarks:This function can be used to test for the correctness of function return types or the type of an expression. -..see:Macro.SEQAN_CONCEPT_USAGE -..include:seqan/basic.h - */ - -template -void sameType(T, T) { } - - -// ============================================================================ -// Metafunctions -// ============================================================================ - -/*! - * @mfn Is - * @brief Returns whether a concept is fulfilled. - * @headerfile seqan/basic.h - * - * @signature Is::Type - * @signature Is::VALUE - * - * @tparam TConcept A concept that is specialized with type(s) that should be - * tested for fulfilling the concept. - * - * @return Type @link Logical Values.tag.True @endlink/true if - * TConcept is a fulfilled concept, otherwise @link - * Logical Values.tag.False @endlink/false. - * - * @section Remarks - * - * The @link Is @endlink-metafunction can be used to test types for fulfilling a concept without causing compilation - * errors. If True or true is returned, TConcept must pass the concept test via @link - * SEQAN_CONCEPT_ASSERT @endlink. It can be used to switch between different implementations depending on the concept - * of a type, or in combination with @link EnableIfFunctionality#SEQAN_FUNC_ENABLE_IF @endlink to make a function only - * visible to types of certain concepts. - * - * @section Examples - * - * @code{.cpp} - * Is >::Type - * IfC >::VALUE, T1, T2>::Type - * - * std::cout << Is >::VALUE << std::endl; // 1 - * std::cout << Is >::VALUE << std::endl; // 0 - * @endcode - * Define a hierarchy of concepts and two models Alice and Bob - * that implements some of them. @link Is @endlink determines which concepts are - * explicitly or implicitly fulfilled. - * - * @code{.cpp} - * struct Alice {}; - * struct Bob {}; - * - * SEQAN_CONCEPT(ConceptA, (T)) {}; - * SEQAN_CONCEPT(ConceptB, (T)) {}; - * SEQAN_CONCEPT_REFINE(ConceptC, (T), (ConceptA)(ConceptB)) {}; - * SEQAN_CONCEPT_REFINE(ConceptD, (T), (ConceptC)) {}; - * - * SEQAN_CONCEPT_IMPL(Alice, (ConceptA)(ConceptB)); - * SEQAN_CONCEPT_IMPL(Bob, (ConceptC)); - * - * std::cout << Is< ConceptA >::VALUE << std::endl; // 1 - * std::cout << Is< ConceptB >::VALUE << std::endl; // 1 - * std::cout << Is< ConceptC >::VALUE << std::endl; // 0 - * std::cout << Is< ConceptD >::VALUE << std::endl; // 0 - * - * std::cout << Is< ConceptA >::VALUE << std::endl; // 1 - * std::cout << Is< ConceptB >::VALUE << std::endl; // 1 - * std::cout << Is< ConceptC >::VALUE << std::endl; // 1 - * std::cout << Is< ConceptD >::VALUE << std::endl; // 0 - * @endcode - * - * @see EnableIfFunctionality#SEQAN_FUNC_ENABLE_IF - * @see SEQAN_CONCEPT_ASSERT - */ - -/** -.Metafunction.Is -..cat:Concepts -..summary:Returns whether a concept is fulfilled. -..signature:Is::Type -..signature:Is::VALUE -..param.TConcept:A concept that is specialized with type(s) that should be tested for fulfilling the concept. -..returns:@Tag.Logical Values.tag.True@/$true$ if $TConcept$ is a fulfilled concept, otherwise @Tag.Logical Values.tag.False@/$false$. -..remarks: -...text:The @Metafunction.Is@-metafunction can be used to test types for fulfilling a concept without causing compilation errors. -If @Tag.Logical Values.tag.True@/$true$ is returned, $TConcept$ must pass the concept test via @Macro.SEQAN_CONCEPT_ASSERT@. -It can be used to switch between different implementations depending on the concept of a type, or in combination with @Macro.SEQAN_FUNC_ENABLE_IF@ to make a function only visible to types of certain concepts. -..example.code: -Is >::Type -IfC >::VALUE, T1, T2>::Type - -std::cout << Is >::VALUE << std::endl; // 1 -std::cout << Is >::VALUE << std::endl; // 0 -..example.text:Define a hierarchy of concepts and two models $Alice$ and $Bob$ that implements some of them. -@Metafunction.Is@ determines which concepts are explicitly or implicitly fulfilled. -..example.code: -struct Alice {}; -struct Bob {}; - -SEQAN_CONCEPT(ConceptA, (T)) {}; -SEQAN_CONCEPT(ConceptB, (T)) {}; -SEQAN_CONCEPT_REFINE(ConceptC, (T), (ConceptA)(ConceptB)) {}; -SEQAN_CONCEPT_REFINE(ConceptD, (T), (ConceptC)) {}; - -SEQAN_CONCEPT_IMPL(Alice, (ConceptA)(ConceptB)); -SEQAN_CONCEPT_IMPL(Bob, (ConceptC)); - -std::cout << Is< ConceptA >::VALUE << std::endl; // 1 -std::cout << Is< ConceptB >::VALUE << std::endl; // 1 -std::cout << Is< ConceptC >::VALUE << std::endl; // 0 -std::cout << Is< ConceptD >::VALUE << std::endl; // 0 - -std::cout << Is< ConceptA >::VALUE << std::endl; // 1 -std::cout << Is< ConceptB >::VALUE << std::endl; // 1 -std::cout << Is< ConceptC >::VALUE << std::endl; // 1 -std::cout << Is< ConceptD >::VALUE << std::endl; // 0 -..include:seqan/basic.h -..see:Macro.SEQAN_FUNC_ENABLE_IF -..see:Macro.SEQAN_CONCEPT_ASSERT -*/ - -// test whether a concept is fulfilled (without concept checking) -template -struct Implements: False {}; - -template -struct Refines -{ - typedef void Type; -}; - - -template -struct IsRecurse_: False {}; - -template -struct IsRecurse_ >: True {}; - -template -struct IsRecurse_< TConceptModel, TagList >: - Or< - IsRecurse_::Type >, - IsRecurse_ - > {}; - -template -struct Is; - -template