This is an automated email from the git hooks/post-receive script. misterc-guest pushed a commit to branch experimental in repository seqan2.
commit 817a28f1cc66ba7431ff15e71053c73cce9ddcc3 Author: Michael R. Crusoe <[email protected]> Date: Wed Dec 20 07:25:55 2017 -0800 New upstream version 2.3.2.000platform-issues9-028fd79+dfsg --- apps/alf/CMakeLists.txt | 2 +- apps/alf/alf.cpp | 2 +- apps/bs_tools/CMakeLists.txt | 2 +- apps/dfi/CMakeLists.txt | 2 +- apps/fiona/CMakeLists.txt | 2 +- apps/fiona/compute_gain.cpp | 6 +- apps/fx_tools/CMakeLists.txt | 2 +- apps/gustaf/CMakeLists.txt | 2 +- apps/insegt/CMakeLists.txt | 2 +- apps/mason2/CMakeLists.txt | 2 +- apps/mason2/mason_genome.cpp | 2 +- apps/mason2/mason_variator.cpp | 10 +- apps/micro_razers/CMakeLists.txt | 2 +- apps/ngs_roi/CMakeLists.txt | 4 +- apps/pair_align/CMakeLists.txt | 2 +- apps/param_chooser/CMakeLists.txt | 2 +- apps/rabema/CMakeLists.txt | 4 +- apps/rabema/rabema_build_gold_standard.cpp | 2 +- apps/rabema/rabema_evaluate.cpp | 4 +- apps/razers/CMakeLists.txt | 2 +- apps/razers3/CMakeLists.txt | 2 +- apps/rep_sep/CMakeLists.txt | 2 +- apps/sak/CMakeLists.txt | 4 +- apps/sam2matrix/CMakeLists.txt | 2 +- apps/samcat/CMakeLists.txt | 2 +- apps/searchjoin/CMakeLists.txt | 2 +- apps/searchjoin/db.h | 8 +- apps/seqan_tcoffee/CMakeLists.txt | 2 +- apps/seqcons2/CMakeLists.txt | 2 +- apps/sgip/CMakeLists.txt | 2 +- apps/snp_store/CMakeLists.txt | 2 +- apps/splazers/CMakeLists.txt | 2 +- apps/stellar/CMakeLists.txt | 2 +- apps/stellar/stellar.cpp | 2 +- apps/tree_recon/CMakeLists.txt | 2 +- apps/yara/CMakeLists.txt | 2 +- dox/CMakeLists.txt | 2 +- .../align/local_alignment_waterman_eggert_impl.h | 39 +++-- include/seqan/arg_parse/arg_parse_argument.h | 36 ++++- include/seqan/arg_parse/tool_doc.h | 7 + include/seqan/bam_io/bam_alignment_record_util.h | 2 +- include/seqan/index/index_base.h | 2 +- include/seqan/index/index_fm_compressed_sa.h | 6 +- include/seqan/index/index_fm_lf_table.h | 2 +- .../seqan/index/index_fm_rank_dictionary_base.h | 2 +- .../seqan/index/index_fm_rank_dictionary_levels.h | 6 +- .../seqan/index/index_fm_rank_dictionary_naive.h | 2 +- include/seqan/index/index_qgram.h | 2 +- include/seqan/modifier/modifier_padding.h | 51 +++++- include/seqan/platform.h | 4 +- include/seqan/seeds/seeds_global_chaining.h | 162 +++++++++++-------- include/seqan/stream/iter_stream.h | 178 ++++++++++++--------- manual/source/Infrastructure/Use/Install.rst | 42 ++--- tests/align/test_alignment_algorithms_local.h | 47 ++++++ .../align/test_alignment_algorithms_local_banded.h | 32 ++++ tests/arg_parse/test_arg_parse.cpp | 1 + tests/arg_parse/test_arg_parse_argument.h | 28 ++++ tests/modifier/test_modifier.cpp | 3 +- tests/modifier/test_modifier_string_padding.h | 24 +++ tests/seeds/test_seeds_global_chaining.cpp | 26 +++ util/cmake/SeqAnBuildSystem.cmake | 25 ++- util/pkgconfig/seqan.pc.in | 4 +- util/skel/app_template/CMakeLists.txt | 2 +- 63 files changed, 578 insertions(+), 257 deletions(-) diff --git a/apps/alf/CMakeLists.txt b/apps/alf/CMakeLists.txt index e198d89..20b98cd 100644 --- a/apps/alf/CMakeLists.txt +++ b/apps/alf/CMakeLists.txt @@ -56,7 +56,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install alf in ${PREFIX}/bin directory install (TARGETS alf - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/alf for SeqAn release builds. diff --git a/apps/alf/alf.cpp b/apps/alf/alf.cpp index 813a377..b4b45d8 100644 --- a/apps/alf/alf.cpp +++ b/apps/alf/alf.cpp @@ -74,7 +74,7 @@ int main(int argc, const char * argv[]) // Options Section: Input / Output parameters. addSection(parser, "Input / Output"); addOption(parser, seqan::ArgParseOption("i", "input-file", "Name of the multi-FASTA input file.", seqan::ArgParseArgument::INPUT_FILE)); - setValidValues(parser, "input-file", "fa fasta"); + setValidValues(parser, "input-file", seqan::SeqFileIn::getFileExtensions()); setRequired(parser, "input-file"); addOption(parser, seqan::ArgParseOption("o", "output-file", "Name of the file to which the tab-delimtied matrix with pairwise scores will be written to. Default is to write to stdout.", seqan::ArgParseArgument::OUTPUT_FILE)); setValidValues(parser, "output-file", "alf.tsv"); diff --git a/apps/bs_tools/CMakeLists.txt b/apps/bs_tools/CMakeLists.txt index 8732293..ebe3ab8 100644 --- a/apps/bs_tools/CMakeLists.txt +++ b/apps/bs_tools/CMakeLists.txt @@ -99,7 +99,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install bs_tools in ${PREFIX}/bin directory install (TARGETS bisar casbar four2three - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/bs_tools for SeqAn release builds. diff --git a/apps/dfi/CMakeLists.txt b/apps/dfi/CMakeLists.txt index ee9e7c6..1b9274a 100644 --- a/apps/dfi/CMakeLists.txt +++ b/apps/dfi/CMakeLists.txt @@ -56,7 +56,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install dfi in ${PREFIX}/bin directory install (TARGETS dfi - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/dfi for SeqAn release builds. diff --git a/apps/fiona/CMakeLists.txt b/apps/fiona/CMakeLists.txt index babd267..9e68130 100644 --- a/apps/fiona/CMakeLists.txt +++ b/apps/fiona/CMakeLists.txt @@ -83,7 +83,7 @@ if (NOT SEQAN_PREFIX_SHARE_DOC) endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install fiona in ${PREFIX}/bin directory -install (TARGETS fiona compute_gain DESTINATION bin) +install (TARGETS fiona compute_gain DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/fiona for SeqAn release builds. diff --git a/apps/fiona/compute_gain.cpp b/apps/fiona/compute_gain.cpp index 523daa5..26876a8 100644 --- a/apps/fiona/compute_gain.cpp +++ b/apps/fiona/compute_gain.cpp @@ -798,7 +798,7 @@ parseCommandLine(Options & options, int argc, char const ** argv) addOption(parser, seqan::ArgParseOption("g", "genome", "Genome file.", seqan::ArgParseOption::INPUT_FILE, "GENOME.fa")); setRequired(parser, "genome"); - setValidValues(parser, "genome", "fa fasta"); + setValidValues(parser, "genome", seqan::SeqFileIn::getFileExtensions()); addOption(parser, seqan::ArgParseOption("", "pre", "Pre-correction SAM file.", seqan::ArgParseOption::INPUT_FILE, "PRE.{sam,bam}")); @@ -1028,10 +1028,10 @@ int main(int argc, char const ** argv) stop = atEnd(inPostBam); else stop = atEnd(inPostFastq); - + if (stop) break; - + // Read next record into chunk. try { diff --git a/apps/fx_tools/CMakeLists.txt b/apps/fx_tools/CMakeLists.txt index b0e9d7e..09a265d 100644 --- a/apps/fx_tools/CMakeLists.txt +++ b/apps/fx_tools/CMakeLists.txt @@ -55,7 +55,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install fx_tools in ${PREFIX}/bin directory install (TARGETS fx_bam_coverage - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/fx_tools for SeqAn release builds. diff --git a/apps/gustaf/CMakeLists.txt b/apps/gustaf/CMakeLists.txt index d8ae684..a1b28ca 100644 --- a/apps/gustaf/CMakeLists.txt +++ b/apps/gustaf/CMakeLists.txt @@ -77,7 +77,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install gustaf in ${PREFIX}/bin directory install (TARGETS gustaf gustaf_mate_joining - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/gustaf for SeqAn release builds. diff --git a/apps/insegt/CMakeLists.txt b/apps/insegt/CMakeLists.txt index 6adda64..d78484a 100644 --- a/apps/insegt/CMakeLists.txt +++ b/apps/insegt/CMakeLists.txt @@ -61,7 +61,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install insegt in ${PREFIX}/bin directory install (TARGETS insegt - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/insegt for SeqAn release builds. diff --git a/apps/mason2/CMakeLists.txt b/apps/mason2/CMakeLists.txt index eaf4345..57dc904 100644 --- a/apps/mason2/CMakeLists.txt +++ b/apps/mason2/CMakeLists.txt @@ -143,7 +143,7 @@ install (TARGETS mason_frag_sequencing mason_simulator mason_splicing mason_variator - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/mason2 for SeqAn release builds. diff --git a/apps/mason2/mason_genome.cpp b/apps/mason2/mason_genome.cpp index 76383cc..a41cf4d 100644 --- a/apps/mason2/mason_genome.cpp +++ b/apps/mason2/mason_genome.cpp @@ -115,7 +115,7 @@ parseCommandLine(MasonGenomeOptions & options, int argc, char const ** argv) addSection(parser, "Output Options"); addOption(parser, seqan::ArgParseOption("o", "out-file", "Output file.", seqan::ArgParseOption::OUTPUT_FILE, "FILE")); - setValidValues(parser, "out-file", "fa fasta"); + setValidValues(parser, "out-file", seqan::SeqFileOut::getFileExtensions()); setRequired(parser, "out-file"); // Add Examples Section. diff --git a/apps/mason2/mason_variator.cpp b/apps/mason2/mason_variator.cpp index cc27c96..e75ffc2 100644 --- a/apps/mason2/mason_variator.cpp +++ b/apps/mason2/mason_variator.cpp @@ -710,7 +710,7 @@ public: { if (isNearN(seq, pos)) return false; // No SNP next to an N. - + // We simulate an alternative base for each haplotype. seqan::Dna5 from = seq[pos]; @@ -1575,7 +1575,7 @@ public: vcfRecord.rID = svRecord.rId; vcfRecord.beginPos = svRecord.pos - 1; - vcfRecord.id = variants.getVariantName(variants.posToIdx(Variants::SV, svIdx)); + vcfRecord.id = variants.getVariantName(variants.posToIdx(Variants::SV, svIdx)); appendValue(vcfRecord.ref, contig[vcfRecord.beginPos]); vcfRecord.alt = "<INV>"; vcfRecord.filter = "PASS"; @@ -1613,7 +1613,7 @@ public: seqan::VcfRecord vcfRecord; vcfRecord.rID = svRecord.rId; vcfRecord.beginPos = svRecord.pos - 1; - vcfRecord.id = variants.getVariantName(variants.posToIdx(Variants::SV, svIdx)); + vcfRecord.id = variants.getVariantName(variants.posToIdx(Variants::SV, svIdx)); vcfRecord.filter = "PASS"; std::stringstream ss; ss << "SVTYPE=DUP;SVLEN=" << svRecord.size << ";END=" << svRecord.pos + svRecord.size @@ -1814,12 +1814,12 @@ parseCommandLine(MasonVariatorOptions & options, int argc, char const ** argv) addOption(parser, seqan::ArgParseOption("", "meth-fasta-in", "Path to load original methylation levels from. " "Methylation levels are simulated if omitted.", seqan::ArgParseOption::INPUT_FILE, "FILE")); - setValidValues(parser, "meth-fasta-in", "fa fasta"); + setValidValues(parser, "meth-fasta-in", seqan::SeqFileIn::getFileExtensions()); addOption(parser, seqan::ArgParseOption("", "meth-fasta-out", "Path to write methylation levels to as FASTA. " "Only written if \\fB-of\\fP/\\fB--out-fasta\\fP is given.", seqan::ArgParseOption::OUTPUT_FILE, "FILE")); - setValidValues(parser, "meth-fasta-out", "fa fasta"); + setValidValues(parser, "meth-fasta-out", seqan::SeqFileOut::getFileExtensions()); // ---------------------------------------------------------------------- diff --git a/apps/micro_razers/CMakeLists.txt b/apps/micro_razers/CMakeLists.txt index 5e2dd4f..4449ac4 100644 --- a/apps/micro_razers/CMakeLists.txt +++ b/apps/micro_razers/CMakeLists.txt @@ -62,7 +62,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install micro_razers in ${PREFIX}/bin directory install (TARGETS micro_razers - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/micro_razers for SeqAn release builds. diff --git a/apps/ngs_roi/CMakeLists.txt b/apps/ngs_roi/CMakeLists.txt index 2ee38bd..3633699 100644 --- a/apps/ngs_roi/CMakeLists.txt +++ b/apps/ngs_roi/CMakeLists.txt @@ -77,7 +77,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) install (TARGETS bam2roi roi_feature_projection roi_plot_thumbnails - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install helper scripts into ${PREFIX}/bin directory. install (FILES # Scripts for sorting. @@ -88,7 +88,7 @@ install (FILES # Scripts for sorting. tool_shed/roi_plot_9.sh tool_shed/plot.awk tool_shed/ps2pswLinks.gawk - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/ngs_roi for SeqAn release builds. diff --git a/apps/pair_align/CMakeLists.txt b/apps/pair_align/CMakeLists.txt index 70f9e5c..7f1009a 100644 --- a/apps/pair_align/CMakeLists.txt +++ b/apps/pair_align/CMakeLists.txt @@ -60,7 +60,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install pair_align in ${PREFIX}/bin directory install (TARGETS pair_align - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/pair_align for SeqAn release builds. diff --git a/apps/param_chooser/CMakeLists.txt b/apps/param_chooser/CMakeLists.txt index ef4cfeb..005ec4c 100644 --- a/apps/param_chooser/CMakeLists.txt +++ b/apps/param_chooser/CMakeLists.txt @@ -62,7 +62,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install param_chooser in ${PREFIX}/bin directory install (TARGETS param_chooser - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/param_chooser for SeqAn release builds. diff --git a/apps/rabema/CMakeLists.txt b/apps/rabema/CMakeLists.txt index 723e225..96d322a 100644 --- a/apps/rabema/CMakeLists.txt +++ b/apps/rabema/CMakeLists.txt @@ -91,11 +91,11 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) install (TARGETS rabema_prepare_sam rabema_build_gold_standard rabema_evaluate - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install rabema in /bin directory install (TARGETS rabema_prepare_sam rabema_build_gold_standard rabema_evaluate - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/pair_align for SeqAn release builds. diff --git a/apps/rabema/rabema_build_gold_standard.cpp b/apps/rabema/rabema_build_gold_standard.cpp index 08ac1fa..1edbe30 100644 --- a/apps/rabema/rabema_build_gold_standard.cpp +++ b/apps/rabema/rabema_build_gold_standard.cpp @@ -1003,7 +1003,7 @@ parseCommandLine(BuildGoldStandardOptions & options, int argc, char const ** arg addOption(parser, seqan::ArgParseOption("r", "reference", "Path to load reference FASTA from.", seqan::ArgParseArgument::INPUT_FILE, "FASTA")); setRequired(parser, "reference", true); - setValidValues(parser, "reference", "fa fasta"); + setValidValues(parser, "reference", seqan::SeqFileIn::getFileExtensions()); addOption(parser, seqan::ArgParseOption("b", "in-bam", "Path to load the \"perfect\" SAM/BAM file from.", seqan::ArgParseArgument::INPUT_FILE, "BAM")); setValidValues(parser, "in-bam", BamFileIn::getFileExtensions()); diff --git a/apps/rabema/rabema_evaluate.cpp b/apps/rabema/rabema_evaluate.cpp index 89c2707..67b3bf9 100644 --- a/apps/rabema/rabema_evaluate.cpp +++ b/apps/rabema/rabema_evaluate.cpp @@ -1064,7 +1064,7 @@ parseCommandLine(RabemaEvaluationOptions & options, int argc, char const ** argv // setRequired(parser, "out-gsi", true); addOption(parser, seqan::ArgParseOption("r", "reference", "Path to load reference FASTA from.", seqan::ArgParseArgument::INPUT_FILE, "FASTA")); - setValidValues(parser, "reference", "fa fasta"); + setValidValues(parser, "reference", seqan::SeqFileIn::getFileExtensions()); setRequired(parser, "reference", true); addOption(parser, seqan::ArgParseOption("g", "in-gsi", "Path to load gold standard intervals from. If compressed using gzip, " @@ -1229,7 +1229,7 @@ parseCommandLine(RabemaEvaluationOptions & options, int argc, char const ** argv getOptionValue(options.checkSorting, parser, "dont-check-sorting"); options.checkSorting = !options.checkSorting; - + options.showMissedIntervals = isSet(parser, "show-missed-intervals"); options.showSuperflousIntervals = isSet(parser, "show-invalid-hits"); options.showAdditionalIntervals = isSet(parser, "show-additional-hits"); diff --git a/apps/razers/CMakeLists.txt b/apps/razers/CMakeLists.txt index be52d54..8b49881 100644 --- a/apps/razers/CMakeLists.txt +++ b/apps/razers/CMakeLists.txt @@ -66,7 +66,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install razers in ${PREFIX}/bin directory install (TARGETS razers - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/razers for SeqAn release builds. diff --git a/apps/razers3/CMakeLists.txt b/apps/razers3/CMakeLists.txt index 0eb5157..9ec8468 100644 --- a/apps/razers3/CMakeLists.txt +++ b/apps/razers3/CMakeLists.txt @@ -92,7 +92,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install razers3 in ${PREFIX}/bin directory install (TARGETS razers3 - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/razers3 for SeqAn release builds. diff --git a/apps/rep_sep/CMakeLists.txt b/apps/rep_sep/CMakeLists.txt index c8b6312..2e11fe6 100644 --- a/apps/rep_sep/CMakeLists.txt +++ b/apps/rep_sep/CMakeLists.txt @@ -64,7 +64,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install rep_sep in ${PREFIX}/bin directory install (TARGETS rep_sep - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/rep_sep for SeqAn release builds. diff --git a/apps/sak/CMakeLists.txt b/apps/sak/CMakeLists.txt index 3687181..c5e9f5b 100644 --- a/apps/sak/CMakeLists.txt +++ b/apps/sak/CMakeLists.txt @@ -68,7 +68,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install sak in ${PREFIX}/bin directory install (TARGETS sak - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/sak for SeqAn release builds. @@ -77,7 +77,7 @@ install (FILES LICENSE ${CMAKE_CURRENT_BINARY_DIR}/README.sak.txt DESTINATION ${SEQAN_PREFIX_SHARE_DOC}) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/sak.1 - DESTINATION ${SEQAN_PREFIX_SHARE_DOC}/man) + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) # ---------------------------------------------------------------------------- # App Test diff --git a/apps/sam2matrix/CMakeLists.txt b/apps/sam2matrix/CMakeLists.txt index e0d60ad..3ea10b4 100644 --- a/apps/sam2matrix/CMakeLists.txt +++ b/apps/sam2matrix/CMakeLists.txt @@ -56,7 +56,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install sam2matrix in ${PREFIX}/bin directory install (TARGETS sam2matrix - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/sam2matrix for SeqAn release builds. diff --git a/apps/samcat/CMakeLists.txt b/apps/samcat/CMakeLists.txt index 1fada83..7c1664a 100644 --- a/apps/samcat/CMakeLists.txt +++ b/apps/samcat/CMakeLists.txt @@ -63,7 +63,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install samcat in ${PREFIX}/bin directory install (TARGETS samcat - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/samcat for SeqAn release builds. diff --git a/apps/searchjoin/CMakeLists.txt b/apps/searchjoin/CMakeLists.txt index 576df51..ceeaab4 100644 --- a/apps/searchjoin/CMakeLists.txt +++ b/apps/searchjoin/CMakeLists.txt @@ -66,7 +66,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install searchjoin in ${PREFIX}/bin directory install (TARGETS s4_search s4_join - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/searchjoin for SeqAn release builds. diff --git a/apps/searchjoin/db.h b/apps/searchjoin/db.h index bec0120..8d5e503 100644 --- a/apps/searchjoin/db.h +++ b/apps/searchjoin/db.h @@ -130,25 +130,25 @@ namespace seqan template <> struct Fibre<TDbDnaSaSmall, FibreSA> { - typedef String<Pair<unsigned int, unsigned char, BitPacked<24, 8> >, StringSpec<TDbDnaSaSmall>::Type> Type; + typedef String<Pair<unsigned int, unsigned char, BitPacked<24, 8> >, DefaultIndexStringSpec<TDbDnaSaSmall>::Type> Type; }; template <> struct Fibre<TDbGeoSaSmall, FibreSA> { - typedef String<Pair<unsigned int, unsigned char, BitPacked<24, 8> >, StringSpec<TDbGeoSaSmall>::Type> Type; + typedef String<Pair<unsigned int, unsigned char, BitPacked<24, 8> >, DefaultIndexStringSpec<TDbGeoSaSmall>::Type> Type; }; template <> struct Fibre<TDbDnaSaHuge, FibreSA> { - typedef String<Pair<unsigned int, unsigned char, Pack>, StringSpec<TDbDnaSaHuge>::Type> Type; + typedef String<Pair<unsigned int, unsigned char, Pack>, DefaultIndexStringSpec<TDbDnaSaHuge>::Type> Type; }; template <> struct Fibre<TDbGeoSaHuge, FibreSA> { - typedef String<Pair<unsigned int, unsigned char, Pack>, StringSpec<TDbDnaSaHuge>::Type> Type; + typedef String<Pair<unsigned int, unsigned char, Pack>, DefaultIndexStringSpec<TDbDnaSaHuge>::Type> Type; }; } diff --git a/apps/seqan_tcoffee/CMakeLists.txt b/apps/seqan_tcoffee/CMakeLists.txt index 66e85e2..c8df67c 100644 --- a/apps/seqan_tcoffee/CMakeLists.txt +++ b/apps/seqan_tcoffee/CMakeLists.txt @@ -56,7 +56,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install seqan_tcoffee in ${PREFIX}/bin directory install (TARGETS seqan_tcoffee - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/seqan_tcoffee for SeqAn release builds. diff --git a/apps/seqcons2/CMakeLists.txt b/apps/seqcons2/CMakeLists.txt index 8b5fcc2..8edf724 100644 --- a/apps/seqcons2/CMakeLists.txt +++ b/apps/seqcons2/CMakeLists.txt @@ -62,7 +62,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install seqcons2 in ${PREFIX}/bin directory install (TARGETS seqcons2 - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/seqcons2 for SeqAn release builds. diff --git a/apps/sgip/CMakeLists.txt b/apps/sgip/CMakeLists.txt index 71a28ac..6f692c4 100755 --- a/apps/sgip/CMakeLists.txt +++ b/apps/sgip/CMakeLists.txt @@ -56,7 +56,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install sgip in ${PREFIX}/bin directory install (TARGETS sgip - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/sgip for SeqAn release builds. diff --git a/apps/snp_store/CMakeLists.txt b/apps/snp_store/CMakeLists.txt index e846ec3..797b248 100644 --- a/apps/snp_store/CMakeLists.txt +++ b/apps/snp_store/CMakeLists.txt @@ -71,7 +71,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install snp_store in ${PREFIX}/bin directory install (TARGETS snp_store - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/snp_store for SeqAn release builds. diff --git a/apps/splazers/CMakeLists.txt b/apps/splazers/CMakeLists.txt index bb85d5d..35c8386 100644 --- a/apps/splazers/CMakeLists.txt +++ b/apps/splazers/CMakeLists.txt @@ -68,7 +68,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install splazers in ${PREFIX}/bin directory install (TARGETS splazers - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/splazers for SeqAn release builds. diff --git a/apps/stellar/CMakeLists.txt b/apps/stellar/CMakeLists.txt index a94d1bf..f6e0499 100644 --- a/apps/stellar/CMakeLists.txt +++ b/apps/stellar/CMakeLists.txt @@ -60,7 +60,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install stellar in ${PREFIX}/bin directory install (TARGETS stellar - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/stellar for SeqAn release builds. diff --git a/apps/stellar/stellar.cpp b/apps/stellar/stellar.cpp index 604cd43..f253d47 100644 --- a/apps/stellar/stellar.cpp +++ b/apps/stellar/stellar.cpp @@ -569,7 +569,7 @@ void _setParser(ArgumentParser & parser) setDefaultValue(parser, "o", "stellar.gff"); addOption(parser, ArgParseOption("od", "outDisabled", "Name of output file for disabled query sequences.", ArgParseArgument::OUTPUT_FILE)); - setValidValues(parser, "outDisabled", "fa fasta"); + setValidValues(parser, "outDisabled", seqan::SeqFileOut::getFileExtensions()); setDefaultValue(parser, "od", "stellar.disabled.fasta"); addOption(parser, ArgParseOption("t", "no-rt", "Suppress printing running time.")); hideOption(parser, "t"); diff --git a/apps/tree_recon/CMakeLists.txt b/apps/tree_recon/CMakeLists.txt index d39248f..2b9a4fc 100644 --- a/apps/tree_recon/CMakeLists.txt +++ b/apps/tree_recon/CMakeLists.txt @@ -56,7 +56,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install tree_recon in ${PREFIX}/bin directory install (TARGETS tree_recon - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/tree_recon for SeqAn release builds. diff --git a/apps/yara/CMakeLists.txt b/apps/yara/CMakeLists.txt index 73ec26a..fd14881 100644 --- a/apps/yara/CMakeLists.txt +++ b/apps/yara/CMakeLists.txt @@ -136,7 +136,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install yara in ${PREFIX}/bin directory install (TARGETS yara_indexer yara_mapper - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/yara for SeqAn release builds. diff --git a/dox/CMakeLists.txt b/dox/CMakeLists.txt index 74b4749..e5e1189 100644 --- a/dox/CMakeLists.txt +++ b/dox/CMakeLists.txt @@ -39,5 +39,5 @@ if (${SEQAN_BUILD_SYSTEM} MATCHES "SEQAN_RELEASE_LIBRARY") # includes SEQAN_RELE --out-dir ${CMAKE_BINARY_DIR}/dox/html) install (DIRECTORY ${CMAKE_BINARY_DIR}/dox/html - DESTINATION share/doc/seqan) + DESTINATION ${CMAKE_INSTALL_DOCDIR}) endif () diff --git a/include/seqan/align/local_alignment_waterman_eggert_impl.h b/include/seqan/align/local_alignment_waterman_eggert_impl.h index d80cfc3..741ca30 100644 --- a/include/seqan/align/local_alignment_waterman_eggert_impl.h +++ b/include/seqan/align/local_alignment_waterman_eggert_impl.h @@ -188,12 +188,12 @@ TScoreValue getScore(LocalAlignmentFinder<TScoreValue> const & sw) // Function _smithWatermanGetMatrix() // ---------------------------------------------------------------------------- -template <typename TScoreValue, typename TStringH, typename TStringV> +template <typename TScoreValue, typename TScoreSpec, typename TStringH, typename TStringV> TScoreValue _smithWatermanGetMatrix(LocalAlignmentFinder<TScoreValue> & sw, TStringH const & strH, TStringV const & strV, - Score<TScoreValue, Simple> const & score_, + Score<TScoreValue, TScoreSpec> const & score_, TScoreValue cutoff) { // typedefs @@ -220,8 +220,6 @@ _smithWatermanGetMatrix(LocalAlignmentFinder<TScoreValue> & sw, TStringIteratorH x = x_end; TStringIteratorV y; - TScoreValue score_match = scoreMatch(score_); - TScoreValue score_mismatch = scoreMismatch(score_); TScoreValue score_gap = scoreGapExtend(score_); TScoreValue h = 0; @@ -263,14 +261,15 @@ _smithWatermanGetMatrix(LocalAlignmentFinder<TScoreValue> & sw, goPrevious(finger1, 0); goPrevious(finger2, 0); + TScoreValue currScore = score(score_, *x, cy); if (*x == cy) { - v = h + score_match; + v = h + currScore; h = *finger2; } else { - TScoreValue s1 = h + score_mismatch; + TScoreValue s1 = h + currScore; h = *finger2; TScoreValue s2 = score_gap + ((h > v) ? h : v); v = (s1 > s2) ? s1 : s2; @@ -303,12 +302,15 @@ _smithWatermanGetMatrix(LocalAlignmentFinder<TScoreValue> & sw, // ---------------------------------------------------------------------------- // declumping -template <typename TScoreValue, typename TSequenceH, typename TGapsSpecH, typename TSequenceV, typename TGapsSpecV> +template <typename TScoreValue, + typename TSequenceH, typename TGapsSpecH, + typename TSequenceV, typename TGapsSpecV, + typename TScoreSpec> void _smithWatermanDeclump(LocalAlignmentFinder<TScoreValue> & sw , Gaps<TSequenceH, TGapsSpecH> & gapsH, Gaps<TSequenceV, TGapsSpecV> & gapsV, - Score<TScoreValue, Simple> const & score_) + Score<TScoreValue, TScoreSpec> const & score_) { //------------------------------------------------------------------------- //typedefs @@ -364,8 +366,6 @@ _smithWatermanDeclump(LocalAlignmentFinder<TScoreValue> & sw , TSequenceHIter x_stop = x_end; - TScoreValue score_match = scoreMatch(score_); - TScoreValue score_mismatch = scoreMismatch(score_); TScoreValue score_gap = scoreGapExtend(score_); TScoreValue h,v; @@ -456,9 +456,10 @@ _smithWatermanDeclump(LocalAlignmentFinder<TScoreValue> & sw , { goPrevious(finger0, 0); goPrevious(finger1, 0); + TScoreValue currScore = score(score_, *x, cy); if (*x == cy && !(sw.forbidden[position(finger0)])) { - v = h + score_match; + v = h + currScore; h = *finger1; } else @@ -474,7 +475,7 @@ _smithWatermanDeclump(LocalAlignmentFinder<TScoreValue> & sw , else { if(sw.forbidden[position(finger0)]) s1 = 0; - else s1 = h + score_mismatch; + else s1 = h + currScore; } h = *finger1; @@ -522,13 +523,16 @@ _smithWatermanDeclump(LocalAlignmentFinder<TScoreValue> & sw , // ---------------------------------------------------------------------------- // Traceback. -template <typename TSourceH, typename TGapsSpecH, typename TSourceV, typename TGapsSpecV, typename TScoreValue, unsigned DIMENSION> +template <typename TSourceH, typename TGapsSpecH, + typename TSourceV, typename TGapsSpecV, + typename TScoreValue, typename TScoreSpec, + unsigned DIMENSION> typename Iterator<Matrix<TScoreValue, DIMENSION>, Standard >::Type _smithWatermanTrace(Gaps<TSourceH, TGapsSpecH> & gapsH, Gaps<TSourceV, TGapsSpecV> & gapsV, typename LocalAlignmentFinder<TScoreValue>::TBoolMatrix & fb_matrix, Iter< Matrix<TScoreValue, DIMENSION>, PositionIterator > source_, - Score<TScoreValue, Simple> const & scoring_) { + Score<TScoreValue, TScoreSpec> const & scoring_) { //typedefs typedef Iter<Matrix<TScoreValue, DIMENSION>, PositionIterator > TMatrixIterator; typedef typename Position<Matrix<TScoreValue, DIMENSION> >::Type TPosition; @@ -559,7 +563,6 @@ _smithWatermanTrace(Gaps<TSourceH, TGapsSpecH> & gapsH, TSourceIteratorV it_1 = iter(strV, pos_1, Standard()); TSourceIteratorV it_1_end = end(strV); - TScoreValue score_mismatch = scoreMismatch(scoring_); TScoreValue score_gap = scoreGapExtend(scoring_); //------------------------------------------------------------------------- @@ -586,7 +589,7 @@ _smithWatermanTrace(Gaps<TSourceH, TGapsSpecH> & gapsH, d = 0; else{ goNext(it_, 1); - d = *it_ + score_mismatch; + d = *it_ + score(scoring_, *it_0, *it_1); } it_ = source_; @@ -678,7 +681,9 @@ _getNextBestEndPosition(LocalAlignmentFinder<TScoreValue> & sw , // ---------------------------------------------------------------------------- // Wrapper that computes the matrix and does the backtracking for the best alignment -template <typename TSourceH, typename TGapsSpecH, typename TSourceV, typename TGapsSpecV, typename TScoreValue, typename TScoreSpec> +template <typename TSourceH, typename TGapsSpecH, + typename TSourceV, typename TGapsSpecV, + typename TScoreValue, typename TScoreSpec> TScoreValue _smithWaterman(Gaps<TSourceH, TGapsSpecH> & gapsH, Gaps<TSourceV, TGapsSpecV> & gapsV, diff --git a/include/seqan/arg_parse/arg_parse_argument.h b/include/seqan/arg_parse/arg_parse_argument.h index 95ebf88..03f473f 100644 --- a/include/seqan/arg_parse/arg_parse_argument.h +++ b/include/seqan/arg_parse/arg_parse_argument.h @@ -438,6 +438,28 @@ inline bool isOutputFileArgument(ArgParseArgument const & me) } // ---------------------------------------------------------------------------- +// Function isDirectoryArgument() +// ---------------------------------------------------------------------------- + +/*! + * @fn ArgParseArgument#isDirectoryArgument + * @headerfile <seqan/arg_parse.h> + * @brief Returns whether the argument is a directorz argument. + * + * @signature bool isDirectoryArgument(arg); + * + * @param[in] arg The ArgParseArgument to query. + * + * @return bool <tt>true</tt> if it is a directory argument, <tt>false</tt> otherwise. + */ + +inline bool isDirectoryArgument(ArgParseArgument const & me) +{ + return me._argumentType == ArgParseArgument::INPUT_DIRECTORY || + me._argumentType == ArgParseArgument::OUTPUT_DIRECTORY; +} + +// ---------------------------------------------------------------------------- // Function isOutputPrefixArgument() // ---------------------------------------------------------------------------- @@ -923,7 +945,15 @@ inline void _checkValue(ArgParseArgument const & me) { unsigned i = 0; for (std::vector<std::string>::const_iterator it = me.value.begin(); it != me.value.end(); ++it, ++i) - _checkValue(me, *it, i); + { + auto val = *it; + + if (isDirectoryArgument(me)) // strip trailing slash for directories + if (val[length(val) - 1] == '/') + val.resize(length(val) - 1); + + _checkValue(me, val, i); + } } // ---------------------------------------------------------------------------- @@ -1138,6 +1168,10 @@ inline std::string getFileExtension(ArgParseArgument const & me, unsigned pos = if (value.empty()) return ""; + if (isDirectoryArgument(me)) // strip trailing slash for directories + if (value[length(value) - 1] == '/') + value.resize(length(value) - 1); + // If there is a list of valid values then we look for each of these in the path. if (!me.validValues.empty()) { diff --git a/include/seqan/arg_parse/tool_doc.h b/include/seqan/arg_parse/tool_doc.h index a19a983..970c0e3 100644 --- a/include/seqan/arg_parse/tool_doc.h +++ b/include/seqan/arg_parse/tool_doc.h @@ -444,6 +444,13 @@ public: std::fill_n(out, _layout.leftPadding, ' '); stream << _toText(listItem._term); unsigned pos = _layout.leftPadding + length(listItem._term); + + if (empty(listItem._description)) + { + stream << '\n'; + return; + } + if (pos + _layout.centerPadding > _layout.rightColumnTab) { stream << '\n'; diff --git a/include/seqan/bam_io/bam_alignment_record_util.h b/include/seqan/bam_io/bam_alignment_record_util.h index 1a7a02f..15d1ac1 100644 --- a/include/seqan/bam_io/bam_alignment_record_util.h +++ b/include/seqan/bam_io/bam_alignment_record_util.h @@ -237,7 +237,7 @@ bamRecordToAlignment(Align<TSource, TSpec> & result, TReference & reference, Bam // TODO(holtgrew): Clipping better than copying infix? But is it generic? resize(rows(result), 2); - unsigned len = record.beginPos + getAlignmentLengthInRef(record) - countPaddings(record.cigar); + unsigned len = getAlignmentLengthInRef(record) - countPaddings(record.cigar); setSource(row(result, 0), reference); setClippedEndPosition(row(result, 0), record.beginPos + len); diff --git a/include/seqan/index/index_base.h b/include/seqan/index/index_base.h index 1cb2eb8..6aa2f5b 100644 --- a/include/seqan/index/index_base.h +++ b/include/seqan/index/index_base.h @@ -218,7 +218,7 @@ SEQAN_CONCEPT_REFINE(StringTrieConcept, (TIndex), (StringIndexConcept)) {}; */ template <typename TObject> - struct [[deprecated("Deprecated in favor of StringSpec.")]] DefaultIndexStringSpec : StringSpec<TObject> {}; + struct DefaultIndexStringSpec : StringSpec<TObject> {}; ////////////////////////////////////////////////////////////////////////////// diff --git a/include/seqan/index/index_fm_compressed_sa.h b/include/seqan/index/index_fm_compressed_sa.h index 16fbc0c..453fdd3 100644 --- a/include/seqan/index/index_fm_compressed_sa.h +++ b/include/seqan/index/index_fm_compressed_sa.h @@ -84,8 +84,8 @@ typedef Tag<FibreSparseString_> const FibreSparseString; // ---------------------------------------------------------------------------- template <typename TText, typename TSpec, typename TConfig> -struct StringSpec<CompressedSA<TText, TSpec, TConfig> > : - StringSpec<TText> {}; +struct DefaultIndexStringSpec<CompressedSA<TText, TSpec, TConfig> > : + DefaultIndexStringSpec<TText> {}; // ---------------------------------------------------------------------------- // Metafunction Fibre @@ -97,7 +97,7 @@ struct Fibre<CompressedSA<TText, TSpec, TConfig>, FibreSparseString> // TODO(esiragusa): Change SparseString spec to be SparseString<TValue, TSpec, TConfig>. typedef CompressedSA<TText, TSpec, TConfig> TCSA; typedef typename SAValue<TText>::Type TSAValue_; - typedef typename StringSpec<TCSA>::Type TSASpec_; + typedef typename DefaultIndexStringSpec<TCSA>::Type TSASpec_; typedef String<TSAValue_, TSASpec_> TSA_; typedef SparseString<TSA_, TConfig> Type; }; diff --git a/include/seqan/index/index_fm_lf_table.h b/include/seqan/index/index_fm_lf_table.h index 8da0a12..64d8320 100644 --- a/include/seqan/index/index_fm_lf_table.h +++ b/include/seqan/index/index_fm_lf_table.h @@ -125,7 +125,7 @@ struct Fibre<LF<TText, TSpec, TConfig>, FibrePrefixSums> // typedef Tuple<TSize_, ValueSize<TValue_>::VALUE> Type; typedef typename Size<LF<TText, TSpec, TConfig> >::Type TSize_; - typedef typename StringSpec<TText>::Type TSpec_; + typedef typename DefaultIndexStringSpec<TText>::Type TSpec_; typedef String<TSize_, TSpec_> Type; }; diff --git a/include/seqan/index/index_fm_rank_dictionary_base.h b/include/seqan/index/index_fm_rank_dictionary_base.h index 6d8a5ba..f45549c 100644 --- a/include/seqan/index/index_fm_rank_dictionary_base.h +++ b/include/seqan/index/index_fm_rank_dictionary_base.h @@ -121,7 +121,7 @@ struct RankDictionary; // ---------------------------------------------------------------------------- template <typename TValue, template <typename, typename> class TRankDictionary, typename TSpec, typename TConfig> -struct StringSpec<RankDictionary<TValue, TRankDictionary<TSpec, TConfig> > > +struct DefaultIndexStringSpec<RankDictionary<TValue, TRankDictionary<TSpec, TConfig> > > { typedef typename TConfig::Fibre Type; }; diff --git a/include/seqan/index/index_fm_rank_dictionary_levels.h b/include/seqan/index/index_fm_rank_dictionary_levels.h index 8b0a446..2eeeadd 100644 --- a/include/seqan/index/index_fm_rank_dictionary_levels.h +++ b/include/seqan/index/index_fm_rank_dictionary_levels.h @@ -354,7 +354,7 @@ struct Fibre<RankDictionary<TValue, Levels<TSpec, TConfig> >, FibreRanks> { typedef RankDictionary<TValue, Levels<TSpec, TConfig> > TRankDictionary_; typedef RankDictionaryEntry_<TValue, Levels<TSpec, TConfig> > TEntry_; - typedef typename StringSpec<TRankDictionary_>::Type TFibreSpec_; + typedef typename DefaultIndexStringSpec<TRankDictionary_>::Type TFibreSpec_; typedef String<TEntry_, TFibreSpec_> Type; }; @@ -364,7 +364,7 @@ struct Fibre<RankDictionary<TValue, Levels<TSpec, TConfig> >, FibreSuperBlocks> { typedef RankDictionary<TValue, Levels<TSpec, TConfig> > TRankDictionary_; typedef typename RankDictionarySuperBlock_<TValue, Levels<TSpec, TConfig> >::Type TSuperBlocks_; - typedef typename StringSpec<TRankDictionary_>::Type TFibreSpec_; + typedef typename DefaultIndexStringSpec<TRankDictionary_>::Type TFibreSpec_; typedef String<TSuperBlocks_, TFibreSpec_> Type; }; @@ -374,7 +374,7 @@ struct Fibre<RankDictionary<TValue, Levels<TSpec, TConfig> >, FibreUltraBlocks> { typedef RankDictionary<TValue, Levels<TSpec, TConfig> > TRankDictionary_; typedef typename RankDictionaryUltraBlock_<TValue, Levels<TSpec, TConfig> >::Type TUltraBlocks_; - typedef typename StringSpec<TRankDictionary_>::Type TFibreSpec_; + typedef typename DefaultIndexStringSpec<TRankDictionary_>::Type TFibreSpec_; typedef String<TUltraBlocks_, TFibreSpec_> Type; }; diff --git a/include/seqan/index/index_fm_rank_dictionary_naive.h b/include/seqan/index/index_fm_rank_dictionary_naive.h index 1884c2e..dcd9ab0 100644 --- a/include/seqan/index/index_fm_rank_dictionary_naive.h +++ b/include/seqan/index/index_fm_rank_dictionary_naive.h @@ -61,7 +61,7 @@ struct Fibre<RankDictionary<TValue, Naive<TSpec, TConfig> >, FibreRanks> { typedef RankDictionary<TValue, Naive<TSpec, TConfig> > TRankDictionary_; typedef typename Size<TRankDictionary_>::Type TSize_; - typedef typename StringSpec<TRankDictionary_>::Type TFibreSpec_; + typedef typename DefaultIndexStringSpec<TRankDictionary_>::Type TFibreSpec_; typedef String<TSize_, TFibreSpec_> Type; }; diff --git a/include/seqan/index/index_qgram.h b/include/seqan/index/index_qgram.h index 90ba86f..7611d23 100644 --- a/include/seqan/index/index_qgram.h +++ b/include/seqan/index/index_qgram.h @@ -343,7 +343,7 @@ struct Fibre< Index<TText, TSpec>, FibreCounts> { typename Size< TText >::Type, typename Size< Index<TText, TSpec> >::Type >, - typename StringSpec< Index<TText, TSpec> >::Type + typename DefaultIndexStringSpec< Index<TText, TSpec> >::Type > Type; }; diff --git a/include/seqan/modifier/modifier_padding.h b/include/seqan/modifier/modifier_padding.h index 83bb805..88aad70 100644 --- a/include/seqan/modifier/modifier_padding.h +++ b/include/seqan/modifier/modifier_padding.h @@ -165,7 +165,7 @@ struct DefaultIteratorSpec< ModifiedString<THost, ModPadding> > * @param [in,out] str The modified string to be padded. * @param [in] size The number of padded characters. * @param [in] pad The character to pad the sequence with. - * + * * @datarace Not thread-safe. */ @@ -211,6 +211,51 @@ length(ModifiedString<THost, ModPadding> const & me) } // ---------------------------------------------------------------------------- +// Function cargoValue() +// ---------------------------------------------------------------------------- + +template <typename THost> +inline typename Reference<ModifiedString<THost, ModPadding> >::Type +cargoValue(ModifiedString<THost, ModPadding> & me) +{ + return cargo(me)._paddedValue; +} + +// NOTE(rrahn): The problem with the padding symbol is, that it is always stored as a member +// of the modifier class. Hence, if the modifier is const all it's members are const. +// Now, the cargo could be either defined mutable or, and this what we did right now, the +// the const is cast-away. However, we use SFINAE to only apply this hack to the Host types, +// for which this becomes relevant. That are Host types like the Segment class who copy pointer semantics, i.e. +// the constness of the object is not propagated to the underlying source. + +// The default version, where Reference<THost const>::Type gives back a const reference. +template <typename THost, + std::enable_if_t<std::is_same<std::remove_reference_t< + typename Reference<ModifiedString<THost, ModPadding>>::Type>, + std::add_const_t<std::remove_reference_t< + typename Reference<ModifiedString<THost, ModPadding>>::Type>>>::value, + int> = 0> +inline typename Reference<ModifiedString<THost, ModPadding> >::Type +cargoValue(ModifiedString<THost, ModPadding> const & me) +{ + return cargo(me)._paddedValue; +} + +// The version, where Reference<THost const>::Type gives back a non-const reference. +template <typename THost, + std::enable_if_t<!std::is_same<std::remove_reference_t< + typename Reference<ModifiedString<THost, ModPadding>>::Type>, + std::add_const_t<std::remove_reference_t< + typename Reference<ModifiedString<THost, ModPadding>>::Type>>>::value, + int> = 0> +inline typename Reference<ModifiedString<THost, ModPadding> >::Type +cargoValue(ModifiedString<THost, ModPadding> const & me) +{ + using TTargetType = typename Reference<ModifiedString<THost, ModPadding> >::Type; + return const_cast<TTargetType>(cargo(me)._paddedValue); +} + +// ---------------------------------------------------------------------------- // Function value() // ---------------------------------------------------------------------------- @@ -219,7 +264,7 @@ inline typename Reference<ModifiedString<THost, ModPadding> >::Type value(ModifiedString<THost, ModPadding> & me, TPosition const pos) { SEQAN_ASSERT_LT(pos, static_cast<TPosition>(length(me))); - return (SEQAN_LIKELY(pos < static_cast<TPosition>(length(host(me))))) ? host(me)[pos] : cargo(me)._paddedValue; + return (SEQAN_LIKELY(pos < static_cast<TPosition>(length(host(me))))) ? host(me)[pos] : cargoValue(me); } template <typename THost, typename TPosition> @@ -227,7 +272,7 @@ inline typename Reference<ModifiedString<THost, ModPadding> const>::Type value(ModifiedString<THost, ModPadding> const & me, TPosition const pos) { SEQAN_ASSERT_LT(pos, static_cast<TPosition>(length(me))); - return (SEQAN_LIKELY(pos < static_cast<TPosition>(length(host(me))))) ? value(host(me), pos) : cargo(me)._paddedValue; + return (SEQAN_LIKELY(pos < static_cast<TPosition>(length(host(me))))) ? value(host(me), pos) : cargoValue(me); } // ---------------------------------------------------------------------------- diff --git a/include/seqan/platform.h b/include/seqan/platform.h index ab0c7ba..e743c71 100644 --- a/include/seqan/platform.h +++ b/include/seqan/platform.h @@ -477,9 +477,9 @@ typedef int8_t __int8; // nolint #include <endian.h> #endif // __GLIBC__ -#if defined(__FreeBSD__) || (defined(__has_include) && __has_include(<sys/endian.h>)) +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) #include <sys/endian.h> -#endif // defined(__FreeBSD__) +#endif // defined *BSD #ifndef SEQAN_BIG_ENDIAN #if (defined( _BYTE_ORDER ) && ( _BYTE_ORDER == _BIG_ENDIAN )) || \ diff --git a/include/seqan/seeds/seeds_global_chaining.h b/include/seqan/seeds/seeds_global_chaining.h index 5a6e867..ee84323 100644 --- a/include/seqan/seeds/seeds_global_chaining.h +++ b/include/seqan/seeds/seeds_global_chaining.h @@ -62,6 +62,23 @@ typedef Tag<SparseChaining_> SparseChaining; // Functions // =========================================================================== +template <typename TIntermediate> +inline bool _checkScoreInvariant(TIntermediate const & list) +{ + if (list.empty()) + return true; + auto it = list.begin(); + auto score = it->i2; + ++it; + for (; it != list.end(); ++it) + { + if (score > it->i2) + return false; + score = it->i2; + } + return true; +} + /*! * @fn chainSeedsGlobally * @headerfile <seqan/seeds.h> @@ -97,6 +114,13 @@ typedef Tag<SparseChaining_> SparseChaining; */ // TODO(holtgrew): Implement scored! +// NOTE(rrahn): Some general notes regarding the sparse chaining algorithm by Gusfield. +// From the text it is hard to follow the correct algorithm, as one usually expects the y-coordinates to +// be increasing integers (sequence positions). However, the algorithm assumes the coordinates of the +// rectangles to be placed in the fourth quadrant of the cartesian coordinate system (negative y-coordinates). +// To adapt the algorithm for the positive sequence space we sort the y-coordinates in *L* in ascending order. +// We then can use lower_bound and upper_bound on the sorted set to find the corresponding seed j as described in +// the algorithm. template <typename TTargetContainer, typename TSeed, typename TSeedSetSpec> void chainSeedsGlobally( @@ -153,8 +177,8 @@ chainSeedsGlobally( // ----------------------------------------------------------------------- // Step 2: Build the chain. // ----------------------------------------------------------------------- - // We build a list of "intermediate solutions". Each such - // solution is represented by the triple (end position in dim1, + // We build a list of "intermediate solutions" (referred to as *L* in the Gusfield book). + // Each such solution is represented by the triple (end position in dim1, // value of best chain so far, last seed of the chain). typedef Triple<TPosition, TSize, unsigned> TIntermediateSolution; typedef std::multiset<TIntermediateSolution> TIntermediateSolutions; @@ -162,89 +186,99 @@ chainSeedsGlobally( // For all interval points... TIntermediateSolutions intermediateSolutions; - for (TIntervalPointsIterator it = begin(intervalPoints), itEnd = end(intervalPoints); it != itEnd; ++it) { + for (TIntervalPointsIterator it_k = begin(intervalPoints), itEnd = end(intervalPoints); it_k != itEnd; ++it_k) { // The seed belonging ot the interval point is seed k. - TSeed const & seedK = seeds[it->i3]; + TSeed const & seed_k = seeds[it_k->i3]; // std::cout << "Processing interval point (" << it->i1 << ", " << it->i2 << ", " << it->i3 << ")" << std::endl; - if (it->i2) { // Is is begin point. - // Find the closest seed (in dimension 1) to seed k with an - // entry in intermediateSolutions whose end coordinate in - // dimension 1 is <= the begin coordinate in dimension 1 - // of seedK. + if (it_k->i2) { // Is is begin point. + // Find the closest seed j (in y-dimension) with an + // entry in L whose end coordinate is less or equal the begin position of k. // // STL gives us upper_bound which returns a pointer to the // *first* one that compares greater than the reference // one. Searching for the this one and decrementing the // result iterator gives the desired result. - TIntermediateSolution referenceSolution(beginPositionV(seedK), std::numeric_limits<TSize>::max(), std::numeric_limits<unsigned>::max()); - // std::cout << " intermediateSolutions.upper_bound(" << beginPositionV(seedK) << ")" << std::endl; - TIntermediateSolutionsIterator itJ = intermediateSolutions.upper_bound(referenceSolution); - if (itJ == intermediateSolutions.begin()) { - if (intermediateSolutions.size() > 0 && - intermediateSolutions.rbegin()->i1 <= beginPositionV(seedK)) { - itJ = intermediateSolutions.end(); - --itJ; - } else { - continue; - } - } else { - SEQAN_ASSERT_GT(intermediateSolutions.size(), 0u); // TODO(holtgrew): Remove this assertion? - --itJ; + TIntermediateSolution referenceSolution(beginPositionV(seed_k), std::numeric_limits<TSize>::max(), std::numeric_limits<unsigned>::max()); + // std::cout << " intermediateSolutions.upper_bound(" << beginPositionV(seed_k) << ")" << std::endl; + TIntermediateSolutionsIterator it_j = intermediateSolutions.upper_bound(referenceSolution); + + // Special case not dealt with in the book: If L is empty or there is no chain + // that ends before k begins, simply continue with the next point in I. + if (intermediateSolutions.empty() || it_j == intermediateSolutions.begin()) + { + continue; } - // std::cout << " --> " << seeds[itJ->i3] << std::endl; + // Go to the last value in L, i.e. l_j <= h_k. + --it_j; + // std::cout << " --> " << seeds[it_j->i3] << std::endl; // Now, we have found such a seed j. - SEQAN_ASSERT_LEQ(endPositionV(seeds[itJ->i3]), endPositionV(seedK)); + SEQAN_ASSERT_LEQ(endPositionV(seeds[it_j->i3]), beginPositionV(seed_k)); // Update the intermediate solution value for k and set predecessor. - qualityOfChainEndingIn[it->i3] += itJ->i2; + qualityOfChainEndingIn[it_k->i3] += it_j->i2; // std::cout << " UPDATE qualityOfChainEndingIn[" << it->i3 << "] == " << qualityOfChainEndingIn[it->i3] << std::endl; - predecessor[it->i3] = itJ->i3; + predecessor[it_k->i3] = it_j->i3; // std::cout << " predecessor[" << it->i3 << "] == " << itJ->i3 << std::endl; } else { // Is end point. - // Search for the first triple in intermediateSolutions - // where the end coordinate in dimension 1 is >= end - // coordinate in dimension 1 for seed k. The corresponding - // seed is seed j. + // Search for the first triple j in L with l_j >= l_k. + // Or to put it in differently, find the first chain that ends + // left and below the chain that ends in k. These are other possible solutions, + // that either result in a better score or must be deleted as the score of the chain ending in k + // is bigger. Hence, every other seed that could connect to both j and k, prefers the one with the higher + // score. // - // We work with upper_bound here which gives us the first - // value that is > so we have to work around this to get - // >= again... - SEQAN_ASSERT_GT(endPositionV(seedK), 0u); - TIntermediateSolution referenceSolution(endPositionV(seedK), 0, std::numeric_limits<unsigned>::max()); - TIntermediateSolutionsIterator itSol = intermediateSolutions.upper_bound(referenceSolution); - if (itSol == intermediateSolutions.end()) { - // None found. Insert a new triple for seed k. - TIntermediateSolution sol(endPositionV(seedK), qualityOfChainEndingIn[it->i3], it->i3); - // std::cout << " INSERT (" << sol.i1 << ", " << sol.i2 << ", " << sol.i3 << ") " << __LINE__ << std::endl; - intermediateSolutions.insert(sol); - } else { + // We can use the lower_bound, which gives the first triple j such that l_j >= l_k + SEQAN_ASSERT_GT(endPositionV(seed_k), 0u); + TIntermediateSolution referenceSolution(endPositionV(seed_k), 0, std::numeric_limits<unsigned>::max()); + TIntermediateSolutionsIterator it_j = intermediateSolutions.lower_bound(referenceSolution); + + // If there was a valid solution in L... + if (it_j != intermediateSolutions.end()) + { // Found this intermediate solution. - SEQAN_ASSERT_GEQ(itSol->i1, endPositionV(seedK)); - TSeed const & seedJ = seeds[itSol->i3]; - // Possibly start a new chain at k if the end1 is - // before the end1 of the chain ending in j or they - // end at the same coordinate in dim1 but k already - // has a higher quality than the whole chaing ending - // at j. - if (endPositionV(seedJ) > endPositionV(seedK) || - (endPositionV(seedJ) == endPositionV(seedK) && qualityOfChainEndingIn[it->i3] > itSol->i2)) { - TIntermediateSolution sol(endPositionV(seedK), qualityOfChainEndingIn[it->i3], it->i3); + SEQAN_ASSERT_GEQ(it_j->i1, endPositionV(seed_k)); + TSeed const & seed_j = seeds[it_j->i3]; + // ... start a new chain at k if the vertical end of k is + // above the vertical end of the chain ending in j or if + // both k and j end at the same vertical position, while + // the score of the chain ending in k is bigger than the + // score of the chain ending in j. + if (endPositionV(seed_j) > endPositionV(seed_k) || + (endPositionV(seed_j) == endPositionV(seed_k) && qualityOfChainEndingIn[it_k->i3] > it_j->i2)) + { + TIntermediateSolution sol(endPositionV(seed_k), qualityOfChainEndingIn[it_k->i3], it_k->i3); // std::cout << " INSERT (" << sol.i1 << ", " << sol.i2 << ", " << sol.i3 << ")" << __LINE__ << std::endl; intermediateSolutions.insert(sol); - } - } - // Delete all intermediate solutions where end1 >= end1 of k and have a lower quality than k. - TIntermediateSolutionsIterator itDel = intermediateSolutions.upper_bound(referenceSolution); - TIntermediateSolutionsIterator itDelEnd = intermediateSolutions.end(); - while (itDel != itDelEnd) { - TIntermediateSolutionsIterator ptr = itDel; - ++itDel; - if (qualityOfChainEndingIn[it->i3] > ptr->i2) { - // std::cout << " ERASE (" << ptr->i1 << ", " << ptr->i2 << ", " << ptr->i3 << ")" << std::endl; - intermediateSolutions.erase(ptr); + // Delete all intermediate solutions where end1 >= end1 of k and have a lower score than k + // to ensure that the invariant of V(j) >= V(j'), with j' <= j holds. + // Roughly then, there is no chain ending in a seed below the seed_k, that has a lower score + // than the chain ending in seed_k. Thus the last value in `intermediateSolutions` will + // always point to the optimal chain. + TIntermediateSolutionsIterator itDel = intermediateSolutions.upper_bound(referenceSolution); + TIntermediateSolutionsIterator itDelEnd = intermediateSolutions.end(); + while (itDel != itDelEnd) + { + TIntermediateSolutionsIterator ptr = itDel; + ++itDel; + if (qualityOfChainEndingIn[it_k->i3] > ptr->i2) + { + // std::cout << " ERASE (" << ptr->i1 << ", " << ptr->i2 << ", " << ptr->i3 << ")" << std::endl; + intermediateSolutions.erase(ptr); + } + } } + } // ... otherwise, add a triple for k in L if either L is empty or the last triple in + // L has a lower score than the chain ending in k. + else if (intermediateSolutions.empty() || (--it_j)->i2 < qualityOfChainEndingIn[it_k->i3]) + { + // None found. Insert a new triple for seed k. + TIntermediateSolution sol(endPositionV(seed_k), qualityOfChainEndingIn[it_k->i3], it_k->i3); + // std::cout << " INSERT (" << sol.i1 << ", " << sol.i2 << ", " << sol.i3 << ") " << __LINE__ << std::endl; + intermediateSolutions.insert(sol); } + // Check if the invariant holds, that the scores in L are in a non-decreasing order. + SEQAN_ASSERT(_checkScoreInvariant(intermediateSolutions)); } } diff --git a/include/seqan/stream/iter_stream.h b/include/seqan/stream/iter_stream.h index 6e1e9d7..661905b 100644 --- a/include/seqan/stream/iter_stream.h +++ b/include/seqan/stream/iter_stream.h @@ -61,7 +61,7 @@ struct StreamIterator {}; /*! * @class StreamBuffer * @headerfile <seqan/stream.h> - * @brief Buffer to use in stream. + * @brief Reinterprets the std::basic_streambuf to grant access to protected member functions. * * @signature template <typename TValue[, typenam TTraits]> * class StreamBuffer : public std::basic_streambuf<TValue, TTraits>; @@ -69,65 +69,92 @@ struct StreamIterator {}; * @tparam TValue The value type of the stream buffer. * @tparam TTraits The traits to use, defaults to <tt>std::char_traits<TValue></tt>. */ - // TODO(holtgrew): Add documentation for member functions. -// Unfortunately some of the most useful members of basic_streambuf are -// protected, so we define a subclass to cast and access them -template <typename TValue, typename TTraits_ = std::char_traits<TValue> > -class StreamBuffer : public std::basic_streambuf<TValue, TTraits_> + // Unfortunately some of the most useful members of basic_streambuf are + // protected, so we define a subclass to cast and access them +template <typename TValue, typename TTraits_ = std::char_traits<TValue>> +struct StreamBuffer : public std::basic_streambuf<TValue, TTraits_> +{ + using TTraits = TTraits_; + using TBasicStream = std::basic_streambuf<TValue, TTraits_>; + + using TBasicStream::eback; + using TBasicStream::gptr; + using TBasicStream::egptr; + using TBasicStream::gbump; + using TBasicStream::underflow; + + using TBasicStream::pbase; + using TBasicStream::pptr; + using TBasicStream::epptr; + using TBasicStream::pbump; + using TBasicStream::overflow; +}; + +// NOTE(rrahn): This is a wrapper for the StreamBuffer class. +// Since we usually work with std::basic_iostreams and their derivatives, we cannot simply cast a pointer to +// std::basic_filebuf to StreamBuffer to expose it's protected member functions. +// To do so, we only use the StreamBuffer to inherit from basic_streambuf (the base class of all buffer implementations.) +// and only expose the protected member functions as public functions. We then store the original basic_streambuf +// in this wrapper class and whenever access to the protected members is required we use a reinterpret_cast to convert +// basic_streambuf* into the public StreamBuffer*. The reinterpret_cast has zero overhead. +// This fixes an undetected error reported w/ the sanitizer option of gcc (https://github.com/seqan/seqan/issues/2104). +template <typename TValue, typename TTraits_ = std::char_traits<TValue>> +class StreamBufferWrapper { public: - typedef TTraits_ TTraits; - typedef std::basic_streambuf<TValue, TTraits_> TBase; - using TBase::eback; - using TBase::gptr; - using TBase::egptr; + typedef std::basic_streambuf<TValue, TTraits_> TBasicStreamBuffer; + typedef StreamBuffer<TValue, TTraits_> TPubStreamBuffer_; + typedef typename TPubStreamBuffer_::TTraits TTraits; - using TBase::pbase; - using TBase::pptr; - using TBase::epptr; + TBasicStreamBuffer * streamBuf{nullptr}; + + StreamBufferWrapper() = default; + + explicit StreamBufferWrapper(TBasicStreamBuffer * _basicStreamBuf) : streamBuf(_basicStreamBuf) + {} size_t chunkSize(Input) { - return egptr() - gptr(); + return baseBuf()->egptr() - baseBuf()->gptr(); } size_t chunkSize(Output) { - return epptr() - pptr(); + return baseBuf()->epptr() - baseBuf()->pptr(); } template <typename TOffset> void advanceChunk(TOffset ofs, Input) { - this->gbump(ofs); + baseBuf()->gbump(ofs); } template <typename TOffset> void advanceChunk(TOffset ofs, Output) { - this->pbump(ofs); + baseBuf()->pbump(ofs); } void reserveChunk(Input) { - if (gptr() == egptr()) - this->underflow(); + if (baseBuf()->gptr() == baseBuf()->egptr()) + baseBuf()->underflow(); } void reserveChunk(Output) { - if (pptr() == epptr()) - this->overflow(EOF); + if (baseBuf()->pptr() == baseBuf()->epptr()) + baseBuf()->overflow(EOF); } template <typename TOffset> typename std::streampos seekoff(TOffset ofs, std::ios_base::seekdir way, std::ios_base::openmode which) { - return TBase::seekoff(ofs, way, which); + return streamBuf->pubseekoff(ofs, way, which); } template <typename TOffset, typename TDirection> @@ -149,9 +176,9 @@ public: return; if (IsSameType<TDirection, Input>::VALUE) - this->underflow(); + baseBuf()->underflow(); else - this->overflow(); + baseBuf()->overflow(); left = chunkSize(dir); if (SEQAN_UNLIKELY(left == 0)) @@ -167,18 +194,23 @@ public: if (IsSameType<TDirection, Input>::VALUE) { for (; ofs != 0; --ofs) - this->sbumpc(); + baseBuf()->sbumpc(); } if (IsSameType<TDirection, Output>::VALUE) { for (; ofs != 0; --ofs) - this->sputc('\0'); + baseBuf()->sputc('\0'); } } return; } } } + + TPubStreamBuffer_* baseBuf() const + { + return reinterpret_cast<TPubStreamBuffer_ *>(streamBuf); + } }; // ---------------------------------------------------------------------------- @@ -216,12 +248,13 @@ template <typename TStream> class Iter<TStream, StreamIterator<Input> > { public: - typedef typename Value<TStream>::Type TValue; - typedef std::basic_istream<TValue> TIStream; - typedef std::basic_streambuf<TValue> TBasicBuffer; - typedef StreamBuffer<TValue> TStreamBuffer; + typedef typename Value<TStream>::Type TValue; + typedef std::basic_istream<TValue> TIStream; + typedef std::basic_streambuf<TValue> TBasicBuffer; + typedef StreamBufferWrapper<TValue> TStreamBufferWrapper; + typedef typename TStreamBufferWrapper::TPubStreamBuffer_ TStreamBuffer; - TStreamBuffer *streamBuf; + TStreamBufferWrapper streamBufWrapper{nullptr}; /*! * @fn InputStreamIterator::Iter @@ -236,17 +269,15 @@ public: * * Allows default construction, construction from stream, as well as from a @link StreamBuffer @endlink. */ - Iter() : streamBuf() - {} + Iter() = default; - Iter(TIStream & stream) : - streamBuf(static_cast<StreamBuffer<TValue> *>(stream.rdbuf())) + Iter(TIStream & stream) : streamBufWrapper(stream.rdbuf()) { + // printf("streamBuf: %p\n", streamBuf); stream.exceptions(std::ios_base::badbit); } - Iter(TStreamBuffer * buf) : - streamBuf(static_cast<StreamBuffer<TValue> *>(buf)) + Iter(TBasicBuffer * buf) : streamBufWrapper(buf) {} }; @@ -268,12 +299,13 @@ template <typename TStream> class Iter<TStream, StreamIterator<Output> > { public: - typedef typename Value<TStream>::Type TValue; - typedef std::basic_ostream<TValue> TOStream; - typedef std::basic_streambuf<TValue> TBasicBuffer; - typedef StreamBuffer<TValue> TStreamBuffer; + typedef typename Value<TStream>::Type TValue; + typedef std::basic_ostream<TValue> TOStream; + typedef std::basic_streambuf<TValue> TBasicBuffer; + typedef StreamBufferWrapper<TValue> TStreamBufferWrapper; + typedef typename TStreamBufferWrapper::TPubStreamBuffer_ TStreamBuffer; - TStreamBuffer *streamBuf; + TStreamBufferWrapper streamBufWrapper{nullptr}; /*! * @fn Iter::Iter @@ -288,17 +320,14 @@ public: * * Allows default construction, construction from stream, as well as from a @link StreamBuffer @endlink. */ - Iter() : streamBuf() - {} + Iter() = default; - Iter(TOStream & stream): - streamBuf(static_cast<StreamBuffer<TValue> *>(stream.rdbuf())) + Iter(TOStream & stream) : streamBufWrapper(stream.rdbuf()) { stream.exceptions(std::ios_base::badbit); } - Iter(TBasicBuffer *buf): - streamBuf(static_cast<StreamBuffer<TValue> *>(buf)) + Iter(TBasicBuffer * buf) : streamBufWrapper(buf) {} template <typename TValue2> @@ -505,13 +534,13 @@ directionIterator(TContainer &cont, TDirection const &) template <typename TStream, typename TDirection, typename TSize> inline void reserveChunk(Iter<TStream, StreamIterator<TDirection> > &iter, TSize, Input dir) { - iter.streamBuf->reserveChunk(dir); + iter.streamBufWrapper.reserveChunk(dir); } template <typename TStream, typename TDirection, typename TSize> inline void reserveChunk(Iter<TStream, StreamIterator<TDirection> > &iter, TSize, Output dir) { - iter.streamBuf->reserveChunk(dir); + iter.streamBufWrapper.reserveChunk(dir); } // ---------------------------------------------------------------------------- @@ -523,7 +552,7 @@ inline void reserveChunk(Iter<TStream, StreamIterator<TDirection> > &iter, TSize template <typename TStream, typename TDirection, typename TSize> inline void advanceChunk(Iter<TStream, StreamIterator<TDirection> > &iter, TSize size) { - iter.streamBuf->advanceChunk(size, TDirection()); + iter.streamBufWrapper.advanceChunk(size, TDirection()); } // ---------------------------------------------------------------------------- @@ -550,8 +579,8 @@ template <typename TChunk, typename TStream, typename TDirection> inline void getChunk(TChunk &result, Iter<TStream, StreamIterator<Tag<TDirection> > > &iter, Tag<TDirection>) { - SEQAN_ASSERT(iter.streamBuf != NULL); - getChunk(result, *iter.streamBuf, Tag<TDirection>()); + SEQAN_ASSERT(iter.streamBufWrapper.baseBuf() != nullptr); + getChunk(result, *iter.streamBufWrapper.baseBuf(), Tag<TDirection>()); } // ---------------------------------------------------------------------------- @@ -562,15 +591,15 @@ template <typename TStream> inline typename Reference<Iter<TStream, StreamIterator<Input> > >::Type value(Iter<TStream, StreamIterator<Input> > &iter) { - SEQAN_ASSERT(iter.streamBuf != NULL); - return iter.streamBuf->sgetc(); + SEQAN_ASSERT(iter.streamBufWrapper.baseBuf() != nullptr); + return iter.streamBufWrapper.baseBuf()->sgetc(); } template <typename TStream> inline typename Reference<Iter<TStream, StreamIterator<Input> > const>::Type value(Iter<TStream, StreamIterator<Input> > const &iter) { - SEQAN_ASSERT(iter.streamBuf != NULL); - return iter.streamBuf->sgetc(); + SEQAN_ASSERT(iter.streamBufWrapper.baseBuf() != nullptr); + return iter.streamBufWrapper.baseBuf()->sgetc(); } // ---------------------------------------------------------------------------- @@ -600,12 +629,13 @@ setValue(Iter<TStream, StreamIterator<Output> > & iter, TValue const &val) { return setValue(const_cast<Iter<TStream, StreamIterator<Output> > const &>(iter), val); } + template <typename TStream, typename TValue> inline void setValue(Iter<TStream, StreamIterator<Output> > const & iter, TValue const &val) { - SEQAN_ASSERT(iter.streamBuf != NULL); - iter.streamBuf->sputc((typename Value<Iter<TStream, StreamIterator<Output> > >::Type)val); + SEQAN_ASSERT(iter.streamBufWrapper.baseBuf() != nullptr); + iter.streamBufWrapper.baseBuf()->sputc((typename Value<Iter<TStream, StreamIterator<Output> > >::Type)val); } // ---------------------------------------------------------------------------- @@ -628,8 +658,8 @@ template <typename TStream> inline void goNext(Iter<TStream, StreamIterator<Input> > & iter) { - SEQAN_ASSERT(iter.streamBuf != NULL); - iter.streamBuf->sbumpc(); + SEQAN_ASSERT(iter.streamBufWrapper.baseBuf() != nullptr); + iter.streamBufWrapper.baseBuf()->sbumpc(); } template <typename TStream> @@ -646,8 +676,8 @@ template <typename TContainer, typename TSpec> inline void operator++(Iter<TContainer, StreamIterator<Input> > & iter, int) { - SEQAN_ASSERT(iter.streamBuf != NULL); - iter.streamBuf->sbumpc(); + SEQAN_ASSERT(iter.streamBufWrapper.baseBuf() != nullptr); + iter.streamBufWrapper.baseBuf()->sbumpc(); } // ---------------------------------------------------------------------------- @@ -658,8 +688,8 @@ template <typename TStream, typename TOffset, typename TDirection> inline void goFurther(Iter<TStream, StreamIterator<TDirection> > &iter, TOffset ofs) { - SEQAN_ASSERT(iter.streamBuf != NULL); - iter.streamBuf->goFurther(ofs, TDirection()); + SEQAN_ASSERT(iter.streamBufWrapper.baseBuf() != nullptr); + iter.streamBufWrapper.goFurther(ofs, TDirection()); } // ---------------------------------------------------------------------------- @@ -670,8 +700,8 @@ template <typename TStream, typename TDirection> inline typename Position<Iter<TStream, StreamIterator<TDirection> > const>::Type position(Iter<TStream, StreamIterator<TDirection> > const & iter) { - SEQAN_ASSERT(iter.streamBuf != NULL); - return iter.streamBuf->pubseekoff(0, std::ios_base::cur, + SEQAN_ASSERT(iter.streamBufWrapper.baseBuf() != nullptr); + return iter.streamBufWrapper.baseBuf()->pubseekoff(0, std::ios_base::cur, (IsSameType<TDirection, Input>::VALUE)? std::ios_base::in: std::ios_base::out); } @@ -683,8 +713,8 @@ template <typename TStream, typename TDirection, typename TPosition> inline void setPosition(Iter<TStream, StreamIterator<TDirection> > const & iter, TPosition pos) { - SEQAN_ASSERT(iter.streamBuf != NULL); - iter.streamBuf->pubseekpos(pos, (IsSameType<TDirection, Input>::VALUE)? std::ios_base::in: std::ios_base::out); + SEQAN_ASSERT(iter.streamBufWrapper.baseBuf() != nullptr); + iter.streamBufWrapper.baseBuf()->pubseekpos(pos, (IsSameType<TDirection, Input>::VALUE)? std::ios_base::in: std::ios_base::out); } // ---------------------------------------------------------------------------- @@ -698,13 +728,13 @@ atEnd(Iter<TStream, StreamIterator<Input> > const & iter) typedef typename Value<Iter<TStream, StreamIterator<Input> > >::Type TValue; typedef StreamBuffer<TValue> TStreamBuffer; - if (SEQAN_UNLIKELY(iter.streamBuf == NULL)) + if (SEQAN_UNLIKELY(iter.streamBufWrapper.baseBuf() == nullptr)) { return true; } else { - TStreamBuffer *buf = static_cast<TStreamBuffer*>(iter.streamBuf); + TStreamBuffer * const buf = iter.streamBufWrapper.baseBuf(); if (SEQAN_LIKELY(buf->gptr() < buf->egptr())) return false; else @@ -719,13 +749,13 @@ atEnd(Iter<TStream, StreamIterator<Output> > const & iter) typedef typename Value<Iter<TStream, StreamIterator<Input> > >::Type TValue; typedef StreamBuffer<TValue> TStreamBuffer; - if (SEQAN_UNLIKELY(iter.streamBuf == NULL)) + if (SEQAN_UNLIKELY(iter.streamBufWrapper.baseBuf() == nullptr)) { return true; } else { - TStreamBuffer *buf = static_cast<TStreamBuffer*>(iter.streamBuf); + TStreamBuffer * const buf = iter.streamBufWrapper.baseBuf(); if (SEQAN_LIKELY(buf->pptr() < buf->epptr())) return false; else diff --git a/manual/source/Infrastructure/Use/Install.rst b/manual/source/Infrastructure/Use/Install.rst index 85dadac..e3ce7d4 100644 --- a/manual/source/Infrastructure/Use/Install.rst +++ b/manual/source/Infrastructure/Use/Install.rst @@ -32,27 +32,27 @@ SeqAn is available natively on the following platforms. <br/> -+---------------------------+--------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Operating System | Package Name | Command | links | -+============+==============+====================+==============================================+==============================================================================================================================================================+ -| **G** |br| | Arch | | | `AUR <https://aur.archlinux.org/packages/?O=0&K=seqan>`__ | -| **N** |br| +--------------+--------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| **U** |br| | Debian | libseqan2-dev | ``apt install libseqan2-dev`` | `info <https://packages.debian.org/search?keywords=libseqan2-dev>`__ | `contact <mailto:debian-med-packaging()lists.alioth.debian.org>`__ | -| / |br| +--------------+--------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| **L** |br| | Fedora | seqan-devel | ``yum install seqan-devel`` | `info <https://apps.fedoraproject.org/packages/seqan-devel>`__ | `contact <mailto:sagitter()fedoraproject.org>`__ | -| **I** |br| +--------------+--------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| **N** |br| | Gentoo | seqan | ``emerge sci-biology/seqan`` | `info <https://packages.gentoo.org/packages/sci-biology/seqan>`__ | `contact <mailto:[email protected]>`__ | -| **U** |br| +--------------+--------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| **X** |br| | Ubuntu | seqan-dev | ``apt install seqan-dev`` | `info <http://packages.ubuntu.com/xenial/seqan-dev>`__ | `contact <mailto:ubuntu-motu()lists.ubuntu.com>`__ | -+------------+--------------+--------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| **M** |br| | Homebrew | seqan | ``brew install homebrew/science/seqan`` | `info <http://braumeister.org/repos/Homebrew/homebrew-science/formula/seqan>`__ | `contact <mailto:tim()tim-smith.us>`__ | -| **A** |br| +--------------+--------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| **C** |br| | MacPorts | seqan | ``port install seqan`` | `info <https://trac.macports.org/browser/trunk/dports/science/seqan/Portfile>`__ | `contact <mailto:rene.rahn()fu-berlin.de>`__ | -+------------+--------------+--------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| **B** |br| | FreeBSD | seqan | ``pkg install seqan`` | `info <http://freshports.org/biology/seqan>`__ | `contact <mailto:h2+fbsdports()fsfe.org>`__ | -| **S** |br| +--------------+--------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| **D** |br| | OpenBSD | seqan | ``pkg_add seqan`` | `info <http://openports.se/biology/seqan>`__ | `contact <mailto:h2+fbsdports()fsfe.org>`__ | -+------------+--------------+--------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++-------------------------+----------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Operating System | Package Name | Command | links | ++============+============+================+=========================================+========================================================================================================================================================================+ +| **G** |br| | Arch | seqan (AUR) | *depends* | `info <https://aur.archlinux.org/packages/seqan/>`__ | +| **N** |br| +------------+----------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **U** |br| | Debian | libseqan2-dev | ``apt install libseqan2-dev`` | `info <https://packages.debian.org/search?keywords=libseqan2-dev>`__ | `contact <mailto:debian-med-packaging()lists.alioth.debian.org>`__ | +| / |br| +------------+----------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **L** |br| | Fedora | seqan-devel | ``yum install seqan-devel`` | `info <https://apps.fedoraproject.org/packages/seqan-devel>`__ | `contact <mailto:sagitter()fedoraproject.org>`__ | +| **I** |br| +------------+----------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **N** |br| | Gentoo | seqan | ``emerge sci-biology/seqan`` | `info <https://packages.gentoo.org/packages/sci-biology/seqan>`__ | `contact <mailto:[email protected]>`__ | +| **U** |br| +------------+----------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **X** |br| | Ubuntu | libseqan2-dev | ``apt install libseqan2-dev`` | `info <https://packages.ubuntu.com/search?keywords=libseqan2-dev&searchon=names&suite=all§ion=all>`__ | `contact <mailto:[email protected]>`__ | ++------------+------------+----------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **M** |br| | Homebrew | seqan | ``brew install homebrew/science/seqan`` | `info <http://braumeister.org/repos/Homebrew/homebrew-science/formula/seqan>`__ | `contact <mailto:tim()tim-smith.us>`__ | +| **A** |br| +------------+----------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **C** |br| | MacPorts | seqan | ``port install seqan`` | `info <https://trac.macports.org/browser/trunk/dports/science/seqan/Portfile>`__ | `contact <mailto:rene.rahn()fu-berlin.de>`__ | ++------------+------------+----------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **B** |br| | FreeBSD | seqan | ``pkg install seqan`` | `info <http://freshports.org/biology/seqan>`__ | `contact <mailto:h2+fbsdports()fsfe.org>`__ | +| **S** |br| +------------+----------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **D** |br| | OpenBSD | seqan | ``pkg_add seqan`` | `info <http://openports.se/biology/seqan>`__ | `contact <mailto:h2+fbsdports()fsfe.org>`__ | ++------------+------------+----------------+-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ You should execute the above commands in a terminal as the ``root`` user or prefix them with ``sudo``. If you have problems installing the package on your operating system, or it is outdated, please write to the contact shown above (and replace ``()`` in the e-mail-address with ``@``). diff --git a/tests/align/test_alignment_algorithms_local.h b/tests/align/test_alignment_algorithms_local.h index f6c1d73..99ce1c7 100644 --- a/tests/align/test_alignment_algorithms_local.h +++ b/tests/align/test_alignment_algorithms_local.h @@ -607,6 +607,53 @@ SEQAN_DEFINE_TEST(test_align_local_alignment_enumeration_gaps) SEQAN_ASSERT_NOT(nextLocalAlignment(gapsH, gapsV, enumerator)); } + + // Test scoring matrix + { + + std::stringstream ssH, ssV; + + String<AminoAcid> strH("IGYELAPIPHTRTMDDFGNWWWKKWIHDDELNYFGTQLLIWHLQEKEGEQ"); + String<AminoAcid> strV("KHSDQGQIALLIHNTLQDWRPKVECDSPRTMIRRDFDDPQLAPPPHTNHRGNM"); + + Gaps<String<AminoAcid>, ArrayGaps> gapsH(strH); + Gaps<String<AminoAcid>, ArrayGaps> gapsV(strV); + + Blosum62 scoringScheme; + int cutoff = 40; + + LocalAlignmentEnumerator<Blosum62, Unbanded> enumerator(scoringScheme, cutoff); + + SEQAN_ASSERT(nextLocalAlignment(gapsH, gapsV, enumerator)); + SEQAN_ASSERT_EQ(getScore(enumerator), 69); + ssH.clear(); ssH.str(""); ssH << gapsH; + SEQAN_ASSERT_EQ(ssH.str(), "GYELAP--IPHTRTMDDFGNWWWK-KWIH-DD-E-L---NYFGT-QLLIW---HLQEKEG"); + ssV.clear(); ssV.str(""); ssV << gapsV; + SEQAN_ASSERT_EQ(ssV.str(), "G-QIA-LLI-HN-TLQD---W--RPK-VECDSPRTMIRRD-FDDPQLA--PPPHTNHR-G"); + + SEQAN_ASSERT(nextLocalAlignment(gapsH, gapsV, enumerator)); + SEQAN_ASSERT_EQ(getScore(enumerator), 57); + ssH.clear(); ssH.str(""); ssH << gapsH; + SEQAN_ASSERT_EQ(ssH.str(), "KWIHDDELNYFGTQ--LLIWH--LQE---K-E"); + ssV.clear(); ssV.str(""); ssV << gapsV; + SEQAN_ASSERT(ssV.str() == "K--HSDQ----G-QIALLI-HNTLQDWRPKVE"); + + SEQAN_ASSERT(nextLocalAlignment(gapsH, gapsV, enumerator)); + SEQAN_ASSERT_EQ(getScore(enumerator), 51); + ssH.clear(); ssH.str(""); ssH << gapsH; + SEQAN_ASSERT_EQ(ssH.str(), "IGYE-LA---P-I----PHTRTMD---DFGNWWWKKWIHDD-EL------NYF-GTQL"); + ssV.clear(); ssV.str(""); ssV << gapsV; + SEQAN_ASSERT_EQ(ssV.str(), "I-HNTLQDWRPKVECDSP--RTM-IRRDF----------DDPQLAPPPHTNH-RGN-M"); + + SEQAN_ASSERT(nextLocalAlignment(gapsH, gapsV, enumerator)); + SEQAN_ASSERT_EQ(getScore(enumerator), 46); + ssH.clear(); ssH.str(""); ssH << gapsH; + SEQAN_ASSERT_EQ(ssH.str(), "I--GYE---LAPIP-HT--RTMDDFGN"); + ssV.clear(); ssV.str(""); ssV << gapsV; + SEQAN_ASSERT_EQ(ssV.str(), "IRRDFDDPQLAP-PPHTNHR-----GN"); + + SEQAN_ASSERT_NOT(nextLocalAlignment(gapsH, gapsV, enumerator)); + } } SEQAN_DEFINE_TEST(test_align_local_alignment_enumeration_fragment) diff --git a/tests/align/test_alignment_algorithms_local_banded.h b/tests/align/test_alignment_algorithms_local_banded.h index 846cf94..afe4148 100644 --- a/tests/align/test_alignment_algorithms_local_banded.h +++ b/tests/align/test_alignment_algorithms_local_banded.h @@ -502,6 +502,38 @@ SEQAN_DEFINE_TEST(test_align_local_alignment_enumeration_banded_gaps) SEQAN_ASSERT_NOT(nextLocalAlignment(gapsH, gapsV, enumerator)); } + + // Test scoring matrix + { + std::stringstream ssH, ssV; + + String<AminoAcid> strH("IGYELAPIPHTRTMDDFGNWWWKKWIHDDELNYFGTQLLIWHLQEKEGEQ"); + String<AminoAcid> strV("KHSDQGQIALLIHNTLQDWRPKVECDSPRTMIRRDFDDPQLAPPPHTNHRGNM"); + + Gaps<String<AminoAcid>, ArrayGaps> gapsH(strH); + Gaps<String<AminoAcid>, ArrayGaps> gapsV(strV); + + Blosum62 scoringScheme; + int cutoff = 40; + + LocalAlignmentEnumerator<Blosum62, Banded> enumerator(scoringScheme, -20, 20, cutoff); + + SEQAN_ASSERT(nextLocalAlignment(gapsH, gapsV, enumerator)); + SEQAN_ASSERT_EQ(getScore(enumerator), 69); + ssH.clear(); ssH.str(""); ssH << gapsH; + SEQAN_ASSERT_EQ(ssH.str(), "GYELAP--IPHTRTMDDFGNWWWK-KWIH-DD-E--L--NYF-GTQLLIW---HLQEKEG"); + ssV.clear(); ssV.str(""); ssV << gapsV; + SEQAN_ASSERT_EQ(ssV.str(), "G-QIA-LLI-H-NTLQD-----WRPK-VECDSPRTMIRRD-FDDPQ-LA-PPPHTNHR-G"); + + SEQAN_ASSERT(nextLocalAlignment(gapsH, gapsV, enumerator)); + SEQAN_ASSERT_EQ(getScore(enumerator), 51); + ssH.clear(); ssH.str(""); ssH << gapsH; + SEQAN_ASSERT_EQ(ssH.str(), "IGYE-L---AP-I----PHTRTM--DDFGNWWWKKWIHDD-EL------NYF-GTQL"); + ssV.clear(); ssV.str(""); ssV << gapsV; + SEQAN_ASSERT(ssV.str() == "I-HNTLQDWRPKVECDSP--RTMIRRDF----------DDPQLAPPPHTNH-RG-NM"); + + SEQAN_ASSERT_NOT(nextLocalAlignment(gapsH, gapsV, enumerator)); + } } SEQAN_DEFINE_TEST(test_align_local_alignment_enumeration_banded_fragment) diff --git a/tests/arg_parse/test_arg_parse.cpp b/tests/arg_parse/test_arg_parse.cpp index aec4bcb..100ec59 100644 --- a/tests/arg_parse/test_arg_parse.cpp +++ b/tests/arg_parse/test_arg_parse.cpp @@ -144,6 +144,7 @@ SEQAN_BEGIN_TESTSUITE(test_arg_parse) SEQAN_CALL_TEST(test_argument_invalid_cast); SEQAN_CALL_TEST(test_argument_min_max_boundaries); SEQAN_CALL_TEST(test_argument_valid_values); + SEQAN_CALL_TEST(test_argument_valid_values_directories); SEQAN_CALL_TEST(test_argument_parser); SEQAN_CALL_TEST(test_parse_non_const_cstring); diff --git a/tests/arg_parse/test_arg_parse_argument.h b/tests/arg_parse/test_arg_parse_argument.h index 675e403..b46fb84 100644 --- a/tests/arg_parse/test_arg_parse_argument.h +++ b/tests/arg_parse/test_arg_parse_argument.h @@ -223,4 +223,32 @@ SEQAN_DEFINE_TEST(test_argument_valid_values) "the given path 'not-a-validfile.qxt' does not have one of the valid file extensions [*.txt, *.fasta]; the file extension was overridden to be '.fa'"); } +SEQAN_DEFINE_TEST(test_argument_valid_values_directories) +{ + ArgParseArgument dirarg(ArgParseArgument::INPUT_DIRECTORY); + setValidValues(dirarg, ".dir1 .dir2"); + + _assignArgumentValue(dirarg, "directory.dir1"); + SEQAN_ASSERT_EQ(value(dirarg.value, 0), "directory.dir1"); + + // Test getFileExtension() function. + SEQAN_ASSERT_EQ(getFileExtension(dirarg), ".dir1"); + + // different case should also work + _assignArgumentValue(dirarg, "directory.DIR1"); + SEQAN_ASSERT_EQ(value(dirarg.value, 0), "directory.DIR1"); + + // also accept a trailing '/' + _assignArgumentValue(dirarg, "directory.dir2/"); + SEQAN_ASSERT_EQ(value(dirarg.value, 0), "directory.dir2/"); + + // Test getFileExtension() function. + SEQAN_ASSERT_EQ(getFileExtension(dirarg), ".dir2"); + + // different case should also work + _assignArgumentValue(dirarg, "directory.DIR2/"); + SEQAN_ASSERT_EQ(value(dirarg.value, 0), "directory.DIR2/"); + +} + #endif // SEQAN_TESTS_ARG_PARSE_TEST_ARG_PARSE_ARGUMENT_H_ diff --git a/tests/modifier/test_modifier.cpp b/tests/modifier/test_modifier.cpp index 9b139a9..ec6fc83 100644 --- a/tests/modifier/test_modifier.cpp +++ b/tests/modifier/test_modifier.cpp @@ -42,7 +42,7 @@ #include "test_modifier_string_padding.h" -SEQAN_BEGIN_TESTSUITE(test_modifier) +SEQAN_BEGIN_TESTSUITE(test_modifier) { // Test the modifier shortcuts. SEQAN_CALL_TEST(test_modifer_shortcuts_dna_string_reverse); @@ -130,5 +130,6 @@ SEQAN_BEGIN_TESTSUITE(test_modifier) SEQAN_CALL_TEST(test_modified_string_padding_end); SEQAN_CALL_TEST(test_modified_string_padding_difference); SEQAN_CALL_TEST(test_modified_string_padding_iterator); + SEQAN_CALL_TEST(test_modified_string_padding_defect_2190); } SEQAN_END_TESTSUITE diff --git a/tests/modifier/test_modifier_string_padding.h b/tests/modifier/test_modifier_string_padding.h index 063b620..b474429 100644 --- a/tests/modifier/test_modifier_string_padding.h +++ b/tests/modifier/test_modifier_string_padding.h @@ -181,4 +181,28 @@ SEQAN_DEFINE_TEST(test_modified_string_padding_iterator) SEQAN_ASSERT_EQ(*(it - 3), seq[12]); } +SEQAN_DEFINE_TEST(test_modified_string_padding_defect_2190) +{ + using namespace seqan; + + DnaString seq = "ACGTGGATAGCATCG"; + auto seqInf = infix(seq, 0, length(seq)); + + auto test_const = [](auto const & modifier) + { + // using TRef = typename Reference<decltype(modifier)>::Type; + auto x = value(modifier, 1); + SEQAN_ASSERT_EQ(x, 'C'); + }; + { // Test working case, when reference of const modifier gives back a const reference to the value + ModifiedString<decltype(seq), ModPadding> modString(seq); + test_const(modString); + } + + { // Test defect, when reference of const modifier gives back a non-const reference to the value + ModifiedString<decltype(seqInf), ModPadding> modString(seqInf); + test_const(modString); + } +} + #endif // #ifndef TESTS_MODIFIER_MODIFIER_STRING_PADDING_H_ diff --git a/tests/seeds/test_seeds_global_chaining.cpp b/tests/seeds/test_seeds_global_chaining.cpp index 3cb5b82..f9e729f 100644 --- a/tests/seeds/test_seeds_global_chaining.cpp +++ b/tests/seeds/test_seeds_global_chaining.cpp @@ -116,6 +116,32 @@ SEQAN_DEFINE_TEST(test_seeds_global_chaining_sparse_length) SEQAN_ASSERT_EQ(1u, length(result)); SEQAN_ASSERT_EQ(TSeed(0, 93, 281, 342), result[0]); } + + { // Issue #2082 + TSeedSet seedSet; + + addSeed(seedSet, TSeed(0, 0, 3), Single()); + addSeed(seedSet, TSeed(2, 3, 2), Single()); + + TSeedChain result; + chainSeedsGlobally(result, seedSet, SparseChaining()); + + SEQAN_ASSERT_EQ(1u, length(result)); + SEQAN_ASSERT_EQ(TSeed(0, 0, 3), result[0]); + } + + { // Issue #2082 + TSeedSet seedSet; + + addSeed(seedSet, TSeed(0, 0, 100), Single()); + addSeed(seedSet, TSeed(95, 95, 10), Single()); + + TSeedChain result; + chainSeedsGlobally(result, seedSet, SparseChaining()); + + SEQAN_ASSERT_EQ(1u, length(result)); + SEQAN_ASSERT_EQ(TSeed(0, 0, 100), result[0]); + } } SEQAN_BEGIN_TESTSUITE(test_seeds_global_chaining) diff --git a/util/cmake/SeqAnBuildSystem.cmake b/util/cmake/SeqAnBuildSystem.cmake index e642f81..d4e2ba8 100644 --- a/util/cmake/SeqAnBuildSystem.cmake +++ b/util/cmake/SeqAnBuildSystem.cmake @@ -53,6 +53,12 @@ set(PythonInterp_FIND_VERSION_COUNT 2) include (SeqAnUsabilityAnalyzer) include (CheckCXXCompilerFlag) +if (DEFINED CMAKE_INSTALL_DOCDIR) + set(CMAKE_INSTALL_DOCDIR_IS_SET ON) +endif () + +include (GNUInstallDirs) + set (COMPILER_CLANG FALSE) set (COMPILER_GCC FALSE) set (COMPILER_LINTEL FALSE) @@ -206,7 +212,7 @@ macro (seqan_build_system_init) # TODO(h-2): raise this to W4 set (SEQAN_CXX_FLAGS "${SEQAN_CXX_FLAGS} /W3") else() - set (SEQAN_CXX_FLAGS "${SEQAN_CXX_FLAGS} -W -Wall -pedantic -fstrict-aliasing -Wstrict-aliasing") + set (SEQAN_CXX_FLAGS "${SEQAN_CXX_FLAGS} -W -Wall -pedantic") set (SEQAN_DEFINITIONS ${SEQAN_DEFINITIONS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64) # disable some warnings on ICC @@ -389,24 +395,24 @@ macro (seqan_setup_library) install (FILES LICENSE README.rst CHANGELOG.rst - DESTINATION share/doc/seqan) + DESTINATION ${CMAKE_INSTALL_DOCDIR}) # Install pkg-config file, except on Windows. if (NOT CMAKE_SYSTEM_NAME MATCHES Windows) configure_file("util/pkgconfig/seqan.pc.in" "${CMAKE_BINARY_DIR}/util/pkgconfig/seqan-${SEQAN_VERSION_MAJOR}.pc" @ONLY) - install(FILES "${CMAKE_BINARY_DIR}/util/pkgconfig/seqan-${SEQAN_VERSION_MAJOR}.pc" DESTINATION lib/pkgconfig) + install(FILES "${CMAKE_BINARY_DIR}/util/pkgconfig/seqan-${SEQAN_VERSION_MAJOR}.pc" DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) endif (NOT CMAKE_SYSTEM_NAME MATCHES Windows) # Install FindSeqAn TODO(h-2) rename seqan-config.cmake to seqan-config${SEQAN_VERSION_MAJOR}.cmake after 2.x cycle - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/util/cmake/seqan-config.cmake" DESTINATION lib/cmake/seqan/) + install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/util/cmake/seqan-config.cmake" DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/seqan/) # Install headers file (GLOB HEADERS - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/include/ include/seqan/[A-z]*/[A-z]/[A-z]*.h include/seqan/[A-z]*/[A-z]*.h include/seqan/[A-z]*.h) foreach (HEADER ${HEADERS}) get_filename_component (_DESTINATION ${HEADER} PATH) - install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} DESTINATION ${_DESTINATION}) + install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/${HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${_DESTINATION}) endforeach () endif () @@ -463,8 +469,11 @@ macro (seqan_setup_install_vars APP_NAME) set (SEQAN_PREFIX_SHARE ".") set (SEQAN_PREFIX_SHARE_DOC ".") else () - set (SEQAN_PREFIX_SHARE "share/${APP_NAME}") - set (SEQAN_PREFIX_SHARE_DOC "share/doc/${APP_NAME}") + if (NOT DEFINED CMAKE_INSTALL_DOCDIR_IS_SET) + set (CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc" CACHE STRING "Documentation root (DATAROOTDIR/doc)" FORCE) + endif () + set (SEQAN_PREFIX_SHARE "${CMAKE_INSTALL_DATADIR}/${APP_NAME}") + set (SEQAN_PREFIX_SHARE_DOC "${CMAKE_INSTALL_DOCDIR}/${APP_NAME}") endif () endmacro (seqan_setup_install_vars) diff --git a/util/pkgconfig/seqan.pc.in b/util/pkgconfig/seqan.pc.in index 8cc5f3f..7dc4a00 100644 --- a/util/pkgconfig/seqan.pc.in +++ b/util/pkgconfig/seqan.pc.in @@ -1,6 +1,4 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -includedir=${prefix}/include +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: @CMAKE_PROJECT_NAME@ Description: C++ library for biological sequence analysis diff --git a/util/skel/app_template/CMakeLists.txt b/util/skel/app_template/CMakeLists.txt index 6d1aeca..1c72c2b 100644 --- a/util/skel/app_template/CMakeLists.txt +++ b/util/skel/app_template/CMakeLists.txt @@ -48,7 +48,7 @@ endif (NOT SEQAN_PREFIX_SHARE_DOC) # Install %(NAME)s in ${PREFIX}/bin directory install (TARGETS %(NAME)s - DESTINATION bin) + DESTINATION ${CMAKE_INSTALL_BINDIR}) # Install non-binary files for the package to "." for app builds and # ${PREFIX}/share/doc/%(NAME)s for SeqAn release builds. -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/seqan2.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
